class="lines-num lines-num-new">
11
+from mch.models import BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, ModelInfo, SaleclerkInfo
|
|
14
|
12
|
from member.models import RightInfo
|
|
15
|
|
-from statistic.models import (DistributorSaleStatisticInfo, ModelSaleStatisticInfo, ProvinceSaleStatisticInfo,
|
|
16
|
|
- SaleclerkSaleStatisticInfo, SaleStatisticInfo, ConsumeSaleStatisticInfo, ConsumeDistributorSaleStatisticInfo, ConsumeModelSaleStatisticInfo, ConsumeProvinceSaleStatisticInfo, ConsumeUserStatisticInfo)
|
|
|
13
|
+from statistic.models import (ConsumeModelSaleStatisticInfo, ConsumeSaleStatisticInfo, ConsumeUserStatisticInfo,
|
|
|
14
|
+ DistributorSaleStatisticInfo, ModelSaleStatisticInfo, ProvinceSaleStatisticInfo,
|
|
|
15
|
+ SaleclerkSaleStatisticInfo, SaleStatisticInfo)
|
|
17
|
16
|
|
|
18
|
17
|
|
|
19
|
18
|
def exec_del_clerk_sale_submit(pk):
|
|
|
|
@@ -52,15 +51,15 @@ def exec_del_clerk_sale_submit(pk):
|
|
52
|
51
|
ymd = str(ssli.ymd)
|
|
53
|
52
|
|
|
54
|
53
|
if not clerk.test_user and not ssli.dupload:
|
|
55
|
|
- #删除积分
|
|
56
|
|
-
|
|
|
54
|
+ # 删除积分
|
|
57
|
55
|
try:
|
|
58
|
56
|
income = SaleclerkIntegralIncomeExpensesInfo.objects.select_for_update().get(model_id=model.model_id, code=ssli.code, clerk_id=ssli.clerk_id)
|
|
59
|
|
- income.status = False
|
|
60
|
|
- income.save()
|
|
61
|
57
|
except SaleclerkIntegralIncomeExpensesInfo.DoesNotExist:
|
|
62
|
58
|
return response()
|
|
63
|
|
-
|
|
|
59
|
+
|
|
|
60
|
+ income.status = False
|
|
|
61
|
+ income.save()
|
|
|
62
|
+
|
|
64
|
63
|
integral = model.integral
|
|
65
|
64
|
|
|
66
|
65
|
clerk.num -= 1
|
|
|
|
@@ -221,6 +220,7 @@ def del_clerk_sale_submit_api(request):
|
|
221
|
220
|
|
|
222
|
221
|
return response(200, 'Del Success', u'删除成功')
|
|
223
|
222
|
|
|
|
223
|
+
|
|
224
|
224
|
def exec_del_consumer_submit(pk):
|
|
225
|
225
|
try:
|
|
226
|
226
|
ssli = ConsumeInfoSubmitLogInfo.objects.select_for_update().get(pk=pk)
|
|
|
|
@@ -236,7 +236,7 @@ def exec_del_consumer_submit(pk):
|
|
236
|
236
|
ssli.save()
|
|
237
|
237
|
|
|
238
|
238
|
ConsumeInfoSubmitLogInfo.objects.filter(serialNo=sn, model_id=ssli.model_id, dupload=True, status=True).update(status=False)
|
|
239
|
|
-
|
|
|
239
|
+
|
|
240
|
240
|
if ssli.dupload:
|
|
241
|
241
|
return response()
|
|
242
|
242
|
|
|
|
|
@@ -255,7 +255,7 @@ def exec_del_consumer_submit(pk):
|
|
255
|
255
|
except UserInfo.DoesNotExist:
|
|
256
|
256
|
return response()
|
|
257
|
257
|
|
|
258
|
|
- #消除用户劵
|
|
|
258
|
+ # 消除用户劵
|
|
259
|
259
|
if user.shots_num <= 5:
|
|
260
|
260
|
rights = RightInfo.objects.filter(is_send_coupon=True, status=True)
|
|
261
|
261
|
for right in rights:
|
|
|
|
@@ -285,12 +285,12 @@ def exec_del_consumer_submit(pk):
|
|
285
|
285
|
user_coupons = UserCouponInfo.objects.filter(user_id=user.user_id, coupon_id=coupon_id, coupon_from='MEMBER_BENEFITS', status=True, has_used=False).values_list('pk', flat=True)
|
|
286
|
286
|
# 防止用户部分劵已使用,不够消除
|
|
287
|
287
|
UserCouponInfo.objects.filter(pk__in=list(user_coupons)[0:min(coupon_num, len(user_coupons))]).update(status=False)
|
|
288
|
|
-
|
|
|
288
|
+
|
|
289
|
289
|
# 消除活动劵
|
|
290
|
290
|
if ssli.submit_during_activity:
|
|
291
|
291
|
UserCouponInfo.objects.filter(user_id=user.user_id, coupon_from='PROMOTION', submit_pk=ssli.pk).update(status=False)
|
|
292
|
292
|
|
|
293
|
|
- #消除积分及会员等级
|
|
|
293
|
+ # 消除积分及会员等级
|
|
294
|
294
|
integral = model.shot_member_integral
|
|
295
|
295
|
|
|
296
|
296
|
if user.shots_num <= 5:
|
|
|
|
@@ -327,7 +327,6 @@ def exec_del_consumer_submit(pk):
|
|
327
|
327
|
ssi.num -= 1
|
|
328
|
328
|
ssi.save()
|
|
329
|
329
|
|
|
330
|
|
-
|
|
331
|
330
|
# 日用户统计
|
|
332
|
331
|
ussi, _ = ConsumeUserStatisticInfo.objects.select_for_update().get_or_create(
|
|
333
|
332
|
brand_id=brand.brand_id,
|
|
|
|
@@ -44,14 +44,14 @@ class Command(CompatibilityBaseCommand):
|
|
44
|
44
|
try:
|
|
45
|
45
|
upload_file_path(ssli.image.path, key=ssli.image.name, bucket='tamron')
|
|
46
|
46
|
os.remove(ssli.image.path)
|
|
47
|
|
- except:
|
|
|
47
|
+ except Exception:
|
|
48
|
48
|
pass
|
|
49
|
49
|
|
|
50
|
50
|
if ssli.code_image:
|
|
51
|
51
|
try:
|
|
52
|
52
|
upload_file_path(ssli.code_image.path, key=ssli.code_image.name, bucket='tamron')
|
|
53
|
53
|
os.remove(ssli.code_image.path)
|
|
54
|
|
- except:
|
|
|
54
|
+ except Exception:
|
|
55
|
55
|
pass
|
|
56
|
56
|
|
|
57
|
57
|
ssli.is_upload_qiniu = True
|
|
|
|
@@ -21,6 +21,6 @@ class Command(CompatibilityBaseCommand):
|
|
21
|
21
|
|
|
22
|
22
|
for ssli in sslis:
|
|
23
|
23
|
r.rpushjson(QINIU_UPLOAD_LIST, {
|
|
24
|
|
- 'model': 'SaleclerkSubmitLogInfo',
|
|
25
|
|
- 'pk': ssli.pk,
|
|
|
24
|
+ 'model': 'SaleclerkSubmitLogInfo',
|
|
|
25
|
+ 'pk': ssli.pk,
|
|
26
|
26
|
})
|
|
|
|
@@ -1,3 +1,3 @@
|
|
1
|
1
|
#!/bin/bash
|
|
2
|
2
|
|
|
3
|
|
-isort -rc -sp . .
|
|
|
3
|
+isort .
|
|
|
|
@@ -44,15 +44,16 @@ def DJANGO_WE_MESSAGE_CALLBACK_FUNC(request, data, decrypted=None):
|
|
44
|
44
|
|
|
45
|
45
|
def DJANGO_WE_COMPONENT_CALLBACK_FUNC(request, appid, data, decrypted=None):
|
|
46
|
46
|
""" WeChat Component Message Callback Func """
|
|
47
|
|
- from account.models import UserInfo
|
|
48
|
47
|
from django_we.models import SubscribeUserInfo
|
|
49
|
48
|
from pywe_component_authorizer_token import authorizer_access_token
|
|
50
|
49
|
from pywe_custom_message import send_custom_card_message
|
|
51
|
50
|
from pywe_event_message import parse_eventkey
|
|
52
|
51
|
from pywe_storage import RedisStorage
|
|
53
|
52
|
from pywe_user import get_user_info
|
|
|
53
|
+
|
|
|
54
|
+ from account.models import UserInfo
|
|
54
|
55
|
from utils.redis.connect import r
|
|
55
|
|
- from utils.redis.rkeys import SUBSCRIBE_USERINFO_LIST, MEMBERCARD_USERINFO_LIST
|
|
|
56
|
+ from utils.redis.rkeys import MEMBERCARD_USERINFO_LIST, SUBSCRIBE_USERINFO_LIST
|
|
56
|
57
|
|
|
57
|
58
|
logger.info(appid)
|
|
58
|
59
|
logger.info(data)
|
|
|
|
@@ -202,6 +203,7 @@ def DJANGO_FILE_UPLOAD_CALLBACK_FUNC(request, file_path=None, file_url=None):
|
|
202
|
203
|
zbar = int(request.POST.get('zbar', 0))
|
|
203
|
204
|
if zbar:
|
|
204
|
205
|
import os
|
|
|
206
|
+
|
|
205
|
207
|
from utils.zbar.zbar import zbar
|
|
206
|
208
|
|
|
207
|
209
|
file_path = os.path.join(settings.MEDIA_ROOT, file_path)
|
|
|
|
@@ -214,6 +216,7 @@ def DJANGO_FILE_UPLOAD_CALLBACK_FUNC(request, file_path=None, file_url=None):
|
|
214
|
216
|
zbar2 = int(request.POST.get('zbar2', 0))
|
|
215
|
217
|
if zbar:
|
|
216
|
218
|
import os
|
|
|
219
|
+
|
|
217
|
220
|
from utils.zbar.zbar2 import zbar2
|
|
218
|
221
|
|
|
219
|
222
|
file_path = os.path.join(settings.MEDIA_ROOT, file_path)
|
|
|
|
@@ -3,10 +3,11 @@
|
|
3
|
3
|
from django.db import models
|
|
4
|
4
|
from django.utils.translation import ugettext_lazy as _
|
|
5
|
5
|
from django_models_ext import BaseModelMixin, upload_file_url, upload_path
|
|
6
|
|
-from mch.models import ModelInfo, OperatorInfo
|
|
7
|
6
|
from shortuuidfield import ShortUUIDField
|
|
8
|
7
|
from TimeConvert import TimeConvert as tc
|
|
9
|
8
|
|
|
|
9
|
+from mch.models import ModelInfo, OperatorInfo
|
|
|
10
|
+
|
|
10
|
11
|
|
|
11
|
12
|
class MchInfoEncryptLogInfo(BaseModelMixin):
|
|
12
|
13
|
plaintext = models.CharField(_(u'plaintext'), max_length=64, blank=True, null=True, help_text=u'待加密字符串', db_index=True, unique=True)
|
|
|
|
@@ -36,13 +37,13 @@ class MchInfoEncryptLogInfo(BaseModelMixin):
|
|
36
|
37
|
|
|
37
|
38
|
def __unicode__(self):
|
|
38
|
39
|
return unicode(self.pk)
|
|
39
|
|
-
|
|
|
40
|
+
|
|
40
|
41
|
@property
|
|
41
|
42
|
def admindata(self):
|
|
42
|
43
|
model = ModelInfo.objects.get(pk=self.model_pk, status=True)
|
|
43
|
44
|
try:
|
|
44
|
45
|
operator_name = OperatorInfo.objects.get(operator_id=self.operator_id).name
|
|
45
|
|
- except:
|
|
|
46
|
+ except OperatorInfo.DoesNotExist:
|
|
46
|
47
|
operator_name = '深圳捷成'
|
|
47
|
48
|
|
|
48
|
49
|
return {
|
|
|
|
@@ -135,7 +135,7 @@ class GoodsOrderInfo(BaseModelMixin):
|
|
135
|
135
|
|
|
136
|
136
|
def __unicode__(self):
|
|
137
|
137
|
return unicode(self.pk)
|
|
138
|
|
-
|
|
|
138
|
+
|
|
139
|
139
|
@property
|
|
140
|
140
|
def admindata(self):
|
|
141
|
141
|
good = GoodsInfo.objects.get(good_id=self.good_id)
|
|
|
|
@@ -312,7 +312,6 @@ class MemberActivityInfo(BaseModelMixin):
|
|
312
|
312
|
|
|
313
|
313
|
position = models.IntegerField(_(u'position'), default=1, help_text=u'排序', db_index=True)
|
|
314
|
314
|
|
|
315
|
|
-
|
|
316
|
315
|
is_signup = models.BooleanField(_(u'is_signup'), default=True, help_text=u'是否有报名功能', db_index=True)
|
|
317
|
316
|
|
|
318
|
317
|
class Meta:
|
|
|
|
@@ -156,14 +156,15 @@ def mini_login_api(request):
|
|
156
|
156
|
user.appid = appId
|
|
157
|
157
|
if unionid:
|
|
158
|
158
|
user.unionid = unionid
|
|
159
|
|
-
|
|
|
159
|
+
|
|
160
|
160
|
# 同步销售员手机号
|
|
161
|
161
|
try:
|
|
162
|
162
|
saleclerk = SaleclerkInfo.objects.get(unionid=unionid, is_auth=True, status=True)
|
|
163
|
|
- user.phone = saleclerk.clerk_phone
|
|
164
|
163
|
except SaleclerkInfo.DoesNotExist:
|
|
165
|
|
- saleclerk = None
|
|
|
164
|
+ saleclerk = None
|
|
166
|
165
|
|
|
|
166
|
+ if saleclerk:
|
|
|
167
|
+ user.phone = saleclerk.clerk_phone
|
|
167
|
168
|
user.user_status = UserInfo.ACTIVATED
|
|
168
|
169
|
user.signup_ip = client_ip(request)
|
|
169
|
170
|
user.signup_at = tc.utc_datetime()
|
|
|
|
@@ -24,7 +24,7 @@ elif django.VERSION >= (1, 8):
|
|
24
|
24
|
name='simditor_upload'),
|
|
25
|
25
|
]
|
|
26
|
26
|
else:
|
|
27
|
|
- from django.conf.urls import patterns # pylint disable=C0411
|
|
|
27
|
+ from django.conf.urls import patterns # pylint disable=C0411
|
|
28
|
28
|
|
|
29
|
29
|
# pylint disable=C0103
|
|
30
|
30
|
urlpatterns = patterns(
|
|
|
|
@@ -25,7 +25,7 @@ try:
|
|
25
|
25
|
from django.forms.utils import flatatt
|
|
26
|
26
|
except ImportError:
|
|
27
|
27
|
# Django <1.7
|
|
28
|
|
- from django.forms.util import flatatt # pylint disable=E0611, E0401
|
|
|
28
|
+ from django.forms.util import flatatt # pylint disable=E0611, E0401
|
|
29
|
29
|
|
|
30
|
30
|
|
|
31
|
31
|
class LazyEncoder(DjangoJSONEncoder):
|
|
|
|
@@ -2,7 +2,6 @@
|
|
2
|
2
|
|
|
3
|
3
|
from django.conf import settings
|
|
4
|
4
|
from PIL import Image, ImageEnhance
|
|
5
|
|
-
|
|
6
|
5
|
from pyzbar import pyzbar
|
|
7
|
6
|
|
|
8
|
7
|
|