async def adddepartment(ns): """ 添加部门 """ db = DBPools() async with db.sqlorContext('kboss') as sor: try: user = await get_user() if user == None: return {'status': False, 'msg': '没有获取token'} user3 = ns['userid'] userid = await sor.R('users', {'id':user3}) if len(userid) >= 1: ns['orgid'] = userid[0]['orgid'] ns['id'] = uuid() await sor.C('department',ns) return {'status': True, 'msg': '添加成功'} except Exception as e: raise e return {'status': False, 'msg': '添加失败'} ret = await adddepartment(params_kw) return ret