def put(self, uid): """更新用户资料""" assert current_user.id == uid # 断言判断当前用户是本人,十分懒人的处理了,哈哈 form = UserForm() user = UserModel.find_by_id(uid) user.update(**form.form) return dict(code=200, msg='success', data=user.asdict())
def delete(self, uid): """ 删除用户 :return: """ users = UserModel.find_by_id(uid) if not users: return dict(code=404, msg='not found', data=None) else: UserModel.delete(uid) return dict(code=200, msg='success', data=None)