""> 110
+            cancel: function (res) {
111
+                // alert('已取消')
112
+                if (JSWE.wxCancel) {JSWE.wxCancel(res)}
113
+            },
114
+            fail: function (res) {
115
+                // alert(JSON.stringify(res))
116
+                if (JSWE.wxFail) {JSWE.wxFail(res)}
117
+            }
118
+        }, shareInfo = function(flag) {
119
+            var _share = {
120
+                title: flag ? wxData.title : (wxData.timeLine || wxData.desc),
121
+                link: wxData.link,
122
+                imgUrl: wxData.imgUrl,
123
+                trigger: callbacks.trigger,
124
+                success: callbacks.success,
125
+                cancel: callbacks.cancel,
126
+                fail: callbacks.fail
127
+            }
128
+            if (flag) _share.desc = wxData.desc
129
+            return _share
130
+        }, wxShareApi = function() {
131
+            // 2. 分享接口
132
+            // 2.1 监听“分享给朋友”,按钮点击、自定义分享内容及分享结果接口
133
+            wx.onMenuShareAppMessage(shareInfo(1))
134
+            // 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
135
+            wx.onMenuShareTimeline(shareInfo(0))
136
+            // 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口
137
+            wx.onMenuShareQQ(shareInfo(1))
138
+            // 2.4 监听“分享到微博”按钮点击、自定义分享内容及分享结果接口
139
+            wx.onMenuShareWeibo(shareInfo(1))
140
+        }, wxMenuApi = function () {
141
+            // 8. 界面操作接口
142
+            // 8.1 隐藏右上角菜单
143
+            // 8.2 显示右上角菜单
144
+            if (wxConfig.hide) {wx.hideOptionMenu()} else {wx.showOptionMenu()}
145
+            // 8.7 关闭当前窗口
146
+            if (wxConfig.close) {wx.closeWindow()}
147
+        }, wxApi = function () {
148
+            wxShareApi()
149
+            wxMenuApi()
150
+        }
151
+
152
+        wx.ready(wxApi)
153
+
154
+        return wxApiFun = wxApi
155
+    }
156
+
157
+    if (isOpenInWeixin() || isOpenOnPC()) {
158
+        if ('undefined' !== typeof JSWE_CONF_UPDATE) JSWE_CONF_UPDATE(config)
159
+        $.ajax({
160
+            url: config.wxconfig,
161
+            type: 'get',
162
+            dataType: 'jsonp',
163
+            jsonpCallback: config.callback,
164
+            data: {
165
+                url: window.location.href.split('#')[0]
166
+            },
167
+            success: wxReady
168
+        })
169
+    }
170
+
171
+    function initWxData(data, flag) {
172
+        for(var d in data) {if (d in wxData) wxData[d] = data[d]}
173
+        if (flag) fixedWxData()
174
+    }
175
+
176
+    function changeWxData(key, value, flag) {
177
+        if (key in falDwxDataata) {wxData[key] = value}
178
+        if (flag) fixedWxData()
179
+    }
180
+
181
+    function fixedWxData() {
182
+        if ('undefined' !== typeof wxApiFun) wxApiFun()
183
+    }
184
+
185
+    // 5 图片接口
186
+    // 5.1 拍照、本地选图
187
+    var images = {
188
+        localIds: [],
189
+        serverIds: []
190
+    };
191
+    function chooseImage(count, directUpload, isShowProgressTips) {
192
+        if ('undefined' === typeof count) {count = 9}
193
+        if ('undefined' === typeof directUpload) {directUpload = false}
194
+        if ('undefined' === typeof isShowProgressTips) {isShowProgressTips = 1}
195
+        wx.chooseImage({
196
+            count: count, // 默认9
197
+            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
198
+            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
199
+            success: function (res) {
200
+                var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
201
+                images.localIds = localIds;
202
+                // 判断是否直接上传
203
+                if (directUpload) {setTimeout(uploadImages(localIds, isShowProgressTips), 100)}
204
+                // 拍照、本地选图成功后的回调函数
205
+                if (JSWE.wxChooseImageSuccess) {JSWE.wxChooseImageSuccess(res)}
206
+            }
207
+        });
208
+    }
209
+
210
+    // 5.3 上传图片
211
+    function uploadImage(localId, isShowProgressTips) {
212
+        // 上传图片为异步处理,重复上传同一图片,返回的serverId也是不同的
213
+        wx.uploadImage({
214
+            localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
215
+            isShowProgressTips: 1, // 默认为1,显示进度提示
216
+            success: function (res) {
217
+                var serverId = res.serverId; // 返回图片的服务器端ID
218
+                images.serverIds.push(serverId);
219
+                // 上传图片成功后的回调函数
220
+                if (JSWE.wxUploadImageSuccess) {JSWE.wxUploadImageSuccess(res)}
221
+            }
222
+        });
223
+    }
224
+
225
+    function uploadImages(localIds, isShowProgressTips) {
226
+        if ('undefined' === typeof localIds) {localIds = images.localIds}
227
+        if ('undefined' === typeof isShowProgressTips) {isShowProgressTips = 1}
228
+        images.serverIds = [];
229
+        for (var index in localIds) {uploadImage(localIds[index], isShowProgressTips)}
230
+    }
231
+
232
+    // 10 微信支付接口
233
+    // 10.1 发起一个支付请求
234
+    function chooseWXPay(wxpay_params) {
235
+        wx.chooseWXPay({
236
+            timestamp: wxpay_params.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
237
+            nonceStr: wxpay_params.nonceStr, // 支付签名随机串,不长于 32 位
238
+            package: wxpay_params.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
239
+            signType: wxpay_params.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
240
+            paySign: wxpay_params.paySign, // 支付签名
241
+            success: function (res) {
242
+                // 支付成功后的回调函数
243
+                if (JSWE.wxPaySuccess) {JSWE.wxPaySuccess(res)}
244
+            }
245
+        })
246
+    }
247
+
248
+    // xx 微信原生企业红包接口
249
+    // xx.1 发起一个发送原生企业红包请求
250
+    function openEnterpriseRedPacket(wxredpack_params) {
251
+        wx.openEnterpriseRedPacket({
252
+            timeStamp: wxredpack_params.timeStamp, // 红包签名时间戳,注意原生企业红包接口timeStamp字段名需大写其中的S字符,而支付接口timeStamp字段名无需大写其中的S字符。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
253
+            nonceStr: wxredpack_params.nonceStr, // 红包签名随机串,不长于 32 位
254
+            package: encodeURIComponent(wxredpack_params.package), // 发放红包接口返回的prepay_id参数值,提交格式如:prepay_id=***)
255
+            signType: wxredpack_params.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
256
+            paySign: wxredpack_params.paySign, // 红包签名
257
+            success: function (res) {
258
+                // 发送原生企业红包成功后的回调函数
259
+                if (JSWE.wxEnterpriseRedPacketSuccess) {JSWE.wxEnterpriseRedPacketSuccess(res)}
260
+            }
261
+        })
262
+    }
263
+
264
+    var v = {
265
+        version: '1.0.5',
266
+
267
+        // Basic Vars
268
+        config: config,
269
+        wxData: wxData,
270
+        jsApiList: jsApiList,
271
+
272
+        // Weixin Function
273
+        isOpenInWeixin: isOpenInWeixin,
274
+        getWeixinVersion: getWeixinVersion,
275
+        isWeixinVersion: isWeixinVersion,
276
+
277
+        // Menu Function
278
+        hideOptionMenu: hideOptionMenu,
279
+        showOptionMenu: showOptionMenu,
280
+        closeWindow: closeWindow,
281
+
282
+        // Share Function
283
+        initWxData: initWxData,
284
+        changeWxData: changeWxData,
285
+        fixedWxData: fixedWxData,
286
+
287
+        // Image Function
288
+        images: images,
289
+        chooseImage: chooseImage,
290
+        uploadImage: uploadImage,
291
+        uploadImages: uploadImages,
292
+
293
+        // Pay Function
294
+        chooseWXPay: chooseWXPay,
295
+
296
+        // EnterpriseRedPacket Function
297
+        openEnterpriseRedPacket: openEnterpriseRedPacket
298
+    }
299
+    e.JSWE = e.V = v
300
+})(window)

