i left"> + 134 - 3 member/models.py
@@ -27,7 +27,7 @@ class GoodsInfo(BaseModelMixin): |
||
| 27 | 27 |
|
| 28 | 28 |
image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, null=True, help_text=u'商品图片') |
| 29 | 29 |
|
| 30 |
- is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=_(u'是否为轮播商品'), db_index=True) |
|
| 30 |
+ is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=u'是否为轮播商品', db_index=True) |
|
| 31 | 31 |
slider_image = models.ImageField(_(u'slider_image'), upload_to=upload_path, blank=True, null=True, help_text=u'商品轮播图片') |
| 32 | 32 |
|
| 33 | 33 |
integral = models.IntegerField(_(u'integral'), default=99999, help_text=u'兑换所需积分') |
@@ -76,6 +76,40 @@ class GoodsInfo(BaseModelMixin): |
||
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 | 78 |
|
| 79 |
+class GoodsOrderInfo(BaseModelMixin): |
|
| 80 |
+ PHYSICAL = 0 |
|
| 81 |
+ VIRTUAL = 1 |
|
| 82 |
+ |
|
| 83 |
+ GOOD_TYPE_TUPLE = ( |
|
| 84 |
+ (PHYSICAL, u'实物'), |
|
| 85 |
+ (VIRTUAL, u'虚拟'), |
|
| 86 |
+ ) |
|
| 87 |
+ |
|
| 88 |
+ order_id = ShortUUIDField(_(u'order_id'), max_length=32, blank=True, null=True, help_text=u'订单唯一标识', db_index=True, unique=True) |
|
| 89 |
+ |
|
| 90 |
+ user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
|
| 91 |
+ |
|
| 92 |
+ good_id = models.CharField(_(u'good_id'), max_length=32, blank=True, null=True, help_text=u'商品唯一标识', db_index=True) |
|
| 93 |
+ good_type = models.IntegerField(_(u'good_type'), choices=GOOD_TYPE_TUPLE, default=VIRTUAL, help_text=u'商品类型', db_index=True) |
|
| 94 |
+ |
|
| 95 |
+ title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'商品名称') |
|
| 96 |
+ |
|
| 97 |
+ name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') |
|
| 98 |
+ phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') |
|
| 99 |
+ address = models.CharField(_(u'address'), max_length=255, blank=True, null=True, help_text=u'地址') |
|
| 100 |
+ |
|
| 101 |
+ tracking_number = models.CharField(_(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号') |
|
| 102 |
+ |
|
| 103 |
+ has_send_template_message = models.BooleanField(_(u'has_send_template_message'), default=True, help_text=u'是否已发送模版消息', db_index=True) |
|
| 104 |
+ |
|
| 105 |
+ class Meta: |
|
| 106 |
+ verbose_name = _(u'会员商品订单信息') |
|
| 107 |
+ verbose_name_plural = _(u'会员商品订单信息') |
|
| 108 |
+ |
|
| 109 |
+ def __unicode__(self): |
|
| 110 |
+ return unicode(self.pk) |
|
| 111 |
+ |
|
| 112 |
+ |
|
| 79 | 113 |
class RightInfo(BaseModelMixin): |
| 80 | 114 |
PHYSICAL = 0 |
| 81 | 115 |
VIRTUAL = 1 |
@@ -169,6 +203,8 @@ class ShotTypeInfo(BaseModelMixin): |
||
| 169 | 203 |
|
| 170 | 204 |
|
| 171 | 205 |
class MemberActivityInfo(BaseModelMixin): |
| 206 |
+ activity_id = ShortUUIDField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True, unique=True) |
|
| 207 |
+ |
|
| 172 | 208 |
title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') |
| 173 | 209 |
subtitle = models.CharField(_(u'subtitle'), max_length=255, blank=True, null=True, help_text=u'活动二级名称') |
| 174 | 210 |
|
@@ -184,7 +220,7 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 184 | 220 |
|
| 185 | 221 |
cover = models.ImageField(_(u'cover'), upload_to=upload_path, blank=True, null=True, help_text=u'活动列表图片') |
| 186 | 222 |
|
| 187 |
- is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=_(u'是否为轮播活动'), db_index=True) |
|
| 223 |
+ is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=u'是否为轮播活动', db_index=True) |
|
| 188 | 224 |
slider_image = models.ImageField(_(u'slider_image'), upload_to=upload_path, blank=True, null=True, help_text=u'活动轮播图片') |
| 189 | 225 |
|
| 190 | 226 |
content_rich_text = RichTextField(_(u'content_rich_text'), blank=True, null=True, help_text=u'活动描述') |
@@ -228,7 +264,8 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 228 | 264 |
@property |
| 229 | 265 |
def data(self): |
| 230 | 266 |
return {
|
| 231 |
- 'id': self.pk, |
|
| 267 |
+ 'id': self.activity_id, |
|
| 268 |
+ 'activity_id': self.activity_id, |
|
| 232 | 269 |
'title': self.title, |
| 233 | 270 |
'subtitle': self.subtitle, |
| 234 | 271 |
'date': tc.local_string(self.date, '%Y-%m-%d'), |
@@ -245,3 +282,97 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 245 | 282 |
'state': 0, |
| 246 | 283 |
'is_signed': 0, |
| 247 | 284 |
} |
| 285 |
+ |
|
| 286 |
+ |
|
| 287 |
+class MemberActivitySignupInfo(BaseModelMixin): |
|
| 288 |
+ signup_id = ShortUUIDField(_(u'signup_id'), max_length=32, blank=True, null=True, help_text=u'活动报名唯一标识', db_index=True, unique=True) |
|
| 289 |
+ |
|
| 290 |
+ user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
|
| 291 |
+ |
|
| 292 |
+ activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) |
|
| 293 |
+ |
|
| 294 |
+ title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') |
|
| 295 |
+ |
|
| 296 |
+ name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') |
|
| 297 |
+ phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') |
|
| 298 |
+ |
|
| 299 |
+ class Meta: |
|
| 300 |
+ verbose_name = _(u'会员活动报名信息') |
|
| 301 |
+ verbose_name_plural = _(u'会员活动报名信息') |
|
| 302 |
+ |
|
| 303 |
+ unique_together = ( |
|
| 304 |
+ ('user_id', 'activity_id'),
|
|
| 305 |
+ ) |
|
| 306 |
+ |
|
| 307 |
+ def __unicode__(self): |
|
| 308 |
+ return unicode(self.pk) |
|
| 309 |
+ |
|
| 310 |
+ |
|
| 311 |
+class MemberActivitySigninInfo(BaseModelMixin): |
|
| 312 |
+ signin_id = ShortUUIDField(_(u'signin_id'), max_length=32, blank=True, null=True, help_text=u'活动签到唯一标识', db_index=True, unique=True) |
|
| 313 |
+ |
|
| 314 |
+ user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
|
| 315 |
+ |
|
| 316 |
+ activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) |
|
| 317 |
+ |
|
| 318 |
+ title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') |
|
| 319 |
+ |
|
| 320 |
+ class Meta: |
|
| 321 |
+ verbose_name = _(u'会员活动签到信息') |
|
| 322 |
+ verbose_name_plural = _(u'会员活动签到信息') |
|
| 323 |
+ |
|
| 324 |
+ unique_together = ( |
|
| 325 |
+ ('user_id', 'activity_id'),
|
|
| 326 |
+ ) |
|
| 327 |
+ |
|
| 328 |
+ def __unicode__(self): |
|
| 329 |
+ return unicode(self.pk) |
|
| 330 |
+ |
|
| 331 |
+ |
|
| 332 |
+class MemberCouponInfo(BaseModelMixin): |
|
| 333 |
+ DEEP_CLEANING = 0 |
|
| 334 |
+ FREE_FOCUS = 1 |
|
| 335 |
+ CLEAN_APPEARANCE = 2 |
|
| 336 |
+ ACCIDENTAL_MAINTENANCE = 3 |
|
| 337 |
+ MAINTENANCE_MANPOWER = 4 |
|
| 338 |
+ |
|
| 339 |
+ COUPON_TYPE_TUPLE = ( |
|
| 340 |
+ (DEEP_CLEANING, u'深度清洁'), |
|
| 341 |
+ (FREE_FOCUS, u'免费调焦'), |
|
| 342 |
+ (CLEAN_APPEARANCE, u'外观清洁'), |
|
| 343 |
+ (ACCIDENTAL_MAINTENANCE, u'意外维修'), |
|
| 344 |
+ (MAINTENANCE_MANPOWER, u'维修人工') |
|
| 345 |
+ ) |
|
| 346 |
+ |
|
| 347 |
+ coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True) |
|
| 348 |
+ |
|
| 349 |
+ user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
|
| 350 |
+ |
|
| 351 |
+ coupon_type = models.IntegerField(_(u'coupon_type'), choices=COUPON_TYPE_TUPLE, default=DEEP_CLEANING, help_text=u'券类型', db_index=True) |
|
| 352 |
+ coupon_start_at = models.DateTimeField(_(u'coupon_start_at'), blank=True, null=True, help_text=u'券生效时间') |
|
| 353 |
+ coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=u'券过期时间') |
|
| 354 |
+ coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=u'券金额(单位:分)') |
|
| 355 |
+ |
|
| 356 |
+ has_used = models.BooleanField(_(u'has_used'), default=False, help_text=u'是否已核销', db_index=True) |
|
| 357 |
+ admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'核销员唯一标识', db_index=True) |
|
| 358 |
+ used_at = models.DateTimeField(_(u'used_at'), blank=True, null=True, help_text=u'维修券核销时间') |
|
| 359 |
+ |
|
| 360 |
+ class Meta: |
|
| 361 |
+ verbose_name = _(u'会员券信息') |
|
| 362 |
+ verbose_name_plural = _(u'会员券信息') |
|
| 363 |
+ |
|
| 364 |
+ def __unicode__(self): |
|
| 365 |
+ return unicode(self.pk) |
|
| 366 |
+ |
|
| 367 |
+ @property |
|
| 368 |
+ def data(self): |
|
| 369 |
+ return {
|
|
| 370 |
+ 'coupon_id': self.coupon_id, |
|
| 371 |
+ 'coupon_type': self.coupon_type, |
|
| 372 |
+ 'coupon_start_at': tc.local_string(self.coupon_start_at, format='%Y%m%d'), |
|
| 373 |
+ 'coupon_expire_at': tc.local_string(self.coupon_expire_at, format='%Y%m%d'), |
|
| 374 |
+ 'coupon_value': self.coupon_value, |
|
| 375 |
+ 'has_used': self.has_used, |
|
| 376 |
+ 'admin_id': self.admin_id, |
|
| 377 |
+ 'used_at': tc.local_string(self.used_at, format='%Y%m%d'), |
|
| 378 |
+ } |
@@ -59,7 +59,7 @@ def upload_handler(request): |
||
| 59 | 59 |
'msg': '图片格式错误!'} |
| 60 | 60 |
return JsonResponse(retdata) |
| 61 | 61 |
|
| 62 |
- key = upload(uploaded_file.read()).get('key', '')
|
|
| 62 |
+ key = upload(uploaded_file.read()) |
|
| 63 | 63 |
if not key: |
| 64 | 64 |
retdata = {'file_path': key, 'success': False, 'msg': '上传失败,请重试!'}
|
| 65 | 65 |
else: |
@@ -62,6 +62,24 @@ class ProductStatusCode(BaseStatusCode): |
||
| 62 | 62 |
PRODUCT_NOT_USED = StatusCodeField(502012, 'Product Not Used', description=u'产品未使用') |
| 63 | 63 |
|
| 64 | 64 |
|
| 65 |
+class MemberGoodStatusCode(BaseStatusCode): |
|
| 66 |
+ """ 会员商品相关错误码 5035xx """ |
|
| 67 |
+ GOOD_NOT_FOUND = StatusCodeField(503501, 'Good Not Found', description=u'商品不存在') |
|
| 68 |
+ |
|
| 69 |
+ GOOD_NO_EXCHANGE_PERMISSION = StatusCodeField(503502, 'Good No Exchange Permission', description=u'商品无兑换权限') |
|
| 70 |
+ GOOD_INTEGRAL_NOT_ENOUGH = StatusCodeField(503503, 'Good Integral Not Enough', description=u'商品兑换积分不足') |
|
| 71 |
+ |
|
| 72 |
+ |
|
| 73 |
+class MemberRightStatusCode(BaseStatusCode): |
|
| 74 |
+ """ 会员商品相关错误码 5036xx """ |
|
| 75 |
+ RIGHT_NOT_FOUND = StatusCodeField(503601, 'Right Not Found', description=u'权益不存在') |
|
| 76 |
+ |
|
| 77 |
+ |
|
| 78 |
+class MemberActivityStatusCode(BaseStatusCode): |
|
| 79 |
+ """ 会员活动相关错误码 5037xx """ |
|
| 80 |
+ ACTIVITY_NOT_FOUND = StatusCodeField(503701, 'Activity Not Found', description=u'活动不存在') |
|
| 81 |
+ |
|
| 82 |
+ |
|
| 65 | 83 |
class LensmanStatusCode(BaseStatusCode): |
| 66 | 84 |
""" 摄影师相关错误码 4000xx """ |
| 67 | 85 |
LENSMAN_NOT_FOUND = StatusCodeField(400001, 'Lensman Not Found', description=u'摄影师不存在') |
@@ -39,7 +39,7 @@ def upload_file_path(path, key=None, mime_type='application/octet-stream', bucke |
||
| 39 | 39 |
return ret.get('key')
|
| 40 | 40 |
|
| 41 | 41 |
|
| 42 |
-def qiniu_file_url(key, bucket): |
|
| 42 |
+def qiniu_file_url(key, bucket=QINIU['bucket_default']): |
|
| 43 | 43 |
if not key: |
| 44 | 44 |
return '' |
| 45 | 45 |
return '{}/{}'.format(QINIU['buckets'][bucket], key)
|