webapi.py 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  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 export_list(self):
  412. hearders = GSTORE['headers']
  413. s = GSTORE['s']
  414. response = s.get(f"{cfg.target_host}/subscribepay/dataExportPack/screenList", headers=hearders)
  415. return response
  416. """剑鱼文库搜索"""
  417. def Library_search(self,keyWord='数据'):
  418. hearders = GSTORE['headers']
  419. s = GSTORE['s']
  420. params={
  421. "keyWord":keyWord,
  422. "tag":"",
  423. "sort": "tSort",
  424. "num": 1,
  425. "size": 10
  426. }
  427. response = s.post(f"{cfg.target_host}/jydocs/search", headers=hearders, params=params)
  428. return response
  429. """剑鱼文库收藏"""
  430. def Library_collection(self):
  431. hearders = GSTORE['headers']
  432. s = GSTORE['s']
  433. params={
  434. "sign": 1,
  435. "num": 1,
  436. "size": 10
  437. }
  438. response = s.post(f"{cfg.target_host}/jydocs/user/list", headers=hearders, params=params)
  439. return response
  440. """剑鱼文库我的文库"""
  441. def My_library(self):
  442. hearders = GSTORE['headers']
  443. s = GSTORE['s']
  444. params={
  445. "sign": 0,
  446. "num": 1,
  447. "size": 10
  448. }
  449. response = s.post(f"{cfg.target_host}/jydocs/user/list", headers=hearders, params=params)
  450. return response
  451. """项目进度监控"""
  452. def Project_monitoring(self):
  453. hearders = GSTORE['headers']
  454. s = GSTORE['s']
  455. params={
  456. "pageNum": 0,
  457. "pageSize": 500
  458. }
  459. response = s.post(f"{cfg.target_host}/bigmember/follow/project/list", headers=hearders, params=params)
  460. return response
  461. """企业情报监控"""
  462. def Enterprise_monitoring(self):
  463. hearders = GSTORE['headers']
  464. s = GSTORE['s']
  465. params={
  466. "pageNum": 0,
  467. "pageSize": 10,
  468. "match":"",
  469. "group":"",
  470. }
  471. response = s.post(f"{cfg.target_host}/bigmember/follow/ent/list", headers=hearders, params=params)
  472. return response
  473. """客户监控"""
  474. def Customer_monitoring(self,):
  475. hearders = GSTORE['headers']
  476. s = GSTORE['s']
  477. params = {
  478. "pagesize": 10,
  479. "pageno": 0,
  480. "keyword":""
  481. }
  482. response = s.post(f"{cfg.target_host}/publicapply/customer/list", headers=hearders, params=params)
  483. return response
  484. """标讯收藏"""
  485. def Message_Collection(self):
  486. hearders = GSTORE['headers']
  487. s = GSTORE['s']
  488. params={
  489. "buyerPhone":0,
  490. "buyerclass":"",
  491. "label":"",
  492. "pagenum":1,
  493. "pagesize":50,
  494. "selectTime":"",
  495. "winnerPhone":0
  496. }
  497. response = s.post(f"{cfg.target_host}/publicapply/bidcoll/list", headers=hearders, params=params)
  498. return response
  499. """标讯收藏"""
  500. #信息获取
  501. def Getuser(self):
  502. headers = GSTORE['headers']
  503. s = GSTORE['s']
  504. response = s.get(f"{cfg.target_host}/jypay/user/getAccountInfo", headers=headers)
  505. return response
  506. #密码校验
  507. def Check_password(self):
  508. headers = GSTORE['headers']
  509. s = GSTORE['s']
  510. params = {
  511. "password": "123456"
  512. }
  513. response = s.post(f"{cfg.target_host}/publicapply/password/check", headers=headers, params=params)
  514. return response
  515. #身份获取
  516. def Identity_list(self,n=0):
  517. headers = GSTORE['headers']
  518. s = GSTORE['s']
  519. params = {
  520. }
  521. response = s.post(f"{cfg.target_host}/publicapply/identity/list",headers=headers, params=params)
  522. # 解析响应内容为JSON
  523. response_json = response.json()
  524. # 从JSON响应中提取token
  525. self.token = response_json['data'][n]['token']
  526. return response
  527. def Identity_switch(self):
  528. headers = GSTORE['headers']
  529. s = GSTORE["s"]
  530. params = {
  531. "token":self.token
  532. }
  533. response =s.post(f"{cfg.target_host}/publicapply/identity/switch", headers=headers, params=params)
  534. return response
  535. """获取用户信息"""
  536. def User_info(self):
  537. headers = {
  538. 'content-Type': 'application/json',
  539. 'appId': '10000',
  540. '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'
  541. }
  542. s = GSTORE["s"]
  543. params = {}
  544. response =s.post(f"{cfg.target_host}/userCenter/ent/userInfo",headers=headers,params=params)
  545. return response
  546. def Whether_buy(self):
  547. headers = GSTORE["headers"]
  548. s = GSTORE["s"]
  549. response =s.get(f"{cfg.target_host}/entnicheNew/buy/whetherbuy",headers=headers)
  550. return response
  551. def Commonly_List(self):
  552. headers = {
  553. 'content-Type': 'application/json',
  554. 'appId': '10000',
  555. 'userid': '63a41aa5cd7ea10389b2a8f3'
  556. }
  557. s = GSTORE['s']
  558. response =s.post(f"{cfg.target_host}/userCenter/workDesktop/renew/commonlyList",headers=headers)
  559. return response
  560. """权限校验"""
  561. def Authorised_info(self):
  562. headers = {
  563. "Content-Type":"application/json",
  564. "functionCode":"znsj_kf_use"
  565. }
  566. s = GSTORE['s']
  567. response =s.post(f"{cfg.target_host}/resourceCenter/waitEmpowerDetail",headers=headers)
  568. return response
  569. """未登录采购单位列表"""
  570. def nologin_buyer_list(self):
  571. headers = GSTORE['headers']
  572. s = GSTORE['s']
  573. data = {"buyerName":"","province":[],"city":[],"buyerClass":[],"isCheckFollow":False,"isCheckReceive":False,"isContact":0,"pageSize":10,"pageNum":1}
  574. response =s.post(f"{cfg.target_host}/jyapi/jybx/buyer/eType/buyerList",headers=headers,json=data)
  575. return response
  576. """未登录供应商列表"""
  577. def nologin_supplySearch(self):
  578. headers = GSTORE['headers']
  579. s = GSTORE['s']
  580. data = {"keywords":"信息","searchType":"title","province":"","city":"","time":"","status":"0","pageSize":50,"pageIndex":1}
  581. response =s.post(f"{cfg.target_host}/jyinfo/supplySearch",headers=headers,json=data)
  582. return response
  583. """未登录企业搜索"""
  584. def nologin_enterpriseSearch(self):
  585. headers = GSTORE['headers']
  586. s = GSTORE['s']
  587. params = {"match":"科技"}
  588. response =s.post(f"{cfg.target_host}/publicapply/enterpriseSearch/doQuery",headers=headers, params=params)
  589. return response
  590. """未登录招标信息搜索"""
  591. def nologin_Tender_search(self ):
  592. headers = GSTORE['headers']
  593. s = GSTORE['s']
  594. params = {"match":"科技"}
  595. response =s.post(f"{cfg.target_host}/jyapi/jybx/core/fType/searchList",headers=headers, params=params)
  596. return response
  597. """未登录拟在建搜索"""
  598. def nologin_Proposed_construction_search(self ):
  599. headers = GSTORE['headers']
  600. s = GSTORE['s']
  601. params = {"match":"科技"}
  602. response =s.post(f"{cfg.target_host}/front/project/nzj/search",headers=headers, params=params)
  603. return response
  604. """未登录拟在建搜索详情页"""
  605. def nologin_proposed_construction_content(self):
  606. headers = GSTORE['headers']
  607. s = GSTORE['s']
  608. params = {"pid":"040600055c0f00594f4351560153085d530f4e4200035201"}
  609. response =s.post(f"{cfg.target_host}/front/project/nzj/details",headers=headers, params=params)
  610. return response
  611. """大会员推送记录列表"""
  612. def bigmember_push(self):
  613. headers = GSTORE['headers']
  614. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/mType/list", headers=headers, json=
  615. {
  616. "pageNum": 1,
  617. "pageSize": 50,
  618. "format": "table",
  619. "area": "",
  620. "selectTime": "all",
  621. "city": "",
  622. "buyerClass": "",
  623. "subtype": "",
  624. "industry": "",
  625. "keyWords": "",
  626. "fileExists": "",
  627. "price": "",
  628. "source": "",
  629. "exportNum": "",
  630. "district": "",
  631. "isRead": "",
  632. "vt": "m"
  633. })
  634. return response
  635. """商机管理推送记录"""
  636. def entniche_push(self):
  637. headers = GSTORE['headers']
  638. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/eType/list", headers=headers, json=
  639. {
  640. "pageNum": 1,
  641. "pageSize": 50,
  642. "format": "table",
  643. "area": "",
  644. "selectTime": "all",
  645. "city": "",
  646. "buyerClass": "",
  647. "subtype": "",
  648. "industry": "",
  649. "keyWords": "",
  650. "fileExists": "",
  651. "price": "",
  652. "source": "",
  653. "exportNum": "",
  654. "district": "",
  655. "isRead": "",
  656. "vt": "s"
  657. })
  658. return response
  659. """订阅搜索"""
  660. #免费用户订阅搜索
  661. def free_subscription_search(self):
  662. headers = GSTORE['headers']
  663. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/fType/list", headers=headers, json=
  664. {
  665. "pageNum": 1,
  666. "pageSize": 50,
  667. "format": "table",
  668. "area": "",
  669. "selectTime": "1718534447_1721126447",
  670. "city": "",
  671. "buyerClass": "",
  672. "subtype": "",
  673. "industry": "",
  674. "keyWords": "",
  675. "fileExists": "",
  676. "price": "",
  677. "source": "",
  678. "exportNum": "",
  679. "district": "",
  680. "isRead": "",
  681. "vt": ""
  682. })
  683. return response
  684. #超级订阅用户订阅搜索
  685. def svip_subscription_search(self):
  686. headers = GSTORE['headers']
  687. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/vType/list", headers=headers, json=
  688. {
  689. "pageNum": 1,
  690. "pageSize": 50,
  691. "format": "table",
  692. "area": "安徽",
  693. "selectTime": "1675094400_1719763199",
  694. "city": "",
  695. "buyerClass": "传媒,采矿业,电信行业,金融业,建筑业,能源化工,农林牧渔,批发零售,信息技术,运输物流,制造业,住宿餐饮",
  696. "subtype": "招标公告,招标,邀标,询价,竞谈,单一,竞价,变更",
  697. "industry": "",
  698. "keyWords": "计算机",
  699. "fileExists": "",
  700. "price": "",
  701. "source": "",
  702. "exportNum": "",
  703. "district": "",
  704. "isRead": "",
  705. "vt": "v"
  706. })
  707. return response
  708. #大会员用户订阅搜索
  709. def bigmember_subscription_search(self):
  710. headers = GSTORE['headers']
  711. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/mType/list", headers=headers, json=
  712. {
  713. "pageNum": 1,
  714. "pageSize": 50,
  715. "format": "table",
  716. "area": "安徽,北京,甘肃",
  717. "selectTime": "1672502400_1719763199",
  718. "city": "",
  719. "buyerClass": "人大,政协,党委办,组织,宣传,统战,纪委,政府办,发改,财政,教育,科技,工信,民政,民宗,人社,公安,检察院,法院,司法,应急管理,军队,自然资源,生态环境,住建,市政,城管,交通,水利,农业,气象,文旅,卫健委,医疗,学校,档案,体育,政务中心,机关事务,国资委,海关,税务,市场监管,商务,人行,银保监,证监,审计,出版广电,统计,公共资源交易,社会团体",
  720. "subtype": "招标预告,预告,预审,预审结果,论证意见,需求公示,招标结果,中标,成交,废标,流标",
  721. "industry": "",
  722. "keyWords": "信息,科技,能源",
  723. "fileExists": "",
  724. "price": "",
  725. "source": "",
  726. "exportNum": "",
  727. "isRead": "1",
  728. "vt": "m"
  729. })
  730. return response
  731. #新增项目关注
  732. def new_project_attention(self):
  733. headers = GSTORE['headers']
  734. response =self.s.post(f"{cfg.target_host}/bigmember/follow/project/add?sid=ABCY1xaYD0vLD86RHxkcwcvJDAZDSB3dlVkKDgzIDodeGpzfQlUCdA=",headers=headers)
  735. return response
  736. #关注项目地区筛选
  737. def project_screenarea(self):
  738. headers = GSTORE['headers']
  739. response =self.s.get(f"{cfg.target_host}/bigmember/follow/project/screenArea",headers=headers, params={})
  740. return response
  741. #商机管理订阅搜索
  742. def entname_subscription_search(self):
  743. headers = GSTORE['headers']
  744. response = self.s.post(f"{cfg.target_host}/jyapi/jybx/subscribe/eType/list", headers=headers, json=
  745. {
  746. "pageNum": 1,
  747. "pageSize": 50,
  748. "format": "table",
  749. "area": "安徽,重庆,河南,江苏",
  750. "selectTime": "1672502400_1719763199",
  751. "city": "",
  752. "buyerClass": "",
  753. "subtype": "招标公告,招标,邀标,询价,竞谈,单一,竞价,变更,招标结果,中标,成交,废标,流标",
  754. "industry": "农林牧渔_生产物资,农林牧渔_生产设备,农林牧渔_相关服务",
  755. "keyWords": "农业,园林,森林",
  756. "fileExists": "",
  757. "price": "",
  758. "source": "1",
  759. "exportNum": "",
  760. "isRead": "",
  761. "vt": "s"
  762. })
  763. return response
  764. #招标采购搜索信息对外接口
  765. def bid_search_api(self):
  766. headers = {
  767. 'Accept-Charset': 'utf-8',
  768. 'timestamp': '1726207205',
  769. 'sign': '1058A958B8D562EA9F2234AC42716778',
  770. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  771. 'Content-Type': 'application/json'
  772. }
  773. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/search?appid=jianyuDev", headers=headers, json={
  774. "releaseTimeStart": 1695456870,"keyWord": ["市政粮食"],"searchMode":1})
  775. return response
  776. #招标采购搜索信息普通字段包对外接口
  777. def bid_ordinarypkg(self):
  778. headers = {
  779. 'Accept-Charset': 'utf-8',
  780. 'timestamp': '1726207205',
  781. 'sign': '1058A958B8D562EA9F2234AC42716778',
  782. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  783. 'Content-Type': 'application/json'
  784. }
  785. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/ordinarypkg?appid=jianyuDev",
  786. headers=headers, json={"id": "040654015b5f500a1b4774135a57015651085a585c4f4c7605dc"})
  787. return response
  788. # 招标采购搜索信息高级字段包对外接口
  789. def bid_seniorpkg(self):
  790. headers = {
  791. 'Accept-Charset': 'utf-8',
  792. 'timestamp': '1726207205',
  793. 'sign': '1058A958B8D562EA9F2234AC42716778',
  794. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  795. 'Content-Type': 'application/json'
  796. }
  797. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/seniorpkg?appid=jianyuDev",
  798. headers=headers,
  799. json={"id": "040654015b5f500a1b4774135a57015651085a585c4f4c7605dc"})
  800. return response
  801. #招标采购信息附件下载接口
  802. def bid_annex(self):
  803. headers = {
  804. 'Accept-Charset': 'utf-8',
  805. 'timestamp': '1726207205',
  806. 'sign': '1058A958B8D562EA9F2234AC42716778',
  807. 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
  808. 'Content-Type': 'application/json'
  809. }
  810. response = self.s.post(f"{cfg.target_host_api}/thirdpartyapi/standard/bid/annex?appid=jianyuDev",
  811. headers=headers,
  812. json={"fid":"040507510f0a075618137614500208530c095c500f1814785d44030451"})
  813. return response
  814. #客户标签类型获取
  815. def customer_getLabel(self):
  816. headers = GSTORE['headers']
  817. response = self.s.post(f"{cfg.target_host}/entnicheNew/customer/getLabel", headers=headers, json={})
  818. return response
  819. #商机管理客户关注
  820. def customer_attention(self):
  821. headers = GSTORE['headers']
  822. response = self.s.post(f"{cfg.target_host}/publicapply/customer/attention", headers=headers, json={"name":"石嘴山市交通工程建设管理中心","mold":1,"D":True})
  823. return response
  824. apimgr = APIMgr()