Fix get_sync_data_xml for book.

This commit is contained in:
邱博亞 2024-07-02 22:44:23 +08:00
parent caa32da02a
commit 8d09fb9dd1
1 changed files with 3 additions and 3 deletions

View File

@ -86,8 +86,8 @@ module NtuSyncPlugin
return res
end
def self.get_sync_data_xml(ntuseq, type)
uri = URI.parse("https://my.ntu.edu.tw/achvservice/xmlpaper.asp?Seq=#{ntuseq}&type=#{type}")
def self.get_sync_data_xml(ntuseq, type, api_name="xmlpaper")
uri = URI.parse("https://my.ntu.edu.tw/achvservice/#{api_name}.asp?Seq=#{ntuseq}&type=#{type}")
response = get_response(uri)
return Nokogiri::XML(response.body)
end
@ -204,7 +204,7 @@ module NtuSyncPlugin
Book.where(member_profile_id: mp.id).destroy
puts "Sync_Book:... #{u_account}."
puts ntuseq
books_xml = get_sync_data_xml(ntuseq, "B")
books_xml = get_sync_data_xml(ntuseq, "B", "xmlBook")
@books = books_xml.xpath("//Book").map do |book_node|
{
author: (book_node>"Authors").text,