+ 33 - 0
tamron/urls.py

@@ -0,0 +1,33 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+"""tamron URL Configuration
4
+
5
+The `urlpatterns` list routes URLs to views. For more information please see:
6
+    https://docs.djangoproject.com/en/1.8/topics/http/urls/
7
+Examples:
8
+Function views
9
+    1. Add an import:  from my_app import views
10
+    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
11
+Class-based views
12
+    1. Add an import:  from other_app.views import Home
13
+    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
14
+Including another URLconf
15
+    1. Add an import:  from blog import urls as blog_urls
16
+    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
17
+"""
18
+from django.conf.urls import include, url
19
+from django.contrib import admin
20
+
21
+from page import info_views, oauth_views, sale_views
22
+
23
+
24
+urlpatterns = [
25
+    url(r'^admin/', include(admin.site.urls)),
26
+    url(r'^api/', include('api.urls', namespace='api')),
27
+]
28
+
29
+urlpatterns += [
30
+    url(r'^page/clerk$', oauth_views.clerk_oauth, name='clerk_oauth'),  # 店员授权页面
31
+    url(r'^page/clerk/sale$', sale_views.clerk_sale_oauth, name='clerk_sale_oauth'),  # 店员销售授权页面
32
+    url(r'^page/clerk/info$', info_views.clerk_info_oauth, name='clerk_info_oauth'),  # 店员信息授权页面
33
+]

