ds) if self.data_fields else [], 'main_activity_id': self.main_activity_id, 'limit_contribute_num': self.limit_contribute_num, 'is_series': self.is_series, 'feed_id': self.feed_id, } @property def admindetails(self): return { 'id': self.activity_id, 'activity_id': self.activity_id, 'activity_type': self.activity_type, 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type), 'activity_section': self.activity_section, 'activity_section_str': dict(MemberActivityInfo.ACTIVITY_SECTION).get(self.activity_section), 'title': self.title, 'subtitle': self.subtitle, 'date': tc.local_date_string(self.date), 'start_date': tc.local_date_string(self.start_date), 'end_date': tc.local_date_string(self.end_date), 'start_display_date': tc.local_date_string(self.start_display_date), 'end_display_date': tc.local_date_string(self.end_display_date), 'start_data_submit_date': tc.local_date_string(self.start_data_submit_date), 'end_data_submit_date': tc.local_date_string(self.end_data_submit_date), 'city': self.city, 'location': self.location, 'lat': self.lat, 'lon': self.lon, 'integral': self.integral, 'is_slider': self.is_slider, 'banner_path': self.slider_image_path, 'slider_image': self.slider_image_url, 'slider_image_path': self.slider_image_path, 'slider_image_url': self.slider_image_url, 'cover_path': self.cover_path, 'cover_url': self.cover_url, 'detail_image_path': self.image_path, 'detail_image_url': self.image_url, 'limit_image_num': self.limit_image_num, 'content_rich_text': self.final_content_rich_text, 'share_img_link': self.share_img_link, 'share_h5_link': self.share_h5_link, 'state': self.final_state, 'is_signup': self.is_signup, 'share_integral': self.group_share_integral, 'share_max_integral': self.group_share_max_integral, 'activity_state': self.activity_state, 'created_at': tc.local_string(utc_dt=self.created_at), 'poster_kv_img_url': self.final_poster_kv_img_url, 'poster_content': self.poster_content, 'contribution_content_placeholder': self.contribution_content_placeholder, 'welfares': self.welfares, 'fields': json.loads(self.fields) if self.fields else [], 'data_fields': json.loads(self.data_fields) if self.data_fields else [], 'main_activity_id': self.main_activity_id, 'limit_contribute_num': self.limit_contribute_num, 'is_series': self.is_series, 'feed_id': self.feed_id, } class MemberActivitySignupInfo(BaseModelMixin, BrandInfoMixin): UNAUDITED = 0 PASSED = 1 UNPASSED = 2 AUDIT_STATUS = ( (UNAUDITED, '未审核'), (PASSED, '已通过'), (UNPASSED, '未通过'), ) signup_id = ShortUUIDField(_(u'signup_id'), max_length=32, blank=True, null=True, help_text=u'活动报名唯一标识', db_index=True, unique=True) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') lensman_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True) avatar = models.CharField(_(u'avatar'), max_length=255, blank=True, null=True, help_text=u'头像') name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') fields = JSONField(_(u'fields'), blank=True, null=True, default='[]', help_text=u'自定义报名字段') audit_status = models.IntegerField(_(u'audit_status'), choices=AUDIT_STATUS, default=UNAUDITED, help_text=u'审核状态', db_index=True) is_signin = models.BooleanField(_(u'is_signin'), default=False, help_text=u'是否已签到') is_read = models.BooleanField(_(u'is_read'), default=False, help_text=u'报名消息是否已读') class Meta: verbose_name = _(u'会员活动报名信息') verbose_name_plural = _(u'会员活动报名信息') unique_together = ( ('user_id', 'activity_id'), ) def __unicode__(self): return '%d' % self.pk @property def final_avatar(self): return self.avatar and self.avatar.replace(settings.QINIU_FILE_URL_BEFORE, settings.QINIU_FILE_URL_AFTER).replace(settings.QINIU_FILE_URL_BEFORE2, settings.QINIU_FILE_URL_AFTER) @property def data(self): return { 'signup_id': self.signup_id, 'lensman_id': self.lensman_id, 'title': self.title, 'avatar': self.final_avatar, 'name': self.name, 'phone': self.phone, 'fields': json.loads(self.fields) if self.fields else [], 'audit_status': self.audit_status, } @property def admindata(self): return { 'signup_id': self.signup_id, 'user_id': self.user_id, 'lensman_id': self.lensman_id, 'activity_id': self.activity_id, 'title': self.title, 'avatar': self.final_avatar, 'name': self.name, 'phone': self.phone, 'fields': json.loads(self.fields) if self.fields else [], 'is_signin': self.is_signin, 'audit_status': self.audit_status, } class MemberActivityDataInfo(BaseModelMixin, BrandInfoMixin): data_id = ShortUUIDField(_(u'data_id'), max_length=32, blank=True, null=True, help_text=u'活动数据唯一标识', db_index=True, unique=True) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') lensman_id = models.CharField(_(u'lensman_id'), max_length=32, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True) lensman_name = models.CharField(_(u'lensman_name'), max_length=255, blank=True, null=True, help_text=u'摄影师姓名') lensman_phone = models.CharField(_(u'lensman_phone'), max_length=255, blank=True, null=True, help_text=u'摄影师手机号') data_fields = JSONField(_(u'data_fields'), blank=True, null=True, default='[]', help_text=u'自定义数据表单字段') class Meta: verbose_name = _(u'会员活动数据信息') verbose_name_plural = _(u'会员活动数据信息') unique_together = ( ('user_id', 'activity_id'), ) def __unicode__(self): return '%d' % self.pk @property def data(self): return { 'signup_id': self.data_id, 'lensman_id': self.lensman_id, 'title': self.title, 'data_fields': json.loads(self.data_fields) if self.data_fields else [], } @property def admindata(self): return { 'signup_id': self.data_id, 'user_id': self.user_id, 'lensman_id': self.lensman_id, 'activity_id': self.activity_id, 'title': self.title, 'lensman_name': self.lensman_name, 'lensman_phone': self.lensman_phone, 'data_fields': json.loads(self.data_fields) if self.data_fields else [], 'created_at': tc.local_string(utc_dt=self.created_at), } class MemberActivitySigninInfo(BaseModelMixin, BrandInfoMixin): signin_id = ShortUUIDField(_(u'signin_id'), max_length=32, blank=True, null=True, help_text=u'活动签到唯一标识', db_index=True, unique=True) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') class Meta: verbose_name = _(u'会员活动签到信息') verbose_name_plural = _(u'会员活动签到信息') unique_together = ( ('user_id', 'activity_id'), ) def __unicode__(self): return '%d' % self.pk class MemberActivityGroupShareInfo(BaseModelMixin, BrandInfoMixin): group_share_id = ShortUUIDField(_(u'group_share_id'), max_length=32, blank=True, null=True, help_text=u'活动群组分享唯一标识', db_index=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) share_user_id = models.CharField(_(u'share_user_id'), max_length=32, blank=True, null=True, help_text=u'分享用户唯一标识', db_index=True) click_user_id = models.CharField(_(u'click_user_id'), max_length=32, blank=True, null=True, help_text=u'点击用户唯一标识', db_index=True) open_gid = models.CharField(_(u'open_gid'), max_length=32, blank=True, null=True, help_text=u'群组唯一标识', db_index=True) title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') is_integral = models.BooleanField(_(u'is_integral'), default=False, help_text=u'是否有积分') integral = models.IntegerField(_(u'integral'), default=0, help_text=u'积分') class Meta: verbose_name = _(u'会员活动群组分享信息') verbose_name_plural = _(u'会员活动群组分享信息') unique_together = ( ('activity_id', 'share_user_id', 'click_user_id', 'brand_id'), ) def __unicode__(self): return '%d' % self.pk class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin): CONTENT_TYPE = ( (0, u'投稿'), (1, u'创作日记'), # (2, u'入围'), ) UNAUDITED = 0 PASSED = 1 UNPASSED = 2 AUDIT_STATUS = ( (UNAUDITED, '未审核'), (PASSED, '已通过'), (UNPASSED, '未通过'), ) contribution_id = ShortUUIDField(_(u'contribution_id'), max_length=32, blank=True, null=True, help_text=u'投稿唯一标识', db_index=True, unique=True) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) main_activity_id = models.CharField(_(u'main_activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) content_type = models.IntegerField(_(u'content_type'), choices=CONTENT_TYPE, default=0, help_text=u'内容类型', db_index=True) # 传参图片列表(默认第一张为封面图,包括图片url、宽、高)、标题、内容(纯文本)。 title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'标题') content = models.TextField(_(u'content'), blank=True, null=True, help_text=u'内容') user_name = models.CharField(_(u'user_name'), max_length=255, blank=True, null=True, help_text=u'用户名称') user_avatar = models.CharField(_(u'user_avatar'), max_length=255, blank=True, null=True, help_text=u'用户头像') # content_rich_text = RichTextField(_(u'content_rich_text'), blank=True, default='', help_text=u'内容') # [{ # 'image_url': '', # 'width': 100, # 'height': 100, # }] images = JSONField(_(u'images'), default=[], help_text=u'图片列表') video_url = models.CharField(_(u'video_url'), max_length=255, blank=True, null=True, help_text=u'视频链接') audit_status = models.IntegerField(_(u'audit_status'), choices=AUDIT_STATUS, default=0, help_text=u'审批状态', db_index=True) is_selected = models.BooleanField(_(u'is_selected'), default=False, help_text=u'是否入围') is_read = models.BooleanField(_(u'is_read'), default=False, help_text=u'审核消息是否已读') class Meta: verbose_name = _(u'会员活动投稿信息') verbose_name_plural = _(u'会员活动投稿信息') def __unicode__(self): return '%d' % self.pk @property def final_user_avatar(self): return self.user_avatar and self.user_avatar.replace(settings.QINIU_FILE_URL_BEFORE, settings.QINIU_FILE_URL_AFTER).replace(settings.QINIU_FILE_URL_BEFORE2, settings.QINIU_FILE_URL_AFTER) @property def final_images(self): if settings.QINIU_FILE_URL_HTTPS: return self.images return [dict(image, **{'image_url': image.get('image_url', '').replace(settings.QINIU_FILE_URL_BEFORE, settings.QINIU_FILE_URL_AFTER).replace(settings.QINIU_FILE_URL_BEFORE2, settings.QINIU_FILE_URL_AFTER)}) for image in self.images] @property def data(self): act = MemberActivityInfo.objects.get(activity_id=self.activity_id, status=True) return { 'contribution_id': self.contribution_id, 'brand_id': self.brand_id, 'brand_name': self.brand_name, 'user_id': self.user_id, 'activity_id': self.activity_id, 'main_activity_id': self.main_activity_id, 'activity_title': act.title, 'content_type': self.content_type, 'title': self.title, 'content': self.content, 'user_name': self.user_name, 'user_avatar': self.final_user_avatar, 'images': self.final_images, 'video_url': self.video_url or '', 'audit_status': self.audit_status, 'is_selected': self.is_selected, 'created_at': tc.local_string(utc_dt=self.created_at), } @property def admindata(self): unlock_welfares = MemberActivityContributionWelfareUnlockingInfo.objects.filter(activity_id=self.activity_id, user_id=self.user_id) unlock_welfares = [unlock_welfare.data for unlock_welfare in unlock_welfares] return { 'contribution_id': self.contribution_id, 'brand_id': self.brand_id, 'brand_name': self.brand_name, 'user_id': self.user_id, 'activity_id': self.activity_id, 'main_activity_id': self.main_activity_id, 'content_type': self.content_type, 'title': self.title, 'content': self.content, 'user_name': self.user_name, 'user_avatar': self.final_user_avatar, 'images': self.final_images, 'video_url': self.video_url or '', 'audit_status': self.audit_status, 'is_selected': self.is_selected, 'created_at': tc.local_string(utc_dt=self.created_at), 'unlock_welfares': unlock_welfares, } class MemberActivityContributionWelfareInfo(BaseModelMixin, BrandInfoMixin): WELFARE_TYPE = ( (0, u'实物'), (1, u'积分'), (2, u'虚拟'), ) welfare_id = ShortUUIDField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True, unique=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) welfare_type = models.IntegerField(_(u'welfare_type'), choices=WELFARE_TYPE, default=0, help_text=u'福利类型', db_index=True) welfare_title = models.CharField(_(u'welfare_title'), max_length=255, blank=True, null=True, help_text=u'福利标题') welfare_detail = RichTextField(_(u'welfare_detail'), blank=True, null=True, help_text=u'福利详情') welfare_value = models.IntegerField(_(u'welfare_value'), default=0, help_text=u'福利数量') welfare_image = models.ImageField(_(u'welfare_image'), upload_to=upload_path, blank=True, null=True, help_text=u'福利图片') is_upload_qiniu = models.BooleanField(_(u'is_upload_qiniu'), default=False, help_text=u'是否已上传七牛') class Meta: verbose_name = _(u'会员活动投稿福利信息') verbose_name_plural = _(u'会员活动投稿福利信息') def __unicode__(self): return '%d' % self.pk @property def welfare_image_path(self): return upload_file_path(self.welfare_image) @property def welfare_image_url(self): return qiniu_file_url(self.welfare_image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.welfare_image) @property def data(self): return { 'welfare_id': self.welfare_id, 'brand_id': self.brand_id, 'brand_name': self.brand_name, 'activity_id': self.activity_id, 'welfare_type': self.welfare_type, 'welfare_type_str': dict(MemberActivityContributionWelfareInfo.WELFARE_TYPE).get(self.welfare_type), 'welfare_title': self.welfare_title, 'welfare_detail': self.welfare_detail, 'welfare_value': self.welfare_value, 'welfare_image_url': self.welfare_image_url, 'welfare_image_path': self.welfare_image_path, } class MemberActivityContributionWelfareUnlockingInfo(BaseModelMixin, BrandInfoMixin): WELFARE_INTEGRAL = 1 WELFARE_TYPE = ( (0, u'实物'), (1, u'积分'), (2, u'虚拟'), ) unlocking_id = ShortUUIDField(_(u'unlocking_id'), max_length=32, blank=True, null=True, help_text=u'福利解锁唯一标识', db_index=True, unique=True) admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'管理员唯一标识', db_index=True) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) contribution_id = models.CharField(_(u'contribution_id'), max_length=32, blank=True, null=True, help_text=u'投稿唯一标识', db_index=True) welfare_id = models.CharField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True) welfare_type = models.IntegerField(_(u'welfare_type'), choices=WELFARE_TYPE, default=0, help_text=u'福利类型', db_index=True) welfare_value = models.IntegerField(_(u'welfare_value'), default=0, help_text=u'福利数量') name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') address = models.CharField(_(u'address'), max_length=255, blank=True, null=True, help_text=u'地址') tracking_number = models.CharField(_(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号') is_handled = models.BooleanField(_(u'is_handled'), default=False, help_text=u'是否已处理') send_template_message_res = JSONField(_(u'send_template_message_res'), blank=True, null=True, help_text=u'send_template_message_res') class Meta: verbose_name = _(u'会员活动投稿福利解锁信息') verbose_name_plural = _(u'会员活动投稿福利解锁信息') unique_together = ( ('brand_id', 'activity_id', 'welfare_id', 'user_id'), ) def __unicode__(self): return '%d' % self.pk @property def data(self): try: welfare = MemberActivityContributionWelfareInfo.objects.get(welfare_id=self.welfare_id) except MemberActivityContributionWelfareInfo.DoesNotExist: welfare = None try: user = MemberActivitySignupInfo.objects.get(user_id=self.user_id, activity_id=self.activity_id) except MemberActivitySignupInfo.DoesNotExist: user = None return { 'unlocking_id': self.unlocking_id, 'brand_id': self.brand_id, 'brand_name': self.brand_name, 'admin_id': self.admin_id, 'user_id': self.user_id, 'activity_id': self.activity_id, 'contribution_id': self.contribution_id, 'welfare_id': self.welfare_id, 'welfare': welfare.data if welfare else {}, 'name': self.name, 'phone': self.phone, 'address': self.address, 'tracking_number': self.tracking_number, 'is_handled': self.is_handled, 'created_at': tc.local_string(utc_dt=self.created_at), 'username': user.name if user else '', 'useravatar': user.final_avatar if user else '', } CarePatch/thermometer - Gogs: Go Git Service

2 Commits (aa768d80b7559220789c90b5fdb1a8788c1680cb)

Autor SHA1 Mensaje Fecha
  huangqimin001 ff8c710766 :art: MQTT %!s(int64=5) %!d(string=hace) años
  huangqimin001 a6bdd3725f :tada: Initial %!s(int64=5) %!d(string=hace) años