471
+        })
472
+    }
473
+
474
+    // QRCode & BarCode is different
475
+    function parseScanQRCodeResultStr(resultStr) {
476
+        var strs = resultStr.split(',')
477
+        return strs[strs.length - 1]
478
+    }
479
+
480
+    // 10 微信支付接口
481
+    // 10.1 发起一个支付请求
482
+    function chooseWXPay(wxpay_params) {
483
+        wx.chooseWXPay({
484
+            timestamp: wxpay_params.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
485
+            nonceStr: wxpay_params.nonceStr, // 支付签名随机串,不长于 32 位
486
+            package: wxpay_params.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
487
+            signType: wxpay_params.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
488
+            paySign: wxpay_params.paySign, // 支付签名
489
+            success: function (res) {
490
+                // 支付成功后的回调函数
491
+                if (JSWE.wxPaySuccess) {JSWE.wxPaySuccess(res)}
492
+            }
493
+        })
494
+    }
495
+
496
+    // xx 微信原生企业红包接口
497
+    // xx.1 发起一个发送原生企业红包请求
498
+    function openEnterpriseRedPacket(wxredpack_params) {
499
+        wx.openEnterpriseRedPacket({
500
+            timeStamp: wxredpack_params.timeStamp, // 红包签名时间戳,注意原生企业红包接口timeStamp字段名需大写其中的S字符,而支付接口timeStamp字段名无需大写其中的S字符。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
501
+            nonceStr: wxredpack_params.nonceStr, // 红包签名随机串,不长于 32 位
502
+            package: encodeURIComponent(wxredpack_params.package), // 发放红包接口返回的prepay_id参数值,提交格式如:prepay_id=***)
503
+            signType: wxredpack_params.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
504
+            paySign: wxredpack_params.paySign, // 红包签名
505
+            success: function (res) {
506
+                // 发送原生企业红包成功后的回调函数
507
+                if (JSWE.wxEnterpriseRedPacketSuccess) {JSWE.wxEnterpriseRedPacketSuccess(res)}
508
+            }
509
+        })
510
+    }
511
+
512
+    var v = {
513
+        version: '1.0.5',
514
+
515
+        // Basic Vars
516
+        config: config,
517
+        wxData: wxData,
518
+        jsApiList: jsApiList,
519
+
520
+        isEmpty: isEmpty,
521
+        isNotEmpty: isNotEmpty,
522
+
523
+        // Weixin Function
524
+        isOpenInWeixin: isOpenInWeixin,
525
+        getWeixinVersion: getWeixinVersion,
526
+        isWeixinVersion: isWeixinVersion,
527
+
528
+        // Menu Function
529
+        hideOptionMenu: hideOptionMenu,
530
+        showOptionMenu: showOptionMenu,
531
+        hideMenuItems: hideMenuItems,
532
+        showMenuItems: showMenuItems,
533
+        hideAllNonBaseMenuItem: hideAllNonBaseMenuItem,
534
+        showAllNonBaseMenuItem: showAllNonBaseMenuItem,
535
+        closeWindow: closeWindow,
536
+
537
+        // Share Function
538
+        initWxData: initWxData,
539
+        changeWxData: changeWxData,
540
+        fixedWxData: fixedWxData,
541
+
542
+        // Voice Function
543
+        voice: voice,
544
+        translateVoice: translateVoice,
545
+        startRecord: startRecord,
546
+        stopRecord: stopRecord,
547
+        playVoice: playVoice,
548
+        pauseVoice: pauseVoice,
549
+        stopVoice: stopVoice,
550
+        uploadVoice: uploadVoice,
551
+        downloadVoice: downloadVoice,
552
+
553
+        // Image Function
554
+        images: images,
555
+        chooseImage: chooseImage,
556
+        previewImage: previewImage,
557
+        uploadImage: uploadImage,
558
+        uploadImages: uploadImages,
559
+        downloadImage: downloadImage,
560
+        downloadImages: downloadImages,
561
+        getLocalImgData: getLocalImgData,
562
+
563
+        // Scan Function
564
+        scanQRCode: scanQRCode,
565
+        parseScanQRCodeResultStr: parseScanQRCodeResultStr,
566
+
567
+        // Pay Function
568
+        chooseWXPay: chooseWXPay,
569
+
570
+        // EnterpriseRedPacket Function
571
+        openEnterpriseRedPacket: openEnterpriseRedPacket
572
+    }
573
+    e.JSWE = e.V = v
574
+})(window)