BIN
tamron/urls.pyc


+ 2 - 0
tamron/uwsgi.bak/shutdown.sh

@@ -0,0 +1,2 @@
1
+killall -9 uwsgi
2
+echo "2敏加油~~~!!!↖(^ω^)↗"

+ 2 - 0
tamron/uwsgi.bak/startup.sh

@@ -0,0 +1,2 @@
1
+nohup uwsgi --ini pai2.ini &>pai2.log &
2
+echo "Start Success !!!"

+ 27 - 0
tamron/uwsgi.bak/tamron.ini

@@ -0,0 +1,27 @@
1
+# tamron_uwsgi.ini file
2
+[uwsgi]
3
+
4
+# Django-related settings
5
+# the base directory (full path)
6
+chdir           = /home/paiai/work/tamron
7
+# Django's wsgi file
8
+module          = tamron.wsgi
9
+# the virtualenv (full path)
10
+# home            = /path/to/virtualenv
11
+
12
+# process-related settings
13
+# master
14
+master          = true
15
+# maximum number of worker processes
16
+processes       = 10
17
+# the socket (use the full path to be safe
18
+socket          = /home/paiai/work/tamron/tamron/uwsgi/tamron.sock
19
+# ... with appropriate permissions - may be needed
20
+chmod-socket    = 777
21
+# clear environment on exit
22
+vacuum          = true
23
+
24
+# 11: Resource temporarily unavailable
25
+reload-mercy    = 64
26
+max-requests    = 8192
27
+listen          = 4096

+ 35 - 0
tamron/uwsgi.bak/tamron_nginx.conf

