更改: 查询pms工作项权限使用restclient

This commit is contained in:
yystopf 2024-11-21 16:15:36 +08:00
parent e7b5039eb6
commit 05ba6dda63
1 changed files with 8 additions and 8 deletions

View File

@ -9,16 +9,16 @@ class ChangeIssueStatusByMessageJob < ApplicationJob
def get_pm_issue_data(user, org, pm_project_id, issue_id)
url = URI("#{EduSetting.get("pms_server_url")}/api/pms/#{org.login}/pmsProjectIssues/#{issue_id}?pmProjectId=#{pm_project_id}")
url = "#{EduSetting.get("pms_server_url")}/api/pms/#{org.login}/pmsProjectIssues/#{issue_id}?pmProjectId=#{pm_project_id}"
headers = {
'Cookie' => "autologin_trustie=#{Token.get_or_create_permanent_login_token(user, 'autologin')&.value}",
}
response = RestClient.get(url, headers)
https = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Cookie"] = "autologin_trustie=#{Token.get_or_create_permanent_login_token(user, 'autologin')&.value}"
response = https.request(request)
puts response.read_body
return JSON.parse(response.read_body)['code'].to_i == 200
puts response.body
return JSON.parse(response.body)["code"].to_i == 200
rescue
return false
end