+ ('member', '0045_auto_20221026_2102'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='memberactivitycontributionwelfareunlockinginfo',
+ name='welfare_value',
+ field=models.IntegerField(default=0, help_text='福利数量', verbose_name='welfare_value'),
+ ),
+ ]
@@ -0,0 +1,19 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# Generated by Django 3.2.16 on 2022-10-27 10:46 |
|
3 |
+ |
|
4 |
+from django.db import migrations, models |
|
5 |
+ |
|
6 |
+ |
|
7 |
+class Migration(migrations.Migration): |
|
8 |
+ |
|
9 |
+ dependencies = [ |
|
10 |
+ ('member', '0046_memberactivitycontributionwelfareunlockinginfo_welfare_value'), |
|
11 |
+ ] |
|
12 |
+ |
|
13 |
+ operations = [ |
|
14 |
+ migrations.AddField( |
|
15 |
+ model_name='memberactivitycontributionwelfareunlockinginfo', |
|
16 |
+ name='welfare_type', |
|
17 |
+ field=models.IntegerField(choices=[(0, '实物'), (1, '积分'), (2, '虚拟')], db_index=True, default=0, help_text='福利类型', verbose_name='welfare_type'), |
|
18 |
+ ), |
|
19 |
+ ] |
@@ -795,6 +795,7 @@ class MemberActivityContributionWelfareInfo(BaseModelMixin, BrandInfoMixin): |
||
795 | 795 |
|
796 | 796 |
|
797 | 797 |
class MemberActivityContributionWelfareUnlockingInfo(BaseModelMixin, BrandInfoMixin): |
798 |
+ WELFARE_INTEGRAL = 1 |
|
798 | 799 |
WELFARE_TYPE = ( |
799 | 800 |
(0, u'实物'), |
800 | 801 |
(1, u'积分'), |
@@ -811,6 +812,8 @@ class MemberActivityContributionWelfareUnlockingInfo(BaseModelMixin, BrandInfoMi |
||
811 | 812 |
contribution_id = models.CharField(_(u'contribution_id'), max_length=32, blank=True, null=True, help_text=u'投稿唯一标识', db_index=True) |
812 | 813 |
|
813 | 814 |
welfare_id = models.CharField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True) |
815 |
+ welfare_type = models.IntegerField(_(u'welfare_type'), choices=WELFARE_TYPE, default=0, help_text=u'福利类型', db_index=True) |
|
816 |
+ welfare_value = models.IntegerField(_(u'welfare_value'), default=0, help_text=_(u'福利数量')) |
|
814 | 817 |
|
815 | 818 |
name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') |
816 | 819 |
phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') |
@@ -318,19 +318,20 @@ def user_integral_add(request): |
||
318 | 318 |
return response(ProductBrandStatusCode.BRAND_NOT_MATCH) |
319 | 319 |
|
320 | 320 |
try: |
321 |
- user = UserInfo.objects.get(user_id=user_id, status=True) |
|
321 |
+ user = UserInfo.objects.select_for_update().get(user_id=user_id, status=True) |
|
322 | 322 |
except UserInfo.DoesNotExist: |
323 | 323 |
return response(UserStatusCode.USER_NOT_FOUND) |
324 | 324 |
|
325 |
+ user.integral += integral |
|
326 |
+ user.save() |
|
327 |
+ |
|
325 | 328 |
UserIntegralIncomeExpensesInfo.objects.create( |
326 | 329 |
brand_id=brand_id, |
327 | 330 |
user_id=user_id, |
328 | 331 |
integral_from=UserIntegralIncomeExpensesInfo.CONTRIBUTE, |
329 | 332 |
integral=integral, |
330 |
- remark=remark |
|
333 |
+ final_integral=user.integral, |
|
334 |
+ remark=remark, |
|
331 | 335 |
) |
332 | 336 |
|
333 |
- user.integral += integral |
|
334 |
- user.save() |
|
335 |
- |
|
336 | 337 |
return response(200, 'Add User Integral Success', u'添加用户投稿积分成功') |
@@ -8,6 +8,78 @@ class ParamStatusCode(BaseStatusCode): |
||
8 | 8 |
PARAM_NOT_FOUND = StatusCodeField(400000, 'Param Not Found', description=u'参数不存在') |
9 | 9 |
|
10 | 10 |
|
11 |
+class PermissionStatusCode(BaseStatusCode): |
|
12 |
+ """ 4099xx 权限相关错误码 """ |
|
13 |
+ PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description=u'权限不足') |
|
14 |
+ |
|
15 |
+ |
|
16 |
+class AdministratorStatusCode(BaseStatusCode): |
|
17 |
+ """ 操作员相关错误码 4002xx """ |
|
18 |
+ ADMINISTRATOR_NOT_FOUND = StatusCodeField(400201, 'Administrator Not Found', description=u'管理员不存在') |
|
19 |
+ ADMINISTRATOR_PERMISSION_DENIED = StatusCodeField(508002, 'Administrator Permission Denied', description=u'管理员权限不足') |
|
20 |
+ |
|
21 |
+ # 密码 |
|
22 |
+ ADMINISTRATOR_PASSWORD_ERROR = StatusCodeField(400202, 'Administrator Password Error', description=u'管理员密码错误') |
|
23 |
+ # 手机号 |
|
24 |
+ ADMINISTRATOR_PHONE_ALREADY_EXISTS = StatusCodeField(400205, 'Administrator Phone Already Exists', description=u'管理员手机号已经存在') |
|
25 |
+ # 状态 |
|
26 |
+ ADMINISTRATOR_NOT_ACTIVATED = StatusCodeField(400215, 'Administrator Not Activated', description=u'管理员未激活') |
|
27 |
+ ADMINISTRATOR_HAS_DISABLED = StatusCodeField(400216, 'Administrator Has Disabled', description=u'管理员已禁用') |
|
28 |
+ ADMINISTRATOR_HAS_DELETED = StatusCodeField(400217, 'Administrator Has Deleted', description=u'管理员已删除') |
|
29 |
+ # 管理员 |
|
30 |
+ MAINTENANCE_NOT_FOUND = StatusCodeField(400251, 'Maintenance Not Found', description=u'核销员不存在') |
|
31 |
+ |
|
32 |
+ |
|
33 |
+class OperatorStatusCode(BaseStatusCode): |
|
34 |
+ """ 操作员相关错误码 4003xx """ |
|
35 |
+ OPERATOR_NOT_FOUND = StatusCodeField(400301, 'Operator Not Found', description=u'操作员不存在') |
|
36 |
+ # 密码 |
|
37 |
+ OPERATOR_PASSWORD_ERROR = StatusCodeField(400302, 'Operator Password Error', description=u'操作员密码错误') |
|
38 |
+ # 手机号 |
|
39 |
+ OPERATOR_PHONE_ALREADY_EXISTS = StatusCodeField(400305, 'Operator Phone Already Exists', description=u'操作员手机号已经存在') |
|
40 |
+ # 状态 |
|
41 |
+ OPERATOR_NOT_ACTIVATED = StatusCodeField(400315, 'Operator Not Activated', description=u'操作员未激活') |
|
42 |
+ OPERATOR_HAS_DISABLED = StatusCodeField(400316, 'Operator Has Disabled', description=u'操作员已禁用') |
|
43 |
+ OPERATOR_HAS_DELETED = StatusCodeField(400317, 'Operator Has Deleted', description=u'操作员已删除') |
|
44 |
+ |
|
45 |
+ |
|
46 |
+class UserStatusCode(BaseStatusCode): |
|
47 |
+ """ 用户相关错误码 4005xx """ |
|
48 |
+ USER_NOT_FOUND = StatusCodeField(400501, 'User Not Found', description=u'用户不存在') |
|
49 |
+ USER_PASSWORD_ERROR = StatusCodeField(400502, 'User Password Error', description=u'用户密码错误') |
|
50 |
+ USERNAME_HAS_REGISTERED = StatusCodeField(400503, 'Username Has Registered', description=u'用户名已注册') |
|
51 |
+ # 游客 |
|
52 |
+ GUEST_NOT_ALLOWED = StatusCodeField(400511, 'Guest Not ALLOWED', description=u'游客登录未开启') |
|
53 |
+ # 身份 |
|
54 |
+ USER_NOT_LENSMAN = StatusCodeField(400521, 'User Not Lensman', description=u'用户非摄影师') |
|
55 |
+ USER_NOT_TOURGUIDE = StatusCodeField(400522, 'User Not Tourguide', description=u'用户非导游') |
|
56 |
+ |
|
57 |
+ |
|
58 |
+class PhoneStatusCode(BaseStatusCode): |
|
59 |
+ """ 手机相关错误码 4006xx """ |
|
60 |
+ PHONE_NOT_FOUND = StatusCodeField(400601, 'Phone Not Found', description=u'手机不存在') |
|
61 |
+ |
|
62 |
+ |
|
63 |
+class WechatStatusCode(BaseStatusCode): |
|
64 |
+ """ 微信相关错误码 4007xx """ |
|
65 |
+ WECHAT_NOT_FOUND = StatusCodeField(400701, 'Wechat Not Found', description=u'微信不存在') |
|
66 |
+ UNIONID_NOT_FOUND = StatusCodeField(400702, 'Unionid Not Found', description=u'微信 UNIONID 不存在') |
|
67 |
+ OPENID_NOT_FOUND = StatusCodeField(400703, 'OPENID Not Found', description=u'微信 OPENID 不存在') |
|
68 |
+ |
|
69 |
+ |
|
70 |
+class ScreenStatusCode(BaseStatusCode): |
|
71 |
+ """ 群组/团相关错误码 4030xx """ |
|
72 |
+ QRCODE_NOT_SCAN = StatusCodeField(403001, 'QRCode Not Scan', description=u'二维码未扫描') |
|
73 |
+ |
|
74 |
+ |
|
75 |
+class CouponStatusCode(BaseStatusCode): |
|
76 |
+ """ 4050xx 优惠劵相关错误码 """ |
|
77 |
+ COUPON_NOT_FOUND = StatusCodeField(405001, 'Coupon Not Found', description=u'劵不存在') |
|
78 |
+ COUPON_EXPIRED = StatusCodeField(405002, 'Coupon Expired', description=u'劵已过期') |
|
79 |
+ COUPON_PERMISSION_DENIED = StatusCodeField(405003, 'Permission Denied', description=u'核销劵权限不足') |
|
80 |
+ COUPON_HAS_USED = StatusCodeField(405004, 'Coupon Has Used', description=u'劵已核销') |
|
81 |
+ |
|
82 |
+ |
|
11 | 83 |
class SaleclerkStatusCode(BaseStatusCode): |
12 | 84 |
""" 店员相关错误码 5001xx """ |
13 | 85 |
CLERK_NOT_FOUND = StatusCodeField(500101, 'Clerk Not Found', description=u'店员不存在') |
@@ -107,7 +179,8 @@ class MemberActivityContributionWelfareStatusCode(BaseStatusCode): |
||
107 | 179 |
|
108 | 180 |
class MemberActivityContributionWelfareUnblockingStatusCode(BaseStatusCode): |
109 | 181 |
""" 会员活动投稿福利相关错误码 5039xx """ |
110 |
- ACTIVITY_CONTRIBUTION_WELFARE_UNBLOCKING_NOT_FOUND = StatusCodeField(503999, 'Activity Contribution Welfare Unblocking Not Found', description=u'活动投稿福利解锁不存在') |
|
182 |
+ ACTIVITY_CONTRIBUTION_WELFARE_UNBLOCKING_NOT_FOUND = StatusCodeField(503901, 'Activity Contribution Welfare Unblocking Not Found', description=u'活动投稿福利解锁不存在') |
|
183 |
+ ACTIVITY_CONTRIBUTION_WELFARE_UNBLOCKING_HAS_HANDLED = StatusCodeField(503902, 'Activity Contribution Welfare Unblocking Has Handled', description=u'活动投稿福利解锁已处理') |
|
111 | 184 |
|
112 | 185 |
|
113 | 186 |
class MemberCouponStatusCode(BaseStatusCode): |
@@ -138,75 +211,3 @@ class MaintenanceStatusCode(BaseStatusCode): |
||
138 | 211 |
""" 维修相关错误码 5080xx """ |
139 | 212 |
MAINTENACE_NOT_FOUND = StatusCodeField(508001, 'Maintenance Not Found', description=u'维修不存在') |
140 | 213 |
MAINTENACE_PERMISSION_DENIED = StatusCodeField(508002, 'Maintenance Permission Denied', description=u'维修权限不足') |
141 |
- |
|
142 |
- |
|
143 |
-class AdministratorStatusCode(BaseStatusCode): |
|
144 |
- """ 操作员相关错误码 4002xx """ |
|
145 |
- ADMINISTRATOR_NOT_FOUND = StatusCodeField(400201, 'Administrator Not Found', description=u'管理员不存在') |
|
146 |
- ADMINISTRATOR_PERMISSION_DENIED = StatusCodeField(508002, 'Administrator Permission Denied', description=u'管理员权限不足') |
|
147 |
- |
|
148 |
- # 密码 |
|
149 |
- ADMINISTRATOR_PASSWORD_ERROR = StatusCodeField(400202, 'Administrator Password Error', description=u'管理员密码错误') |
|
150 |
- # 手机号 |
|
151 |
- ADMINISTRATOR_PHONE_ALREADY_EXISTS = StatusCodeField(400205, 'Administrator Phone Already Exists', description=u'管理员手机号已经存在') |
|
152 |
- # 状态 |
|
153 |
- ADMINISTRATOR_NOT_ACTIVATED = StatusCodeField(400215, 'Administrator Not Activated', description=u'管理员未激活') |
|
154 |
- ADMINISTRATOR_HAS_DISABLED = StatusCodeField(400216, 'Administrator Has Disabled', description=u'管理员已禁用') |
|
155 |
- ADMINISTRATOR_HAS_DELETED = StatusCodeField(400217, 'Administrator Has Deleted', description=u'管理员已删除') |
|
156 |
- # 管理员 |
|
157 |
- MAINTENANCE_NOT_FOUND = StatusCodeField(400251, 'Maintenance Not Found', description=u'核销员不存在') |
|
158 |
- |
|
159 |
- |
|
160 |
-class OperatorStatusCode(BaseStatusCode): |
|
161 |
- """ 操作员相关错误码 4003xx """ |
|
162 |
- OPERATOR_NOT_FOUND = StatusCodeField(400301, 'Operator Not Found', description=u'操作员不存在') |
|
163 |
- # 密码 |
|
164 |
- OPERATOR_PASSWORD_ERROR = StatusCodeField(400302, 'Operator Password Error', description=u'操作员密码错误') |
|
165 |
- # 手机号 |
|
166 |
- OPERATOR_PHONE_ALREADY_EXISTS = StatusCodeField(400305, 'Operator Phone Already Exists', description=u'操作员手机号已经存在') |
|
167 |
- # 状态 |
|
168 |
- OPERATOR_NOT_ACTIVATED = StatusCodeField(400315, 'Operator Not Activated', description=u'操作员未激活') |
|
169 |
- OPERATOR_HAS_DISABLED = StatusCodeField(400316, 'Operator Has Disabled', description=u'操作员已禁用') |
|
170 |
- OPERATOR_HAS_DELETED = StatusCodeField(400317, 'Operator Has Deleted', description=u'操作员已删除') |
|
171 |
- |
|
172 |
- |
|
173 |
-class UserStatusCode(BaseStatusCode): |
|
174 |
- """ 用户相关错误码 4005xx """ |
|
175 |
- USER_NOT_FOUND = StatusCodeField(400501, 'User Not Found', description=u'用户不存在') |
|
176 |
- USER_PASSWORD_ERROR = StatusCodeField(400502, 'User Password Error', description=u'用户密码错误') |
|
177 |
- USERNAME_HAS_REGISTERED = StatusCodeField(400503, 'Username Has Registered', description=u'用户名已注册') |
|
178 |
- # 游客 |
|
179 |
- GUEST_NOT_ALLOWED = StatusCodeField(400511, 'Guest Not ALLOWED', description=u'游客登录未开启') |
|
180 |
- # 身份 |
|
181 |
- USER_NOT_LENSMAN = StatusCodeField(400521, 'User Not Lensman', description=u'用户非摄影师') |
|
182 |
- USER_NOT_TOURGUIDE = StatusCodeField(400522, 'User Not Tourguide', description=u'用户非导游') |
|
183 |
- |
|
184 |
- |
|
185 |
-class PhoneStatusCode(BaseStatusCode): |
|
186 |
- """ 手机相关错误码 4006xx """ |
|
187 |
- PHONE_NOT_FOUND = StatusCodeField(400601, 'Phone Not Found', description=u'手机不存在') |
|
188 |
- |
|
189 |
- |
|
190 |
-class WechatStatusCode(BaseStatusCode): |
|
191 |
- """ 微信相关错误码 4007xx """ |
|
192 |
- WECHAT_NOT_FOUND = StatusCodeField(400701, 'Wechat Not Found', description=u'微信不存在') |
|
193 |
- UNIONID_NOT_FOUND = StatusCodeField(400702, 'Unionid Not Found', description=u'微信 UNIONID 不存在') |
|
194 |
- OPENID_NOT_FOUND = StatusCodeField(400703, 'OPENID Not Found', description=u'微信 OPENID 不存在') |
|
195 |
- |
|
196 |
- |
|
197 |
-class ScreenStatusCode(BaseStatusCode): |
|
198 |
- """ 群组/团相关错误码 4030xx """ |
|
199 |
- QRCODE_NOT_SCAN = StatusCodeField(403001, 'QRCode Not Scan', description=u'二维码未扫描') |
|
200 |
- |
|
201 |
- |
|
202 |
-class PermissionStatusCode(BaseStatusCode): |
|
203 |
- """ 4099xx 权限相关错误码 """ |
|
204 |
- PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description=u'权限不足') |
|
205 |
- |
|
206 |
- |
|
207 |
-class CouponStatusCode(BaseStatusCode): |
|
208 |
- """ 4050xx 优惠劵相关错误码 """ |
|
209 |
- COUPON_NOT_FOUND = StatusCodeField(405001, 'Coupon Not Found', description=u'劵不存在') |
|
210 |
- COUPON_EXPIRED = StatusCodeField(405002, 'Coupon Expired', description=u'劵已过期') |
|
211 |
- COUPON_PERMISSION_DENIED = StatusCodeField(405003, 'Permission Denied', description=u'核销劵权限不足') |
|
212 |
- COUPON_HAS_USED = StatusCodeField(405004, 'Coupon Has Used', description=u'劵已核销') |