amac_securities_private_investment_funds_api.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import json
  2. import Utils
  3. from Config import mysql_pool, conn, headers, page, size
  4. start_time = Utils.data_time()
  5. print("开始时间(精确到毫秒)[证券公司私募投资基金]:", start_time)
  6. # 因为这里数据一条人员信息amac_member_user中包含了对应的多个证书,所以需要先循环把证书拿出来
  7. def savetodb(data):
  8. # 判断是否为空,为空则跳过直接返回
  9. if data is None: return
  10. person_record = []
  11. for item in data:
  12. # 构建人员信息记录
  13. this_data = {
  14. 'id': item.get("id"),
  15. 'product_id': item.get("productId"),
  16. 'product_name': item.get("productName"),
  17. 'product_code': item.get("productCode"),
  18. 'user_tenant_id': item.get("userTenantId"),
  19. 'mgr_name': item.get("mgrName"),
  20. 'found_date': item.get("foundDate"),
  21. 'registered_date': item.get("registeredDate"),
  22. 'cast_product': item.get("castProduct"),
  23. 'fund_type': item.get("fundType"),
  24. 'org_form': item.get("orgForm"),
  25. 'fund_status': item.get("fundStatus"),
  26. 'tuo_guan': item.get("tuoGuan"),
  27. 'trustee': item.get("trustee"),
  28. 'delmark': item.get("delmark")
  29. }
  30. person_record.append(this_data)
  31. # 批量插入
  32. mysql_pool.insert('amac_securities_private_investment_funds', person_record)
  33. this_page = page
  34. this_size = size
  35. payload = json.dumps({})
  36. # 证券公司私募投资基金
  37. http_url = "/amac-infodisc/api/pof/subfund"
  38. Utils.get_page_result(http_url, this_page, this_size, payload, headers, conn, savetodb, __file__)
  39. print(f"结束时间(精确到毫秒): {Utils.data_time()} - {start_time}")