from USSyunwei.bin import *标签:状态,statu,no,text,list,ledger,查询,re,第三方 From: https://www.cnblogs.com/xieweiwen/p/17928145.html
def yeestatus(order_no):
# order_no="W23042211480020"
ledger_remark={"完结分账":"十分到家","服务商分账":"服务商","工程师分账":"工程师"}
statu_list=[]
for i in ledger_remark:
sql = f"select ledger_no,yeepay_ledger_no from tcl_ledger_detail where order_no='{order_no}' and ledger_remark='{i}'"
statu1, requestId = DB_sql(sql, database="uss_payunit",example="生产_营销_十分到家_USS2.0_basicdata_MYSQL_从(10.68.70.37)")
if statu1==False and "sql查询出来是空值" in requestId:
statu_list.append(f"{ledger_remark[i]}状态为:无需分账;")
continue
#查询易宝发送记录
sql=f"select payee_no,unique_order_no,pay_no from intf_yee_payment where pay_no like '{order_no}%' and status='SUCCESS'"
statu2, insert_ledger_param = DB_sql(sql, database="uss_intfapi",example="生产_营销_十分到家_USS2.0_basicdata_MYSQL_从(10.68.70.37)")
# print(requestId)
data = {
"orderId": f"{insert_ledger_param[0][2]}",
"requestId": f"{requestId[0][0]}",
"uniqueOrderNo": f"{insert_ledger_param[0][1]}",
"settleMerchantNo": f"{requestId[0][1]}"
}
# print(data["orderId"])
# url="https://gateway.shifendaojia.com/uss-intfapi-service/v1/yee-pay-ledger/querySettleAmount"
url = "https://uss-sit-gateway.tcl.com/uss-intfapi-service/v1/yee-pay-ledger/querySettleAmount"
header={
"Connection": "keep-alive",
"Authorization": "bearer 4a86d88a-6c0f-4004-a916-42b4f073545c",
"Content-Type": "application/json",
"User-Agent": "Apache-HttpClient/4.5.12 (Java/20.0.1)"
}
re=requests.post(data=json.dumps(data),url=url,headers=header)
re_text = json.loads(re.text.replace("'",'"'))
try:
re_text = json.loads(re_text['settleRecordQueryDtos'])
# print(re_text)
if "errorMessage" in str(re_text):
statu_list.append(f"{ledger_remark[i]}易宝状态为:已冲退,冲退原因为:{re_text[0]['settleRecordDetailsDtos'][0]['errorMessage']};")
# print(re_text[0]["settleRecordDetailsDtos"][0]["statusDesc"])
else:
# print(re_text)
statu_list.append(f"{ledger_remark[i]}易宝状态为:{re_text[0]['settleRecordDetailsDtos'][0]['statusDesc']};")
except:
statu_list.append(f"{ledger_remark[i]}易宝状态为:{re_text};")
statu_list.append(data["orderId"])
# for k in statu_list:
# print(k)
return f"{order_no} {statu_list}"