class="lines-num lines-num-new"> 97
     @Override
118 98
     public void showSessionViews() {
119
-        runOnUiThread(new Runnable() {
120
-            @Override
121
-            public void run() {
122
-                noDataLayout.setVisibility(android.view.View.GONE);
123
-                sessionsRecyclerView.setVisibility(android.view.View.VISIBLE);
124
-            }
125
-        });
126
-
99
+        noDataLayout.setVisibility(android.view.View.GONE);
100
+        sessionsRecyclerView.setVisibility(android.view.View.VISIBLE);
127 101
     }
128 102
 
129 103
     @Override
@@ -133,21 +107,12 @@ public class UploadActivity extends BaseActivity implements UploadContract.View
133 107
 
134 108
     @Override
135 109
     public void refreshSessionViews(final ArrayList<SessionBean> sessionList) {
136
-        runOnUiThread(new Runnable() {
137
-            @Override
138
-            public void run() {
139
-                adapter.clear();
140
-                adapter.addSessionBeans(sessionList);
141
-            }
142
-        });
110
+        adapter.clear();
111
+        adapter.addSessionBeans(sessionList);
143 112
     }
144 113
 
145 114
 
146
-    public void jumpToSelectedSession(SessionBean sessionBean) {
147
-        sessionBean.lensmanId = Preferences.getInstance(this).getLensManId();
148
-        sessionBean.sessionDate=20160813;
149
-        sessionBean.sessionSeq = new Random().nextInt(10000);
150
-        sessionBean.sessionId ="chengzhenyu_test"+sessionBean.sessionSeq;
115
+    private void jumpToSelectedSession(SessionBean sessionBean) {
151 116
         Intent intent = new Intent(this, SessionActivity.class);
152 117
         intent.putExtra("session",sessionBean);
153 118
         startActivity(intent);

+ 3 - 3
app/src/main/java/ai/pai/lensman/upload/UploadContract.java

@@ -14,8 +14,8 @@ public class UploadContract {
14 14
     interface View extends BaseView {
15 15
 
16 16
         void addNewSessionView(SessionBean bean);
17
-        void showBTDisconnectedView();
18
-        void showBTConnectedView();
17
+        void showBoxDisconnectedView();
18
+        void showBoxConnectedView();
19 19
         void showEmptyView();
20 20
         void showSessionViews();
21 21
         void updateSessionUploadView(SessionBean bean);
@@ -23,7 +23,7 @@ public class UploadContract {
23 23
     }
24 24
 
25 25
     interface Presenter extends BasePresenter{
26
-
26
+        SessionBean createNewSession();
27 27
     }
28 28
 
29 29
 }

+ 15 - 2
app/src/main/java/ai/pai/lensman/upload/UploadPresenter.java

@@ -8,10 +8,12 @@ public class UploadPresenter implements UploadContract.Presenter {
8 8
 
9 9
     private UploadContract.View uploadView;
10 10
     private ArrayList<SessionBean> sessionList;
11
+    private String lensmanId;
12
+    private int sessionSeq;
11 13
 
12
-
13
-    public UploadPresenter( UploadContract.View view){
14
+    public UploadPresenter(UploadContract.View view,String lensmanId){
14 15
         this.uploadView = view;
16
+        this.lensmanId = lensmanId;
15 17
         sessionList = new ArrayList<>();
16 18
     }
17 19
 
@@ -24,6 +26,7 @@ public class UploadPresenter implements UploadContract.Presenter {
24 26
             uploadView.showSessionViews();
25 27
             uploadView.refreshSessionViews(sessionList);
26 28
         }
29
+        sessionSeq = sessionList.size();
27 30
     }
28 31
 
29 32
     @Override
@@ -31,4 +34,14 @@ public class UploadPresenter implements UploadContract.Presenter {
31 34
 
32 35
     }
33 36
 
37
+    @Override
38
+    public SessionBean createNewSession() {
39
+        SessionBean sessionBean = new SessionBean();
40
+        sessionBean.lensmanId = lensmanId;
41
+        sessionBean.sessionDate=20160813;
42
+        sessionBean.sessionSeq = sessionSeq+1;
43
+        sessionBean.sessionId ="chengzhenyu_test"+sessionBean.sessionSeq;
44
+        sessionList.add(sessionBean);
45
+        return sessionBean;
46
+    }
34 47
 }

+ 3 - 10
app/src/main/res/layout/activity_session.xml

@@ -76,17 +76,10 @@
76 76
         android:layout_height="match_parent"
77 77
         android:layout_below="@id/title_bar_with_back_btn">
78 78
 
79
-        <android.support.v4.widget.SwipeRefreshLayout
80
-            android:id="@+id/refresh_layout"
79
+        <android.support.v7.widget.RecyclerView
80
+            android:id="@+id/recycler_view_photos"
81 81
             android:layout_width="match_parent"
82
-            android:layout_height="match_parent">
83
-
84
-            <android.support.v7.widget.RecyclerView
85
-                android:id="@+id/recycler_view_photos"
86
-                android:layout_width="match_parent"
87
-                android:layout_height="match_parent" />
88
-
89
-        </android.support.v4.widget.SwipeRefreshLayout>
82
+            android:layout_height="match_parent" />
90 83
 
91 84
         <ImageButton
92 85
             android:id="@+id/btn_session_complete"

+ 7 - 13
app/src/main/res/layout/activity_upload.xml

@@ -21,7 +21,7 @@
21 21
                 android:layout_height="32dp"
22 22
                 android:layout_gravity="center_vertical"
23 23
                 android:layout_marginLeft="6dp"
24
-                android:src="@drawable/ic_launcher" />
24
+                android:src="@drawable/logo" />
25 25
 
26 26
             <TextView
27 27
                 android:layout_width="0dp"
@@ -43,18 +43,12 @@
43 43
         android:layout_centerInParent="true"
44 44
         android:src="@drawable/no_photo_tip" />
45 45
 
46
-    <android.support.v4.widget.SwipeRefreshLayout
47
-        android:id="@+id/swipe_refresh_layout_sessions"
46
+    <android.support.v7.widget.RecyclerView
47
+        android:id="@+id/recycler_view_sessions"
48 48
         android:layout_width="match_parent"
49 49
         android:layout_height="match_parent"
50
-        android:layout_below="@id/title_layout">
50
+        android:layout_below="@id/title_layout"/>
51 51
 
52
-        <android.support.v7.widget.RecyclerView
53
-            android:id="@+id/recycler_view_sessions"
54
-            android:layout_width="match_parent"
55
-            android:layout_height="match_parent" />
56
-
57
-    </android.support.v4.widget.SwipeRefreshLayout>
58 52
 
59 53
     <RelativeLayout
60 54
         android:layout_width="match_parent"
@@ -75,7 +69,7 @@
75 69
                 android:gravity="center_horizontal">
76 70
 
77 71
                 <ImageView
78
-                    android:id="@+id/iv_bt_status"
72
+                    android:id="@+id/iv_box_status"
79 73
                     android:layout_width="24dp"
80 74
                     android:layout_height="24dp"
81 75
                     android:layout_centerHorizontal="true"
@@ -83,10 +77,10 @@
83 77
                     android:src="@drawable/wifi_connect" />
84 78
 
85 79
                 <TextView
86
-                    android:id="@+id/tv_bt_status"
80
+                    android:id="@+id/tv_box_status"
87 81
                     android:layout_width="wrap_content"
88 82
                     android:layout_height="wrap_content"
89
-                    android:layout_below="@id/iv_bt_status"
83
+                    android:layout_below="@id/iv_box_status"
90 84
                     android:layout_centerHorizontal="true"
91 85
                     android:text="@string/bt_connected"
92 86
                     android:textColor="@color/grey"

Add api operator login · 49634dc097 - Gogs: Go Git Service

Add api operator login

Brightcells 8 gadi atpakaļ
vecāks
revīzija
49634dc097

+ 35 - 1
api/mch_views.py

@@ -2,10 +2,44 @@
2 2
 
3 3
 from __future__ import division
4 4
 
5
+from django.contrib.auth.hashers import check_password, make_password
5 6
 from django_response import response
6 7
 from logit import logit
7 8
 
8
-from mch.models import BrandInfo, DistributorInfo, LatestAppInfo, ModelInfo
9
+from mch.models import BrandInfo, DistributorInfo, LatestAppInfo, ModelInfo, OperatorInfo
10
+from utils.error.errno_utils import OperatorStatusCode
11
+
12
+
13
+@logit
14
+def login_api(request):
15
+    phone = request.POST.get('phone', '')
16
+    password = request.POST.get('password', '')
17
+
18
+    try:
19
+        operator = OperatorInfo.objects.get(phone=phone, status=True)
20
+    except OperatorInfo.DoesNotExist:
21
+        return response(OperatorStatusCode.OPERATOR_NOT_FOUND)
22
+
23
+    if operator.user_status == OperatorInfo.DISABLED:
24
+        return response(OperatorStatusCode.OPERATOR_NOT_ACTIVATED)
25
+
26
+    if not check_password(password, operator.encryption):
27
+        return response(OperatorStatusCode.OPERATOR_PASSWORD_ERROR)
28
+
29
+    brands = BrandInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
30
+    brands = [brand.data for brand in brands]
31
+
32
+    models = ModelInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
33
+    models = [model.data for model in models]
34
+
35
+    distributors = DistributorInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
36
+    distributors = [distributor.data for distributor in distributors]
37
+
38
+    return response(200, data={
39
+        'brands': brands,
40
+        'models': models,
41
+        'distributors': distributors,
42
+    })
9 43
 
10 44
 
11 45
 @logit

+ 5 - 1
api/urls.py

@@ -185,6 +185,10 @@ urlpatterns += [
185 185
 
186 186
 # Kodo
187 187
 urlpatterns += [
188
+    url(r'^api/login$', mch_views.login_api, name='login_api'),
189
+]
190
+
191
+urlpatterns += [
188 192
     url(r'^api/brands$', mch_views.brands_list, name='brands_list'),
189 193
     url(r'^api/models$', mch_views.models_list, name='models_list'),
190 194
     url(r'^api/distributors$', mch_views.distributors_list, name='distributors_list'),
@@ -196,5 +200,5 @@ urlpatterns += [
196 200
 ]
197 201
 
198 202
 urlpatterns += [
199
-    url(r'^api/upgrade$', mch_views.upgrade_api, name='upgrade_api2'),  # APP 升级
203
+    url(r'^api/upgrade$', mch_views.upgrade_api, name='upgrade_api'),  # APP 升级
200 204
 ]

+ 52 - 3
mch/admin.py

@@ -1,9 +1,30 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
+from django.conf import settings
3 4
 from django.contrib import admin
5
+from django.contrib.auth.hashers import check_password, make_password
4 6
 from pysnippets.strsnippets import strip
5 7
 
6
-from mch.models import BrandInfo, DistributorInfo, LatestAppInfo, ModelImageInfo, ModelInfo
8
+from mch.models import BrandInfo, DistributorInfo, LatestAppInfo, ModelImageInfo, ModelInfo, OperatorInfo
9
+
10
+
11
+class OperatorInfoAdmin(admin.ModelAdmin):
12
+    list_display = ('operator_id', 'phone', 'password', 'encryption', 'name', 'brand_id', 'brand_name', 'user_status', 'status', 'created_at', 'updated_at')
13
+    readonly_fields = ('encryption', 'brand_name')
14
+
15
+    def save_model(self, request, obj, form, change):
16
+        obj.phone = strip(obj.phone)
17
+        obj.password = strip(obj.password)
18
+        obj.encryption = make_password(obj.password, settings.MAKE_PASSWORD_SALT, settings.MAKE_PASSWORD_HASHER)
19
+        obj.password = ''
20
+
21
+        obj.brand_id = strip(obj.brand_id)
22
+        try:
23
+            obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name
24
+        except BrandInfo.DoesNotExist:
25
+            obj.brand_name = ''
26
+
27
+        obj.save()
7 28
 
8 29
 
9 30
 class BrandInfoAdmin(admin.ModelAdmin):
@@ -14,16 +35,43 @@ class ModelInfoAdmin(admin.ModelAdmin):
14 35
     list_display = ('brand_id', 'model_id', 'model_name', 'model_descr', 'position', 'status', 'created_at', 'updated_at')
15 36
     list_filter = ('brand_id', 'status')
16 37
 
38
+    def save_model(self, request, obj, form, change):
39
+        obj.brand_id = strip(obj.brand_id)
40
+        try:
41
+            obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name
42
+        except BrandInfo.DoesNotExist:
43
+            obj.brand_name = ''
44
+
45
+        obj.save()
46
+
17 47
 
18 48
 class ModelImageInfoAdmin(admin.ModelAdmin):
19
-    list_display = ('model_id', 'image', 'url', 'position', 'status', 'created_at', 'updated_at')
49
+    list_display = ('model_id', 'model_name', 'image', 'url', 'position', 'status', 'created_at', 'updated_at')
20 50
     list_filter = ('model_id', 'status')
21 51
 
52
+    def save_model(self, request, obj, form, change):
53
+        obj.model_id = strip(obj.model_id)
54
+        try:
55
+            obj.model_name = ModelInfo.objects.get(model_id=obj.model_id).model_name
56
+        except BrandInfo.DoesNotExist:
57
+            obj.model_name = ''
58
+
59
+        obj.save()
60
+
22 61
 
23 62
 class DistributorInfoAdmin(admin.ModelAdmin):
24
-    list_display = ('brand_id', 'distributor_id', 'distributor_name', 'distributor_descr', 'position', 'status', 'created_at', 'updated_at')
63
+    list_display = ('brand_id', 'brand_name', 'distributor_id', 'distributor_name', 'distributor_descr', 'position', 'status', 'created_at', 'updated_at')
25 64
     list_filter = ('brand_id', 'status')
26 65
 
66
+    def save_model(self, request, obj, form, change):
67
+        obj.brand_id = strip(obj.brand_id)
68
+        try:
69
+            obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name
70
+        except BrandInfo.DoesNotExist:
71
+            obj.brand_name = ''
72
+
73
+        obj.save()
74
+
27 75
 
28 76
 class LatestAppInfoAdmin(admin.ModelAdmin):
29 77
     list_display = ('latest_adr_version_code', 'latest_adr_version_name', 'latest_adr_app', 'latest_adr_url', 'status', 'created_at', 'updated_at')
@@ -36,6 +84,7 @@ class LatestAppInfoAdmin(admin.ModelAdmin):
36 84
         obj.save()
37 85
 
38 86
 
87
+admin.site.register(OperatorInfo, OperatorInfoAdmin)
39 88
 admin.site.register(BrandInfo, BrandInfoAdmin)
40 89
 admin.site.register(ModelInfo, ModelInfoAdmin)
41 90
 admin.site.register(ModelImageInfo, ModelImageInfoAdmin)

+ 51 - 0
mch/migrations/0005_auto_20180115_0021.py

@@ -0,0 +1,51 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.9 on 2018-01-14 16:21
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    dependencies = [
11
+        ('mch', '0004_latestappinfo'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.CreateModel(
16
+            name='OperatorInfo',
17
+            fields=[
18
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
19
+                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
20
+                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
21
+                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
22
+                ('operator_id', models.CharField(blank=True, db_index=True, help_text='\u64cd\u4f5c\u5458\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, unique=True, verbose_name='operator_id')),
23
+                ('phone', models.CharField(blank=True, db_index=True, help_text='\u64cd\u4f5c\u5458\u7535\u8bdd', max_length=16, null=True, verbose_name='phone')),
24
+                ('password', models.CharField(blank=True, help_text='\u64cd\u4f5c\u5458\u5bc6\u7801', max_length=255, null=True, verbose_name='password')),
25
+                ('encryption', models.CharField(blank=True, help_text='\u64cd\u4f5c\u5458\u5bc6\u7801', max_length=255, null=True, verbose_name='encryption')),
26
+                ('name', models.CharField(blank=True, help_text='\u64cd\u4f5c\u5458\u59d3\u540d', max_length=255, null=True, verbose_name='name')),
27
+                ('brand_id', models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id')),
28
+                ('brand_name', models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name')),
29
+                ('user_status', models.IntegerField(choices=[(1, '\u5df2\u6fc0\u6d3b'), (2, '\u5df2\u7981\u7528')], db_index=True, default=1, help_text='\u64cd\u4f5c\u5458\u72b6\u6001', verbose_name='user_status')),
30
+            ],
31
+            options={
32
+                'verbose_name': '\u64cd\u4f5c\u5458\u4fe1\u606f',
33
+                'verbose_name_plural': '\u64cd\u4f5c\u5458\u4fe1\u606f',
34
+            },
35
+        ),
36
+        migrations.AddField(
37
+            model_name='distributorinfo',
38
+            name='brand_name',
39
+            field=models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name'),
40
+        ),
41
+        migrations.AddField(
42
+            model_name='modelimageinfo',
43
+            name='model_name',
44
+            field=models.CharField(blank=True, help_text='\u578b\u53f7\u540d\u79f0', max_length=255, null=True, verbose_name='model_name'),
45
+        ),
46
+        migrations.AddField(
47
+            model_name='modelinfo',
48
+            name='brand_name',
49
+            field=models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name'),
50
+        ),
51
+    ]

+ 21 - 0
mch/migrations/0006_auto_20180115_0047.py

@@ -0,0 +1,21 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.9 on 2018-01-14 16:47
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations
6
+import shortuuidfield.fields
7
+
8
+
9
+class Migration(migrations.Migration):
10
+
11
+    dependencies = [
12
+        ('mch', '0005_auto_20180115_0021'),
13
+    ]
14
+
15
+    operations = [
16
+        migrations.AlterField(
17
+            model_name='operatorinfo',
18
+            name='operator_id',
19
+            field=shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='\u64cd\u4f5c\u5458\u552f\u4e00\u6807\u8bc6', max_length=22, null=True, unique=True),
20
+        ),
21
+    ]

+ 33 - 0
mch/models.py

@@ -6,6 +6,36 @@ from models_ext import BaseModelMixin, upload_file_url, upload_path
6 6
 from shortuuidfield import ShortUUIDField
7 7
 
8 8
 
9
+class OperatorInfo(BaseModelMixin):
10
+    ACTIVATED = 1
11
+    DISABLED = 2
12
+
13
+    USER_STATUS_TUPLE = (
14
+        (ACTIVATED, u'已激活'),
15
+        (DISABLED, u'已禁用'),
16
+    )
17
+
18
+    operator_id = ShortUUIDField(_(u'operator_id'), max_length=32, blank=True, null=True, help_text=u'操作员唯一标识', db_index=True, unique=True)
19
+
20
+    phone = models.CharField(_(u'phone'), max_length=16, blank=True, null=True, help_text=u'操作员电话', db_index=True)
21
+    password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'操作员密码')
22
+    encryption = models.CharField(_(u'encryption'), max_length=255, blank=True, null=True, help_text=u'操作员密码')
23
+
24
+    name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'操作员姓名')
25
+
26
+    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
27
+    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
28
+
29
+    user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS_TUPLE, default=ACTIVATED, help_text=u'操作员状态', db_index=True)
30
+
31
+    class Meta:
32
+        verbose_name = _(u'操作员信息')
33
+        verbose_name_plural = _(u'操作员信息')
34
+
35
+    def __unicode__(self):
36
+        return u'{}-{}'.format(self.name, self.phone)
37
+
38
+
9 39
 class BrandInfo(BaseModelMixin):
10 40
     brand_id = ShortUUIDField(_(u'brand_id'), max_length=32, help_text=u'品牌唯一标识', db_index=True, unique=True)
11 41
     brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
@@ -37,6 +67,7 @@ class BrandInfo(BaseModelMixin):
37 67
 
38 68
 class ModelInfo(BaseModelMixin):
39 69
     brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
70
+    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
40 71
 
41 72
     model_id = ShortUUIDField(_(u'model_id'), max_length=32, help_text=u'型号唯一标识', db_index=True, unique=True)
42 73
     model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称')
@@ -67,6 +98,7 @@ class ModelInfo(BaseModelMixin):
67 98
 
68 99
 class ModelImageInfo(BaseModelMixin):
69 100
     model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True)
101
+    model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称')
70 102
 
71 103
     image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, null=True, help_text=u'图片')
72 104
     url = models.CharField(_(u'url'), max_length=255, blank=True, null=True, help_text=u'链接')
@@ -94,6 +126,7 @@ class ModelImageInfo(BaseModelMixin):
94 126
 
95 127
 class DistributorInfo(BaseModelMixin):
96 128
     brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
129
+    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
97 130
 
98 131
     distributor_id = ShortUUIDField(_(u'distributor_id'), max_length=32, help_text=u'经销商唯一标识', db_index=True, unique=True)
99 132
     distributor_name = models.CharField(_(u'distributor_name'), max_length=255, blank=True, null=True, help_text=u'经销商名称')

+ 4 - 0
pai2/settings.py

@@ -314,6 +314,10 @@ LOGIT_RES_FLAG = True
314 314
 # Django-Admin Settings
315 315
 DISABLE_ACTION = False
316 316
 
317
+# KODO 设置
318
+MAKE_PASSWORD_SALT = ''
319
+MAKE_PASSWORD_HASHER = ''
320
+
317 321
 # 错误信息邮件设置
318 322
 # Email address that error messages come from.
319 323
 SERVER_EMAIL = 'kimi@pai.ai'

+ 9 - 0
utils/error/errno_utils.py

@@ -29,6 +29,15 @@ class TourGuideStatusCode(BaseStatusCode):
29 29
     TOURGUIDE_NOT_ACTIVATED = StatusCodeField(400115, 'Tour Guide Not Activated', description=u'导游帐号未激活')
30 30
 
31 31
 
32
+class OperatorStatusCode(BaseStatusCode):
33
+    """ 操作员相关错误码 4002xx """
34
+    OPERATOR_NOT_FOUND = StatusCodeField(400201, 'Operator Not Found', description=u'操作员不存在')
35
+    # 密码
36
+    OPERATOR_PASSWORD_ERROR = StatusCodeField(400202, 'Operator Password Error', description=u'操作员密码错误')
37
+    # 状态
38
+    OPERATOR_NOT_ACTIVATED = StatusCodeField(400215, 'Operator Not Activated', description=u'操作员未激活')
39
+
40
+
32 41
 class UserStatusCode(BaseStatusCode):
33 42
     """ 用户相关错误码  4005xx """
34 43
     USER_NOT_FOUND = StatusCodeField(400501, 'User Not Found', description=u'用户不存在')