@@ -0,0 +1,35 @@
1
+# tamron_nginx.conf
2
+
3
+# the upstream component nginx needs to connect to
4
+upstream pai2 {
5
+    # server unix:///home/paiai/work/tamron/tamron/uwsgi/tamron.sock; # for a file socket
6
+    server 127.0.0.1:8888; # for a web port socket (we'll use this first)
7
+}
8
+
9
+# configuration of the server
10
+server {
11
+    # the port your site will be served on
12
+    listen      80;
13
+    # the domain name it will serve for
14
+    server_name .tamron.xfoto.com.cn; # substitute your machine's IP address or FQDN
15
+    charset     utf-8;
16
+
17
+    # max upload size
18
+    client_max_body_size 75M;   # adjust to taste
19
+
20
+    # Django media
21
+    location /media  {
22
+        alias /home/paiai/work/tamron/media;  # your Django project's media files - amend as required
23
+    }
24
+
25
+    location /static {
26
+        alias /home/paiai/work/tamron/collect_static; # your Django project's static files - amend as required
27
+    }
28
+
29
+    # Finally, send all non-media requests to the Django server.
30
+    location / {
31
+        # uwsgi_pass  tamron;
32
+        proxy_pass  http://tamron;
33
+        include     /home/paiai/work/tamron/tamron/uwsgi/uwsgi_params; # the uwsgi_params file you installed
34
+    }
35
+}

+ 15 - 0
tamron/uwsgi.bak/uwsgi_params

@@ -0,0 +1,15 @@
1
+uwsgi_param	QUERY_STRING		$query_string;
2
+uwsgi_param	REQUEST_METHOD		$request_method;
3
+uwsgi_param	CONTENT_TYPE		$content_type;
4
+uwsgi_param	CONTENT_LENGTH		$content_length;
5
+
6
+uwsgi_param	REQUEST_URI		$request_uri;
7
+uwsgi_param	PATH_INFO		$document_uri;
8
+uwsgi_param	DOCUMENT_ROOT		$document_root;
9
+uwsgi_param	SERVER_PROTOCOL		$server_protocol;
10
+uwsgi_param	UWSGI_SCHEME		$scheme;
11
+
12
+uwsgi_param	REMOTE_ADDR		$remote_addr;
13
+uwsgi_param	REMOTE_PORT		$remote_port;
14
+uwsgi_param	SERVER_PORT		$server_port;
15
+uwsgi_param	SERVER_NAME		$server_name;

+ 17 - 0
tamron/wsgi.py

@@ -0,0 +1,17 @@
1
+"""
2
+WSGI config for tamron project.
3
+
4
+It exposes the WSGI callable as a module-level variable named ``application``.
5
+
6
+For more information on this file, see
7
+https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
8
+"""
9
+
10
+import os
11
+
12
+from django.core.wsgi import get_wsgi_application
13
+
14
+
15
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tamron.settings")
16
+
17
+application = get_wsgi_application()

BIN
tamron/wsgi.pyc


+ 0 - 0
utils/__init__.py


BIN
utils/__init__.pyc


+ 0 - 0
utils/error/__init__.py


BIN
utils/error/__init__.pyc


+ 62 - 0
utils/error/errno_utils.py