+ 55 - 0
kodosale/urls.py

@@ -0,0 +1,55 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+"""kodosale URL Configuration
4
+
5
+The `urlpatterns` list routes URLs to views. For more information please see:
6
+    https://docs.djangoproject.com/en/1.11/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. Import the include() function: from django.conf.urls import url, include
16
+    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
17
+"""
18
+from django.conf import settings
19
+from django.conf.urls import include, url
20
+from django.conf.urls.static import static
21
+from django.contrib import admin
22
+
23
+
24
+urlpatterns = [
25
+    url(r'^admin/', admin.site.urls),
26
+]
27
+
28
+urlpatterns += [
29
+    url(r'^api/', include(('api.urls', 'api'), namespace='api')),
30
+    url(r'^uniapi/', include(('django_uniapi.urls', 'uniapi'), namespace='uniapi')),
31
+]
32
+
33
+urlpatterns += [
34
+    # url(r'^s/', include(('django_short_url.urls', 'django_short_url'), namespace='django_short_url')),
35
+]
36
+
37
+urlpatterns += [
38
+    url(r'^w/', include(('django_we.urls', 'shortwechat'), namespace='shortwechat')),
39
+    url(r'^we/', include(('django_we.urls', 'wechat'), namespace='wechat')),
40
+]
41
+
42
+urlpatterns += [
43
+    # url(r'^p/', include(('page.urls', 'shortpage'), namespace='shortpage')),
44
+    # url(r'^page/', include(('page.urls', 'page'), namespace='page')),
45
+]
46
+
47
+urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
48
+urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
49
+
50
+# AdminSite
51
+admin.site.site_header = 'Django administration'
52
+admin.site.site_title = 'Django site admin'
53
+# Make site_url/index_title None to hidden
54
+admin.site.site_url = '/'
55
+admin.site.index_title = 'Site administration'

+ 17 - 0
kodosale/wsgi.py

