class="lines-code">
+  const CompressionWebpackPlugin = require('compression-webpack-plugin')
128
+
129
+  webpackConfig.plugins.push(
130
+    new CompressionWebpackPlugin({
131
+      asset: '[path].gz[query]',
132
+      algorithm: 'gzip',
133
+      test: new RegExp(
134
+        '\\.(' +
135
+        config.build.productionGzipExtensions.join('|') +
136
+        ')$'
137
+      ),
138
+      threshold: 10240,
139
+      minRatio: 0.8
140
+    })
141
+  )
142
+}
143
+
144
+if (config.build.bundleAnalyzerReport) {
145
+  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
146
+  webpackConfig.plugins.push(new BundleAnalyzerPlugin())
147
+}
148
+
149
+module.exports = webpackConfig

+ 7 - 0
config/dev.env.js

@@ -0,0 +1,7 @@
1
+'use strict'
2
+const merge = require('webpack-merge')
3
+const prodEnv = require('./prod.env')
4
+
5
+module.exports = merge(prodEnv, {
6
+  NODE_ENV: '"development"'
7
+})

+ 81 - 0
config/index.js

@@ -0,0 +1,81 @@
1
+'use strict'
2
+// Template version: 1.3.1
3
+// see http://vuejs-templates.github.io/webpack for documentation.
4
+
5
+const path = require('path')
6
+
7
+module.exports = {
8
+  dev: {
9
+
10
+    // Paths
11
+    assetsSubDirectory: 'static',
12
+    assetsPublicPath: './',
13
+    proxyTable: {
14
+      '/api': {
15
+        target: 'http://kodo.xfoto.com.cn',//设置你调用的接口域名和端口号
16
+        changeOrigin: true     //跨域
17
+      }
18
+    },
19
+
20
+    // Various Dev Server settings
21
+    host: '127.0.0.1', // can be overwritten by process.env.HOST
22
+    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
23
+    autoOpenBrowser: true,
24
+    errorOverlay: true,
25
+    notifyOnErrors: true,
26
+    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
27
+
28
+    // Use Eslint Loader?
29
+    // If true, your code will be linted during bundling and
30
+    // linting errors and warnings will be shown in the console.
31
+    useEslint: true,
32
+    // If true, eslint errors and warnings will also be shown in the error overlay
33
+    // in the browser.
34
+    showEslintErrorsInOverlay: false,
35
+
36
+    /**
37
+     * Source Maps
38
+     */
39
+
40
+    // https://webpack.js.org/configuration/devtool/#development
41
+    devtool: 'cheap-module-eval-source-map',
42
+
43
+    // If you have problems debugging vue-files in devtools,
44
+    // set this to false - it *may* help
45
+    // https://vue-loader.vuejs.org/en/options.html#cachebusting
46
+    cacheBusting: true,
47
+
48
+    cssSourceMap: true
49
+  },
50
+
51
+  build: {
52
+    // Template for index.html
53
+    index: path.resolve(__dirname, '../dist/index.html'),
54
+
55
+    // Paths
56
+    assetsRoot: path.resolve(__dirname, '../dist'),
57
+    assetsSubDirectory: 'static',
58
+    assetsPublicPath: '/',
59
+
60
+    /**
61
+     * Source Maps
62
+     */
63
+
64
+    productionSourceMap: true,
65
+    // https://webpack.js.org/configuration/devtool/#production
66
+    devtool: '#source-map',
67
+
68
+    // Gzip off by default as many popular static hosts such as
69
+    // Surge or Netlify already gzip all static assets for you.
70
+    // Before setting to `true`, make sure to:
71
+    // npm install --save-dev compression-webpack-plugin
72
+    productionGzip: false,
73
+    productionGzipExtensions: ['js', 'css'],
74
+
75
+    // Run the build command with an extra argument to
76
+    // View the bundle analyzer report after build finishes:
77
+    // `npm run build --report`
78
+    // Set to `true` or `false` to always turn it on or off
79
+    bundleAnalyzerReport: process.env.npm_config_report
80
+  }
81
+}

+ 4 - 0
config/prod.env.js

@@ -0,0 +1,4 @@
1
+'use strict'
2
+module.exports = {
3
+  NODE_ENV: '"production"'
4
+}

+ 7 - 0
config/test.env.js

@@ -0,0 +1,7 @@
1
+'use strict'
2
+const merge = require('webpack-merge')
3
+const devEnv = require('./dev.env')
4
+
5
+module.exports = merge(devEnv, {
6
+  NODE_ENV: '"testing"'
7
+})

BIN
dist/.DS_Store


+ 1 - 0
dist/index.html