@@ -0,0 +1,62 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from StatusCode import BaseStatusCode, StatusCodeField
4
+
5
+
6
+class FranchiserStatusCode(BaseStatusCode):
7
+    """ 店员相关错误码 4001xx """
8
+    CHISER_NOT_FOUND = StatusCodeField(400001, 'Chiser Not Found', description=u'经销商不存在')
9
+
10
+
11
+class SaleclerkStatusCode(BaseStatusCode):
12
+    """ 店员相关错误码 4001xx """
13
+    CLERK_NOT_FOUND = StatusCodeField(400101, 'Clerk Not Found', description=u'店员不存在')
14
+    # 手机号
15
+    CLERK_PHONE_ALREADY_EXISTS = StatusCodeField(400105, 'Clerk Phone Already Exists', description=u'手机号已经存在')
16
+    # 状态
17
+    CLERK_ALREADY_NOT_UNVERIFIED = StatusCodeField(400110, 'Clerk Already Not Unverified', description=u'店员帐号已激活')
18
+    CLERK_NOT_ACTIVATED = StatusCodeField(400115, 'Clerk Not Activated', description=u'店员帐号未激活')
19
+
20
+
21
+class ProductModelStatusCode(BaseStatusCode):
22
+    """ 型号相关错误码 4010xx """
23
+    MODEL_NOT_FOUND = StatusCodeField(401001, 'Model Not Found', description=u'型号不存在')
24
+
25
+
26
+class ProductStatusCode(BaseStatusCode):
27
+    """ 产品相关错误码 4020xx """
28
+    PRODUCT_NOT_FOUND = StatusCodeField(402001, 'Product Not Found', description=u'产品不存在')
29
+    # 状态
30
+    PRODUCT_HAS_USED = StatusCodeField(402011, 'Product Has Used', description=u'产品已使用')
31
+
32
+
33
+class OrderStatusCode(BaseStatusCode):
34
+    """ 订单/支付相关错误码 4040xx """
35
+    WX_UNIFIED_ORDER_FAIL = StatusCodeField(404000, 'WX Unified Order Fail', description=u'微信统一下单失败')
36
+    WX_ORDER_NOT_FOUND = StatusCodeField(404001, 'WX Order Not Found', description=u'订单不存在')
37
+    WX_ORDER_NOT_PAY = StatusCodeField(404002, 'WX Order Not Pay', description=u'订单未支付')
38
+    WX_ORDER_PAYING = StatusCodeField(404003, 'WX Order Paying', description=u'订单支付中')
39
+    WX_ORDER_PAY_FAIL = StatusCodeField(404009, 'WX Order Pay Fail', description=u'微信支付失败')
40
+    SIGN_CHECK_FAIL = StatusCodeField(404010, 'Sign Check Fail', description=u'签名校验失败')
41
+    FEE_CHECK_FAIL = StatusCodeField(404011, 'FEE Check Fail', description=u'金额校验失败')
42
+    NO_DETAIL_PERMISSION = StatusCodeField(404015, 'No Detail Permission', description=u'无详情权限')
43
+    WX_ORDER_PAID_ALREADY_EXISTS = StatusCodeField(404020, 'WX Order Paid Already Exists', description=u'照片已购买')
44
+
45
+
46
+class PayStatusCode(BaseStatusCode):
47
+    """ 支付相关错误码 4041xx """
48
+
49
+
50
+class WithdrawStatusCode(BaseStatusCode):
51
+    """ 提现相关错误码 4042xx """
52
+    BALANCE_NOT_ENOUGH = StatusCodeField(404200, 'Balance Not Enough', description=u'提现金额不足')
53
+
54
+
55
+class MessageStatusCode(BaseStatusCode):
56
+    """ 消息相关错误码 4090xx """
57
+    MESSAGE_NOT_FOUND = StatusCodeField(409001, 'Message Not Found', description=u'消息不存在')
58
+
59
+
60
+class TokenStatusCode(BaseStatusCode):
61
+    """ 票据相关错误码 4090xx """
62
+    TOKEN_NOT_FOUND = StatusCodeField(409901, 'Token Not Found', description=u'票据不存在')

BIN
utils/error/errno_utils.pyc


+ 18 - 0
utils/error/response_utils.py

@@ -0,0 +1,18 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.http import JsonResponse
4
+from StatusCode import StatusCodeField
5
+
6
+
7
+def response_data(status_code=200, message=None, description=None, data={}, **kwargs):
8
+    return dict({
9
+        'status': status_code,
10
+        'message': message,
11
+        'description': description,
12
+        'data': data,
13
+    }, **kwargs)
14
+
15
+
16
+def response(status_code=200, message=None, description=None, data={}, **kwargs):
17
+    message, description = (message or status_code.message, description or status_code.description) if isinstance(status_code, StatusCodeField) else (message, description)
18
+    return JsonResponse(response_data(status_code, message, description, data, **kwargs), safe=False)

BIN
utils/error/response_utils.pyc


+ 0 - 0
utils/redis/__init__.py


BIN
utils/redis/__init__.pyc


+ 6 - 0
utils/redis/connect.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.conf import settings
4
+
5
+
6
+r = settings.REDIS_CACHE

BIN
utils/redis/connect.pyc


+ 68 - 0
utils/redis/rkeys.py

