@@ -0,0 +1,4 @@ |
||
1 |
+from django.contrib import admin |
|
2 |
+ |
|
3 |
+ |
|
4 |
+# Register your models here. |
@@ -0,0 +1,7 @@ |
||
1 |
+from __future__ import unicode_literals |
|
2 |
+ |
|
3 |
+from django.apps import AppConfig |
|
4 |
+ |
|
5 |
+ |
|
6 |
+class CommandConfig(AppConfig): |
|
7 |
+ name = 'commands' |
@@ -0,0 +1,31 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+ |
|
3 |
+import logging |
|
4 |
+ |
|
5 |
+from django.db import transaction |
|
6 |
+from django_six import CompatibilityBaseCommand, close_old_connections |
|
7 |
+ |
|
8 |
+from utils.redis.connect import r |
|
9 |
+ |
|
10 |
+ |
|
11 |
+logger = logging.getLogger('console') |
|
12 |
+ |
|
13 |
+ |
|
14 |
+class Command(CompatibilityBaseCommand): |
|
15 |
+ def handle(self, *args, **options): |
|
16 |
+ |
|
17 |
+ logger.info('Templet bak cmd is dealing') |
|
18 |
+ |
|
19 |
+ while True: |
|
20 |
+ # r.rpushjson('TEMPLET_CMD_KEY', {}) |
|
21 |
+ k, v = r.blpopjson('TEMPLET_CMD_KEY', 60) |
|
22 |
+ if v: |
|
23 |
+ |
|
24 |
+ close_old_connections() |
|
25 |
+ |
|
26 |
+ logger.info(v) |
|
27 |
+ |
|
28 |
+ with transaction.atomic(): |
|
29 |
+ pass |
|
30 |
+ |
|
31 |
+ close_old_connections() |
@@ -0,0 +1,47 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+ |
|
3 |
+import logging |
|
4 |
+ |
|
5 |
+import requests |
|
6 |
+from django.conf import settings |
|
7 |
+from django.db import transaction |
|
8 |
+from django_six import CompatibilityBaseCommand, close_old_connections |
|
9 |
+ |
|
10 |
+from utils.redis.connect import r |
|
11 |
+from utils.redis.rkeys import MINI_PROGRAM_GIS_LIST |
|
12 |
+ |
|
13 |
+ |
|
14 |
+logger = logging.getLogger('console') |
|
15 |
+ |
|
16 |
+ |
|
17 |
+class Command(CompatibilityBaseCommand): |
|
18 |
+ def handle(self, *args, **options): |
|
19 |
+ |
|
20 |
+ logger.info('Gis is dealing') |
|
21 |
+ |
|
22 |
+ while True: |
|
23 |
+ # r.rpushjson('TEMPLET_CMD_KEY', { |
|
24 |
+ # 'lat': .0, |
|
25 |
+ # 'lon': .0, |
|
26 |
+ # 'ymd': 0, |
|
27 |
+ # 'ym': 0, |
|
28 |
+ # }) |
|
29 |
+ k, v = r.blpopjson(MINI_PROGRAM_GIS_LIST, 60) |
|
30 |
+ if v: |
|
31 |
+ |
|
32 |
+ close_old_connections() |
|
33 |
+ |
|
34 |
+ logger.info(v) |
|
35 |
+ |
|
36 |
+ with transaction.atomic(): |
|
37 |
+ try: |
|
38 |
+ gisinfo = requests.get(settings.GIS_2_ADMINISTRATIVE_DIVISION.format(v.get('lat', 0), v.get('lon', 0))).json() |
|
39 |
+ except Exception as e: |
|
40 |
+ logger.info(e.message) |
|
41 |
+ if gisinfo.get('error') != 0: |
|
42 |
+ continue |
|
43 |
+ ymd = v.get('ymd', 0) |
|
44 |
+ ym = v.get('ym', 0) |
|
45 |
+ zh1 = gisinfo.get('data', {}).get('zh1', '') |
|
46 |
+ |
|
47 |
+ close_old_connections() |
@@ -0,0 +1,6 @@ |
||
1 |
+from __future__ import unicode_literals |
|
2 |
+ |
|
3 |
+from django.db import models |
|
4 |
+ |
|
5 |
+ |
|
6 |
+# Create your models here. |
@@ -0,0 +1,4 @@ |
||
1 |
+from django.test import TestCase |
|
2 |
+ |
|
3 |
+ |
|
4 |
+# Create your tests here. |
@@ -0,0 +1,4 @@ |
||
1 |
+from django.shortcuts import render |
|
2 |
+ |
|
3 |
+ |
|
4 |
+# Create your views here. |
@@ -52,6 +52,7 @@ INSTALLED_APPS = ( |
||
52 | 52 |
'api', |
53 | 53 |
'account', |
54 | 54 |
'box', |
55 |
+ 'commands', |
|
55 | 56 |
'group', |
56 | 57 |
'integral', |
57 | 58 |
'logs', |
@@ -390,6 +391,9 @@ KODO_DEFAULT_BRAND_DOMAIN = '' |
||
390 | 391 |
|
391 | 392 |
KODO_CLERK_AUTH_URL = 'http://pai.ai/w/o?r=http%3A%2F%2Fkodo.xfoto.com.cn%2Fp%2Fclerk%3Fbrand_id%3D{0}' |
392 | 393 |
|
394 |
+# 经纬度 |
|
395 |
+GIS_2_ADMINISTRATIVE_DIVISION = 'http://116.196.105.215:1234/gis?auth_user=freevip&latitude={0}&longitude={1}' |
|
396 |
+ |
|
393 | 397 |
try: |
394 | 398 |
from local_settings import * |
395 | 399 |
except ImportError: |
@@ -4,7 +4,7 @@ Pillow==5.0.0 |
||
4 | 4 |
StatusCode==1.0.0 |
5 | 5 |
TimeConvert==1.4.3 |
6 | 6 |
cryptography==1.5.2 |
7 |
-furl==1.2.1 |
|
7 |
+furl==2.0.0 |
|
8 | 8 |
isoweek==1.3.3 |
9 | 9 |
jsonfield==2.0.2 |
10 | 10 |
mock==2.0.0 |
@@ -66,3 +66,6 @@ APP_PATCH_INFO = 'app:patch:info:%s:%s:%s' # STRING,APP 补丁信息,platfo |
||
66 | 66 |
|
67 | 67 |
# BOX 相关 |
68 | 68 |
BOX_PROGRAM_VERSION_INFO = 'box:program:version:info' # STRING,BOX 程序版本信息 |
69 |
+ |
|
70 |
+# 小程序相关 |
|
71 |
+MINI_PROGRAM_GIS_LIST = 'tamron:miniprogram:gis:list' |