Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
ypt_mgw_local
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
苏星豪
ypt_mgw_local
Commits
2d9b90ae
提交
2d9b90ae
authored
11月 05, 2024
作者:
李思鑫
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
核销id批量核销
上级
f27bf620
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
60 行增加
和
4 行删除
+60
-4
views.py
sales/views.py
+58
-2
views.py
wx/views.py
+2
-2
没有找到文件。
sales/views.py
浏览文件 @
2d9b90ae
...
...
@@ -5615,10 +5615,10 @@ def do_hexiao(request):
remark
=
request
.
GET
.
get
(
'remark'
,
''
)
parent_agent_id
=
request
.
GET
.
get
(
'parent_agent_id'
,
''
)
hexiao_id
=
request
.
GET
.
get
(
'hexiao_id'
,
''
)
hexiao_ids
=
request
.
GET
.
get
(
'hexiao_ids'
,
''
)
applyer_id
=
request
.
GET
.
get
(
'applyer_id'
,
''
)
lat
=
request
.
GET
.
get
(
'lat'
,
'0'
)
lng
=
request
.
GET
.
get
(
'lng'
,
'0'
)
cur
=
connection
.
cursor
()
if
parent_agent_id
==
'undefined'
:
parent_agent_id
=
''
...
...
@@ -5696,6 +5696,62 @@ def do_hexiao(request):
else
:
data
[
'e'
]
=
'奖品不需要核销'
return
JsonResponse
(
data
);
elif
hexiao_ids
:
#批量核销
no_need_hexiao_ids
=
[]
need_hexiao_ids
=
[]
# 先判断所有记录的核销条件
hexiao_ids
=
hexiao_ids
.
split
(
','
)
if
len
(
hexiao_ids
)
>
20
:
data
[
'e'
]
=
'一次最多核销20个'
for
hx_id
in
hexiao_ids
:
hx
=
HeXiao_Record
.
objects
.
get
(
id
=
int
(
hx_id
))
if
hx
.
is_need_agent_writeoff
:
if
not
hx
.
is_agent_writeoff
:
need_hexiao_ids
.
append
(
hx
)
# 符合条件的记录,加入处理列表
else
:
no_need_hexiao_ids
.
append
(
f
'ID {hx_id}: 奖品已被核销'
)
else
:
no_need_hexiao_ids
.
append
(
f
'ID {hx_id}: 奖品不需要核销'
)
if
len
(
no_need_hexiao_ids
):
print
(
'no_need_hexiao_ids'
,
no_need_hexiao_ids
)
data
[
'e'
]
=
'存在不需要核销记录'
+
','
.
join
(
no_need_hexiao_ids
)
elif
len
(
hexiao_ids
)
<=
20
and
len
(
no_need_hexiao_ids
)
==
0
and
len
(
need_hexiao_ids
)
>
0
:
for
hx
in
need_hexiao_ids
:
agent
=
Company
.
objects
.
get
(
id
=
int
(
agent_id
))
if
hx
.
agent_id
!=
agent
.
id
:
award
=
hx
.
award
consumer
=
hx
.
consumer
money
=
award
.
amount
if
award
.
amount
else
0
record
=
HeXiao_Record
(
company_id
=
int
(
company_id
),
award
=
award
,
consumer
=
consumer
,
activity
=
hx
.
activity
,
activity_name
=
hx
.
activity
.
name
,
agent
=
agent
,
award_name
=
award
.
name
,
consumer_name
=
consumer
.
name
,
consumer_phone
=
consumer
.
phone
,
agent_name
=
agent
.
name
,
remark
=
remark
,
money
=
money
,
winner_id
=
hx
.
winner_id
,
is_redeemed
=
False
,
hexiao_id
=
hx
.
id
,
is_need_dispatch
=
False
)
if
applyer_id
:
record
.
applyer_id
=
int
(
applyer_id
)
if
agent
.
level_id
!=
1
:
record
.
is_need_agent_writeoff
=
True
record
.
save
()
hx
.
is_agent_writeoff
=
True
hx
.
save
()
else
:
data
[
'e'
]
=
'无核销权限'
return
JsonResponse
(
data
)
if
c
:
vs
=
VoidLabel
.
objects
.
filter
(
label_code
=
c
.
label_code
)
if
len
(
vs
)
==
0
:
...
...
@@ -9872,7 +9928,7 @@ def activity_lottery_plan_edit(request, id=None):
#lisin 修改成批量
if
win_scan_num
:
win_scan_num
=
[
int
(
num
)
for
num
in
win_scan_num
.
split
(
','
)]
if
(
len
(
win_scan_num
)
>
2
):
if
(
len
(
win_scan_num
)
>
2
0
):
e
=
'设置数量不能超过20个'
return
render
(
request
,
'sales/activity_lottery_plan.html'
,
{
e
:
e
})
...
...
wx/views.py
浏览文件 @
2d9b90ae
...
...
@@ -124,10 +124,10 @@ def app_autocomplete(request,what):
return
JsonResponse
(
data
,
safe
=
False
)
#2020-07-10
rd
=
redis
.
StrictRedis
(
host
=
'localhost'
,
port
=
settings
.
RD
[
'port'
],
decode_responses
=
True
)
rd
=
redis
.
StrictRedis
(
host
=
'localhost'
,
port
=
settings
.
RD
[
'port'
],
password
=
'tjredis139'
,
decode_responses
=
True
)
#2020-12-21 微信redis库
rd_wx
=
redis
.
StrictRedis
(
host
=
'localhost'
,
port
=
settings
.
RD
[
'port'
],
db
=
5
,
decode_responses
=
True
)
rd_wx
=
redis
.
StrictRedis
(
host
=
'localhost'
,
port
=
settings
.
RD
[
'port'
],
db
=
5
,
password
=
'tjredis139'
,
decode_responses
=
True
)
WX_ERRS
=
{
1
:
'标签号码不存在'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论