|
42
|
+ return {
|
|
|
43
|
+ 'latest_version': self.latest_version,
|
|
|
44
|
+ 'latest_url': self.final_latest_url,
|
|
|
45
|
+ }
|
|
|
46
|
+
|
|
|
47
|
+ data = property(_data)
|
|
|
48
|
+
|
|
|
49
|
+
|
|
|
50
|
+class SplashInfo(CreateUpdateMixin):
|
|
|
51
|
+ splash_image = models.ImageField(_(u'splash_image'), upload_to=upload_path, blank=True, null=True, help_text=u'启动页面图片')
|
|
|
52
|
+ spalash_image_airtime = models.DateTimeField(_(u'spalash_image_airtime'), blank=True, null=True, help_text=u'启动页面图片开始日期')
|
|
|
53
|
+ spalash_image_deadline = models.DateTimeField(_(u'spalash_image_deadline'), blank=True, null=True, help_text=u'启动页面图片截止日期')
|
|
|
54
|
+
|
|
|
55
|
+ class Meta:
|
|
|
56
|
+ verbose_name = _('splashinfo')
|
|
|
57
|
+ verbose_name_plural = _('splashinfo')
|
|
|
58
|
+
|
|
|
59
|
+ def __unicode__(self):
|
|
|
60
|
+ return u'{0.pk}'.format(self)
|
|
|
61
|
+
|
|
|
62
|
+ @property
|
|
|
63
|
+ def splash_image_url(self):
|
|
|
64
|
+ return self.splash_image and (settings.DOMAIN + self.splash_image.url)
|
|
|
65
|
+
|
|
|
66
|
+ def _data(self):
|
|
|
67
|
+ return {
|
|
|
68
|
+ 'splash_image_url': self.splash_image_url,
|
|
|
69
|
+ 'spalash_image_airtime': self.spalash_image_airtime,
|
|
|
70
|
+ 'spalash_image_deadline': self.spalash_image_deadline,
|
|
|
71
|
+ }
|
|
|
72
|
+
|
|
|
73
|
+ data = property(_data)
|
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+from django.test import TestCase
|
|
|
2
|
+
|
|
|
3
|
+# Create your tests here.
|
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+
|
|
|
3
|
+from django.conf import settings
|
|
|
4
|
+from django.core.files.storage import default_storage
|
|
|
5
|
+from django.db import transaction
|
|
|
6
|
+from django.http import JsonResponse
|
|
|
7
|
+from django.shortcuts import render, redirect
|
|
|
8
|
+
|
|
|
9
|
+from operation.models import LatestAppInfo, SplashInfo
|
|
|
10
|
+
|
|
|
11
|
+
|
|
|
12
|
+def upgrade_api(request):
|
|
|
13
|
+ try:
|
|
|
14
|
+ appinfo = LatestAppInfo.objects.all()[0].data
|
|
|
15
|
+ except IndexError:
|
|
|
16
|
+ appinfo = {}
|
|
|
17
|
+
|
|
|
18
|
+ return JsonResponse({
|
|
|
19
|
+ 'status': 200,
|
|
|
20
|
+ 'message': u'获取最新版信息成功',
|
|
|
21
|
+ 'data': {
|
|
|
22
|
+ 'appinfo': appinfo,
|
|
|
23
|
+ },
|
|
|
24
|
+ })
|
|
|
25
|
+
|
|
|
26
|
+
|
|
|
27
|
+def splash_api(request):
|
|
|
28
|
+ splashes = SplashInfo.objects.all()
|
|
|
29
|
+ splashes = [splash.data for splash in splashes]
|
|
|
30
|
+
|
|
|
31
|
+ return JsonResponse({
|
|
|
32
|
+ 'status': 200,
|
|
|
33
|
+ 'message': u'获取最新版信息成功',
|
|
|
34
|
+ 'data': {
|
|
|
35
|
+ 'splashes': splashes,
|
|
|
36
|
+ },
|
|
|
37
|
+ })
|
|
|
|
@@ -45,6 +45,7 @@ INSTALLED_APPS = (
|
|
45
|
45
|
'account',
|
|
46
|
46
|
'group',
|
|
47
|
47
|
'photo',
|
|
|
48
|
+ 'operation',
|
|
48
|
49
|
)
|
|
49
|
50
|
|
|
50
|
51
|
INSTALLED_APPS += ('multidomain', )
|
|
|
|
@@ -11,7 +11,7 @@ server {
|
|
11
|
11
|
# the port your site will be served on
|
|
12
|
12
|
listen 80;
|
|
13
|
13
|
# the domain name it will serve for
|
|
14
|
|
- server_name .img.xfoto.com.cn; # substitute your machine's IP address or FQDN
|
|
|
14
|
+ server_name .img.pai.ai .img.xfoto.com.cn; # substitute your machine's IP address or FQDN
|
|
15
|
15
|
charset utf-8;
|
|
16
|
16
|
|
|
17
|
17
|
# max upload size
|
|
|
|
@@ -36,7 +36,7 @@ server {
|
|
36
|
36
|
# the port your site will be served on
|
|
37
|
37
|
listen 80;
|
|
38
|
38
|
# the domain name it will serve for
|
|
39
|
|
- server_name .api.xfoto.com.cn; # substitute your machine's IP address or FQDN
|
|
|
39
|
+ server_name .api.pai.ai .api.xfoto.com.cn; # substitute your machine's IP address or FQDN
|
|
40
|
40
|
charset utf-8;
|
|
41
|
41
|
|
|
42
|
42
|
# max upload size
|
|
|
|
@@ -64,7 +64,7 @@ server {
|
|
64
|
64
|
# the port your site will be served on
|
|
65
|
65
|
listen 80;
|
|
66
|
66
|
# the domain name it will serve for
|
|
67
|
|
- server_name .xfoto.com.cn; # substitute your machine's IP address or FQDN
|
|
|
67
|
+ server_name .pai.ai .xfoto.com.cn; # substitute your machine's IP address or FQDN
|
|
68
|
68
|
charset utf-8;
|
|
69
|
69
|
|
|
70
|
70
|
# max upload size
|
|
|
|
@@ -37,7 +37,7 @@ def uuid_init(request):
|
|
37
|
37
|
})
|
|
38
|
38
|
|
|
39
|
39
|
|
|
40
|
|
-# curl -X POST -F user=xxxxxxx -F num=100 http://api.xfoto.com.cn/uuid
|
|
|
40
|
+# curl -X POST -F user=xxxxxxx -F num=100 http://api.pai.ai/uuid
|
|
41
|
41
|
@transaction.atomic
|
|
42
|
42
|
def uuid(request):
|
|
43
|
43
|
lensman_id = request.POST.get('user', '')
|
|
|
|
@@ -67,7 +67,7 @@ def uuid(request):
|
|
67
|
67
|
# name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload,
|
|
68
|
68
|
# while the < makes a text field and just get the contents for that text field from a file.
|
|
69
|
69
|
#
|
|
70
|
|
-# curl -X POST -F user=xxxxxxx -F session=xxxxxxx -F photo_id=xxxxxxx -F photo=@xxxxxxx.jpg http://api.xfoto.com.cn/photos/upload
|
|
|
70
|
+# curl -X POST -F user=xxxxxxx -F session=xxxxxxx -F photo_id=xxxxxxx -F photo=@xxxxxxx.jpg http://api.pai.ai/photos/upload
|
|
71
|
71
|
def upload_photo(request):
|
|
72
|
72
|
lensman_id = request.POST.get('user', '')
|
|
73
|
73
|
session_id = request.POST.get('session', '')
|