@@ -4,7 +4,6 @@ from django.db import models |
||
| 4 | 4 |
from django.utils.translation import ugettext_lazy as _ |
| 5 | 5 |
from django_models_ext import BaseModelMixin |
| 6 | 6 |
from jsonfield import JSONField |
| 7 |
-from shortuuidfield import ShortUUIDField |
|
| 8 | 7 |
|
| 9 | 8 |
from kodo.basemodels import LensmanTypeBoolMixin |
| 10 | 9 |
from mch.models import SaleclerkInfo |
@@ -43,7 +43,28 @@ def clerk_sale_submit_api(request): |
||
| 43 | 43 |
return response(SaleclerkStatusCode.CLERK_NOT_FOUND) |
| 44 | 44 |
|
| 45 | 45 |
try: |
| 46 |
- clerk = SaleclerkInfo.objects.get(brand_id=brandID, unionid=user.unionid, status=True) |
|
| 46 |
+ brand = BrandInfo.objects.get(pk=brandID) |
|
| 47 |
+ except BrandInfo.DoesNotExist: |
|
| 48 |
+ return response(ProductBrandStatusCode.BRAND_NOT_FOUND) |
|
| 49 |
+ except ValueError: |
|
| 50 |
+ return response(ProductBrandStatusCode.BRAND_NOT_FOUND) |
|
| 51 |
+ |
|
| 52 |
+ try: |
|
| 53 |
+ model = ModelInfo.objects.get(pk=modelID) |
|
| 54 |
+ except ModelInfo.DoesNotExist: |
|
| 55 |
+ return response(ProductModelStatusCode.MODEL_NOT_FOUND) |
|
| 56 |
+ except ValueError: |
|
| 57 |
+ return response(ProductModelStatusCode.MODEL_NOT_FOUND) |
|
| 58 |
+ |
|
| 59 |
+ try: |
|
| 60 |
+ distributor = DistributorInfo.objects.get(pk=distributorID) |
|
| 61 |
+ except DistributorInfo.DoesNotExist: |
|
| 62 |
+ return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND) |
|
| 63 |
+ except ValueError: |
|
| 64 |
+ return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND) |
|
| 65 |
+ |
|
| 66 |
+ try: |
|
| 67 |
+ clerk = SaleclerkInfo.objects.get(brand_id=brand.brand_id, unionid=user.unionid, status=True) |
|
| 47 | 68 |
except SaleclerkInfo.DoesNotExist: |
| 48 | 69 |
return response(SaleclerkStatusCode.CLERK_NOT_FOUND) |
| 49 | 70 |
|
@@ -82,27 +103,6 @@ def clerk_sale_submit_api(request): |
||
| 82 | 103 |
} if clerk else {})
|
| 83 | 104 |
|
| 84 | 105 |
# 店员积分 |
| 85 |
- try: |
|
| 86 |
- brand = BrandInfo.objects.get(pk=brandID) |
|
| 87 |
- except BrandInfo.DoesNotExist: |
|
| 88 |
- return response(ProductBrandStatusCode.BRAND_NOT_FOUND) |
|
| 89 |
- except ValueError: |
|
| 90 |
- return response(ProductBrandStatusCode.BRAND_NOT_FOUND) |
|
| 91 |
- |
|
| 92 |
- try: |
|
| 93 |
- model = ModelInfo.objects.get(pk=modelID) |
|
| 94 |
- except ModelInfo.DoesNotExist: |
|
| 95 |
- return response(ProductModelStatusCode.MODEL_NOT_FOUND) |
|
| 96 |
- except ValueError: |
|
| 97 |
- return response(ProductModelStatusCode.MODEL_NOT_FOUND) |
|
| 98 |
- |
|
| 99 |
- try: |
|
| 100 |
- distributor = DistributorInfo.objects.get(pk=distributorID) |
|
| 101 |
- except DistributorInfo.DoesNotExist: |
|
| 102 |
- return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND) |
|
| 103 |
- except ValueError: |
|
| 104 |
- return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND) |
|
| 105 |
- |
|
| 106 | 106 |
integral = model.integral |
| 107 | 107 |
|
| 108 | 108 |
clerk.integral += integral |