Example #1
0
 def post(self, *args, **kwargs):
     # 获取表单中的用户分组ID
     group_id = self.get_argument('group_id', None)
     if not group_id:
         return self.finish(WorkOrderResult(msg='用户分组不能为空'))
     # 获取表单中的用户角色
     user_role = self.get_argument('user_role', None)
     if not user_role:
         return self.finish(WorkOrderResult(msg='用户角色不能为空'))
     # 获取表单中的帐号
     user_name = self.get_argument('user_name', None)
     if not user_name:
         return self.finish(WorkOrderResult(msg='账号不能为空'))
     # 获取表单中用户的昵称
     user_nick = self.get_argument('user_nick', None)
     if not user_nick:
         return self.finish(WorkOrderResult(msg='昵称不能为空'))
     # 获取表单中的密码
     user_upwd = self.get_argument('user_upwd', None)
     if not user_upwd:
         return self.finish(WorkOrderResult(msg='密码不能为空'))
     # 获取表单中的默认密码
     user_dpwd = self.get_argument('user_dpwd', 'zzz123456')
     # 获取表单中允许用户的IP地址
     user_ips = self.get_argument('user_ips', None)
     if not user_ips:
         return self.finish(WorkOrderResult(msg='IP范围不能为空'))
     # 后台线程异步请求
     code, msg, _ = yield AsyncUtil().run(
         UsersModel.register, group_id, user_role, user_name,
         user_nick, user_upwd, user_dpwd, user_ips)
     self.finish(WorkOrderResult(code, msg))
Example #2
0
 def post(self, *args, **kwargs):
     # 获取表单中的帐号
     user_name = self.get_argument('user_name', None)
     if not user_name:
         return self.finish(WorkOrderResult(msg='账号不能为空'))
     # 获取表单中的操作
     user_state = self.get_argument('user_state', None)
     if not user_state:
         return self.finish(WorkOrderResult(msg='操作类型不能为空'))
     # 后台线程异步请求
     msg, _ = yield AsyncUtil().run(UsersModel.lock, user_name, user_state)
     self.finish(WorkOrderResult(msg=msg))
Example #3
0
 def post(self, *args, **kwargs):
     # 获取表单中的帐号
     user_name = self.get_argument('user_name', None)
     if not user_name:
         return self.finish(WorkOrderResult(0, '帐号不能为空'))
     # 获取表单中的密码
     user_upwd = self.get_argument('user_upwd', None)
     if not user_upwd:
         return self.finish(WorkOrderResult(0, '密码不能为空'))
     # 获取访问者的IP地址
     user_ip = self.request.remote_ip
     # 后台线程异步请求
     code, msg, data = yield AsyncUtil().run(UsersModel.login, user_name, user_upwd, user_ip)
     if data:  # 设置私密cookie
         self.set_secure_cookie('user', data)
     self.finish(WorkOrderResult(code, msg, data))
Example #4
0
 def post(self, *args, **kwargs):
     # 获取表单中的帐号
     user_name = self.get_argument('user_name', None)
     if not user_name:
         return self.finish(WorkOrderResult(msg='账号不能为空'))
     # 获取表单中的密码
     user_upwd = self.get_argument('user_upwd', None)
     if not user_upwd:
         return self.finish(WorkOrderResult(msg='密码不能为空'))
     # 获取表单中的新密码
     user_npwd = self.get_argument('user_npwd', None)
     if not user_npwd:
         return self.finish(WorkOrderResult(msg='新密码不能为空'))
     # 后台线程异步请求
     code, msg, _ = yield AsyncUtil().run(
         UsersModel.password, user_name, user_upwd, user_npwd)
     self.finish(WorkOrderResult(code, msg))
Example #5
0
 def get(self, *args, **kwargs):
     # 后台线程异步请求
     msg, data = yield AsyncUtil().run(
         BugsModel.get_all_dict, 200, BugsModel.bug_time)
     self.finish(WorkOrderResult(msg=msg, data=data))
Example #6
0
 def get(self, *args, **kwargs):
     # 后台线程异步请求
     msg, data = yield AsyncUtil().run(GroupsModel.get_all_dict)
     self.finish(WorkOrderResult(msg=msg, data=data))
Example #7
0
 def post(self, *args, **kwargs):
     group_name = self.get_argument('group_name', None)
     # 后台线程异步请求
     msg, _ = yield AsyncUtil().run(GroupsModel.insert, group_name)
     self.finish(WorkOrderResult(msg=msg))