@@ -0,0 +1,68 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+# 唯一标识相关
4
+UUID_LIST = 'uuid:list'  # List,唯一标识列表
5
+
6
+# 用户相关
7
+PROFILE_INFO = 'profile:info:%s'  # STRING,用户信息,user_id
8
+
9
+# 导游相关
10
+TOUR_GUIDE_GROUP_GEO_INFO = 'tour:guide:group:geo:info:%s'  # ZSET,旅游团地理位置信息,group_id
11
+TOUR_GUIDE_GROUP_GEO_SUBMIT_DT = 'tour:guide:group:geo:submit:dt:%s'  # ZSET,旅游团地理位置最后上传时间,group_id
12
+TOUR_GUIDE_GROUP_CUR_SESSION = 'tour:guide:group:cur:session:%s'  # STRING,旅游团当前Session,group_id,导游设置集合时间的时候更新
13
+TOUR_GUIDE_GROUP_CUR_GATHER_INFO = 'tour:guide:group:cur:gather:info:%s'  # STRING,旅游团当前Session,group_id,导游设置集合时间的时候更新
14
+TOUR_GUIDE_GROUP_USER_GEO_LIST = 'tour:guide:group:user:geo:list:%s:%s:%s'  # LIST,旅游团当前用户地理位置列表,group_id、session_id、user_id
15
+
16
+TOUR_GUIDE_GROUP_USER_OWN = 'tour:guide:group:user:own:%s'  # STRING,导游当前拥有的旅行团,user_id,导游创建旅行团的时候更新
17
+TOUR_GUIDE_GROUP_USER_BELONG = 'tour:guide:group:user:belong:%s'  # STRING,用户当前所属旅行团,user_id,用户加入旅行团的时候更新
18
+
19
+# 群组相关
20
+GROUP_INFO = 'group:info:%s'  # STRING,群组信息,group_id
21
+
22
+# 群组用户相关
23
+GROUP_USERS_INFO = 'group:users:info:%s'  # STRING,群组用户信息,group_id
24
+GROUP_USERS_KV_INFO = 'group:users:kv:info:%s'  # STRING,群组用户信息,group_id
25
+GROUP_USERS_APPLYING_SET = 'group:users:applying:set:%s'  # SET,群组用户申请集合,group_id
26
+GROUP_USERS_PASSED_SET = 'group:users:passed:set:%s'  # SET,群组用户通过集合,group_id
27
+GROUP_USERS_REFUSED_SET = 'group:users:refused:set:%s'  # SET,群组用户拒绝集合,group_id
28
+GROUP_USERS_DELETED_SET = 'group:users:deleted:set:%s'  # SET,群组用户移除集合,group_id
29
+GROUP_USERS_QUIT_SET = 'group:users:quit:set:%s'  # SET,群组用户退出集合,group_id
30
+
31
+# 群组照片相关
32
+GROUP_PHOTO_DATA = 'group:photo:data:%s'  # STRING,群组数据记录,group_id
33
+GROUP_PHOTO_THUMB_UP = 'group:photo:thumb:up:%s:%s'  # STRING,群组照片用户点赞记录,photo_id、user_id
34
+GROUP_PHOTO_COMMENT_LIST = 'group:photo:comment:list:%s'  # STRING,群组照片用户评论列表,photo_id
35
+GROUP_PHOTO_THUMB_UP_LIST = 'group:photo:thumb:up:list:%s'  # STRING,群组照片用户点赞列表,photo_id
36
+GROUP_PHOTO_WATCHER_SET = 'group:photo:watcher:set:%s'  # SET,群组照片用户关注集合,photo_id,关注即评论点赞
37
+GROUP_LAST_PHOTO_PK = 'group:last:photo:pk:%s'  # STRING,群组最后一张照片PK,group_id
38
+
39
+# 摄影师照片相关
40
+LENSMAN_PHOTO_ORDER_RECORD = 'lensman:photo:order:record:%s:%s'  # STRING,摄影师照片购买记录,photo_id、user_id
41
+
42
+# 摄影师简报相关
43
+# 收入
44
+TOTAL_INCOME = 'total:income:%s:%s'  # STRING,总收入,user_id、photo_type
45
+WEEK_INCOME = 'week:income:%s:%s:%s'  # STRING,周收入,user_id、photo_type、Week.thisweek().isoformat()
46
+TODAY_INCOME = 'today:income:%s:%s:%s'  # STRING,日收入,user_id、photo_type、tc.local_string(format='%Y%m%d')
47
+# 上传
48
+TODAY_UPLOAD_PHOTO_AMOUNT = 'today:upload:photo:amount:%s:%s'  # STRING,日上传照片数量,user_id、tc.local_string(format='%Y%m%d')
49
+# 售出
50
+WEEK_SOLD = 'week:sold:%s:%s:%s'  # STRING,周售出,user_id、photo_type、Week.thisweek().isoformat()
51
+
52
+# 摄影师定价相关
53
+LENSMAN_PHOTO_PRICE_FIXED = 'lensman:photo:price:fixed:%s'  # STRING,摄影师照片定价(单位:分),user_id
54
+
55
+# 系统消息相关
56
+SYSTEM_MESSAGE_READ_INFO = 'system:message:read:info:%s'  # STRING,系统消息读取信息,user_id
57
+SYSTEM_MESSAGE_DELETED_INFO = 'system:message:deleted:info:%s'  # STRING,系统消息删除信息,user_id
58
+
59
+# 游客入口相关
60
+GUEST_ENTRANCE_CONTROL_INFO = 'guest:entrance:control:info:%s'  # STRING,游客入口控制信息,src
61
+
62
+# APP 相关
63
+LATEST_APP_INFO = 'latest:app:info:%s'  # STRING,最新 APP 信息,src
64
+APP_SETTINGS_INFO = 'app:settings:info:%s:%s:%s'  # STRING,APP 设置信息,platform、channel、version
65
+APP_PATCH_INFO = 'app:patch:info:%s:%s:%s'  # STRING,APP 补丁信息,platform、version、src
66
+
67
+# BOX 相关
68
+BOX_PROGRAM_VERSION_INFO = 'box:program:version:info'  # STRING,BOX 程序版本信息

