Example #1
0
 def set_user_member(self, organization_id, user_id, excuse):
     info = self.find_data(['type'],
                           organization_id=organization_id,
                           user_id=user_id,
                           get_some=False)
     if not info:  #如果没有该条数据
         info = {}
         info['type'] = 0
         self.insert_into_db({
             "organization_id":
             organization_id,
             "user_id":
             user_id,
             "type":
             self.is_ord_memeber,
             "msg":
             excuse,
             "change_date":
             PublicFunc.get_current_datetime()
         })
         return
     new_type = info['type'] | self.is_ord_memeber
     return self.update_db({'type': new_type},
                           organization_id=organization_id,
                           user_id=user_id,
                           msg=excuse,
                           change_date=PublicFunc.get_current_datetime())
Example #2
0
    def set_user_apply(self, organization_id, user_id, excuse):
        """
		设置用户为申请状态
		"""
        info = self.find_data(['type'],
                              organization_id=organization_id,
                              user_id=user_id,
                              get_some=False)
        if not info:  #如果没有该条数据
            info = {}
            info['type'] = 0
            self.insert_into_db({
                "organization_id":
                organization_id,
                "user_id":
                user_id,
                "type":
                self.is_applying,
                "msg":
                excuse,
                "change_date":
                PublicFunc.get_current_datetime()
            })
            return
        new_type = info['type'] | self.is_applying
        return self.update_db({'type': new_type},
                              organization_id=organization_id,
                              user_id=user_id)
Example #3
0
	def get_act_status(self,regis_start_time,regis_end_time,start_time,end_time):
		current_datatime = PublicFunc.get_current_datetime()
		if current_datatime < regis_start_time: return {'flag':0,'name':'预告'}
		if current_datatime < regis_end_time: return {'flag':1,'name':'报名中'}
		if current_datatime < start_time: return {'flag':2,'name':'马上开始'} 
		if current_datatime < end_time: return {'flag':3,'name':'进行中'}   
		else: return {'flag':4,'name':'已结束'} 
		return '结束' 
Example #4
0
	def add_pic(self,uid,album_id,file_name,org_id):
		# create_time = int(time.time())
		create_time = PublicFunc.get_current_datetime()
		type = self.org_pic
		web_path = options.ipnet + "/Uploads/AlbumPic/" + file_name
		self.insert_into_db({'user_id':uid,'create_time':create_time,'type':type,'type_id':org_id,'target_id':album_id,'file_path':'','web_path':web_path,
							'file_name':file_name,'file_path':self.file_path,'file_old_name':'','old_width':0,'old_height':0,'old_size':0,
							'msg':''})
		return 
Example #5
0
 def save_trace(self, uid, logitude, latitude):
     current_time = PublicFunc.get_current_stamp()
     current_date = PublicFunc.get_current_datetime()
     result = self.insert_into_db({
         'uid': uid,
         'logitude': logitude,
         'latitude': latitude,
         'timestamp': current_time,
         'date_time': current_date
     })
     return
Example #6
0
 def create_album(self, uid, org_id, album_name):
     data_dict = {
         'organization_id': org_id,
         'name': album_name,
         'create_time': PublicFunc.get_current_datetime(),
         'count': 0,
         'show_times': 0,
         'msg': '',
         'create_user': uid
     }
     va = self.insert_into_db(data_dict)
     return va
Example #7
0
 def attend_activity(self, activity_id, user_id, truename, tel, sex):
     create_time = PublicFunc.get_current_datetime()
     info_dict = {
         "activity_id": activity_id,
         "user_id": user_id,
         "true_name": truename,
         "tel": tel,
         "sex": sex,
         "create_time": create_time
     }
     self.insert_into_db(info_dict)
     return True
Example #8
0
 def add_pic(self, uid, album_id, file_name, org_id):
     # create_time = int(time.time())
     create_time = PublicFunc.get_current_datetime()
     type = self.org_pic
     web_path = options.ipnet + "/Uploads/AlbumPic/" + file_name
     self.insert_into_db({
         'user_id': uid,
         'create_time': create_time,
         'type': type,
         'type_id': org_id,
         'target_id': album_id,
         'file_path': '',
         'web_path': web_path,
         'file_name': file_name,
         'file_path': self.file_path,
         'file_old_name': '',
         'old_width': 0,
         'old_height': 0,
         'old_size': 0,
         'msg': ''
     })
     return
Example #9
0
    def judge_has_focus(self, organization_id, user_id):
        """
		return True if has focus else False 
		"""
        info = self.find_data(['type'],
                              organization_id=organization_id,
                              user_id=user_id,
                              get_some=False)
        if not info:
            self.insert_into_db({
                'user_id':
                user_id,
                'organization_id':
                organization_id,
                'msg':
                '',
                'type':
                0,
                'change_date':
                PublicFunc.get_current_datetime()
            })
            return False
        return True if int(info['type']) & (self.has_focus + self.is_admin +
                                            self.is_ord_memeber) else False
