mageField(_(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)

+ 3 - 0
operation/tests.py

@@ -0,0 +1,3 @@
1
+from django.test import TestCase
2
+
3
+# Create your tests here.

+ 37 - 0
operation/views.py

@@ -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
+    })

+ 1 - 0
pai2/settings.py

@@ -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', )

+ 3 - 3
pai2/uwsgi.bak/pai2_nginx.conf

@@ -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

+ 2 - 2
photo/views.py

@@ -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', '')

adminSystem - Gogs: Go Git Service

Няма описание

FFIB: 11e3a9652a first преди 8 години
..
lib 11e3a9652a first преди 8 години
.travis.yml 11e3a9652a first преди 8 години
README.md 11e3a9652a first преди 8 години
package.json 11e3a9652a first преди 8 години

README.md

spdy-transport

Build Status NPM version dependencies Status Standard - JavaScript Style Guide Waffle

SPDY/HTTP2 generic transport implementation.

Usage

var transport = require('spdy-transport');

// NOTE: socket is some stream or net.Socket instance, may be an argument
// of `net.createServer`'s connection handler.

var server = transport.connection.create(socket, {
  protocol: 'http2',
  isServer: true
});

server.on('stream', function(stream) {
  console.log(stream.method, stream.path, stream.headers);
  stream.respond(200, {
    header: 'value'
  });

  stream.on('readable', function() {
    var chunk = stream.read();
    if (!chunk)
      return;

    console.log(chunk);
  });

  stream.on('end', function() {
    console.log('end');
  });

  // And other node.js Stream APIs
  // ...
});

LICENSE

This software is licensed under the MIT License.

Copyright Fedor Indutny, 2015.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.