def execute(self, request): """判断是否为管理员""" staff_admin = self.auth_user StaffServer.judge_staff_role(staff_admin) """身份证号是否存在""" StaffServer.check_exist(request.user_info['identity']) """创建员工""" staff = StaffServer.register(**request.user_info) """添加权限关系""" if 'role_ids' in request.user_info: StaffPermiseServer.generate_staff_access( request.user_info['role_ids'], "role", staff) if 'department_ids' in request.user_info: StaffPermiseServer.generate_staff_access( request.user_info['department_ids'], "department", staff)
def execute(self, request): '''获得员工信息''' staff = StaffServer.get(request.user_id) """判断身份证号是否存在""" if "identity" in request.user_info: StaffServer.check_exist(request.user_info['identity'], staff) StaffServer.update(staff, **request.user_info) '''更新账号信息 account = StaffAccountServer.get_account_bystaff(staff) StaffAccountServer.update(account, **request.user_info) ''' '''更新权限信息''' StaffPermiseServer.update_staff_access(request.user_info['role_ids'], "role", staff) StaffPermiseServer.update_staff_access( request.user_info['department_ids'], "department", staff)