def login_info(self):
     unionid = self.get_argument("unioinid")
     logger.info(unionid)
     args_unionid = {}
     args_unionid.setdefault("unionid", unionid)
     data = UserService.getUserByUnionid(args_unionid)
     logger.info(data)
     if data.getSuccess() and len(data.getMessage()) > 0:
         request_data = {}
         request_data.setdefault("userName", data.username)
         request_data.setdefault("userPasswd", data.passwd)
         return LoginHandler.auth_login(request_data)
     elif data.getSuccess() and len(data.getMessage()) == 0:
         # userinfo = requests.post(url="http://dev2-stpuser.greedyint.com/user/GetDingTalkUserDetail",data=args_unionid,headers={"Content-Type":"application/json"})
         userinfo = requests.post(
             url=
             "http://user-sign.xiaobao100.com/user/GetDingTalkUserDetail",
             data=args_unionid,
             headers={"Content-Type": "application/json"})
         request_data = {}
         request_data.setdefault("userName", userinfo.name)
         request_data.setdefault("userPasswd", 123456)
         request_data.setdefault("mobile", userinfo.mobile)
         request_data.setdefault("userid_ding", userinfo.userid)
         request_data.setdefault("unionid", userinfo.unionid)
         request_data.setdefault("ding_department_id",
                                 userinfo.department[0])
         request_data.setdefault("roles", "")
         return UserService.addUser(request_data)
     DataResult.setMessage("请联系管理员")
     DataResult.setSuccess(False)
     return DataResult
Esempio n. 2
0
 def addUser(self):
     logger.error(self.request.body)
     data = json.loads(self.request.body)
     #数据库该字段可为空,入参没有时,需要补充key,否则访问sql
     if "userPasswd" not in data:
         data.setdefault("userPasswd", "123456")
     logger.info(data)
     dataResult = UserService().addUser(data)
     self.set_secure_cookie("userName", str(data["userName"]), version=1)
     self.set_secure_cookie("userId",
                            str(dataResult.getMessage()),
                            version=1)
     return dataResult
Esempio n. 3
0
 def getApplicationList(self):
     userId = self.get_secure_cookie("userId")
     id=userId
     data=UserService().getUserInfoById(id).getMessage()[0]
     if data["isleader"]==0:
         dataResult=ApplicationService().getApplicationList(userId)
     else:
         dataResult=ApplicationService().getApplicationListLeader()
     return dataResult
Esempio n. 4
0
 def add_user_info(self):
     logger.error(self.request.body)
     if isinstance(self.request.body,dict):
         logger.error("JJJJJJJJJJJ")
     data = json.loads(self.request.body)
     logger.error("JJJJJJJJJJJasssss")
     #数据库该字段可为空,入参没有时,需要补充key,否则访问sql
     if "remarks" not in  data:
         data.setdefault("remarks",None)
     return UserService().addUser(data)
Esempio n. 5
0
 def getProjectList(self):
     userId = self.get_secure_cookie("userId")
     id = userId
     data = UserService().getUserInfoById(id).getMessage()[0]
     logger.info(data)
     if data["isleader"] == 0:
         dataResult = ProjectService().getProjectList(userId)
     else:
         dataResult = ProjectService().getProjectListLeader()
     return dataResult
 def getCount(self):
     args = {}
     args["createUser"] = UserService().getUserCount().getMessage(
     )[0]["userCount"]
     args["project"] = ProjectService().getProjectCount().getMessage(
     )[0]["projectCount"]
     args["application"] = ApplicationService().getApplicationCount(
     ).getMessage()[0]["applicationCount"]
     args["testCase"] = TestCaseService().getTestCaseCount().getMessage(
     )[0]["testCaseCount"]
     dataResult = DataResult()
     dataResult.setMessage(args)
     dataResult.setSuccess(True)
     logger.info(dataResult)
     return dataResult
Esempio n. 7
0
 def get_user_info_by_user_id(self):
     userId = self.get_argument('userId')
     return UserService().getUserInfoById(userId)
Esempio n. 8
0
 def delete_user_info(self):
     return UserService().deleteUser(json.loads(self.request.body))
Esempio n. 9
0
 def get_user_info_by_user_name(self):
     userName = self.get_argument('userName')
     return UserService().getUserInfo(userName)
Esempio n. 10
0
 def deleteUserInfoByName(self):
     return UserService().deleteUserInfoByName(json.loads(self.request.body))
Esempio n. 11
0
 def getUserInfo(self):
     logger.error(self.request.body)
     userName = self.get_argument('userName')
     return UserService().getUserInfo(userName)
Esempio n. 12
0
 def getCurrentUserIsleader(self):
     useId = self.get_secure_cookie("userId")
     logger.info(useId)
     return UserService().getCurrentUserIsleader(useId)
Esempio n. 13
0
 def getUserByUnionid(self):
     unionid = self.get_argument('unionid')
     logger.info(unionid)
     return UserService().getUserByUnionid(unionid)
Esempio n. 14
0
 def getUserList(self):
     logger.error(self.request.body)
     return UserService().getUserList()