def get_login_model(self, user): retdata = [] user_model = Usermodel.get_user_detail_from_user(user) # 用户模型 photo_list = [] # 摄影师发布的约拍 model_list = [] try: photo_list_all = self.db.query(Appointment).filter(Appointment.APtype == 1, Appointment.APvalid == 1). \ order_by(desc(Appointment.APcreateT)).limit(6).all() model_list_all = self.db.query(Appointment).filter(Appointment.APtype == 0, Appointment.APvalid == 1). \ order_by(desc(Appointment.APcreateT)).limit(6).all() from Appointment.APmodel import APmodelHandler ap_model_handler = APmodelHandler() # 创建对象 ap_model_handler.ap_Model_simply(photo_list_all, photo_list, user.Uid) ap_model_handler.ap_Model_simply(model_list_all, model_list, user.Uid) # 约拍类型和id data = dict( userModel=user_model, daohanglan=self.bannerinit(), photoList=photo_list, modelList=model_list, groupList=APgroupHandler.Group(), ) retdata.append(data) self.retjson['code'] = '10111' self.retjson['contents'] = retdata except Exception, e: print e self.retjson['contents'] = r"摄影师约拍列表导入失败!"
def get_new_login_model(self, user): models = [] retdata = [] imghandler = UserImgHandler() user_model = Usermodel.get_user_detail_from_user(user) # 用户模型 try: my_likes = self.db.query(UserLike).filter( UserLike.ULlikeid == user.Uid, UserLike.ULvalid == 1).all() for like in my_likes: pic = self.db.query(UserCollection).filter( UserCollection.UCuser == like.ULlikedid, UserCollection.UCvalid == 1).all() for item in pic: retdata.append( imghandler.UC_login_model(item, item.UCuser, user.Uid)) # 推荐作品集 # 约拍类型和id data = dict( userModel=user_model, daohanglan=self.bannerinit(), CollectionList=retdata, # 好友作品集 RecList=[], # 推荐作品集 groupList=APgroupHandler.Group(), ) models.append(data) self.retjson['code'] = '10111' self.retjson['contents'] = models except Exception, e: print e self.retjson['contents'] = r"摄影师约拍列表导入失败!"
Appointment.APid == ap_id, Appointment.APtitle == ap_title).one() print '判断授权是否存在' if exist: ap_sponsorid = exist.APsponsorid if uid == ap_sponsorid: print '授权存在' self.db.query(Appointment).filter(Appointment.APid == ap_id). \ update({Appointment.APstartT: ap_start_time, Appointment.APendT: ap_end_time, Appointment.APjoinT: ap_join_time, Appointment.APlocation: ap_location, Appointment.APfree: ap_free, Appointment.APcontent: ap_content, Appointment.APaddallowed: ap_addallowed, Appointment.APtype: ap_type, Appointment.APvalid: 1, Appointment.APgroup: APgroupHandler.GetGroupNum(ap_group), }, synchronize_session=False) imghandler = ImageHandler() try: imghandler.insert_appointment_image( ap_imgs_json, ap_id) except Exception, e: print e, '网络故障' self.retjson['contents'] = u'网络故障' self.db.commit() self.retjson['code'] = '10214' self.retjson['contents'] = '发布约拍成功' else: print 'fd' except Exception, e: print e