Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
7a02442
规则enum 添加, 活跃度获取类型model + makeke_data
shuaibinliu Sep 6, 2019
5db181f
订单增加活跃度搜索索引,make_data 修改为初始化活跃度类型
shuaibinliu Sep 6, 2019
027d9fe
素材反馈同步创建随笔
shuaibinliu Sep 7, 2019
b6f53e4
活跃度获取类型修改以及查询
shuaibinliu Sep 7, 2019
08b5fa8
为了有序排列,修改初始化主键id
shuaibinliu Sep 7, 2019
cdcc849
添加活跃度类型enum以及创建公共方法
shuaibinliu Sep 8, 2019
4cbd883
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
Wiilz Sep 10, 2019
7e6a4e9
修改初始化配置适配model修改
shuaibinliu Sep 10, 2019
8f098f7
适配前端修改
shuaibinliu Sep 10, 2019
ace5d0f
绑定信息增加活跃积分+获取绑定信息
shuaibinliu Sep 10, 2019
6d03c9b
fix 信息绑定
shuaibinliu Sep 10, 2019
e348ca7
修改:门票编辑
Wiilz Sep 10, 2019
e6e991a
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
Wiilz Sep 10, 2019
05e4c53
fix
Wiilz Sep 10, 2019
286fed9
迁移公共方法
shuaibinliu Sep 10, 2019
480aaa5
分享老人获得活跃度
shuaibinliu Sep 10, 2019
393452a
绑定信息获取活跃度
shuaibinliu Sep 10, 2019
51a8b35
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 10, 2019
a63dcc4
分享新人记录
shuaibinliu Sep 10, 2019
e9d0be0
发布随笔 累加活跃度
shuaibinliu Sep 10, 2019
99c0322
fix
Wiilz Sep 11, 2019
91ed570
增加记录表 公共方法适配
shuaibinliu Sep 11, 2019
a7113bb
活跃度增加适配修改
shuaibinliu Sep 11, 2019
69b4ed3
增加打赏和加精 同时适配修改
shuaibinliu Sep 11, 2019
af58454
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 11, 2019
2d17f18
打赏和加精
shuaibinliu Sep 11, 2019
e97640d
加精状态添加 + 失败加精日志记录。并且不记录当前加活跃度行为
shuaibinliu Sep 12, 2019
1cb2338
规则
shuaibinliu Sep 12, 2019
bedc0e2
增加规则名用于管理员区分
shuaibinliu Sep 12, 2019
c600572
意念编程分享类型。意念觉得没问题,实际不知道。待上正式版测试
shuaibinliu Sep 12, 2019
cf127f1
增加门票供应商类型
Wiilz Sep 15, 2019
b582f9a
门票关联供应商
Wiilz Sep 15, 2019
395b7c6
显示规则,添加活跃分排名
Wiilz Sep 15, 2019
71309b6
已购门票状态筛选
Wiilz Sep 15, 2019
0944bb1
支付修改
Wiilz Sep 15, 2019
1f6b278
fix
Wiilz Sep 15, 2019
049155c
门票动态
Wiilz Sep 17, 2019
7b3c870
支付回调修改
Wiilz Sep 17, 2019
f4af0d6
门票改版
Wiilz Sep 17, 2019
3b8fa56
创建虚拟商品供应商
shuaibinliu Sep 18, 2019
197b4fe
增加小程序码图片格式设置
Wiilz Sep 18, 2019
be8bb49
推广图修改
shuaibinliu Sep 18, 2019
e16723e
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 18, 2019
18135cb
虚拟供应商增加核销员
shuaibinliu Sep 18, 2019
e6f1298
添加排序
shuaibinliu Sep 18, 2019
37a7a94
添加排序
shuaibinliu Sep 18, 2019
9878f35
未知bug fix
shuaibinliu Sep 18, 2019
c133a8f
门票消费记录查看
Wiilz Sep 18, 2019
c87f280
开奖异步任务
Wiilz Sep 18, 2019
e2c9764
退款记录订单id
Wiilz Sep 18, 2019
30d544a
开奖部分修改
Wiilz Sep 18, 2019
bcf6e2d
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
Wiilz Sep 18, 2019
9e6933b
bug fix
Wiilz Sep 18, 2019
eafd1f1
票务增加位置信息
Wiilz Sep 19, 2019
8cadb30
增加已完成状态
Wiilz Sep 19, 2019
9308ec7
核销身份判断
Wiilz Sep 19, 2019
46a6c45
反馈素材退还金额修改
Wiilz Sep 19, 2019
d772c57
门票核销
Wiilz Sep 19, 2019
8f3a30d
fix: 试用码可能被替换
Wiilz Sep 21, 2019
bab37a1
核销有效期验证,直购状态更改
Wiilz Sep 21, 2019
5cd5647
增加删除限制条件
Wiilz Sep 21, 2019
77b71a4
活跃分排名显示
Wiilz Sep 21, 2019
3534d08
增加已结束状态的虚拟申请数
Wiilz Sep 21, 2019
7522df2
腾讯地图视频
shuaibinliu Sep 22, 2019
2c5e3bb
bug fix
shuaibinliu Sep 22, 2019
05bb28e
添加异常捕获
shuaibinliu Sep 22, 2019
39f1872
修改订单状态
shuaibinliu Sep 22, 2019
a369dd1
更新未处理位置信息异步任务
shuaibinliu Sep 22, 2019
8ef2751
直购不限次数
Wiilz Sep 23, 2019
31555e7
更新小bug 修复
shuaibinliu Sep 23, 2019
8606d3b
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 23, 2019
a2feed9
仅虚拟供应商设置核销员
Wiilz Sep 23, 2019
7a9a1df
加积分bug fx
shuaibinliu Sep 23, 2019
8556ec6
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 23, 2019
9bfdc6b
增加供应商查看门票时的筛选
Wiilz Sep 23, 2019
18aecf7
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
Wiilz Sep 23, 2019
af726e3
调整活跃分排名顺序
Wiilz Sep 23, 2019
663dee7
优化随笔内容安全检测
Wiilz Sep 23, 2019
6b033e8
修改绑定账号bug
shuaibinliu Sep 23, 2019
61a07b8
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 23, 2019
014bd43
绑定账号过滤空值
shuaibinliu Sep 23, 2019
86eaee7
修改推广语
shuaibinliu Sep 23, 2019
d760119
昵称内容检查
Wiilz Sep 23, 2019
cc2eda5
图片纠察 todo
shuaibinliu Sep 23, 2019
fb6bb3b
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 23, 2019
9f83fc1
暂时隐藏景区列表数据、
Wiilz Sep 23, 2019
6640b7f
图片增加校验
shuaibinliu Sep 23, 2019
756ce84
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 23, 2019
638549a
完善图片校验 todo 头像上传校验
shuaibinliu Sep 23, 2019
1de2254
头像图片校验
shuaibinliu Sep 23, 2019
d3dc4c1
fix: 正式服头像图片名切分
Wiilz Sep 24, 2019
f836843
调整FormData拼接方式
Wiilz Sep 24, 2019
e4ec5f0
调整图片名切分
Wiilz Sep 24, 2019
e077a7c
fix: 图片检测报错方式
Wiilz Sep 24, 2019
bc545c4
视频内容安全检测
Wiilz Sep 24, 2019
e61173d
调整部分提示
Wiilz Sep 25, 2019
682a613
暂时屏蔽景区内容
Wiilz Sep 25, 2019
2731ce9
fix
Wiilz Sep 25, 2019
c74ce4d
小bug fix
shuaibinliu Sep 25, 2019
cdaee6f
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 25, 2019
cb97129
分享图参数校验
Wiilz Sep 25, 2019
6a5cc12
全局屏蔽某ip段
Wiilz Sep 25, 2019
5dc295f
多次加分修复
shuaibinliu Sep 25, 2019
9747ead
Merge branch 'copytrybox' of github.com:haobin12358/python_planet int…
shuaibinliu Sep 25, 2019
273928c
刷新加分限制
shuaibinliu Sep 26, 2019
eef2596
fix: 绑定社交账号多次加分
Wiilz Sep 26, 2019
352be9e
同人每天邀请一次
shuaibinliu Sep 26, 2019
91d8098
fix: 用户无登录时间
Wiilz Sep 27, 2019
edb5e48
添加虚拟用户
Wiilz Sep 28, 2019
eeb2f52
虚拟购票记录
Wiilz Sep 28, 2019
eefe996
fix
Wiilz Sep 29, 2019
0a054d1
fix
Wiilz Sep 29, 2019
315c343
add user
shuaibinliu Sep 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 196 additions & 3 deletions make_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

