:art: Opt del_clerk_sale_submit_api

huangqimin 5 ans auparavant
Parent
Commettre
5f83fed5ab
10 fichiers modifiés avec 87 ajouts et 4 suppressions
  1. 6 4
      api/staff_views.py
  2. 1 0
      kodo/settings.py
  3. 0 0
      staff/__init__.py
  4. 12 0
      staff/admin.py
  5. 8 0
      staff/apps.py
  6. 31 0
      staff/migrations/0001_initial.py
  7. 0 0
      staff/migrations/__init__.py
  8. 17 0
      staff/models.py
  9. 6 0
      staff/tests.py
  10. 6 0
      staff/views.py

+ 6 - 4
api/staff_views.py

@@ -8,7 +8,8 @@ from django_response import response
8 8
 from TimeConvert import TimeConvert as tc
9 9
 
10 10
 from integral.models import SaleclerkIntegralIncomeExpensesInfo, SaleclerkSubmitLogInfo
11
-from mch.models import BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, ModelInfo, SaleclerkInfo
11
+from mch.models import BrandInfo, DistributorInfo, ModelInfo, SaleclerkInfo
12
+from staff.models import StaffDeleteClerkSaleSubmitLogInfo
12 13
 from statistic.models import (DistributorSaleStatisticInfo, ModelSaleStatisticInfo, ProvinceSaleStatisticInfo,
13 14
                               SaleclerkSaleStatisticInfo, SaleStatisticInfo)
14 15
 
@@ -17,9 +18,8 @@ from statistic.models import (DistributorSaleStatisticInfo, ModelSaleStatisticIn
17 18
 @staff_member_required
18 19
 @transaction.atomic
19 20
 def del_clerk_sale_submit_api(request):
20
-    brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
21
-
22
-    sn = request.POST.get('sn', '')
21
+    brand_id = request.GET.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
22
+    sn = request.GET.get('sn', '')
23 23
 
24 24
     try:
25 25
         ssli = SaleclerkSubmitLogInfo.objects.get(code=sn)
@@ -32,6 +32,8 @@ def del_clerk_sale_submit_api(request):
32 32
     if ssli.is_staff_delete:
33 33
         return response()
34 34
 
35
+    StaffDeleteClerkSaleSubmitLogInfo.objects.create(username=request.user.username, code=sn)
36
+
35 37
     ssli.status = False
36 38
     ssli.is_staff_delete = True
37 39
     ssli.save()

+ 1 - 0
kodo/settings.py

@@ -71,6 +71,7 @@ INSTALLED_APPS = (
71 71
     'pre',
72 72
     'sales',
73 73
     'server',
74
+    'staff',
74 75
     'statistic',
75 76
     'website',
76 77
 )

+ 0 - 0
staff/__init__.py


+ 12 - 0
staff/admin.py

@@ -0,0 +1,12 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.contrib import admin
4
+
5
+from staff.models import StaffDeleteClerkSaleSubmitLogInfo
6
+
7
+
8
+class StaffDeleteClerkSaleSubmitLogInfoAdmin(admin.ModelAdmin):
9
+    list_display = ('username', 'code', 'status', 'created_at', 'updated_at')
10
+
11
+
12
+admin.site.register(StaffDeleteClerkSaleSubmitLogInfo, StaffDeleteClerkSaleSubmitLogInfoAdmin)

+ 8 - 0
staff/apps.py

@@ -0,0 +1,8 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.apps import AppConfig
5
+
6
+
7
+class StaffConfig(AppConfig):
8
+    name = 'staff'

+ 31 - 0
staff/migrations/0001_initial.py

@@ -0,0 +1,31 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.28 on 2020-03-01 13:19
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    initial = True
11
+
12
+    dependencies = [
13
+    ]
14
+
15
+    operations = [
16
+        migrations.CreateModel(
17
+            name='StaffDeleteClerkSaleSubmitLogInfo',
18
+            fields=[
19
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20
+                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
21
+                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
22
+                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
23
+                ('username', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u540d', max_length=32, null=True, verbose_name='username')),
24
+                ('code', models.CharField(blank=True, db_index=True, help_text='\u673a\u8eab\u7801', max_length=32, null=True, verbose_name='code')),
25
+            ],
26
+            options={
27
+                'verbose_name': 'staffdeleteclerksalesubmitloginfo',
28
+                'verbose_name_plural': 'staffdeleteclerksalesubmitloginfo',
29
+            },
30
+        ),
31
+    ]

+ 0 - 0
staff/migrations/__init__.py


+ 17 - 0
staff/models.py

@@ -0,0 +1,17 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.db import models
4
+from django.utils.translation import ugettext_lazy as _
5
+from django_models_ext import BaseModelMixin
6
+
7
+
8
+class StaffDeleteClerkSaleSubmitLogInfo(BaseModelMixin):
9
+    username = models.CharField(_(u'username'), max_length=32, blank=True, null=True, help_text=u'用户名', db_index=True)
10
+    code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码', db_index=True)
11
+
12
+    class Meta:
13
+        verbose_name = _(u'staffdeleteclerksalesubmitloginfo')
14
+        verbose_name_plural = _(u'staffdeleteclerksalesubmitloginfo')
15
+
16
+    def __unicode__(self):
17
+        return unicode(self.pk)

+ 6 - 0
staff/tests.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.test import TestCase
5
+
6
+# Create your tests here.

+ 6 - 0
staff/views.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.shortcuts import render
5
+
6
+# Create your views here.