@@ -0,0 +1 @@
1
+<html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui"><meta name=screen-orientation content=portrait><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><meta name=full-screen content=yes><meta name=x5-fullscreen content=true><title>盈多</title><link href=/static/css/app.3a26c6e73b7d3ba6472504322287f93a.css rel=stylesheet></head><body><div id=app><router-view></router-view></div><script type=text/javascript src=/static/js/manifest.8482e608f8350cc30a57.js></script><script type=text/javascript src=/static/js/vendor.4d2f6d4ff07a2e355c29.js></script><script type=text/javascript src=/static/js/app.b0c121ab3b3ceaefb9c6.js></script></body><style media=screen>body { margin: 0 !important; }</style></html>

+ 196 - 0
dist/static/city.json

@@ -0,0 +1,196 @@
1
+{
2
+  "海门": [121.15, 31.89],
3
+  "鄂尔多斯": [109.781327, 39.608266],
4
+  "招远": [120.38, 37.35],
5
+  "舟山": [122.207216, 29.985295],
6
+  "齐齐哈尔": [123.97, 47.33],
7
+  "盐城": [120.13, 33.38],
8
+  "赤峰": [118.87, 42.28],
9
+  "青岛": [120.33, 36.07],
10
+  "乳山": [121.52, 36.89],
11
+  "金昌": [102.188043, 38.520089],
12
+  "泉州": [118.58, 24.93],
13
+  "莱西": [120.53, 36.86],
14
+  "日照": [119.46, 35.42],
15
+  "胶南": [119.97, 35.88],
16
+  "南通": [121.05, 32.08],
17
+  "拉萨": [91.11, 29.97],
18
+  "云浮": [112.02, 22.93],
19
+  "梅州": [116.1, 24.55],
20
+  "文登": [122.05, 37.2],
21
+  "上海": [121.48, 31.22],
22
+  "攀枝花": [101.718637, 26.582347],
23
+  "威海": [122.1, 37.5],
24
+  "承德": [117.93, 40.97],
25
+  "厦门": [118.1, 24.46],
26
+  "汕尾": [115.375279, 22.786211],
27
+  "潮州": [116.63, 23.68],
28
+  "丹东": [124.37, 40.13],
29
+  "太仓": [121.1, 31.45],
30
+  "曲靖": [103.79, 25.51],
31
+  "烟台": [121.39, 37.52],
32
+  "福州": [119.3, 26.08],
33
+  "瓦房店": [121.979603, 39.627114],
34
+  "即墨": [120.45, 36.38],
35
+  "抚顺": [123.97, 41.97],
36
+  "玉溪": [102.52, 24.35],
37
+  "张家口": [114.87, 40.82],
38
+  "阳泉": [113.57, 37.85],
39
+  "莱州": [119.942327, 37.177017],
40
+  "湖州": [120.1, 30.86],
41
+  "汕头": [116.69, 23.39],
42
+  "昆山": [120.95, 31.39],
43
+  "宁波": [121.56, 29.86],
44
+  "湛江": [110.359377, 21.270708],
45
+  "揭阳": [116.35, 23.55],
46
+  "荣成": [122.41, 37.16],
47
+  "连云港": [119.16, 34.59],
48
+  "葫芦岛": [120.836932, 40.711052],
49
+  "常熟": [120.74, 31.64],
50
+  "东莞": [113.75, 23.04],
51
+  "河源": [114.68, 23.73],
52
+  "淮安": [119.15, 33.5],
53
+  "泰州": [119.9, 32.49],
54
+  "南宁": [108.33, 22.84],
55
+  "营口": [122.18, 40.65],
56
+  "惠州": [114.4, 23.09],
57
+  "江阴": [120.26, 31.91],
58
+  "蓬莱": [120.75, 37.8],
59
+  "韶关": [113.62, 24.84],
60
+  "嘉峪关": [98.289152, 39.77313],
61
+  "广州": [113.23, 23.16],
62
+  "延安": [109.47, 36.6],
63
+  "太原": [112.53, 37.87],
64
+  "清远": [113.01, 23.7],
65
+  "中山": [113.38, 22.52],
66
+  "昆明": [102.73, 25.04],
67
+  "寿光": [118.73, 36.86],
68
+  "盘锦": [122.070714, 41.119997],
69
+  "长治": [113.08, 36.18],
70
+  "深圳": [114.07, 22.62],
71
+  "珠海": [113.52, 22.3],
72
+  "宿迁": [118.3, 33.96],
73
+  "咸阳": [108.72, 34.36],
74
+  "铜川": [109.11, 35.09],
75
+  "平度": [119.97, 36.77],
76
+  "佛山": [113.11, 23.05],
77
+  "海口": [110.35, 20.02],
78
+  "江门": [113.06, 22.61],
79
+  "章丘": [117.53, 36.72],
80
+  "肇庆": [112.44, 23.05],
81
+  "大连": [121.62, 38.92],
82
+  "临汾": [111.5, 36.08],
83
+  "吴江": [120.63, 31.16],
84
+  "石嘴山": [106.39, 39.04],
85
+  "沈阳": [123.38, 41.8],
86
+  "苏州": [120.62, 31.32],
87
+  "茂名": [110.88, 21.68],
88
+  "嘉兴": [120.76, 30.77],
89
+  "长春": [125.35, 43.88],
90
+  "胶州": [120.03336, 36.264622],
91
+  "银川": [106.27, 38.47],
92
+  "张家港": [120.555821, 31.875428],
93
+  "三门峡": [111.19, 34.76],
94
+  "锦州": [121.15, 41.13],
95
+  "南昌": [115.89, 28.68],
96
+  "柳州": [109.4, 24.33],
97
+  "三亚": [109.511909, 18.252847],
98
+  "自贡": [104.778442, 29.33903],
99
+  "吉林": [126.57, 43.87],
100
+  "阳江": [111.95, 21.85],
101
+  "泸州": [105.39, 28.91],
102
+  "西宁": [101.74, 36.56],
103
+  "宜宾": [104.56, 29.77],
104
+  "呼和浩特": [111.65, 40.82],
105
+  "成都": [104.06, 30.67],
106
+  "大同": [113.3, 40.12],
107
+  "镇江": [119.44, 32.2],
108
+  "桂林": [110.28, 25.29],
109
+  "张家界": [110.479191, 29.117096],
110
+  "宜兴": [119.82, 31.36],
111
+  "北海": [109.12, 21.49],
112
+  "西安": [108.95, 34.27],
113
+  "金坛": [119.56, 31.74],
114
+  "东营": [118.49, 37.46],
115
+  "牡丹江": [129.58, 44.6],
116
+  "遵义": [106.9, 27.7],
117
+  "绍兴": [120.58, 30.01],
118
+  "扬州": [119.42, 32.39],
119
+  "常州": [119.95, 31.79],
120
+  "潍坊": [119.1, 36.62],
121
+  "重庆": [106.54, 29.59],
122
+  "台州": [121.420757, 28.656386],
123
+  "南京": [118.78, 32.04],
124
+  "滨州": [118.03, 37.36],
125
+  "贵阳": [106.71, 26.57],
126
+  "无锡": [120.29, 31.59],
127
+  "本溪": [123.73, 41.3],
128
+  "克拉玛依": [84.77, 45.59],
129
+  "渭南": [109.5, 34.52],
130
+  "马鞍山": [118.48, 31.56],
131
+  "宝鸡": [107.15, 34.38],
132
+  "焦作": [113.21, 35.24],
133
+  "句容": [119.16, 31.95],
134
+  "北京": [116.46, 39.92],
135
+  "徐州": [117.2, 34.26],
136
+  "衡水": [115.72, 37.72],
137
+  "包头": [110, 40.58],
138
+  "绵阳": [104.73, 31.48],
139
+  "乌鲁木齐": [87.68, 43.77],
140
+  "枣庄": [117.57, 34.86],
141
+  "杭州": [120.19, 30.26],
142
+  "淄博": [118.05, 36.78],
143
+  "鞍山": [122.85, 41.12],
144
+  "溧阳": [119.48, 31.43],
145
+  "库尔勒": [86.06, 41.68],
146
+  "安阳": [114.35, 36.1],
147
+  "开封": [114.35, 34.79],
148
+  "济南": [117, 36.65],
149
+  "德阳": [104.37, 31.13],
150
+  "温州": [120.65, 28.01],
151
+  "九江": [115.97, 29.71],
152
+  "邯郸": [114.47, 36.6],
153
+  "临安": [119.72, 30.23],
154
+  "兰州": [103.73, 36.03],
155
+  "沧州": [116.83, 38.33],
156
+  "临沂": [118.35, 35.05],
157
+  "南充": [106.110698, 30.837793],
158
+  "天津": [117.2, 39.13],
159
+  "富阳": [119.95, 30.07],
160
+  "泰安": [117.13, 36.18],
161
+  "诸暨": [120.23, 29.71],
162
+  "郑州": [113.65, 34.76],
163
+  "哈尔滨": [126.63, 45.75],
164
+  "聊城": [115.97, 36.45],
165
+  "芜湖": [118.38, 31.33],
166
+  "唐山": [118.02, 39.63],
167
+  "平顶山": [113.29, 33.75],
168
+  "邢台": [114.48, 37.05],
169
+  "德州": [116.29, 37.45],
170
+  "济宁": [116.59, 35.38],
171
+  "荆州": [112.239741, 30.335165],
172
+  "宜昌": [111.3, 30.7],
173
+  "义乌": [120.06, 29.32],
174
+  "丽水": [119.92, 28.45],
175
+  "洛阳": [112.44, 34.7],
176
+  "秦皇岛": [119.57, 39.95],
177
+  "株洲": [113.16, 27.83],
178
+  "石家庄": [114.48, 38.03],
179
+  "莱芜": [117.67, 36.19],
180
+  "常德": [111.69, 29.05],
181
+  "保定": [115.48, 38.85],
182
+  "湘潭": [112.91, 27.87],
183
+  "金华": [119.64, 29.12],
184
+  "岳阳": [113.09, 29.37],
185
+  "长沙": [113, 28.21],
186
+  "衢州": [118.88, 28.97],
187
+  "廊坊": [116.7, 39.53],
188
+  "菏泽": [115.480656, 35.23375],
189
+  "合肥": [117.27, 31.86],
190
+  "武汉": [114.31, 30.52],
191
+  "大庆": [125.03, 46.58],
192
+  "林芝地": [94.25, 29.59],
193
+  "果洛藏族自治": [97.42, 34.81],
194
+  "闵行": [121.23, 31.07],
195
+  "那曲地": [92.1, 31.47]
196
+}