from flask import current_app
import uuid

from sqlalchemy import false

from planet import create_app
from planet.config.enums import ItemAuthrity, ItemPostion, ItemType, ActivityType, TimeLimitedStatus
from planet.control.CExcel import CExcel
from planet.extensions.register_ext import db
from planet.models import Items, ProductBrand, Activity, PermissionType, Approval, ProductSku, Admin, Products, \
TimeLimitedActivity, UserActivationCode, ActivationCodeApply, MakeOver
TimeLimitedActivity, UserActivationCode, ActivationCodeApply, MakeOver, ActivationType, User


# 添加一些默认的数据
Expand Down Expand Up @@ -309,7 +312,7 @@ def check_abnormal_sale_volume():
db.session.add(product)
# 修正商品月销量
ops = db.session.query(extract('month', OrderPart.createtime), func.count('*')).outerjoin(
OrderMain,OrderMain.OMid == OrderPart.OMid).filter(
OrderMain, OrderMain.OMid == OrderPart.OMid).filter(
OrderMain.isdelete == False,
OrderPart.isdelete == False,
OrderMain.OMstatus != -40,
Expand Down Expand Up @@ -429,6 +432,194 @@ def init_make_over():
db.session.add(mo)


def make_ActivationType():
with db.auto_commit():
print('start add attype')
attid = 100
act_list = []

# 分享新用户
share_new = ActivationType.create({
'ATTid': str(attid),
'ATTname': "分享新用户",
'ATTnum': 20,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ADid': 'adid1'
})
act_list.append(share_new)
attid += 100

# 分享老用户
share_old = ActivationType.create({
'ATTid': str(attid),
'ATTname': "分享老用户",
'ATTnum': 10,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ADid': 'adid1'
})
act_list.append(share_old)
attid += 100

# 发布随笔
publish = ActivationType.create({
'ATTid': str(attid),
'ATTname': "发布随笔",
'ATTnum': 20,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 100,
'ADid': 'adid1'
})
act_list.append(publish)
attid += 100

# 加精
selected = ActivationType.create({
'ATTid': str(attid),
'ATTname': "系统精选随笔",
'ATTnum': 20,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ADid': 'adid1'
})
act_list.append(selected)
attid += 100

# 打赏 该类型具体积分需按照实际情况添加
print('get reward id is {}'.format(attid))
reward = ActivationType.create({
'ATTid': str(attid),
'ATTname': "系统打赏",
'ATTnum': 0,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ADid': 'adid1'
})
act_list.append(reward)
attid += 100

# 小红书信息绑定
redbook = ActivationType.create({
'ATTid': str(attid),
'ATTname': "小红书信息绑定",
'ATTnum': 10,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ATTtype': 1,
'ATTicon': '/img/base/2019/8/1/logo-red.png',
'ADid': 'adid1'
})
act_list.append(redbook)
attid += 100

# 抖音信息绑定
tiktok = ActivationType.create({
'ATTid': str(attid),
'ATTname': "抖音信息绑定",
'ATTnum': 10,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ATTtype': 1,
'ATTicon': '/img/base/2019/8/1/logo-dou.png',
'ADid': 'adid1'
})
act_list.append(tiktok)
attid += 100

# QQ号信息绑定
qq = ActivationType.create({
'ATTid': str(attid),
'ATTname': "QQ号信息绑定",
'ATTnum': 10,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ATTtype': 1,
'ATTicon': '/img/base/2019/8/1/logo-qq.png',
'ADid': 'adid1'
})
act_list.append(qq)
attid += 100

# 微信号信息绑定
wechat = ActivationType.create({
'ATTid': str(attid),
'ATTname': "微信号信息绑定",
'ATTnum': 10,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ATTtype': 1,
'ATTicon': '/img/base/2019/8/1/logo-peng.png',
'ADid': 'adid1'
})
act_list.append(wechat)
attid += 10

# sina微博信息绑定
sina = ActivationType.create({
'ATTid': str(attid),
'ATTname': "sina微博信息绑定",
'ATTnum': 10,
'ATTupperLimit': 0,
'ATTdayUpperLimit': 0,
'ATTtype': 1,
'ATTicon': '/img/base/2019/8/1/logo-weibo.png',
'ADid': 'adid1'
})
act_list.append(sina)
# attid += 1

print('max attid is {}'.format(attid))

db.session.add_all(act_list)


def add_user():
import xlrd
import os
from PIL import Image
from planet.extensions.qiniu.storage import QiniuStorage

file_path = os.path.join(current_app.config['BASEDIR'], 'img', 'avatar', '2019', '9', '29')
username = xlrd.open_workbook(os.path.join(file_path, 'username.xls'))
sheet = username.sheet_by_index(0)
one_col = sheet.col_values(0)
with db.auto_commit():
last_user_id = db.session.query(User.USid).filter(
User.isdelete == false(), User.USid.ilike('id000%')).order_by(
User.USid.desc(), User.createtime.desc(), origin=True).first()
current_app.logger.info("query_last_user_id: {}".format(last_user_id))

if last_user_id:
last_user_id = last_user_id[0]
else:
last_user_id = 'id00000000'
new_id = int(str(last_user_id).split('id')[-1]) + 1
user_list = []

qiniu = QiniuStorage(current_app)
for index, name in enumerate(one_col):
avatar_name = '/img/avatar/2019/9/29/aratar_{}.jpg'.format(index + 1)
avatar_path = os.path.join(current_app.config['BASEDIR'], avatar_name[1:])
img = Image.open(avatar_path)
x, y = img.size
if x != 132 or y != 132:
img.resize((132, 132), Image.LANCZOS).save(avatar_path)

print(name, avatar_name)
# 上传七牛云
qiniu.save(data=avatar_path, filename=avatar_name[1:])
usid = 'id%08d' % new_id
user = User.create({'USid': usid,
'USname': name,
'USheader': avatar_name,
'USfrom': 2,
})
user_list.append(user)
new_id += 1
db.session.add_all(user_list)


if __name__ == '__main__':
app = create_app()
with app.app_context():
Expand All @@ -437,7 +628,7 @@ def init_make_over():
# print(admin.__dict__)
# print(admin_str)
# make_acvitity()
make_items()
# make_items()
# make_permissiontype()
# make_admin()
# cexcel = CExcel()
Expand All @@ -450,4 +641,6 @@ def init_make_over():
# check_product_from()
# change_tla_status()
# add_uac_acaid()
# make_ActivationType()
add_user()
pass
5 changes: 4 additions & 1 deletion planet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from planet.api.v2.ATicket import ATicket
from planet.common.request_handler import error_handler, request_first_handler
from planet.config.secret import DefaltSettig
from planet.api.v2.AActivation import AActivation
from planet.extensions.register_ext import register_ext
from planet.extensions.loggers import LoggerHandler
from planet.route.RouteSocket import Mynamespace, JSONEncoder as socketjsonencoder
Expand Down Expand Up @@ -118,7 +119,8 @@ def detail(self):
'method': self.method,
'data': self.data,
'query': self.args.to_dict(),
'address': self.remote_addr
'address': self.remote_addr,
'user-agent': self.user_agent.__dict__,
}
# if self.files:
# res.setdefault('files', dict(self.files))
Expand Down Expand Up @@ -197,6 +199,7 @@ def register(app):
v2.add_url_rule('/play/<string:play>', view_func=APlay.as_view('play')) # 活动
v2.add_url_rule('/ticket/<string:ticket>', view_func=ATicket.as_view('ticket')) # 票务
v2.add_url_rule('/feedback/<string:feedback>', view_func=AMaterialFeedback.as_view('feedback')) # 素材反馈
v2.add_url_rule('/activation/<string:activation>', view_func=AActivation.as_view('activation')) # 活跃度
v2.add_url_rule('/personalcenter/<string:personalcenter>',
view_func=AMiniProgramPersonalCenter.as_view('personalcenter')) # 小程序个人中心

