32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
# 保存审批参数配置
|
|
async def save_apv_key(ns={}):
|
|
_f = ns.get("flag")
|
|
try:
|
|
data = {
|
|
"id": ns.get('id'),
|
|
"user_id": ns["user_id"], # 用户id
|
|
"orgid": ns["orgid"], # 机构id
|
|
"source": ns["source"], # key所属公司
|
|
"app_key": password_encode(ns["app_key"]), # 应用凭证key
|
|
"app_secret": password_encode(ns["app_secret"]), # 应用凭证secret
|
|
"http_aes_key": password_encode(ns["http_aes_key"]), # 加密aes_key
|
|
"http_token": password_encode(ns["http_token"]), # 签名token
|
|
}
|
|
except Exception as e:
|
|
return {"status": False, "msg": f"参数解析错误,请检查参数:{e}"}
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
if _f == "add":
|
|
data["id"] = uuid()
|
|
await sor.C("apv_key", data)
|
|
elif _f == "update":
|
|
data["update_time"] = "{}".format(datetime.datetime.now())
|
|
await sor.U("apv_key", data)
|
|
else:
|
|
return {"status": False, "msg": "flag is error"}
|
|
return {"status": True, "msg": "success"}
|
|
|
|
|
|
ret = await save_apv_key(params_kw)
|
|
return ret
|