lib/lhj/command/yapi.rb in lhj-tools-0.1.76 vs lib/lhj/command/yapi.rb in lhj-tools-0.1.77
- old
+ new
@@ -132,15 +132,18 @@
def notify_robot(upload_info, interface_info, project_info)
i_url = "#{project_info['data']['basepath']}#{interface_info['data']['path']}"
username = interface_info['data']['username']
title = interface_info['data']['title']
+ p_id = project_info['data']['_id']
+ api_url = api_original_url(p_id)
temp_vars = upload_info.merge({
api_id: api_id,
title: title,
username: username,
- interface_url: i_url
+ interface_url: i_url,
+ api_url: api_url
})
template = Lhj::ErbTemplateHelper.load('oc_code_notify')
output = Lhj::ErbTemplateHelper.render(template, temp_vars, '-')
Lhj::Dingtalk.post_message_robot(robot_url, 'yapi generate', output)
end
@@ -149,9 +152,13 @@
"#{@config_base_url}/#{API_INTERFACE_URL}#{api_id}"
end
def project_url_str(project_id)
"#{@config_base_url}/#{API_PROJECT_URL}#{project_id}"
+ end
+
+ def api_original_url(project_id)
+ "#{@config_base_url}/project/#{project_id}/interface/api/#{api_id}"
end
def yml_file
File.join(Lhj::Config.instance.home_dir, 'yapi.yml')
end