Expand Down
25 changes: 25 additions & 0 deletions planet/api/v2/AActivation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from planet.common.base_resource import Resource
from planet.control.CActivation import CActivation


class AActivation(Resource):
def __init__(self):
self.cat = CActivation()

def post(self, activation):
apis = {
'update_activationtype': self.cat.update_activationtype,
'bind_linkage': self.cat.bind_linkage,
'reward': self.cat.reward,
'select': self.cat.select,
}
return apis

def get(self, activation):
apis = {
'get_activationtype': self.cat.get_activationtype,
'list_activationtype': self.cat.list_activationtype,
'get_userlinkage': self.cat.get_userlinkage,
'get_duration_activation': self.cat.get_duration_activation,
}
return apis
3 changes: 3 additions & 0 deletions planet/api/v2/APlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def get(self, play):
'get_promotion': self.cplay.get_promotion,
'get_undertake_agreement': self.cplay.get_undertake_agreement,
'get_params': self.cplay.get_params,
'get_role': self.cplay.get_role,
'list_role': self.cplay.list_role,
'download_team': self.cplay.download_team_user_info,
}
return apis
Expand All @@ -53,6 +55,7 @@ def post(self, play):
'make_over': self.cplay.make_over,
'undertake': self.cplay.undertake,
'payment': self.cplay.payment,
'update_role': self.cplay.update_role,
'help': self.cplay.help
}
return apis
2 changes: 2 additions & 0 deletions planet/api/v2/ASupplizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def get(self, supplizer):
'code': self.csupplizer.send_reset_password_code,
'get_supplizeraccount': self.csupplizer.get_supplizeraccount,
'get_system_notes': self.csupplizer.get_system_notes,
'get_verifier': self.csupplizer.get_verifier,
}
return apis

