webapi.py 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. import json
  2. import requests
  3. from hytest.common import *
  4. from cfg import cfg
  5. from bs4 import BeautifulSoup
  6. from requests.packages import urllib3
  7. #存放公用方法
  8. # 存储 全局共享 数据
  9. GSTORE = {}
  10. class APIMgr():
  11. #打印https请求与消息
  12. def __init__(self):
  13. self.ui = None
  14. self.token = None
  15. def printRequest(self,req):
  16. if req.body==None:
  17. msgBody=''
  18. else:
  19. msgBody=req.body
  20. self.ui.outputWindow.append(
  21. '{}\n{}\n{}\n\n{}'.format(
  22. '\n\n-------发送请求--------',
  23. req.method+''+req.url,
  24. '\n'.join('{}:{}'.format(k,v) for k,v in req.headers.items()),
  25. msgBody,
  26. ))
  27. # 打印http相应消息的函数
  28. def printResponse(self, response):
  29. print('\n\n----- https response begin -----')
  30. print(response.status_code)
  31. # print(response.headers)
  32. for k, v in response.headers.items():
  33. print(f'{k}:{v}')
  34. print(response.content.decode('utf8'))
  35. print('----- https response end-----\n\n')
  36. headers = {
  37. "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67;jy-test"
  38. }
  39. #headers设置为全局变量
  40. GSTORE['headers'] = headers
  41. # session对象设置为全局变量
  42. s = requests.Session()
  43. GSTORE['s'] = s
  44. #pc登录接口
  45. def mgr_login(self, phone='18211989987', password='123456',useproxies=False):
  46. headers=GSTORE['headers']
  47. s = GSTORE['s']
  48. if useproxies:
  49. self.s.proxies.update({'http':'127.0.0.1:8888'})
  50. response = self.s.post(f"{cfg.target_host}/phone/login",headers=headers,data=
  51. {
  52. 'reqType': 'phoneLogin',
  53. 'isAutoLogin': 'false',
  54. 'phone':phone,
  55. 'password':password
  56. })
  57. self.printResponse(response)
  58. # 把response对象返回出去
  59. return response
  60. # app登录接口
  61. def mgr_login_app(self, phone='18211989987', password='123456',useproxies=False):
  62. headers=GSTORE['headers']
  63. s = GSTORE['s']
  64. if useproxies:
  65. self.s.proxies.update({'http':'127.0.0.1:8888'})
  66. response = self.s.post(f"{cfg.target_host_app}/jyapp/free/login",headers=headers,params=
  67. {
  68. 'reqType': 'phoneLogin',
  69. 'phone':phone,
  70. 'password':password,
  71. 'rid':'',
  72. 'oid': '',
  73. 'phoneType': '',
  74. 'channel': '',
  75. 'deviceId': ''
  76. })
  77. self.printResponse(response)
  78. # 把response对象返回出去
  79. return response
  80. """退出登录pc"""
  81. def mgr_logout(self):
  82. url = f"{cfg.target_host}/front/signOut"
  83. headers = GSTORE['headers']
  84. s = GSTORE['s']
  85. s.post(url=url, headers=headers)
  86. # self.printResponse(res)
  87. # return res
  88. """退出登录app"""
  89. def mgr_logout_app(self):
  90. url = f"{cfg.target_host_app}/jyapp/free/signOut"
  91. headers = GSTORE['headers']
  92. s = GSTORE['s']
  93. s.post(url=url, headers=headers)
  94. #招标搜索
  95. def bidsearch(self, keywords="建筑", publishtime="fiveyear", selectType="content"):
  96. #使用全局变量
  97. headers = GSTORE['headers']
  98. params={"keywords":keywords,"publishtime":publishtime,"timeslot":"","area":"","subtype":"","minprice":"","maxprice":"","industry":"","buyerclass":"","buyertel":"","winnertel":"","selectType":selectType,"notkey":"","fileExists":"0","city":"","searchGroup":"0","searchMode":"0","wordsMode":"0","additionalWords":""}
  99. #保存session
  100. session = self.s
  101. response = session.post(f"{cfg.target_host}/jylab/supsearch/index.html", headers=headers, params=params)
  102. self.printResponse(response)
  103. return response
  104. #超前项目搜索
  105. def advanced_search(self):
  106. #使用全局变量
  107. headers = GSTORE['headers']
  108. #保存session
  109. session = self.s
  110. data={
  111. "searchGroup": 2,
  112. "reqType": "lastNews",
  113. "pageNum": 1,
  114. "pageSize": 50,
  115. "keyWords": "科技",
  116. "searchMode": 0,
  117. "bidField": "",
  118. "publishTime": "1689573022-1721195422",
  119. "selectType": "title,content",
  120. "subtype": "",
  121. "exclusionWords": "",
  122. "buyer": "",
  123. "winner": "",
  124. "agency": "",
  125. "industry": "",
  126. "province": "",
  127. "city": "",
  128. "district": "",
  129. "buyerClass": "",
  130. "fileExists": "",
  131. "price": "",
  132. "buyerTel": "",
  133. "winnerTel": ""
  134. }
  135. response = session.post(f"{cfg.target_host}/jyapi/jybx/core/mType/searchList", headers=headers, data=data)
  136. return response
  137. # 企业搜索
  138. def enterpriseSearch(self, match="北京剑鱼信息技术有限公司河南分公司", matchType="A", pageSize="10", pageNum="0"):
  139. # 使用全局变量
  140. headers = GSTORE['headers']
  141. # 保存session
  142. session = self.s
  143. response = session.post(f"{cfg.target_host}/publicapply/enterpriseSearch/doQuery", headers=headers, data={
  144. 'match': match,
  145. 'matchType': matchType,
  146. 'pageSize': pageSize,
  147. 'pageNum': pageNum
  148. })
  149. self.printResponse(response)
  150. return response
  151. # 供应搜索
  152. def supplySearch(self, keywords="PH计", searchType="title", province="", city="", time="", status="0",
  153. pageSize=50, pageIndex=1):
  154. headers = GSTORE['headers']
  155. headers['Content-Type'] = 'application/json' # 添加Content-Type头部
  156. url = f"{cfg.target_host}/jyinfo/supplySearch"
  157. data = {
  158. "keywords": keywords,
  159. "searchType": searchType,
  160. "province": province,
  161. "city": city,
  162. "time": time,
  163. "status": status,
  164. "pageSize": pageSize,
  165. "pageIndex": pageIndex
  166. }
  167. session=self.s
  168. response = session.post(url=url, headers=headers, data=json.dumps(data))
  169. self.printResponse(response)
  170. return response
  171. #采购单位搜索
  172. def buyer_search(self, buyerName, province=None, city=None, buyerClass=None, isCheckFollow=True, isCheckReceive=True,
  173. isContact=0, pageSize=10, pageNum=1):
  174. if buyerClass is None:
  175. buyerClass = []
  176. if city is None:
  177. city = []
  178. if province is None:
  179. province = []
  180. url = f"{cfg.target_host}/jyapi/jybx/buyer/eType/buyerList"
  181. data = {
  182. "buyerName": buyerName,
  183. "province": province,
  184. "city": city,
  185. "buyerClass": buyerClass,
  186. "isCheckFollow": isCheckFollow,
  187. "isCheckReceive": isCheckReceive,
  188. "isContact": isContact,
  189. "pageSize": pageSize,
  190. "pageNum":pageNum
  191. }
  192. response = requests.post(url=url, json=data, headers=self.headers)
  193. self.printResponse(response)
  194. return response
  195. #融创用户搜索
  196. def rc_search(self):
  197. headers = GSTORE['headers']
  198. headers['Content-Type'] = 'application/json' # 添加Content-Type头部
  199. url = f"{cfg.target_host}/jyapi/jybx/core/mType/searchList"
  200. params={
  201. "searchGroup": 0,
  202. "reqType": "lastNews",
  203. "pageNum": 1,
  204. "pageSize": 50,
  205. "keyWords": "医疗设备",
  206. "searchMode": 0,
  207. "bidField": "",
  208. "publishTime": "1654704000-1657900799",
  209. "selectType": "title,content",
  210. "subtype": "",
  211. "exclusionWords": "",
  212. "buyer": "",
  213. "winner": "",
  214. "agency": "",
  215. "industry": "",
  216. "province": "",
  217. "city": "",
  218. "district": "",
  219. "buyerClass": "",
  220. "fileExists": "",
  221. "price": "",
  222. "buyerTel": "",
  223. "winnerTel": "",
  224. "mobileTag": [
  225. "军队类",
  226. "武警类",
  227. "融通类",
  228. "退役类",
  229. "融办类",
  230. "某某类",
  231. "all"
  232. ]
  233. }
  234. session = self.s
  235. response = session.post(url=url, headers=headers, params=params)
  236. self.printResponse(response)
  237. return response
  238. """三级页公告摘要"""
  239. #两个接口,
  240. def preagent(self):
  241. headers = {
  242. 'Referer': 'https://www.jianyu360.cn/nologin/content/ApGY1xdfTI4LyMsM3d4cE8JIzAvFj1jcXNlKwUkPT0dY2BwDidUCZM%3D.html'
  243. }
  244. s = GSTORE["s"]
  245. response = s.get(f"{cfg.target_host}/publicapply/detail/preAgent", headers=headers)
  246. response_data=json.loads(response.text)
  247. token=response_data["data"]["token"]
  248. return token
  249. def detail_baseinfo(self):
  250. headers = GSTORE['headers']
  251. s = GSTORE["s"]
  252. token=self.preagent()
  253. params = {
  254. "token":token
  255. }
  256. response = s.post(f"{cfg.target_host}/publicapply/detail/baseInfo", headers=headers, params=params)
  257. return response
  258. """三级页商机推荐"""
  259. def detail_advancedinfo(self):
  260. headers = GSTORE['headers']
  261. s = GSTORE["s"]
  262. res = self.detail_baseinfo()
  263. response_data = json.loads(res.text)
  264. token = response_data["data"]["token"]
  265. params = {
  266. "token": token
  267. }
  268. response = s.post(f"{cfg.target_host}/publicapply/detail/advancedInfo", headers=headers, params=params)
  269. return response
  270. """三级页监控项目"""
  271. def detail_monitor_project(self):
  272. headers = GSTORE['headers']
  273. s = GSTORE["s"]
  274. params = {
  275. "sid": "ABCY1xdfTI4LyMsM3d4cE8JIzAvFj1jcXNlKwUkPT0dY2BwDidUCZM="
  276. }
  277. response = s.post(f"{cfg.target_host}/bigmember/follow/project/add", headers=headers, params=params)
  278. return response
  279. """取消项目监控"""
  280. def cacel_project(self):
  281. headers = GSTORE['headers']
  282. s = GSTORE["s"]
  283. params = {
  284. "sid": "ABCY1xdfTI4LyMsM3d4cE8JIzAvFj1jcXNlKwUkPT0dY2BwDidUCZM=",
  285. "fid[followId]":"ABCY3ZdfT0FUCw4AnpUA3k%3D",
  286. "fid[limit_count]": 10,
  287. "fid[msg_open]": True,
  288. "fid[status]": True,
  289. }
  290. response = s.post(f"{cfg.target_host}/bigmember/follow/project/cancel", headers=headers, params=params)
  291. return response
  292. """用户信息获取isadd接口"""
  293. def isadd(self):
  294. headers = GSTORE['headers']
  295. s = GSTORE["s"]
  296. response = s.get(f"{cfg.target_host}/bigmember/use/isAdd", headers=headers)
  297. return response
  298. #接口数据传值常用三种方式:urlencoded---params,键值对---data,json格式---json
  299. #获取推送记录接口
  300. def push_list(self):
  301. headers=GSTORE['headers']
  302. s = GSTORE['s']
  303. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/fType/list",headers=headers,json=
  304. {"pageNum": 1, "pageSize": 50, "format": "table", "area": "", "selectTime": "all", "city": "", "buyerClass": "",
  305. "subtype": "", "industry": "", "keyWords": "", "fileExists": "", "price": "", "source": "", "exportNum": "",
  306. "vt": ""})
  307. return response
  308. # 不登录招标搜索
  309. def notloggedin_search(self, keyword='科技', publishtime='thisyear', selectType='content,title'):
  310. headers = GSTORE['headers']
  311. params={"keywords": keyword , "publishtime": publishtime, "timeslot": "", "area": "", "subtype": "",
  312. "minprice": "", "maxprice": "", "industry": "", "buyerclass": "", "buyertel": "", "winnertel": "",
  313. "selectType": selectType, "notkey": "", "fileExists": "0", "city": "", "searchGroup": "0",
  314. "searchMode": "0", "wordsMode": "0", "additionalWords": ""}
  315. response = requests.post(f"{cfg.target_host}/jylab/supsearch/index.html", headers=headers, params=params)
  316. response.raise_for_status() # 如果请求失败,会抛出异常
  317. return response
  318. #不登录采购单位搜索
  319. def notloggedin_buysearch(self,keyword):
  320. headers = GSTORE['headers']
  321. s = GSTORE['s']
  322. data = {"buyerName":keyword,"province":[],"city":[],"buyerClass":[],"isCheckFollow":False,"isCheckReceive":False,"isContact":0,"pageSize":10,"pageNum":1}
  323. response =s.post(f"{cfg.target_host}/jyapi/jybx/buyer/eType/buyerList", headers=headers, json=data)
  324. # response.raise_for_status() # 如果请求失败,会抛出异常
  325. return response
  326. #消息中心列表
  327. def get_messagelist(self):
  328. headers = GSTORE['headers']
  329. s = GSTORE['s']
  330. response=s.post(f"{cfg.target_host}/jyapi/messageCenter/MessageList",headers=headers,json=
  331. {"msgType":-1,"isRead":-1,"offset":1,"size":20})
  332. return response
  333. """用户中台"""
  334. def get_userCenter(self):
  335. hearders = GSTORE['headers']
  336. s = GSTORE['s']
  337. response = s.post(f"{cfg.target_host}/userCenter/workDesktop/menuInfo", headers=hearders)
  338. return response
  339. """我的订单"""
  340. def get_myOrder(self):
  341. hearders = GSTORE['headers']
  342. s = GSTORE['s']
  343. params = {
  344. "type": 0,
  345. "pageNum": 1,
  346. "fromPage": "pc",
  347. "page_size": 10
  348. }
  349. response = s.post(f"{cfg.target_host}/subscribepay/orderListDetails/myOrder", headers=hearders, params=params)
  350. return response
  351. """优惠卷"""
  352. def get_coupon(self):
  353. hearders = GSTORE['headers']
  354. s = GSTORE['s']
  355. params={
  356. "mold": 4,
  357. "currentPage": 1,
  358. "pageSize": 8,
  359. "platform": "P"
  360. }
  361. response= s.post(f"{cfg.target_host}/jyCoupon/getInfoByUser", headers=hearders,params=params)
  362. return response
  363. """数据自动导出"""
  364. def get_dataExport(self,publishtime=1672502400_1688951529,keyword='数据',selectType='title'):
  365. hearders = GSTORE['headers']
  366. s = GSTORE['s']
  367. params={
  368. "publishtime":publishtime,
  369. "area":"",
  370. "city":"",
  371. "region":"",
  372. "industry":"",
  373. "buyerclass":"",
  374. "keyword": [{"keyword":keyword,"appended":[],"exclude":[]}],
  375. "selectType":selectType,
  376. "minprice":"",
  377. "maxprice":"",
  378. "subtype":"",
  379. "buyer":"",
  380. "winner":"",
  381. "dataType": 2
  382. }
  383. response = s.post(f"{cfg.target_host}/front/dataExport/sieveData", headers=hearders, params=params)
  384. return response
  385. """数据导出记录"""
  386. def Export_recordList(self):
  387. hearders = GSTORE['headers']
  388. s = GSTORE['s']
  389. params={
  390. "pageNum": 0,
  391. "pageSize": 10
  392. }
  393. response = s.post(f"{cfg.target_host}/subscribepay/dataExportPack/recordList", headers=hearders, params=params)
  394. return response
  395. """数据导出-超出2w条,点击不在提示"""
  396. def Export_prompt(self):
  397. hearders = GSTORE['headers']
  398. s = GSTORE['s']
  399. params={
  400. "status": 1
  401. }
  402. response = s.post(f"{cfg.target_host}/front/dataExport/setDontPromptAgain", headers=hearders, params=params)
  403. return response
  404. """数据导出-判断是否展示弹框"""
  405. def Export_frame(self):
  406. hearders = GSTORE['headers']
  407. s = GSTORE['s']
  408. response = s.post(f"{cfg.target_host}/front/dataExport/getDontPromptAgain", headers=hearders)
  409. return response
  410. """剑鱼文库搜索"""
  411. def Library_search(self,keyWord='数据'):
  412. hearders = GSTORE['headers']
  413. s = GSTORE['s']
  414. params={
  415. "keyWord":keyWord,
  416. "tag":"",
  417. "sort": "tSort",
  418. "num": 1,
  419. "size": 10
  420. }
  421. response = s.post(f"{cfg.target_host}/jydocs/search", headers=hearders, params=params)
  422. return response
  423. """剑鱼文库收藏"""
  424. def Library_collection(self):
  425. hearders = GSTORE['headers']
  426. s = GSTORE['s']
  427. params={
  428. "sign": 1,
  429. "num": 1,
  430. "size": 10
  431. }
  432. response = s.post(f"{cfg.target_host}/jydocs/user/list", headers=hearders, params=params)
  433. return response
  434. """剑鱼文库我的文库"""
  435. def My_library(self):
  436. hearders = GSTORE['headers']
  437. s = GSTORE['s']
  438. params={
  439. "sign": 0,
  440. "num": 1,
  441. "size": 10
  442. }
  443. response = s.post(f"{cfg.target_host}/jydocs/user/list", headers=hearders, params=params)
  444. return response
  445. """项目进度监控"""
  446. def Project_monitoring(self):
  447. hearders = GSTORE['headers']
  448. s = GSTORE['s']
  449. params={
  450. "pageNum": 0,
  451. "pageSize": 500
  452. }
  453. response = s.post(f"{cfg.target_host}/bigmember/follow/project/list", headers=hearders, params=params)
  454. return response
  455. """企业情报监控"""
  456. def Enterprise_monitoring(self):
  457. hearders = GSTORE['headers']
  458. s = GSTORE['s']
  459. params={
  460. "pageNum": 0,
  461. "pageSize": 10,
  462. "match":"",
  463. "group":"",
  464. }
  465. response = s.post(f"{cfg.target_host}/bigmember/follow/ent/list", headers=hearders, params=params)
  466. return response
  467. """客户监控"""
  468. def Customer_monitoring(self,):
  469. hearders = GSTORE['headers']
  470. s = GSTORE['s']
  471. params = {
  472. "pagesize": 10,
  473. "pageno": 0,
  474. "keyword":""
  475. }
  476. response = s.post(f"{cfg.target_host}/publicapply/customer/list", headers=hearders, params=params)
  477. return response
  478. """标讯收藏"""
  479. def Message_Collection(self):
  480. hearders = GSTORE['headers']
  481. s = GSTORE['s']
  482. params={
  483. "buyerPhone":0,
  484. "buyerclass":"",
  485. "label":"",
  486. "pagenum":1,
  487. "pagesize":50,
  488. "selectTime":"",
  489. "winnerPhone":0
  490. }
  491. response = s.post(f"{cfg.target_host}/publicapply/bidcoll/list", headers=hearders, params=params)
  492. return response
  493. """标讯收藏"""
  494. #信息获取
  495. def Getuser(self):
  496. headers = GSTORE['headers']
  497. s = GSTORE['s']
  498. response = s.get(f"{cfg.target_host}/jypay/user/getAccountInfo", headers=headers)
  499. return response
  500. #密码校验
  501. def Check_password(self):
  502. headers = GSTORE['headers']
  503. s = GSTORE['s']
  504. params = {
  505. "password": "123456"
  506. }
  507. response = s.post(f"{cfg.target_host}/publicapply/password/check", headers=headers, params=params)
  508. return response
  509. #身份获取
  510. def Identity_list(self,n=0):
  511. headers = GSTORE['headers']
  512. s = GSTORE['s']
  513. params = {
  514. }
  515. response = s.post(f"{cfg.target_host}/publicapply/identity/list",headers=headers, params=params)
  516. # 解析响应内容为JSON
  517. response_json = response.json()
  518. # 从JSON响应中提取token
  519. self.token = response_json['data'][n]['token']
  520. return response
  521. def Identity_switch(self):
  522. headers = GSTORE['headers']
  523. s = GSTORE["s"]
  524. params = {
  525. "token":self.token
  526. }
  527. response =s.post(f"{cfg.target_host}/publicapply/identity/switch", headers=headers, params=params)
  528. return response
  529. """获取用户信息"""
  530. def User_info(self):
  531. headers = {
  532. 'content-Type': 'application/json',
  533. 'appId': '10000',
  534. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67'
  535. }
  536. s = GSTORE["s"]
  537. params = {}
  538. response =s.post(f"{cfg.target_host}/userCenter/ent/userInfo",headers=headers,params=params)
  539. return response
  540. def Whether_buy(self):
  541. headers = GSTORE["headers"]
  542. s = GSTORE["s"]
  543. response =s.get(f"{cfg.target_host}/entnicheNew/buy/whetherbuy",headers=headers)
  544. return response
  545. def Commonly_List(self):
  546. headers = {
  547. 'content-Type': 'application/json',
  548. 'appId': '10000',
  549. 'userid': '63a41aa5cd7ea10389b2a8f3'
  550. }
  551. s = GSTORE['s']
  552. response =s.post(f"{cfg.target_host}/userCenter/workDesktop/renew/commonlyList",headers=headers)
  553. return response
  554. """权限校验"""
  555. def Authorised_info(self):
  556. headers = {
  557. "Content-Type":"application/json",
  558. "functionCode":"znsj_kf_use"
  559. }
  560. s = GSTORE['s']
  561. response =s.post(f"{cfg.target_host}/resourceCenter/waitEmpowerDetail",headers=headers)
  562. return response
  563. """未登录采购单位列表"""
  564. def nologin_buyer_list(self):
  565. headers = GSTORE['headers']
  566. s = GSTORE['s']
  567. data = {"buyerName":"","province":[],"city":[],"buyerClass":[],"isCheckFollow":False,"isCheckReceive":False,"isContact":0,"pageSize":10,"pageNum":1}
  568. response =s.post(f"{cfg.target_host}/jyapi/jybx/buyer/eType/buyerList",headers=headers,json=data)
  569. return response
  570. """未登录供应商列表"""
  571. def nologin_supplySearch(self):
  572. headers = GSTORE['headers']
  573. s = GSTORE['s']
  574. data = {"keywords":"信息","searchType":"title","province":"","city":"","time":"","status":"0","pageSize":50,"pageIndex":1}
  575. response =s.post(f"{cfg.target_host}/jyinfo/supplySearch",headers=headers,json=data)
  576. return response
  577. """未登录企业搜索"""
  578. def nologin_enterpriseSearch(self):
  579. headers = GSTORE['headers']
  580. s = GSTORE['s']
  581. params = {"match":"科技"}
  582. response =s.post(f"{cfg.target_host}/publicapply/enterpriseSearch/doQuery",headers=headers, params=params)
  583. return response
  584. """未登录招标信息搜索"""
  585. def nologin_Tender_search(self ):
  586. headers = GSTORE['headers']
  587. s = GSTORE['s']
  588. params = {"match":"科技"}
  589. response =s.post(f"{cfg.target_host}/jyapi/jybx/core/fType/searchList",headers=headers, params=params)
  590. return response
  591. """未登录拟在建搜索"""
  592. def nologin_Proposed_construction_search(self ):
  593. headers = GSTORE['headers']
  594. s = GSTORE['s']
  595. params = {"match":"科技"}
  596. response =s.post(f"{cfg.target_host}/front/project/nzj/search",headers=headers, params=params)
  597. return response
  598. """大会员推送记录列表"""
  599. def bigmember_push(self):
  600. headers = GSTORE['headers']
  601. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/mType/list", headers=headers, json=
  602. {
  603. "pageNum": 1,
  604. "pageSize": 50,
  605. "format": "table",
  606. "area": "",
  607. "selectTime": "all",
  608. "city": "",
  609. "buyerClass": "",
  610. "subtype": "",
  611. "industry": "",
  612. "keyWords": "",
  613. "fileExists": "",
  614. "price": "",
  615. "source": "",
  616. "exportNum": "",
  617. "district": "",
  618. "isRead": "",
  619. "vt": "m"
  620. })
  621. return response
  622. """商机管理推送记录"""
  623. def entniche_push(self):
  624. headers = GSTORE['headers']
  625. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/eType/list", headers=headers, json=
  626. {
  627. "pageNum": 1,
  628. "pageSize": 50,
  629. "format": "table",
  630. "area": "",
  631. "selectTime": "all",
  632. "city": "",
  633. "buyerClass": "",
  634. "subtype": "",
  635. "industry": "",
  636. "keyWords": "",
  637. "fileExists": "",
  638. "price": "",
  639. "source": "",
  640. "exportNum": "",
  641. "district": "",
  642. "isRead": "",
  643. "vt": "s"
  644. })
  645. return response
  646. """订阅搜索"""
  647. #免费用户订阅搜索
  648. def free_subscription_search(self):
  649. headers = GSTORE['headers']
  650. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/fType/list", headers=headers, json=
  651. {
  652. "pageNum": 1,
  653. "pageSize": 50,
  654. "format": "table",
  655. "area": "",
  656. "selectTime": "1718534447_1721126447",
  657. "city": "",
  658. "buyerClass": "",
  659. "subtype": "",
  660. "industry": "",
  661. "keyWords": "",
  662. "fileExists": "",
  663. "price": "",
  664. "source": "",
  665. "exportNum": "",
  666. "district": "",
  667. "isRead": "",
  668. "vt": ""
  669. })
  670. return response
  671. #超级订阅用户订阅搜索
  672. def svip_subscription_search(self):
  673. headers = GSTORE['headers']
  674. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/vType/list", headers=headers, json=
  675. {
  676. "pageNum": 1,
  677. "pageSize": 50,
  678. "format": "table",
  679. "area": "安徽",
  680. "selectTime": "1675094400_1719763199",
  681. "city": "",
  682. "buyerClass": "传媒,采矿业,电信行业,金融业,建筑业,能源化工,农林牧渔,批发零售,信息技术,运输物流,制造业,住宿餐饮",
  683. "subtype": "招标公告,招标,邀标,询价,竞谈,单一,竞价,变更",
  684. "industry": "",
  685. "keyWords": "计算机",
  686. "fileExists": "",
  687. "price": "",
  688. "source": "",
  689. "exportNum": "",
  690. "district": "",
  691. "isRead": "",
  692. "vt": "v"
  693. })
  694. return response
  695. #大会员用户订阅搜索
  696. def bigmember_subscription_search(self):
  697. headers = GSTORE['headers']
  698. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/mType/list", headers=headers, json=
  699. {
  700. "pageNum": 1,
  701. "pageSize": 50,
  702. "format": "table",
  703. "area": "安徽,北京,甘肃",
  704. "selectTime": "1672502400_1719763199",
  705. "city": "",
  706. "buyerClass": "人大,政协,党委办,组织,宣传,统战,纪委,政府办,发改,财政,教育,科技,工信,民政,民宗,人社,公安,检察院,法院,司法,应急管理,军队,自然资源,生态环境,住建,市政,城管,交通,水利,农业,气象,文旅,卫健委,医疗,学校,档案,体育,政务中心,机关事务,国资委,海关,税务,市场监管,商务,人行,银保监,证监,审计,出版广电,统计,公共资源交易,社会团体",
  707. "subtype": "招标预告,预告,预审,预审结果,论证意见,需求公示,招标结果,中标,成交,废标,流标",
  708. "industry": "",
  709. "keyWords": "信息,科技,能源",
  710. "fileExists": "",
  711. "price": "",
  712. "source": "",
  713. "exportNum": "",
  714. "isRead": "1",
  715. "vt": "m"
  716. })
  717. return response
  718. #商机管理订阅搜索
  719. def entname_subscription_search(self):
  720. headers = GSTORE['headers']
  721. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/eType/list", headers=headers, json=
  722. {
  723. "pageNum": 1,
  724. "pageSize": 50,
  725. "format": "table",
  726. "area": "安徽,重庆,河南,江苏",
  727. "selectTime": "1672502400_1719763199",
  728. "city": "",
  729. "buyerClass": "",
  730. "subtype": "招标公告,招标,邀标,询价,竞谈,单一,竞价,变更,招标结果,中标,成交,废标,流标",
  731. "industry": "农林牧渔_生产物资,农林牧渔_生产设备,农林牧渔_相关服务",
  732. "keyWords": "农业,园林,森林",
  733. "fileExists": "",
  734. "price": "",
  735. "source": "1",
  736. "exportNum": "",
  737. "isRead": "",
  738. "vt": "s"
  739. })
  740. return response
  741. #招标采购搜索信息对外接口
  742. def bid_search_api(self):
  743. headers = {
  744. 'Accept-Charset': 'utf-8',
  745. 'timestamp': '1726207205',
  746. 'sign': '1058A958B8D562EA9F2234AC42716778',
  747. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  748. 'Content-Type': 'application/json'
  749. }
  750. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/search?appid=jianyuDev", headers=headers, json={
  751. "releaseTimeStart": 1695456870,"keyWord": ["市政粮食"],"searchMode":1})
  752. return response
  753. #招标采购搜索信息普通字段包对外接口
  754. def bid_ordinarypkg(self):
  755. headers = {
  756. 'Accept-Charset': 'utf-8',
  757. 'timestamp': '1726207205',
  758. 'sign': '1058A958B8D562EA9F2234AC42716778',
  759. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  760. 'Content-Type': 'application/json'
  761. }
  762. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/ordinarypkg?appid=jianyuDev",
  763. headers=headers, json={"id": "040654015b5f500a1b4774135a57015651085a585c4f4c7605dc"})
  764. return response
  765. # 招标采购搜索信息高级字段包对外接口
  766. def bid_seniorpkg(self):
  767. headers = {
  768. 'Accept-Charset': 'utf-8',
  769. 'timestamp': '1726207205',
  770. 'sign': '1058A958B8D562EA9F2234AC42716778',
  771. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  772. 'Content-Type': 'application/json'
  773. }
  774. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/seniorpkg?appid=jianyuDev",
  775. headers=headers,
  776. json={"id": "040654015b5f500a1b4774135a57015651085a585c4f4c7605dc"})
  777. return response
  778. #招标采购信息附件下载接口
  779. def bid_annex(self):
  780. headers = {
  781. 'Accept-Charset': 'utf-8',
  782. 'timestamp': '1726207205',
  783. 'sign': '1058A958B8D562EA9F2234AC42716778',
  784. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  785. 'Content-Type': 'application/json'
  786. }
  787. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/annex?appid=jianyuDev",
  788. headers=headers,
  789. json={"fid":"040507510f0a075618137614500208530c095c500f1814785d44030451"})
  790. return response
  791. #客户标签类型获取
  792. def customer_getLabel(self):
  793. headers = GSTORE['headers']
  794. response = self.s.post(f"{cfg.target_host}/entnicheNew/customer/getLabel", headers=headers, json={})
  795. return response
  796. #商机管理客户关注
  797. def customer_attention(self):
  798. headers = GSTORE['headers']
  799. response = self.s.post(f"{cfg.target_host}/publicapply/customer/attention", headers=headers, json={"name":"石嘴山市交通工程建设管理中心","mold":1,"D":True})
  800. return response
  801. apimgr = APIMgr()