@@ -0,0 +1,17 @@
1
+"""
2
+WSGI config for kodosale 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.11/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", "kodosale.settings")
16
+
17
+application = get_wsgi_application()

+ 0 - 0
kol/__init__.py


+ 12 - 0
kol/admin.py

@@ -0,0 +1,12 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.contrib import admin
4
+
5
+from kol.models import KOLInfo
6
+
7
+
8
+class KOLInfoAdmin(admin.ModelAdmin):
9
+    list_display = ('kol_id', 'unionid', 'openid', 'name', 'phone', 'nickname', 'avatar', 'banner', 'image', 'fans', 'fee', 'total_fee', 'status', 'created_at', 'updated_at')
10
+
11
+
12
+admin.site.register(KOLInfo, KOLInfoAdmin)

+ 5 - 0
kol/apps.py

@@ -0,0 +1,5 @@
1
+from django.apps import AppConfig
2
+
3
+
4
+class KolConfig(AppConfig):
5
+    name = 'kol'

+ 42 - 0
kol/migrations/0001_initial.py

@@ -0,0 +1,42 @@
1
+# Generated by Django 2.2.12 on 2020-04-21 07:04
2
+
3
+from django.db import migrations, models
4
+import django_models_ext.fileext
5
+import shortuuidfield.fields
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    initial = True
11
+
12
+    dependencies = [
13
+    ]
14
+
15
+    operations = [
16
+        migrations.CreateModel(
17
+            name='KOLInfo',
18
+            fields=[
19
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20
+                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
21
+                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
22
+                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
23
+                ('kol_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='KOL 唯一标识', max_length=22, null=True, unique=True)),
24
+                ('unionid', models.CharField(blank=True, db_index=True, help_text='微信 Unionid', max_length=32, null=True, unique=True, verbose_name='unionid')),
25
+                ('openid', models.CharField(blank=True, db_index=True, help_text='微信 Openid', max_length=32, null=True, unique=True, verbose_name='openid')),
26
+                ('name', models.CharField(blank=True, help_text='KOL 姓名', max_length=32, null=True, verbose_name='name')),
27
+                ('phone', models.CharField(blank=True, db_index=True, help_text='KOL 电话', max_length=11, null=True, verbose_name='phone')),
28
+                ('nickname', models.CharField(blank=True, help_text='KOL 昵称', max_length=32, null=True, verbose_name='nickname')),
29
+                ('avatar', models.ImageField(blank=True, help_text='KOL 头像', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='avatar')),
30
+                ('banner', models.ImageField(blank=True, help_text='KOL Banner图', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='banner')),
31
+                ('intro', models.TextField(blank=True, help_text='KOL 简介', null=True, verbose_name='intro')),
32
+                ('image', models.ImageField(blank=True, help_text='KOL 简介图', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='image')),
33
+                ('fans', models.IntegerField(default=0, help_text='KOL 粉丝数', verbose_name='fans')),
34
+                ('fee', models.IntegerField(default=0, help_text='KOL 余额(分)', verbose_name='fee')),
35
+                ('total_fee', models.IntegerField(default=0, help_text='KOL 总收入(分)', verbose_name='total_fee')),
36
+            ],
37
+            options={
38
+                'verbose_name': 'KOL 信息',
39
+                'verbose_name_plural': 'KOL 信息',
40
+            },
41
+        ),
42
+    ]

+ 0 - 0
kol/migrations/__init__.py


+ 73 - 0
kol/models.py

@@ -0,0 +1,73 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.db import models
4
+from django.utils.translation import ugettext_lazy as _
5
+from django_models_ext import BaseModelMixin, upload_file_path, upload_file_url, upload_path
6
+from shortuuidfield import ShortUUIDField
7
+
8
+
9
+class KOLInfo(BaseModelMixin):
10
+    kol_id = ShortUUIDField(_('kol_id'), max_length=32, blank=True, null=True, help_text='KOL 唯一标识', db_index=True, unique=True)
11
+    # 微信相关
12
+    unionid = models.CharField(_('unionid'), max_length=32, blank=True, null=True, help_text='微信 Unionid', db_index=True, unique=True)
13
+    openid = models.CharField(_('openid'), max_length=32, blank=True, null=True, help_text='微信 Openid', db_index=True, unique=True)
14
+    # 真实相关
15
+    name = models.CharField(_('name'), max_length=32, blank=True, null=True, help_text='KOL 姓名')
16
+    phone = models.CharField(_('phone'), max_length=11, blank=True, null=True, help_text='KOL 电话', db_index=True)
17
+    # 昵称相关
18
+    nickname = models.CharField(_('nickname'), max_length=32, blank=True, null=True, help_text='KOL 昵称')
19
+    avatar = models.ImageField(_('avatar'), upload_to=upload_path, blank=True, null=True, help_text='KOL 头像')
20
+    banner = models.ImageField(_('banner'), upload_to=upload_path, blank=True, null=True, help_text='KOL Banner图')
21
+    intro = models.TextField(_('intro'), blank=True, null=True, help_text='KOL 简介')
22
+    image = models.ImageField(_('image'), upload_to=upload_path, blank=True, null=True, help_text='KOL 简介图')
23
+    fans = models.IntegerField(_('fans'), default=0, help_text='KOL 粉丝数')
24
+    # 余额相关
25
+    fee = models.IntegerField(_('fee'), default=0, help_text='KOL 余额(分)')
26
+    total_fee = models.IntegerField(_('total_fee'), default=0, help_text='KOL 总收入(分)')
27
+
28
+    class Meta:
29
+        verbose_name = _('KOL 信息')
30
+        verbose_name_plural = _('KOL 信息')
31
+
32
+    def __unicode__(self):
33
+        return self.pk
34
+
35
+    @property
36
+    def final_nickname(self):
37
+        return self.nickname or self.name
38
+
39
+    @property
40
+    def avatar_path(self):
41
+        return upload_file_path(self.avatar)
42
+
43
+    @property
44
+    def avatar_url(self):
45
+        return upload_file_url(self.avatar)
46
+
47
+    @property
48
+    def banner_path(self):
49
+        return upload_file_path(self.banner)
50
+
51
+    @property
52
+    def banner_url(self):
53
+        return upload_file_url(self.banner)
54
+
55
+    @property
56
+    def image_path(self):
57
+        return upload_file_path(self.image)
58
+
59
+    @property
60
+    def image_url(self):
61
+        return upload_file_url(self.image)
62
+
63
+    @property
64
+    def data(self):
65
+        return {
66
+            'kol_id': self.kol_id,
67
+            'nickname': self.final_nickname,
68
+            'avatar_url': self.avatar_url,
69
+            'banner_url': self.banner_url,
70
+            'intro': self.intro,
71
+            'image_url': self.image_url,
72
+            'fans': self.fans,
73
+        }

+ 4 - 0
kol/tests.py

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

+ 4 - 0
kol/views.py

@@ -0,0 +1,4 @@
1
+from django.shortcuts import render
2
+
3
+
4
+# Create your views here.

+ 23 - 0
manage.py

@@ -0,0 +1,23 @@
1
+#!/usr/bin/env python
2
+import os
3
+import sys
4
+
5
+
6
+if __name__ == "__main__":
7
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kodosale.settings")
8
+    try:
9
+        from django.core.management import execute_from_command_line
10
+    except ImportError:
11
+        # The above import may fail for some other reason. Ensure that the
12
+        # issue is really that Django is missing to avoid masking other
13
+        # exceptions on Python 2.
14
+        try:
15
+            import django
16
+        except ImportError:
17
+            raise ImportError(
18
+                "Couldn't import Django. Are you sure it's installed and "
19
+                "available on your PYTHONPATH environment variable? Did you "
20
+                "forget to activate a virtual environment?"
21
+            )
22
+        raise
23
+    execute_from_command_line(sys.argv)

+ 10 - 0
pep8.sh

@@ -0,0 +1,10 @@
1
+#!/bin/bash
2
+
3
+# Ignoring autogenerated files
4
+#  -- Migration directories
5
+# Ignoring error codes
6
+#  -- E128 continuation line under-indented for visual indent
7
+#  -- E402 module level import not at top of file
8
+#  -- E501 line too long
9
+
10
+pycodestyle --exclude=build,migrations,.tox --ignore=E128,E402,E501 .

+ 8 - 0
requirements.txt

@@ -0,0 +1,8 @@
1
+StatusCode==1.0.0
2
+furl==2.1.0
3
+jsonfield==2.0.2
4
+mysqlclient==1.4.6
5
+rlog==0.3
6
+-r requirements_dj.txt
7
+-r requirements_pywe.txt
8
+-r requirements_redis.txt

+ 3 - 0
requirements_deploy.txt

@@ -0,0 +1,3 @@
1
+ipdb==0.12.3
2
+ipython==7.11.1
3
+uwsgi==2.0.18

+ 2 - 0
requirements_dev.txt

@@ -0,0 +1,2 @@
1
+isort==4.3.21
2
+pycodestyle==2.5.0

+ 15 - 0
requirements_dj.txt

@@ -0,0 +1,15 @@
1
+Django==2.2.12
2
+django-admin==2.0.1
3
+django-detect==1.0.18
4
+django-file==1.0.4
5
+django-json-render==1.0.3
6
+django-json-response==1.1.5
7
+django-logit==1.1.3
8
+django-models-ext==1.1.9
9
+django-redis-connector==1.0.3
10
+django-response==1.1.1
11
+django-rlog==1.0.7
12
+django-short-url==1.1.4
13
+django-six==1.0.4
14
+django-uniapi==1.0.7
15
+django-we==1.5.5

+ 2 - 0
requirements_pywe.txt

@@ -0,0 +1,2 @@
1
+pywe-oauth==1.1.1
2
+pywe-pay==1.0.13

+ 3 - 0
requirements_redis.txt

@@ -0,0 +1,3 @@
1
+hiredis==1.0.1
2
+redis==3.4.1
3
+redis-extensions==2.0.0

+ 4 - 0
sysctl.sh

@@ -0,0 +1,4 @@
1
+#!/bin/bash
2
+
3
+sudo sysctl -w net.core.somaxconn=65535
4
+sudo sysctl -w net.core.netdev_max_backlog=65535

+ 0 - 0
utils/__init__.py


+ 0 - 0
utils/error/__init__.py


+ 77 - 0
utils/error/errno_utils.py

@@ -0,0 +1,77 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from StatusCode import BaseStatusCode, StatusCodeField
4
+
5
+
6
+class ParamStatusCode(BaseStatusCode):
7
+    """ 4000xx 参数相关错误码 """
8
+    PARAM_NOT_FOUND = StatusCodeField(400000, 'Param Not Found', description=u'参数不存在')
9
+
10
+
11
+class ProfileStatusCode(BaseStatusCode):
12
+    """ 4001xx 用户相关错误码 """
13
+    PROFILE_NOT_FOUND = StatusCodeField(400101, 'Profile Not Found', description=u'用户不存在')
14
+
15
+
16
+class PhoneStatusCode(BaseStatusCode):
17
+    """ 4002xx 手机相关错误码 """
18
+    INVALID_PHONE = StatusCodeField(400200, 'Invalid Phone', description=u'非法手机号')
19
+    PHONE_NOT_FOUND = StatusCodeField(400201, 'Phone Not Found', description=u'手机号不存在')
20
+    PHONE_ALREADY_EXISTS = StatusCodeField(400202, 'Phone Already Exists', description=u'手机号已存在')
21
+
22
+
23
+class OrderStatusCode(BaseStatusCode):
24
+    """ 4040xx 订单/支付相关错误码 """
25
+    UNIFIED_ORDER_FAIL = StatusCodeField(404000, 'Unified Order Fail', description=u'统一下单失败')
26
+    ORDER_NOT_FOUND = StatusCodeField(404001, 'Order Not Found', description=u'订单不存在')
27
+    # 订单支付状态
28
+    ORDER_NOT_PAY = StatusCodeField(404011, 'Order Not Pay', description=u'订单未支付')
29
+    ORDER_PAYING = StatusCodeField(404012, 'Order Paying', description=u'订单支付中')
30
+    ORDER_PAY_FAIL = StatusCodeField(404013, 'Order Pay Fail', description=u'微信支付失败')
31
+    # 通知校验状态
32
+    SIGN_CHECK_FAIL = StatusCodeField(404090, 'Sign Check Fail', description=u'签名校验失败')
33
+    FEE_CHECK_FAIL = StatusCodeField(404091, 'FEE Check Fail', description=u'金额校验失败')
34
+
35
+
36
+class PayStatusCode(BaseStatusCode):
37
+    """ 4041xx 支付相关错误码 """
38
+
39
+
40
+class WithdrawStatusCode(BaseStatusCode):
41
+    """ 4042xx 提现相关错误码 """
42
+    BALANCE_INSUFFICIENT = StatusCodeField(404200, 'Balance Insufficient', description=u'提现金额不足')
43
+
44
+
45
+class TokenStatusCode(BaseStatusCode):
46
+    """ 4090xx 票据相关错误码 """
47
+    TOKEN_NOT_FOUND = StatusCodeField(409001, 'Token Not Found', description=u'票据不存在')
48
+
49
+
50
+class SignatureStatusCode(BaseStatusCode):
51
+    """ 4091xx 签名校验错误 """
52
+    SIGNATURE_ERROR = StatusCodeField(409101, 'Signature Error', description=u'签名错误')
53
+
54
+
55
+class GVCodeStatusCode(BaseStatusCode):
56
+    """ 4092xx 图形验证码相关错误码 """
57
+    GRAPHIC_VCODE_ERROR = StatusCodeField(409201, 'Graphic VCode Error', description=u'图形验证码错误')
58
+
59
+
60
+class SVCodeStatusCode(BaseStatusCode):
61
+    """ 4093xx 短信验证码相关错误码 """
62
+    SMS_QUOTA_LIMIT = StatusCodeField(409300, 'SMS Quota Limit', description=u'短信次数超限')
63
+    SMS_VCODE_ERROR = StatusCodeField(409301, 'SMS VCode Error', description=u'验证码错误,请稍后重试')
64
+    SMS_VCODE_HAS_SEND = StatusCodeField(409302, 'SMS VCode Has Send', description=u'验证码已发送,请勿重复获取')
65
+
66
+
67
+class InsufficientStatusCode(BaseStatusCode):
68
+    """ 4095xx 不足相关错误码 """
69
+    BALANCE_INSUFFICIENT = StatusCodeField(409501, 'Balance Insufficient', description=u'余额不足')
70
+    INTEGRAL_INSUFFICIENT = StatusCodeField(409502, 'Integral Insufficient', description=u'积分不足')
71
+
72
+
73
+class PermissionStatusCode(BaseStatusCode):
74
+    """ 4099xx 权限相关错误码 """
75
+    PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description=u'权限不足')
76
+    UPLOAD_PERMISSION_DENIED = StatusCodeField(409910, 'Upload Permission Denied', description=u'上传权限不足')
77
+    UPDATE_PERMISSION_DENIED = StatusCodeField(409930, 'Update Permission Denied', description=u'更新权限不足')

+ 24 - 0
utils/error/response_utils.py

@@ -0,0 +1,24 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from json_response import JsonpResponse, 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={}, msg_args=[], msg_kwargs={}, desc_args=[], desc_kwargs={}, request=None, callback=None, **kwargs):
17
+    # Final Message and Description
18
+    message, description = (message or status_code.message, description or status_code.description) if isinstance(status_code, StatusCodeField) else (message, description)
19
+    # Final Response Data
20
+    resp_data = response_data(status_code, (message or '').format(*msg_args, **msg_kwargs), (description or '').format(*desc_args, **desc_kwargs), data, **kwargs)
21
+    # Assign Callback
22
+    callback = callback or (request and request.GET.get('callback'))
23
+    # Call JsonResponse or JsonpResponse
24
+    return JsonpResponse(callback, resp_data, safe=False) if callback else JsonResponse(resp_data, safe=False)

+ 0 - 0
utils/redis/__init__.py


+ 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

+ 1 - 0
utils/redis/rkeys.py

@@ -0,0 +1 @@
1
+# -*- coding: utf-8 -*-

+ 0 - 0
utils/user/__init__.py


+ 18 - 0
utils/user/userinfo_save.py

@@ -0,0 +1,18 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+
4
+def userinfo_save(userinfo):
5
+    """ Save profile or something else """
6
+    # from account.models import UserInfo
7
+    # from django.conf import settings
8
+    #
9
+    # unique_identifier = userinfo.get(settings.WECHAT_UNIQUE_IDENTIFICATION, '')
10
+    #
11
+    # user, created = UserInfo.objects.select_for_update().get_or_create(**{settings.WECHAT_UNIQUE_IDENTIFICATION: unique_identifier})
12
+    # user.unionid = userinfo.get('unionid', '')
13
+    # user.openid = userinfo.get('openid', '')
14
+    # user.nickname = userinfo.get('nickname', '')
15
+    # user.avatar = userinfo.get('headimgurl', '')
16
+    # user.save()
17
+    #
18
+    # return user

kodo - Gogs: Go Git Service

Nessuna descrizione

Brightcells: 66a598b30c Makemigrations 7 anni fa
..
0001_initial.py e184e7dd5b add api group_create/group_join 10 anni fa
0002_groupinfo_session_id.py e184e7dd5b add api group_create/group_join 10 anni fa
0003_groupinfo_admin_id.py 7e305483ab add api group_detail/group_lock/group_pass/group_refuse 10 anni fa
0004_auto_20151216_2337.py 7467a3e68a add api group_update/group_remove 10 anni fa
0005_groupuserinfo_current_id.py f587f0a48f user can just see photo after he joined the group & zh_Hans replace zh_CN in settings.py 10 anni fa
0006_groupuserinfo_avatar.py 4afdb94e20 add avatar for GroupUserInfo 10 anni fa
0007_auto_20160112_2040.py df1df69fe3 add api upgrade/splash 10 anni fa
0008_photocommentinfo.py c72d89f6e5 add api comment_submit_api/comment_list_api/thumbup_submit_api/thumbup_list_api/thumbup_cancel_api 10 anni fa
0009_photothumbupinfo.py c72d89f6e5 add api comment_submit_api/comment_list_api/thumbup_submit_api/thumbup_list_api/thumbup_cancel_api 10 anni fa
0010_auto_20160120_1830.py a121b75ff2 add db_index=True for status field 10 anni fa
0011_auto_20160302_2048.py da2a81fff1 add api pai2_home 10 anni fa
0012_groupinfo_group_avatar.py da2a81fff1 add api pai2_home 10 anni fa
0013_groupinfo_group_default_avatar.py f6a88c632b add group_default_avatar field for GroupInfo 10 anni fa
0014_auto_20160308_2347.py ca727b0362 store/return w/h for photo 10 anni fa
0015_groupphotoinfo_avatar.py 88049b12db store/return more field for photo 10 anni fa
0016_auto_20160321_1535.py 537bd9bd41 add api group_quit_api 10 anni fa
0017_groupphotoinfo_photo_from.py dbea356558 add photo_from field for GroupPhotoInfo and return photo_from for some api 10 anni fa
0018_auto_20160417_2246.py d64b3c216b add and return photo_thumbnail2 relative 10 anni fa
0019_auto_20160422_1322.py 102152ca4a add api lensman_photo_bought & modify api wx_order_create_api and adjust return field 10 anni fa
0020_groupphotoinfo_session_id.py 102152ca4a add api lensman_photo_bought & modify api wx_order_create_api and adjust return field 10 anni fa
0021_photocommentinfo_to_uid.py fa36c26ce4 extend param to_uid for comment_submit_api 10 anni fa
0022_auto_20160901_1439.py 6199c8f7ad add api lensman_origin_wanted_api/lensman_origin_photo_upload_api 9 anni fa
0023_groupinfo_group_initio.py e06dc10006 Make join session group by scan group qrcode fetch group photos initio 9 anni fa
0024_auto_20161214_1329.py f724e0f9c0 Add tour guide apis 9 anni fa
0025_auto_20161214_1659.py ad69866b26 Add tour guide's name and phone in GroupInfo 9 anni fa
0026_auto_20161216_1301.py 034acddb68 Add total_persons for GroupInfo 9 anni fa
0027_groupuserinfo_authority.py 88f0697a89 Add authority field for GroupUserInfo 9 anni fa
0028_auto_20161220_1815.py 272f181c50 Makemigrations 9 anni fa
0029_auto_20161224_1616.py 564ff620d7 Add unique_together = (('group_id', 'user_id'),) for GroupUserInfo 9 anni fa
0030_groupinfo_gather_location.py 90d377ee6e Add gather location 9 anni fa
0031_groupphotoinfo_photo_md5.py d824fbd441 Add photo_md5 for GroupPhotoInfo 9 anni fa
0032_groupinfo_gather_screenshot.py e8cd9652b7 Add gather_screenshot for api tg_group_gather_start_api 9 anni fa
0033_groupphotoinfo_photo_id.py 3c6e34823b Add photo_id for GroupPhotoInfo replaced pk 9 anni fa
0034_auto_20170411_1156.py 14d5d63e3b Add nomark/origin price for GroupPhotoInfo 9 anni fa
0035_groupuserinfo_admin_status.py 9e4ac4fd3b Add admin_status for GroupUserInfo 9 anni fa
0036_groupphotoinfo_has_watermark.py 3b92e37156 Add field has_watermark for GroupPhotoInfo 8 anni fa
0037_auto_20170821_1600.py bf678fc740 Add unique_together = (('session_id', 'group_from'),) 8 anni fa
0038_auto_20170821_1608.py 7060597dd6 Add unique_together = (('group_id', 'user_id', 'photo_md5'),) for GroupPhotoInfo 8 anni fa
0039_auto_20170821_1613.py 9f4c919c29 Add unique_together = (('photo_id', 'user_id'),) for PhotoThumbUpInfo 8 anni fa
0040_auto_20170825_1342.py e5ad69259f Add unique_together = (('group_id', 'session_id', 'user_id', 'photo_id', 'lensman_photo_id'),) for GroupPhotoOrderInfo 8 anni fa
0041_auto_20170825_1342.py e5ad69259f Add unique_together = (('group_id', 'session_id', 'user_id', 'photo_id', 'lensman_photo_id'),) for GroupPhotoOrderInfo 8 anni fa
0042_groupphotoinfo_lensman_type.py a6195fa70d Add outtake lensman 8 anni fa
0043_auto_20180101_2220.py 9bb56c50cc Makemigrations 8 anni fa
0044_auto_20180103_0446.py a7cbbf15a7 Update max_length for CharField 8 anni fa
0045_auto_20180930_1159.py 66a598b30c Makemigrations 7 anni fa
__init__.py e184e7dd5b add api group_create/group_join 10 anni fa