async def get_code_state(ns={}): if not ns: return { 'status': False, 'msg': 'There need params, but get none' } code_info = { 'id': ns.get('state'), 'code': ns.get('code') } db = DBPools() async with db.sqlorContext('kboss') as sor: try: await sor.C('wechat_login_code', code_info) except Exception as e: return { 'status': False, 'msg': str(e) } with open('code_state.txt', 'w', encoding='utf-8') as f: f.write(json.dumps(ns) + '\n') #return { # 'status': True, # 'msg': '参数保存成功' #} ret = await get_code_state(params_kw) return ret