def updateuserstate(request): result = {} user_receive = User() if request.method == "POST": userid = request.POST.get("userid", None) # 读取get数据,None为默认值 qunid = request.POST.get("qunid", None) # 读取get数据,None为默认值 userstate = request.POST.get("userstate", None) # 读取get数据,None为默认值 if request.method == "GET": userid = request.GET.get("userid", None) # 读取get数据,None为默认值 qunid = request.GET.get("qunid", None) # 读取get数据,None为默认值 userstate = request.GET.get("userstate", None) # 读取get数据,None为默认值 print("修改用户在群组中的状态接口参数:用户id" + userid +"用户状态" + userstate) user_receive = UserDAO.getUserInfoId(userid) user_receive.state(userstate) UserDAO.updateUserInfo(user_receive) qun = QunDAO.getqunInfoqunid(qunid) userqun=Userqun() userqun.userid=userid userqun.qunid=qunid userqun = UserqunDAO.getuserqunInfouserqun(userqun) if(not userqun or not qun): result["data"]="" result["respcode"]= ResultCode.FAIL result["errorcode"]=ResultCode.FAIL result["message"]= "修改失败not " return result userqun.userstate=userstate UserqunDAO.updateuserqun(userqun) #如果升级为群主 if(userstate==ResultCode.USERQUN_QUNZHU): #查找原群主关系组 userqun.userid=qun.userid userqun.qunid=qunid userqun = UserqunDAO.getuserqunInfouserqun(userqun) userqun.userstate=ResultCode.USERQUN_FUZHU UserqunDAO.updateuserqun(userqun) #修改群信息 qun.userid=userid QunDAO.updatequnInfoqun(qun) result["data"]= "" result["respcode"]= ResultCode.SUCCESS result["errorcode"]= "" result["message"]= "修改成功not " return result
def updateuserinf(request): result = {} user = User() if request.method == "POST": userid = request.POST.get("userid", None) # 读取post数据,None为默认值 phone = request.POST.get("phone", None) # 读取post数据,None为默认值 qunidstr = request.POST.get("qunid", None) # 读取get数据,None为默认值 password = request.POST.get("password", None) # 读取post数据,None为默认值 name = request.POST.get("name", None) # 读取post数据,None为默认值 identity = request.POST.get("identity", None) # 读取post数据,None为默认值 email = request.POST.get("email", None) # 读取post数据,None为默认值 address = request.POST.get("address", None) # 读取post数据,None为默认值 id_number = request.POST.get("id_number", None) # 读取get数据,None为默认值 push_userId = request.POST.get("push_userId", None) # 读取get数据,None为默认值 push_channelId = request.POST.get("push_channelId", None) # 读取get数据,None为默认值 school = request.POST.get("school", None) # 读取post数据,None为默认值 usertype = request.POST.get("usertype", 0) # 读取post数据,None为默认值 usericon = request.POST.get("usericon", None) # 读取get数据,None为默认值 wechat = request.POST.get("wechat", None) # 读取get数据,None为默认值 alipay = request.POST.get("alipay", None) # 读取get数据,None为默认值 parameter1 = request.POST.get("parameter1", None) # 读取get数据,None为默认值 parameter2 = request.POST.get("parameter2", None) # 读取get数据,None为默认值 parameter3 = request.POST.get("parameter3", None) # 读取get数据,None为默认值 parameter4 = request.POST.get("parameter4", None) # 读取get数据,None为默认值 parameter5 = request.POST.get("parameter5", None) # 读取get数据,None为默认值 parameter6 = request.POST.get("parameter6", None) # 读取get数据,None为默认值 parameter7 = request.POST.get("parameter7", None) # 读取get数据,None为默认值 parameter8 = request.POST.get("parameter8", None) # 读取get数据,None为默认值 parameter9 = request.POST.get("parameter9", None) # 读取get数据,None为默认值 parameter10 = request.POST.get("parameter10", None) # 读取get数据,None为默认值 parameter11 = request.POST.get("parameter11", None) # 读取get数据,None为默认值 parameter12 = request.POST.get("parameter12", None) # 读取get数据,None为默认值 parameter13 = request.POST.get("parameter13", None) # 读取get数据,None为默认值 parameter14 = request.POST.get("parameter14", None) # 读取get数据,None为默认值 parameter15 = request.POST.get("parameter15", None) # 读取get数据,None为默认值 parameter16 = request.POST.get("parameter16", None) # 读取get数据,None为默认值 parameter17 = request.POST.get("parameter17", None) # 读取get数据,None为默认值 parameter18 = request.POST.get("parameter18", None) # 读取get数据,None为默认值 parameter19 = request.POST.get("parameter19", None) # 读取get数据,None为默认值 parameter20 = request.POST.get("parameter20", None) # 读取get数据,None为默认值 if request.method == "GET": userid = request.GET.get("userid", None) # 读取get数据,None为默认值 phone = request.GET.get("phone", None) # 读取get数据,None为默认值 qunidstr = request.GET.get("qunid", None) # 读取get数据,None为默认值 password = request.GET.get("password", None) # 读取get数据,None为默认值 name = request.GET.get("name", None) # 读取get数据,None为默认值 identity = request.GET.get("identity", None) # 读取get数据,None为默认值 email = request.GET.get("email", None) # 读取get数据,None为默认值 address = request.GET.get("address", None) # 读取get数据,None为默认值 id_number = request.GET.get("id_number", None) # 读取get数据,None为默认值 push_userId = request.GET.get("push_userId", None) # 读取get数据,None为默认值 push_channelId = request.GET.get("push_channelId", None) # 读取get数据,None为默认值 school = request.GET.get("school", None) # 读取get数据,None为默认值 usertype = request.GET.get("usertype", 0) # 读取post数据,None为默认值 usericon = request.GET.get("usericon", None) # 读取get数据,None为默认值 wechat = request.GET.get("wechat", None) # 读取get数据,None为默认值 alipay = request.GET.get("alipay", None) # 读取get数据,None为默认值 parameter1 = request.GET.get("parameter1", None) # 读取get数据,None为默认值 parameter2 = request.GET.get("parameter2", None) # 读取get数据,None为默认值 parameter3 = request.GET.get("parameter3", None) # 读取get数据,None为默认值 parameter4 = request.GET.get("parameter4", None) # 读取get数据,None为默认值 parameter5 = request.GET.get("parameter5", None) # 读取get数据,None为默认值 parameter6 = request.GET.get("parameter6", None) # 读取get数据,None为默认值 parameter7 = request.GET.get("parameter7", None) # 读取get数据,None为默认值 parameter8 = request.GET.get("parameter8", None) # 读取get数据,None为默认值 parameter9 = request.GET.get("parameter9", None) # 读取get数据,None为默认值 parameter10 = request.GET.get("parameter10", None) # 读取get数据,None为默认值 parameter11 = request.GET.get("parameter11", None) # 读取get数据,None为默认值 parameter12 = request.GET.get("parameter12", None) # 读取get数据,None为默认值 parameter13 = request.GET.get("parameter13", None) # 读取get数据,None为默认值 parameter14 = request.GET.get("parameter14", None) # 读取get数据,None为默认值 parameter15 = request.GET.get("parameter15", None) # 读取get数据,None为默认值 parameter16 = request.GET.get("parameter16", None) # 读取get数据,None为默认值 parameter17 = request.GET.get("parameter17", None) # 读取get数据,None为默认值 parameter18 = request.GET.get("parameter18", None) # 读取get数据,None为默认值 parameter19 = request.GET.get("parameter19", None) # 读取get数据,None为默认值 parameter20 = request.GET.get("parameter20", None) # 读取get数据,None为默认值 print("更新资料接口参数:" + "昵称:" + name + "手机号" + phone + "邮箱:" + email + "身份账号" + id_number + "地址:" + address) user = UserDAO.getUserInfoId(userid) if(not user): result["message"]= "修改用户资料失败" result["respcode"]= ResultCode.FAIL result["data"]="0" result["errorcode"]= ResultCode.FAIL return result user.id = userid if(name): user.name=name if(qunidstr): user.qunid=int(qunidstr) if(phone): user.phone=phone if(email): user.email=email if(id_number): user.id_number=id_number if(address): user.address=address if(school): user.school=school if(wechat): user.wechat=wechat if(alipay): user.alipay=alipay if(usericon): user.image=usericon if(push_userId): user.push_userId=push_userId if(push_channelId): user.push_channelId=push_channelId if(parameter1): user.parameter1=parameter1 if(parameter2): user.parameter2=parameter2 if(parameter3): user.parameter3=parameter3 if(parameter4): user.parameter4=parameter4 if(parameter5): user.parameter5=parameter5 if(parameter6): user.parameter6=parameter6 if(parameter7): user.parameter7=parameter7 if(parameter8): user.parameter8=parameter8 if(parameter9): user.parameter9=parameter9 if(parameter10): user.parameter10=parameter10 if(parameter11): user.parameter11=parameter11 if(parameter12): user.parameter12=parameter12 if(parameter13): user.parameter13=parameter13 if(parameter14): user.parameter14=parameter14 if(parameter15): user.parameter15=parameter15 if(parameter16): user.parameter16=parameter16 if(parameter17): user.parameter17=parameter17 if(parameter18): user.parameter18=parameter18 if(parameter19): user.parameter19=parameter19 if(parameter20): user.parameter20=parameter20 #升级为高级会员的条件,能创建群组 if(id_number): pass #user.setState(ResultCode.USER_VIP) try: #先修该用户资料 UserDAO.updateUserInfo(user) #根据用户id查询用户信息 users_back = UserDAO.getUserInfoId(user.id) #将返回信息转变为本文信息类 loginResult = user2meBack(users_back) result["data"]= loginResult result["respcode"]= ResultCode.SUCCESS result["errorcode"]= "" result["message"]= "修改用户资料成功" except Exception as e: print(e) result["message"]= "修改用户资料失败" result["respcode"]= ResultCode.FAIL result["data"]= "0" result["errorcode"]= ResultCode.FAIL return result
def userLogin(request): result = {} user = User() if request.method == "POST": phone = request.POST.get("phone", None) # 读取get数据,None为默认值 password = request.POST.get("password", None) # 读取get数据,None为默认值 identity = request.POST.get("identity", None) # 读取get数据,None为默认值 school = request.POST.get("school", None) # 读取get数据,None为默认值 qunidstr = request.POST.get("qunid", None) # 读取get数据,None为默认值 if request.method == "GET": phone = request.GET.get("phone", None) # 读取get数据,None为默认值 password = request.GET.get("password", None) # 读取get数据,None为默认值 identity = request.GET.get("identity", None) # 读取get数据,None为默认值 school = request.GET.get("school", None) # 读取get数据,None为默认值 qunidstr = request.GET.get("qunid", None) # 读取get数据,None为默认值 print("用户登录接口参数:电话" + phone + "密码" + password) user.phone=phone user.password=password user = UserDAO.userLogin(user) if (user): if(identity): user.identity=identity if(school): user.school=school UserDAO.updateUserInfo(user) #如果登陆时需要加入群组,这里加入群组 if(qunidstr): try: qunid = int(qunidstr) qun=QunDAO.getqunInfoqunid(qunid) userqun = Userqun() userqun.userid=user.id userqun.qunid=qunid userquntemp = UserqunDAO.getuserqunInfouserqun(userqun) if(not userquntemp): if(qun.quntype==ResultCode.QUN_USER or qun.quntype==ResultCode.QUN_USER_DIARY or qun.quntype==ResultCode.QUN_USER_DIARY_NOT_USER): userqun.userstate(ResultCode.USERQUN_NOT) else: userqun.userstate(ResultCode.USERQUN_YUAN) UserqunDAO.adduserqun(userqun) #添加群聊关系 chatuser =Chatuser() chatuser.send_id=qunid chatuser.receive_id=user.id chatuser.usertype=ResultCode.CHATUSER_TYPE_QUN chatuser.state=ResultCode.CHATUSER_HIDE chatuser.abid=str(qunid) chatuser.content="" chatuser.time=TimeUtil.getCurrentTime() chatuser.date=TimeUtil.getCurrentDate() ChatuserDAO.addchatuser(chatuser) except Exception as e: print(e) user_me_back = user2meBack(user) appBean=AppVersionDAO.queryVersionById(1) result["data"]= user_me_back result["respcode"]= ResultCode.SUCCESS result["errorcode"]= "" result["message"]=appBean #将版本信息一并返回 else: result["data"]="" result["respcode"]= ResultCode.FAIL result["errorcode"]=ResultCode.FAIL result["message"]="账号或密码错误" return result
def adddeal(request): result = {} if request.method == "POST": deal = request.POST.get("deal", None) # 读取post数据,None为默认值 userid_source = request.POST.get("userid_source", 0) # 读取post数据,None为默认值 diaryid_source = request.POST.get("diaryid_source", 0) # 读取post数据,None为默认值 qunid_source = request.POST.get("qunid_source", 0) # 读取post数据,None为默认值 userid_destination = request.POST.get("userid_destination", 0) # 读取post数据,None为默认值 diaryid_destination = request.POST.get("diaryid_destination", 0) # 读取post数据,None为默认值 qunid_destination = request.POST.get("qunid_destination", 0) # 读取post数据,None为默认值 if request.method == "GET": deal = request.GET.get("deal", None) # 读取get数据,None为默认值 userid_source = request.GET.get("userid_source", 0) # 读取get数据,None为默认值 diaryid_source = request.GET.get("diaryid_source", 0) # 读取get数据,None为默认值 qunid_source = request.GET.get("qunid_source", 0) # 读取get数据,None为默认值 userid_destination = request.GET.get("userid_destination", 0) # 读取get数据,None为默认值 diaryid_destination = request.GET.get("diaryid_destination", 0) # 读取get数据,None为默认值 qunid_destination = request.GET.get("qunid_destination", 0) # 读取get数据,None为默认值 print("添加更多操作接口参数:操作类型" + deal + "源用户id" + userid_source + "源日志id:" + diaryid_source + "目的用户id:" + userid_destination + "目的日志id:" + diaryid_destination + "源群id:" + qunid_source + "目的群id:" + qunid_destination) if (userid_source == userid_destination): result["data"] = "" result["respcode"] = ResultCode.FAIL result["errorcode"] = ResultCode.FAIL result["message"] = "添加处理失败" return result more = More() more.deal = deal more.userid_source = userid_source more.userid_destination = userid_destination more.diaryid_source = diaryid_source more.diaryid_destination = diaryid_destination more.qunid_source = qunid_source more.qunid_destination = qunid_destination more1 = MoreDAO.selectmoreInfomore(more) if (more1): result["data"] = more1 result["respcode"] = ResultCode.SUCCESS result["errorcode"] = ResultCode.SUCCESS result["message"] = "添加处理成功" else: try: MoreDAO.adddeal(more) more = MoreDAO.selectmoreInfomore(more) result["data"] = more result["respcode"] = ResultCode.SUCCESS result["errorcode"] = ResultCode.SUCCESS result["message"] = "添加处理成功" #如果是日志点赞则添加到日志属性中去 if (diaryid_destination != 0): diary = DiaryDAO.selectDiary(diaryid_destination) if (diary): if (deal == ResultCode.DIARY_ZAN): diary.zannum = diary.zannum + 1 DiaryDAO.updatediary(diary) elif (deal == ResultCode.DIARY_SHOUCANG): diary.shoucangnum = diary.shoucangnum + 1 DiaryDAO.updatediary(diary) elif (deal == ResultCode.DIARY_TUIJIAN): diary.tuijiannum = diary.tuijiannum + 1 DiaryDAO.updatediary(diary) #如果是群组点赞 则添加到群属性中 elif (qunid_destination != 0): qun = QunDAO.getqunInfoqunid(qunid_destination) if (qun): if (deal == ResultCode.QUN_ZAN): qun.zannum = qun.zannum + 1 QunDAO.updatequnInfoqun(qun) elif (deal == ResultCode.QUN_SHOUCANG): qun.shoucangnum = qun.shoucangnum + 1 QunDAO.updatequnInfoqun(qun) elif (deal == ResultCode.QUN_TUIJIAN): qun.tuijiannum = qun.tuijiannum + 1 QunDAO.updatequnInfoqun(qun) #如果是用户点赞 则添加到用户属性中 elif (userid_destination != 0): user = UserDAO.getUserInfoId(userid_destination) if (user): if (deal == ResultCode.USER_ZAN): user.zannum = user.zannum + 1 UserDAO.updateUserInfo(user) if (deal == ResultCode.USER_SHOUCANG): user.shoucangnum = user.shoucangnum + 1 UserDAO.updateUserInfo(user) if (deal == ResultCode.USER_TUIJIAN): user.tuijiannum = user.tuijiannum + 1 UserDAO.updateUserInfo(user) except Exception as e: result["data"] = "" result["respcode"] = ResultCode.FAIL result["errorcode"] = ResultCode.FAIL result["message"] = "添加处理失败" return result
def deldealinfomore(request): result = {} if request.method == "POST": deal = request.POST.get("deal", 0) # 读取post数据,None为默认值 userid_source = request.POST.get("userid_source", 0) # 读取post数据,None为默认值 diaryid_source = request.POST.get("diaryid_source", 0) # 读取post数据,None为默认值 qunid_source = request.POST.get("qunid_source", 0) # 读取post数据,None为默认值 userid_destination = request.POST.get("userid_destination", 0) # 读取post数据,None为默认值 diaryid_destination = request.POST.get("diaryid_destination", 0) # 读取post数据,None为默认值 qunid_destination = request.POST.get("qunid_destination", 0) # 读取post数据,None为默认值 if request.method == "GET": deal = request.GET.get("deal", 0) # 读取get数据,None为默认值 userid_source = request.GET.get("userid_source", 0) # 读取get数据,None为默认值 diaryid_source = request.GET.get("diaryid_source", 0) # 读取get数据,None为默认值 qunid_source = request.GET.get("qunid_source", 0) # 读取get数据,None为默认值 userid_destination = request.GET.get("userid_destination", 0) # 读取get数据,None为默认值 diaryid_destination = request.GET.get("diaryid_destination", 0) # 读取get数据,None为默认值 qunid_destination = request.GET.get("qunid_destination", 0) # 读取get数据,None为默认值 print("删除更多操作接口参数:deal" + deal) more = More() more.deal = deal more.userid_source = userid_source more.userid_destination = userid_destination more.diaryid_source = diaryid_source more.diaryid_destination = diaryid_destination more.qunid_source = qunid_source more.qunid_destination = qunid_destination more = MoreDAO.selectmoreInfomore(more) if (more): MoreDAO.deldealInfoid(more.id) result["data"] = "" result["respcode"] = ResultCode.SUCCESS result["errorcode"] = ResultCode.SUCCESS result["message"] = "删除处理成功" #如果是日志点赞则添加到日志属性中去 if (more.diaryid_destination): diary = DiaryDAO.selectDiary(more.diaryid_destination) if (diary): if (more.deal == ResultCode.DIARY_ZAN): diary.zannum = diary.zannum - 1 DiaryDAO.updatediary(diary) elif (more.deal == ResultCode.DIARY_SHOUCANG): diary.shoucangnum = diary.shoucangnum - 1 DiaryDAO.updatediary(diary) elif (more.deal == ResultCode.DIARY_TUIJIAN): diary.tuijiannum = diary.tuijiannum - 1 DiaryDAO.updatediary(diary) #如果是群组点赞 则添加到群属性中 elif (more.qunid_destination()): qun = QunDAO.getqunInfoqunid(more.qunid_destination) if (qun): if (more.deal == ResultCode.QUN_ZAN): qun.zannum = qun.zannum - 1 QunDAO.updatequnInfoqun(qun) elif (more.deal == ResultCode.QUN_SHOUCANG): qun.shoucangnum = qun.shoucangnum - 1 QunDAO.updatequnInfoqun(qun) elif (more.deal == ResultCode.QUN_TUIJIAN): qun.tuijiannum = qun.tuijiannum - 1 QunDAO.updatequnInfoqun(qun) #如果是用户点赞 则添加到用户属性中 elif (more.userid_destination): user = UserDAO.getUserInfoId(more.userid_destination) if (user): if (more.deal == ResultCode.USER_ZAN): user.zannum = user.zannum - 1 UserDAO.updateUserInfo(user) if (more.deal == ResultCode.USER_SHOUCANG): user.shoucangnum = user.shoucangnum - 1 UserDAO.updateUserInfo(user) if (more.deal == ResultCode.USER_TUIJIAN): user.tuijiannum = user.tuijiannum - 1 UserDAO.updateUserInfo(user) return result
def deldeal(request): result = {} if request.method == "POST": id = request.POST.get("id", None) # 读取post数据,None为默认值 if request.method == "GET": id = request.GET.get("id", None) # 读取get数据,None为默认值 print("删除更多操作接口参数:操作id" + id) more = MoreDAO.selectdealInfoid(id) try: MoreDAO.deldealInfoid(id) result["data"] = "" result["respcode"] = ResultCode.SUCCESS result["errorcode"] = ResultCode.SUCCESS result["message"] = "删除处理成功" #如果是日志点赞则添加到日志属性中去 if (more.diaryid_destination): diary = DiaryDAO.selectDiary(more.diaryid_destination) if (diary): if (more.deal == ResultCode.DIARY_ZAN): diary.zannum = diary.zannum - 1 DiaryDAO.updatediary(diary) elif (more.deal == ResultCode.DIARY_SHOUCANG): diary.shoucangnum = diary.shoucangnum - 1 DiaryDAO.updatediary(diary) elif (more.deal == ResultCode.DIARY_TUIJIAN): diary.tuijiannum = diary.tuijiannum - 1 DiaryDAO.updatediary(diary) #如果是群组点赞 则添加到群属性中 elif (more.qunid_destination): qun = QunDAO.getqunInfoqunid(more.qunid_destination) if (qun): if (more.deal == ResultCode.QUN_ZAN): qun.zannum = qun.zannum - 1 QunDAO.updatequnInfoqun(qun) elif (more.deal == ResultCode.QUN_SHOUCANG): qun.shoucangnum = qun.shoucangnum - 1 QunDAO.updatequnInfoqun(qun) elif (more.deal == ResultCode.QUN_TUIJIAN): qun.tuijiannum = qun.tuijiannum - 1 QunDAO.updatequnInfoqun(qun) #如果是用户点赞 则添加到用户属性中 elif (more.userid_destination): user = UserDAO.getUserInfoId(more.userid_destination) if (user): if (more.deal == ResultCode.USER_ZAN): user.zannum = user.zannum - 1 UserDAO.updateUserInfo(user) if (more.deal == ResultCode.USER_SHOUCANG): user.shoucangnum = user.shoucangnum - 1 UserDAO.updateUserInfo(user) if (more.deal == ResultCode.USER_TUIJIAN): user.tuijiannum = user.tuijiannum - 1 UserDAO.updateUserInfo(user) except Exception as e: result["data"] = "" result["respcode"] = ResultCode.FAIL result["errorcode"] = ResultCode.FAIL result["message"] = "删除处理成功" return result