kodo - Gogs: Go Git Service

暫無描述

models.py 6.5KB

    # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django_models_ext import BaseModelMixin, upload_file_url, upload_path from kodo.basemodels import PaiaiSrcMixin, PlatformMixin, VersionMixin class LatestAppInfo(BaseModelMixin, PaiaiSrcMixin): latest_adr_version_code = models.IntegerField(_(u'latest_adr_version_code'), default=0, help_text=u'最新安卓版本号') latest_adr_version_name = models.CharField(_(u'latest_adr_version_name'), max_length=16, blank=True, null=True, help_text=u'最新安卓版本名') latest_adr_app = models.FileField(_(u'latest_adr_app'), upload_to=upload_path, blank=True, null=True, help_text=u'最新版安卓 APP') latest_adr_url = models.URLField(_(u'latest_adr_url'), max_length=255, blank=True, null=True, help_text=u'最新版 APP 链接') latest_ios_version_code = models.IntegerField(_(u'latest_ios_version_code'), default=0, help_text=u'最新 iOS 版本号') latest_ios_version_name = models.CharField(_(u'latest_ios_version_name'), max_length=16, blank=True, null=True, help_text=u'最新 iOS 版本名') latest_ios_url = models.URLField(_(u'latest_ios_url'), max_length=255, blank=True, null=True, help_text=u'最新版 iOS 链接') class Meta: verbose_name = _('latestappinfo') verbose_name_plural = _('latestappinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def final_latest_adr_url(self): return self.latest_adr_url or upload_file_url(self.latest_adr_app) @property def data(self): return { 'latest_adr_version_code': self.latest_adr_version_code, 'latest_adr_version_name': self.latest_adr_version_name, 'latest_adr_url': self.final_latest_adr_url, 'latest_ios_version_code': self.latest_ios_version_code, 'latest_ios_version_name': self.latest_ios_version_name, 'latest_ios_url': self.latest_ios_url, } class PatchInfo(BaseModelMixin, PlatformMixin, PaiaiSrcMixin): version = models.CharField(_(u'version'), max_length=16, blank=True, null=True, help_text=u'版本(1.0.0)') patch = models.FileField(_(u'patch'), upload_to=upload_path, blank=True, null=True, help_text=u'补丁') class Meta: verbose_name = _('patchinfo') verbose_name_plural = _('patchinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def patch_url(self): return upload_file_url(self.patch) @property def data(self): return { 'patch_url': self.patch_url, } class APPSettingsInfo(BaseModelMixin, PlatformMixin, PaiaiSrcMixin): channel = models.CharField(_(u'channel'), max_length=16, blank=True, null=True, help_text=u'渠道') version = models.CharField(_(u'version'), max_length=16, blank=True, null=True, help_text=u'版本(1.0.0)') online = models.BooleanField(_(u'online'), default=True, help_text=u'是否上线') class Meta: verbose_name = _('appsettingsinfo') verbose_name_plural = _('appsettingsinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def data(self): return { 'online': self.online, } class SplashInfo(BaseModelMixin, PaiaiSrcMixin): splash_image = models.ImageField(_(u'splash_image'), upload_to=upload_path, blank=True, null=True, help_text=u'启动页面图片') spalash_image_airtime = models.DateTimeField(_(u'spalash_image_airtime'), blank=True, null=True, help_text=u'启动页面图片开始日期') spalash_image_deadline = models.DateTimeField(_(u'spalash_image_deadline'), blank=True, null=True, help_text=u'启动页面图片截止日期') class Meta: verbose_name = _('splashinfo') verbose_name_plural = _('splashinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def splash_image_url(self): return upload_file_url(self.splash_image) @property def data(self): return { 'splash_image_url': self.splash_image_url, 'spalash_image_airtime': self.spalash_image_airtime, 'spalash_image_deadline': self.spalash_image_deadline, } class FeedbackInfo(BaseModelMixin, PaiaiSrcMixin): user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识') feedback = models.TextField(_(u'feedback'), blank=True, null=True, help_text=u'用户反馈') class Meta: verbose_name = _('feedbackinfo') verbose_name_plural = _('feedbackinfo') def __unicode__(self): return u'{0.pk}'.format(self) class GuestEntranceControlInfo(BaseModelMixin, PlatformMixin, VersionMixin, PaiaiSrcMixin): class Meta: verbose_name = _('guestentrancecontrolinfo') verbose_name_plural = _('guestentrancecontrolinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def data(self): return { 'platform': self.platform, 'min_adr': self.min_adr, 'min_ios': self.min_ios, 'max_adr': self.max_adr, 'max_ios': self.max_ios, } class BoxProgramVersionInfo(BaseModelMixin): srv_version_code = models.IntegerField(_(u'srv_version_code'), default=0, help_text=u'Box Server 版本号') srv_version_name = models.CharField(_(u'srv_version_name'), max_length=255, blank=True, null=True, help_text=u'Box Server 版本名') srv_sha1 = models.CharField(_(u'srv_sha1'), max_length=255, blank=True, null=True, help_text=u'Box Server Commit SHA1') proc_version_code = models.IntegerField(_(u'proc_version_code'), default=0, help_text=u'Box Proc 版本号') proc_version_name = models.CharField(_(u'proc_version_name'), max_length=255, blank=True, null=True, help_text=u'Box Proc 版本名') proc_sha1 = models.CharField(_(u'proc_sha1'), max_length=255, blank=True, null=True, help_text=u'Box Proc Commit SHA1') class Meta: verbose_name = _('boxprogramversioninfo') verbose_name_plural = _('boxprogramversioninfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def data(self): return { 'srv_version_code': self.srv_version_code, 'srv_version_name': self.srv_version_name, 'srv_sha1': self.srv_sha1, 'proc_version_code': self.proc_version_code, 'proc_version_name': self.proc_version_name, 'proc_sha1': self.proc_sha1, }