Example #10
0
	def set_user_member(self,organization_id,user_id,excuse):
		info = self.find_data(['type'],organization_id=organization_id,user_id=user_id,get_some=False)
		if not info:#如果没有该条数据
			info = {}
			info['type'] = 0
			self.insert_into_db({"organization_id":organization_id,"user_id":user_id,"type":self.is_ord_memeber,"msg":excuse,"change_date":PublicFunc.get_current_datetime()})
			return
		new_type = info['type'] | self.is_ord_memeber
		return self.update_db({'type':new_type},organization_id=organization_id,user_id=user_id,msg=excuse,change_date=PublicFunc.get_current_datetime())
Example #11
0
	def judge_has_focus(self,organization_id,user_id):
		"""
		return True if has focus else False 
		"""
		info = self.find_data(['type'],organization_id=organization_id,user_id=user_id,get_some=False)
		if not info:
			self.insert_into_db({'user_id':user_id,'organization_id':organization_id,'msg':'','type':0,'change_date':PublicFunc.get_current_datetime()}) 
			return False
		return True if int(info['type']) &  (self.has_focus + self.is_admin + self.is_ord_memeber) else False 
Example #12
0
	def set_user_apply(self,organization_id,user_id,excuse):
		"""
		设置用户为申请状态
		"""
		info = self.find_data(['type'],organization_id=organization_id,user_id=user_id,get_some=False)
		if not info:#如果没有该条数据
			info = {}
			info['type'] = 0
			self.insert_into_db({"organization_id":organization_id,"user_id":user_id,"type":self.is_applying,"msg":excuse,"change_date":PublicFunc.get_current_datetime()})
			return
		new_type = info['type'] | self.is_applying
		return self.update_db({'type':new_type},organization_id=organization_id,user_id=user_id)
Example #13
0
	def get_act_info(self,uid,activity_id):
		"""
		attend_status_name  状态名称
attend_status 状态id

attend_status  attend_status_name 
   0		 已经报名
   1		 报名未开始
   2         	 报名 
   3 		 报名结束
   4             参与中
   5             进行中
   6             已结束

		"""
		act_info = ActivityInfoModel().get_act_info(activity_id)
		# 'co_organizer','organizer','supporting_agency','crowner_crowner'
		act_info['co_organizer'] = act_info['co_organizer'].split('||') if act_info['co_organizer'] else [] 
		act_info['organizer'] = act_info['organizer'].split("||") if act_info['organizer'] else []
		act_info['sponsor_sponsor'] =  act_info['sponsor_sponsor'].split("||") if act_info['sponsor_sponsor'] else []
		act_info['supporting_agency'] = act_info['supporting_agency'].split("||") if act_info['supporting_agency'] else []
		act_info['crowner_crowner'] = act_info['crowner_crowner'].split("||") if act_info['crowner_crowner'] else [] 
		act_info['time_scope'] = act_info['start_time'] + "至" + act_info['end_time']
		act_info_status = self.get_act_status(act_info['regis_start_time'],act_info['regis_end_time'],act_info['start_time'],act_info['end_time'])
		act_info['activity_status'] = act_info_status['name']
		act_info['activity_status_id'] = act_info_status['flag']
		act_info['regist_avail'] = act_info['regis_max'] - act_info['regist_member'] 
		attend_status = 0 #init status id 
		attend_status_name = ''#init status name 
		user_has_attend = int(ActivitySignUpModel().judge_have_attend(uid,activity_id))
		current_datatime = PublicFunc.get_current_datetime()
		if current_datatime < act_info['regis_start_time']:
			attend_status = 1
			attend_status_name = '报名未开始'
		elif current_datatime < act_info['regis_end_time']:
			if user_has_attend:
				attend_status = 0 
				attend_status_name = '已报名'
			else:
				attend_status = 2
				attend_status_name = '报名'
		elif current_datatime < act_info['start_time']:
			if user_has_attend:
				attend_status = 0
				attend_status_name = '已报名'
			else:
				attend_status = 3 
				attend_status_name = '报名结束'
		elif current_datatime < act_info['end_time']:
			if user_has_attend:
				attend_status = 4
				attend_status_name = '参与中' 
			else:
				attend_status = 5
				attend_status_name = '进行中'
		elif current_datatime > act_info['end_time']:
			attend_status = 6
			attend_status_name = '已结束' 
		act_info['attend_status'] = attend_status
		act_info['attend_status_name'] = attend_status_name
		##if the man has agree the activity???
		act_info['have_zan'] = 1 if '|' + str(uid) + "|" in act_info['like_list'] else 0
		return act_info
Example #14
0
 def save_trace(self,uid,logitude,latitude):
     current_time = PublicFunc.get_current_stamp()
     current_date = PublicFunc.get_current_datetime()
     result = self.insert_into_db({'uid':uid,'logitude':logitude,'latitude':latitude,'timestamp':current_time,'date_time':current_date})
     return 
Example #15
0
	def create_album(self,uid,org_id,album_name):
		data_dict = {'organization_id':org_id,'name':album_name,'create_time':PublicFunc.get_current_datetime(),'count':0,'show_times':0,'msg':'','create_user':uid}
		va = self.insert_into_db(data_dict)
		return va