Expand All @@ -26,5 +27,6 @@ def post(self, supplizer):
'offshelves': self.csupplizer.offshelves,
'set_supplizeraccount': self.csupplizer.set_supplizeraccount,
'add_update_notes': self.csupplizer.add_update_notes,
'set_verifier': self.csupplizer.set_verifier,
}
return apis
54 changes: 28 additions & 26 deletions planet/api/v2/ATicket.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
from planet.common.base_resource import Resource
from planet.control.CTicket import CTicket


class ATicket(Resource):
def __init__(self):
self.cticket = CTicket()

def get(self, ticket):
apis = {
'get': self.cticket.get_ticket,
'list': self.cticket.list_ticket,
'get_promotion': self.cticket.get_promotion,
'list_linkage': self.cticket.list_linkage,
'list_trade': self.cticket.list_trade,
}
return apis

def post(self, ticket):
apis = {
'create': self.cticket.create_ticket,
'update': self.cticket.update_ticket,
'pay': self.cticket.pay,
'award': self.cticket.set_award,
}
return apis
from planet.common.base_resource import Resource
from planet.control.CTicket import CTicket


class ATicket(Resource):
def __init__(self):
self.cticket = CTicket()

def get(self, ticket):
apis = {
'get': self.cticket.get_ticket,
'list': self.cticket.list_ticket,
'get_promotion': self.cticket.get_promotion,
'list_linkage': self.cticket.list_linkage,
'list_trade': self.cticket.list_trade,
'tsostatus': self.cticket.list_tsostatus,
}
return apis

def post(self, ticket):
apis = {
'create': self.cticket.create_ticket,
'update': self.cticket.update_ticket,
'pay': self.cticket.pay,
'award': self.cticket.set_award,
'verify': self.cticket.ticketorder_verified,
}
return apis
1 change: 1 addition & 0 deletions planet/api/v2/AUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def post(self, user):
'mp_login': self.user.mini_program_login, # 小程序登录
'blog_login': self.user.blog_login, # 网页blog登录
'update_usinfo': self.user.update_usinfo, # 小程序编辑个人信息
'add_mock_user': self.user.add_mock_user, # 添加虚拟用户

# 'update': self.user.update,
# 'destroy': self.user.destroy,
Expand Down
Loading