+ 0 - 0
dist/static/css/app.3a26c6e73b7d3ba6472504322287f93a.css

@@ -0,0 +1,2 @@

kodo - Gogs: Go Git Service

Keine Beschreibung

models.py 25KB

    # -*- coding: utf-8 -*- import datetime from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from django_models_ext import BaseModelMixin, SexModelMixin from shortuuidfield import ShortUUIDField from TimeConvert import TimeConvert as tc from kodo.basemodels import LensmanTypeBoolMixin from mch.models import ConsumeInfoSubmitLogInfo, MaintenancemanInfo, SaleclerkInfo from member.models import MemberActivityInfo from sales.models import SalesResponsibilityInfo class UserInfo(BaseModelMixin, LensmanTypeBoolMixin): APP_USER = 0 WX_USER = 1 USER_USER = 8 GUEST_USER = 9 LENSMAN_USER = 10 TOURGUIDE_USER = 11 MINIAPP_USER = 12 QYMINIAPP_USER = 22 OAUTH_USER = 13 USER_FROM = ( (APP_USER, u'APP 创建用户'), (WX_USER, u'微信授权用户'), (USER_USER, u'用户端用户'), (GUEST_USER, u'游客用户'), (LENSMAN_USER, u'摄影师端用户'), (TOURGUIDE_USER, u'导游端用户'), (MINIAPP_USER, u'小程序端用户'), (QYMINIAPP_USER, u'企业微信小程序端用户'), (OAUTH_USER, u'网页授权用户'), ) UNVERIFIED = 0 ACTIVATED = 1 DISABLED = 2 DELETED = 3 ASSIGN = 10 USER_STATUS = ( (UNVERIFIED, u'未验证'), (ACTIVATED, u'已激活'), (DISABLED, u'已禁用'), (DELETED, u'已删除'), (ASSIGN, u'已分配'), ) MALE = 1 FEMALE = 0 SEX_TYPE = ( (MALE, u'男'), (FEMALE, u'女'), ) MEMBER_NO = 0 MEMBER_LRC = 1 MEMBER_SILVER = 2 MEMBER_GOLD = 3 MEMBER_WHITE_GOLD = 4 MEMBER_BLACK_GOLD = 5 LEVEL_TUPLE = ( (MEMBER_NO, u'非会员'), (MEMBER_LRC, u'LRC会员'), (MEMBER_SILVER, u'银卡会员'), (MEMBER_GOLD, u'金卡会员'), (MEMBER_WHITE_GOLD, u'白金卡会员'), (MEMBER_BLACK_GOLD, u'黑金卡会员'), ) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True, unique=True) user_from = models.IntegerField(_(u'user_from'), choices=USER_FROM, default=APP_USER, help_text=u'用户来源', db_index=True) uuid = models.CharField(_(u'uuid'), max_length=255, blank=True, null=True, help_text=u'通用唯一识别码 (Universally Unique Identifier)', db_index=True) # APP 创建用户 username = models.CharField(_(u'username'), max_length=255, blank=True, null=True, help_text=u'用户用户名', db_index=True, unique=True) password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'用户密码') # 微信授权用户 appid = models.CharField(_(u'appid'), max_length=32, blank=True, null=True, help_text=u'appId', db_index=True) unionid = models.CharField(_(u'unionid'), max_length=32, blank=True, null=True, help_text=u'微信 Unionid', db_index=True, unique=True) openid = models.CharField(_(u'openid'), max_length=32, blank=True, null=True, help_text=u'微信 Openid', db_index=True, unique=True) openid_lensman = models.CharField(_(u'openid_lensman'), max_length=32, blank=True, null=True, help_text=u'微信 Openid', db_index=True, unique=True) openid_tourguide = models.CharField(_(u'openid_tourguide'), max_length=32, blank=True, null=True, help_text=u'微信 Openid', db_index=True, unique=True) openid_miniapp = models.CharField(_(u'openid_miniapp'), max_length=32, blank=True, null=True, help_text=u'微信 Openid', db_index=True, unique=True) openid_oauth = models.CharField(_(u'openid_oauth'), max_length=32, blank=True, null=True, help_text=u'微信 Openid', db_index=True, unique=True) # 企业微信授权用户 userid = models.CharField(_(u'userid'), max_length=32, blank=True, null=True, help_text=u'企业微信 userid', db_index=True) # 用户基本信息 name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户姓名') sex = models.IntegerField(_(u'sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.UNKNOWN, help_text=u'用户性别') nickname = models.CharField(_(u'nickname'), max_length=255, blank=True, null=True, help_text=u'用户昵称') avatar = models.CharField(_(u'avatar'), max_length=255, blank=True, null=True, help_text=u'用户头像') phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'用户电话', db_index=True) country = models.CharField(_(u'country'), max_length=255, blank=True, null=True, help_text=u'用户国家') province = models.CharField(_(u'province'), max_length=255, blank=True, null=True, help_text=u'用户省份') city = models.CharField(_(u'city'), max_length=255, blank=True, null=True, help_text=u'用户城市') location = models.CharField(_(u'location'), max_length=255, blank=True, null=True, help_text=u'用户地址') province_code = models.CharField(_(u'province_code'), max_length=255, blank=True, null=True, help_text=u'用户省份编码') province_name = models.CharField(_(u'province_name'), max_length=255, blank=True, null=True, help_text=u'用户省份信息') # 用户身份 islensman = models.BooleanField(_(u'islensman'), default=False, help_text=u'摄影师?') istourguide = models.BooleanField(_(u'istourguide'), default=False, help_text=u'导游?') balance = models.IntegerField(_(u'balance'), default=0, help_text=u'用户余额(分)') freeze_income_balance = models.IntegerField(_(u'freeze_income_balance'), default=0, help_text=u'用户收入冻结余额(分)') freeze_expense_balance = models.IntegerField(_(u'freeze_expense_balance'), default=0, help_text=u'用户支出冻结余额(分)') user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS, default=UNVERIFIED, help_text=u'用户状态') outtake_status = models.IntegerField(_(u'outtake_status'), choices=USER_STATUS, default=UNVERIFIED, help_text=u'花絮摄影师状态') assign_ip = models.CharField(_(u'assign_ip'), max_length=32, blank=True, null=True, help_text=u'分配IP') assign_at = models.DateTimeField(_(u'assign_at'), blank=True, null=True, help_text=u'分配时间') signup_ip = models.CharField(_(u'signup_ip'), max_length=32, blank=True, null=True, help_text=u'注册IP') signup_at = models.DateTimeField(_(u'signup_at'), blank=True, null=True, help_text=u'注册时间') login_ip = models.CharField(_(u'login_ip'), max_length=32, blank=True, null=True, help_text=u'登录IP') login_at = models.DateTimeField(_(u'login_at'), blank=True, null=True, help_text=u'登录时间') subscribe = models.IntegerField(_(u'subscribe'), default=0, help_text=u'是否关注', db_index=True) new_subscribe = models.BooleanField(_(u'new_subscribe'), default=False, help_text=u'是否新增关注') code_version = models.IntegerField(_(u'code_version'), default=1, help_text=u'统览码版本', db_index=True) has_membercard = models.BooleanField(_(u'has_membercard'), default=False, help_text=u'是否激活会员卡') membercardid = models.CharField(_(u'membercardid'), max_length=32, blank=True, null=True, help_text=u'会员卡编号', db_index=True) memberusercardcode = models.CharField(_(u'memberusercardcode'), max_length=32, blank=True, null=True, help_text=u'用户会员卡编号', db_index=True) test_user = models.BooleanField(_(u'test_user'), default=False, help_text=u'是否为测试用户') # 会员信息 integral = models.IntegerField(_(u'integral'), default=0, help_text=u'会员积分') freeze_integral = models.IntegerField(_(u'freeze_integral'), default=0, help_text=u'会员冻结积分') shots_num = models.IntegerField(_(u'shots_num'), default=0, help_text=u'主持镜头数') level = models.IntegerField(_(u'level'), choices=LEVEL_TUPLE, default=MEMBER_NO, help_text=u'会员等级') # 优惠券信息 coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=u'优惠券过期时间') # 维修员信息 is_maintenance = models.BooleanField(_(u'is_maintenance'), default=False, help_text=u'是否维修员') resgister_at = models.DateTimeField(_(u'resgister_at'), blank=True, null=True, help_text=u'注册镜头时间') # 身份证信息 identity_card_number = models.CharField(_(u'identity_card_number'), max_length=32, blank=True, null=True, help_text=u'身份证号') identity_card_name = models.CharField(_(u'identity_card_name'), max_length=32, blank=True, null=True, help_text=u'身份证姓名') # 租用镜头权限 tenancy_shot_permission = models.BooleanField(_(u'tenancy_shot_permission'), default=False, help_text=u'租用镜头权限') class Meta: verbose_name = _(u'userinfo') verbose_name_plural = _(u'userinfo') unique_together = ( ('appid', 'userid'), ) def __unicode__(self): return '%d' % self.pk @property def final_integral(self): return self.integral + self.freeze_integral @property def final_nickname(self): if self.user_from == self.APP_USER: return self.username elif self.user_from == self.WX_USER: return self.nickname elif self.user_from == self.GUEST_USER: return self.nickname elif self.user_from == self.LENSMAN_USER: return self.name elif self.user_from == self.TOURGUIDE_USER: return self.name elif self.user_from == self.MINIAPP_USER: return self.nickname return self.nickname @property def final_avatar(self): return self.avatar and self.avatar.replace(settings.QINIU_FILE_URL_BEFORE, settings.QINIU_FILE_URL_AFTER).replace(settings.QINIU_FILE_URL_BEFORE2, settings.QINIU_FILE_URL_AFTER) @property def data(self): return { 'user_id': self.user_id, 'name': self.name, 'username': self.username, 'nickname': self.nickname, 'avatar': self.final_avatar, 'phone': self.phone, } @property def cardList(self): return [ { 'cardId': self.membercardid, 'code': self.memberusercardcode } ] @property def lensmaninfo(self): try: lensman = LensmanInfo.objects.get(user_id=self.user_id, lensman_status=LensmanInfo.ACTIVATED) except LensmanInfo.DoesNotExist: lensman = None return lensman.data if lensman else {} def srinfo(self, brand_id=None): try: sr = SalesResponsibilityInfo.objects.get(brand_id=brand_id, unionid=self.unionid, user_status=SalesResponsibilityInfo.ACTIVATED) except SalesResponsibilityInfo.DoesNotExist: sr = None return sr.base_data if sr else { 'sr_id': '', 'is_sr': False, 'is_super_sr': False, } def brandata(self, brand_id=None): if self.unionid: try: saleclerk = SaleclerkInfo.objects.get(brand_id=brand_id, unionid=self.unionid, status=True) except SaleclerkInfo.DoesNotExist: saleclerk = None saleclerk_info = saleclerk.data if saleclerk and saleclerk.is_auth else {} else: saleclerk_info = {} return { 'has_unionid': bool(self.unionid), 'unionid': self.unionid, 'openid': self.openid, 'user_id': self.user_id, 'name': self.name, 'username': self.username, 'nickname': self.nickname, 'avatar': self.avatar, 'phone': self.phone, 'subscribe': self.subscribe, 're_membercard': True if self.has_membercard and not self.memberusercardcode else False, 'has_membercard': self.has_membercard, 'membercardid': self.membercardid, 'memberusercardcode': self.memberusercardcode, 'cardList': self.cardList, 'saleclerk': bool(saleclerk_info), 'saleclerk_info': saleclerk_info, 'sr_info': self.srinfo(brand_id), # 会员信息 'integral': self.integral, 'freeze_integral': self.freeze_integral, 'shots_num': self.shots_num, 'level': self.level, # 身份信息 'identity_card_number': self.identity_card_number, 'identity_card_name': self.identity_card_name, 'tenancy_shot_permission': self.tenancy_shot_permission, # 摄影师 'is_lensman': bool(self.lensmaninfo), 'lensman_info': self.lensmaninfo, } def brand_qydata(self, brand_id=None): if self.phone: try: saleclerk = SaleclerkInfo.objects.get(brand_id=brand_id, clerk_phone=self.phone, status=True) except SaleclerkInfo.DoesNotExist: saleclerk = None saleclerk_info = saleclerk.data if saleclerk and saleclerk.is_auth else {} else: saleclerk_info = {} try: maintenance = MaintenancemanInfo.objects.get(brand_id=brand_id, user_id=self.user_id, status=True) except MaintenancemanInfo.DoesNotExist: maintenance = {} maintenance_info = maintenance.data if maintenance and self.is_maintenance else {} return { 'has_unionid': bool(self.unionid), 'user_id': self.user_id, 'name': self.name, 'username': self.username, 'nickname': self.nickname, 'avatar': self.final_avatar, 'phone': self.phone, 'subscribe': self.subscribe, 're_membercard': True if self.has_membercard and not self.memberusercardcode else False, 'has_membercard': self.has_membercard, 'membercardid': self.membercardid, 'memberusercardcode': self.memberusercardcode, 'cardList': self.cardList, 'saleclerk': bool(saleclerk_info), 'saleclerk_info': saleclerk_info, 'sr_info': self.srinfo(brand_id), # 会员信息 'integral': self.integral, 'freeze_integral': self.freeze_integral, 'shots_num': self.shots_num, 'level': self.level, # 维修员信息 'is_maintenance': bool(maintenance_info), 'maintenance': maintenance_info, } @property def sendcustomwxamessage(self): # 关注公众号 + 未领保修卡 + 已绑定镜头 return self.subscribe and not self.has_membercard and self.shots_num @property def admindata(self): models = ConsumeInfoSubmitLogInfo.objects.filter(user_id=self.user_id, dupload=False, status=True).values_list('model_uni_name', flat=True) return { 'user_id': self.user_id, 'nickname': self.nickname, 'avatar': self.final_avatar, 'phone': self.phone, 'sex': self.sex, 'province': self.province, 'city': self.city, 'province_name': self.province_name, 'subscribe': self.subscribe, 'membercardid': self.membercardid, 'memberusercardcode': self.memberusercardcode, 'created_at': tc.local_string(utc_dt=self.created_at), 'code_version': self.code_version, # 商品信息 'models': list(models), # 会员信息 'integral': self.integral, 'shots_num': self.shots_num, 'level': self.level, 'tenancy_shot_permission': self.tenancy_shot_permission, } @property def cardata(self): return { # 'brand_id': self.brand_id, 'card_id': self.membercardid, 'code': self.memberusercardcode, } class LensmanInfo(BaseModelMixin): REFUSED = -1 UNVERIFIED = 0 ACTIVATED = 1 DISABLED = 2 LENSMAN_TYPE = ( (0, u'小红书摄影师'), (1, u'其他摄影师'), ) LENSMAN_STATUS = ( (REFUSED, u'已拒绝'), (UNVERIFIED, u'未验证'), (ACTIVATED, u'已激活'), (DISABLED, u'已禁用'), ) lensman_id = ShortUUIDField(_(u'lensman_id'), max_length=32, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True, unique=True) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'摄影师姓名') phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'摄影师联系电话') integral = models.IntegerField(_(u'integral'), default=0, help_text=u'摄影师积分') remark = models.CharField(_(u'remark'), max_length=255, blank=True, null=True, help_text=u'备注') lensman_status = models.IntegerField(_(u'lensman_status'), choices=LENSMAN_STATUS, default=UNVERIFIED, help_text=u'摄影师状态', db_index=True) lensman_type = models.IntegerField(_(u'lensman_type'), choices=LENSMAN_TYPE, default=0, help_text=u'摄影师类型', db_index=True) start_date = models.DateField(_(u'start_date'), blank=True, null=True, help_text=u'合作开始日期') end_date = models.DateField(_(u'end_date'), blank=True, null=True, help_text=u'合作截止日期') integral_start_date = models.DateField(_(u'start_date'), blank=True, null=True, help_text=u'积分开始日期') integral_end_date = models.DateField(_(u'start_date'), blank=True, null=True, help_text=u'积分截止日期') # 身份证信息 identity_card_number = models.CharField(_(u'identity_card_number'), max_length=32, blank=True, null=True, help_text=u'身份证号') identity_card_name = models.CharField(_(u'identity_card_name'), max_length=32, blank=True, null=True, help_text=u'身份证姓名') class Meta: verbose_name = _(u'LensmanInfo') verbose_name_plural = _(u'LensmanInfo') unique_together = ( ('lensman_id'), ) def __unicode__(self): return '%d' % self.pk @property def is_expired(self): now_time = datetime.datetime.now() now_date = datetime.date(now_time.year, now_time.month, now_time.day) return not self.start_date <= now_date <= self.end_date if self.start_date and self.end_date else False @property def data(self): return { 'lensman_id': self.lensman_id, 'name': self.name, 'phone': self.phone, 'start_date': self.start_date, 'end_date': self.end_date, 'integral_start_date': self.integral_start_date, 'integral_end_date': self.integral_end_date, 'integral': self.integral, 'identity_card_name': self.identity_card_name, 'identity_card_number': self.identity_card_number, 'is_expired': self.is_expired, 'lensman_status': self.lensman_status, 'lensman_type': self.lensman_type, } @property def admindata(self): return { 'lensman_id': self.lensman_id, 'user_id': self.user_id, 'name': self.name, 'phone': self.phone, 'integral': self.integral, 'lensman_status': self.lensman_status, 'start_date': self.start_date, 'end_date': self.end_date, 'integral_start_date': self.integral_start_date, 'integral_end_date': self.integral_end_date, 'is_expired': self.is_expired, 'remark': self.remark, 'identity_card_name': self.identity_card_name, 'identity_card_number': self.identity_card_number, 'lensman_type': self.lensman_type, 'created_at': tc.local_string(utc_dt=self.created_at), } class UserIntegralIncomeExpensesInfo(BaseModelMixin): PRODUCT = 0 SHARE = 1 CONTRIBUTE = 2 LENSMAN_ACTIVITY = 3 MEMBER_ACTIVITY_CONTRIBUTION_WELFARE = 99 INTEGRAL_FROM = ( (PRODUCT, u'产品'), (SHARE, u'分享'), (CONTRIBUTE, u'投稿'), (MEMBER_ACTIVITY_CONTRIBUTION_WELFARE, u'会员活动投稿福利'), (LENSMAN_ACTIVITY, u'摄影师活动') ) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称') code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码', db_index=True) integral_from = models.IntegerField(_(u'integral_from'), choices=INTEGRAL_FROM, default=PRODUCT, help_text=u'积分来源') integral = models.IntegerField(_(u'integral'), default=0, help_text=u'增减积分') final_integral = models.IntegerField(_(u'final_integral'), default=0, help_text=u'最终积分') remark = models.CharField(_(u'remark'), max_length=255, blank=True, null=True, help_text=u'备注') activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) expired_at = models.DateField(_(u'expired_at'), blank=True, null=True, help_text=u'积分过期日期') class Meta: verbose_name = _(u'userinfointegralincomeexpensesinfo') verbose_name_plural = _(u'userinfointegralincomeexpensesinfo') def __unicode__(self): return '%d' % self.pk @property def lensman_admindata(self): act = MemberActivityInfo.objects.get(activity_id=self.activity_id) return { 'integral_from': self.integral_from, 'integral': self.integral, 'remark': self.remark, 'act_info': act.admindata, 'activity_id': self.activity_id, 'expired_at': self.expired_at if self.expired_at else '', 'created_at': tc.local_string(utc_dt=self.created_at), } @property def lensman_userdata(self): act = MemberActivityInfo.objects.get(activity_id=self.activity_id) return { 'integral_from': self.integral_from, 'integral': self.integral, 'remark': self.remark, 'act_info': act.admindata, 'activity_id': self.activity_id, 'expired_at': self.expired_at if self.expired_at else '', 'created_at': tc.local_string(utc_dt=self.created_at), } class LensmanIntegralIncomeExpensesInfo(BaseModelMixin): user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') integral = models.IntegerField(_(u'integral'), default=0, help_text=u'增减积分') remark = models.CharField(_(u'remark'), max_length=255, blank=True, null=True, help_text=u'备注') activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) expired_at = models.DateField(_(u'expired_at'), blank=True, null=True, help_text=u'积分过期日期') class Meta: verbose_name = _(u'lensmanintegralincomeexpensesinfo') verbose_name_plural = _(u'lensmanintegralincomeexpensesinfo') def __unicode__(self): return '%d' % self.pk @property def admindata(self): if self.activity_id: act = MemberActivityInfo.objects.get(activity_id=self.activity_id) else: act = None return { 'integral': self.integral, 'remark': self.remark, 'act_info': act.admindata if act else None, 'activity_id': self.activity_id, 'expired_at': self.expired_at if self.expired_at else '', 'created_at': tc.local_string(utc_dt=self.created_at), } @property def userdata(self): if self.activity_id: act = MemberActivityInfo.objects.get(activity_id=self.activity_id) else: act = None return { 'integral': self.integral, 'remark': self.remark, 'act_info': act.admindata if act else None, 'activity_id': self.activity_id, 'expired_at': self.expired_at if self.expired_at else '', 'created_at': tc.local_string(utc_dt=self.created_at), }