Beispiel #1
0
 def post(self, *args, **kwargs):
     post_data={}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     if(Dal_user().selectUserByNP(post_data['name'],post_data['password'])==True):
         respon={'errorCode':userRegister_error['userExist']}
     else:
         nowtime=Utils().dbTimeCreate()
         newUser = User(id=None, name=post_data['name'], password=post_data['password'],tel=post_data['tel'],registerTime=str(nowtime))
         id=Dal_user().addUser(newUser)
         if id == False:
             respon = {'errorCode': userRegister_error['failed']}
         else:
             respon = {'errorCode': userRegister_error['success'], 'id': id}
     respon_json=json.dumps(respon)
     self.write(respon_json)
Beispiel #2
0
def initCache():
    Dal_user().initCache()
    Dal_Company().initCache()
    Dal_Staff().initCache()
    Dal_Warehouse().initCache()
    Dal_Logistics().initCache()
    Dal_Batch().initCache()
    Dal_Manifest().initCache()
Beispiel #3
0
 def post(self, *args, **kwargs):
     post_data = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     user = Dal_user().selectAllUser(1 if (
         int(post_data["page"]) <= 0) else post_data["page"])
     respon = {'errorCode': selectUser_error['success'], 'user': user}
     respon_json = json.dumps(respon)
     self.write(respon_json)
Beispiel #4
0
 def post(self, *args, **kwargs):
     post_data = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     if (Dal_user().deleteUser(post_data['id']) == False):
         respon = {'errorCode': deleteUser_error['userInvaild']}
     else:
         respon = {'errorCode': deleteUser_error['success']}
     respon_json = json.dumps(respon)
     self.write(respon_json)
Beispiel #5
0
 def post(self, *args, **kwargs):
     post_data = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     user = Dal_user().selectUser(post_data["id"])
     if user == None:
         respon = {'errorCode': selectUser_error['userInvaild']}
     else:
         respon = {'errorCode': selectUser_error['success'], 'user': user}
     respon_json = json.dumps(respon)
     self.write(respon_json)
Beispiel #6
0
 def post(self, *args, **kwargs):
     post_data = {}
     new = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     if (Dal_user().selectUser(post_data['id']) == None):
         respon = {'errorCode': updateUser_error['userInvaild']}
     else:
         if post_data.has_key('name') != False and post_data['name'] != '':
             new['name'] = post_data['name']
         if post_data.has_key(
                 'password') != False and post_data['password'] != '':
             new['password'] = post_data['password']
         if post_data.has_key('tel') != False and post_data['tel'] != '':
             new['tel'] = post_data['tel']
         if (Dal_user().updateUser(post_data["id"], **new) == 1):
             respon = {'errorCode': updateUser_error['success']}
         else:
             respon = {'errorCode': updateUser_error['failed']}
     respon_json = json.dumps(respon)
     self.write(respon_json)
Beispiel #7
0
 def post(self, *args, **kwargs):
     post_data = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
         user = Dal_user().selectUser(post_data["id"])
     if (user == False):
         respon = {"errorCode": userLogin_error['userInvaild']}
     elif (user['password'] != post_data["password"]):
         respon = {"errorCode": userLogin_error['wrong_password']}
     else:
         respon = {"errorCode": userLogin_error['success']}
     ##ensure_ascii=False  解决json打包中文时出现乱码问题
     respon_json = json.dumps(respon, ensure_ascii=False)
     self.write(respon_json)