286 Commits

Author SHA1 Message Date
8a62c2f1eb 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 21:44:23 +08:00
854c87cc46 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 21:32:55 +08:00
aa9bf9232e 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 21:27:28 +08:00
21890b3fcd 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 21:09:15 +08:00
dbe7a83aef 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 20:58:08 +08:00
39018da4e3 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 20:54:35 +08:00
85d4174798 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 20:37:44 +08:00
656f0692cf 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 20:22:06 +08:00
20ad1818e0 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 20:18:21 +08:00
9ffb61ada9 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 19:22:00 +08:00
8269218c7d 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 18:27:45 +08:00
d284ee8346 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 18:24:08 +08:00
db7a9c460c 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 16:39:58 +08:00
8ab582956e 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 15:44:53 +08:00
9f4b3a512c 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 14:40:33 +08:00
74c0e85178 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 14:14:48 +08:00
1e4729fbb7 Merge remote-tracking branch 'origin/develop' into develop 2025-10-16 11:37:58 +08:00
3abe055f1c 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 11:37:50 +08:00
36850d6087 小时榜红包入口 2025-10-16 11:01:39 +08:00
cf0d665f42 Merge remote-tracking branch 'origin/develop' into develop 2025-10-16 10:59:05 +08:00
2525487051 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 10:58:57 +08:00
fd535f969b 红包 抢完销毁 2025-10-16 10:42:04 +08:00
2308ea8b64 红包 抢完销毁 2025-10-16 10:23:58 +08:00
774107e28f 红包 抢完销毁 2025-10-16 10:16:20 +08:00
beb87cf3fd 小时榜红包入口 2025-10-16 09:18:16 +08:00
754bc120ca 抢红包条件验证提示语修改 2025-10-15 19:22:00 +08:00
ed5488699f 抢红包条件验证提示语修改 2025-10-15 19:16:23 +08:00
6c89b1b992 抢红包条件验证提示语修改 2025-10-15 18:39:22 +08:00
ec7aa532d8 红包详情 2025-10-15 17:44:16 +08:00
6bf05fd52d 红包详情 2025-10-15 17:42:57 +08:00
195f6f9fad 红包详情 2025-10-15 17:41:54 +08:00
85bc9a30db Merge remote-tracking branch 'origin/develop' into develop 2025-10-15 17:19:43 +08:00
a72b3bc410 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-15 17:19:36 +08:00
18944ddcbc 红包详情 2025-10-15 17:16:09 +08:00
d6bbdefb0a 红包状态检查 2025-10-15 17:12:51 +08:00
46dd1af437 Merge remote-tracking branch 'origin/develop' into develop 2025-10-15 17:10:49 +08:00
5ff8dc4acf 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-15 17:10:43 +08:00
ba835772b2 红包状态检查 2025-10-15 17:07:57 +08:00
b5422fbc35 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-15 16:39:05 +08:00
4a08d656f0 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-15 16:12:22 +08:00
5e80ea66f1 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-15 16:03:46 +08:00
09b4ebb5b8 Merge remote-tracking branch 'origin/develop' into develop 2025-10-15 15:55:12 +08:00
a04a75d7d9 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-15 15:54:53 +08:00
aa972a9669 推送 重新定义 2025-10-15 15:45:37 +08:00
faba9d6d2b 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试-优化错误 2025-10-15 14:58:37 +08:00
213294ac64 Merge remote-tracking branch 'origin/develop' into develop 2025-10-15 14:36:45 +08:00
09a02c1d14 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试-优化错误 2025-10-15 14:36:13 +08:00
ee8b00e840 推送 重新定义 2025-10-15 14:19:11 +08:00
9fe6beb9f3 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试-优化错误 2025-10-15 11:40:41 +08:00
05acefde88 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试-优化错误 2025-10-15 10:56:09 +08:00
c3bddf960a 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试-优化错误 2025-10-15 10:31:51 +08:00
a1866ff95f 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试-优化错误 2025-10-15 10:20:50 +08:00
0140dad0d1 红包状态修改 2025-10-14 18:36:49 +08:00
62a00d51d6 红包状态修改 2025-10-14 18:12:28 +08:00
4aac4e9109 红包状态修改 2025-10-14 18:09:49 +08:00
7a57493a19 红包收藏房间 2025-10-14 16:59:37 +08:00
4a6cb606a7 Merge remote-tracking branch 'origin/develop' into develop 2025-10-14 16:54:29 +08:00
b168178112 新需求-活动需求-盲盒转盘调通盘-调试-优化错误 2025-10-14 16:54:22 +08:00
c8efd7c4cc 房间红包管理 2025-10-14 16:11:37 +08:00
aff5a7ae17 房间红包管理 2025-10-14 15:49:41 +08:00
ee98bd051b 房间红包管理 2025-10-14 15:36:34 +08:00
1878361188 新需求-活动需求-盲盒转盘调通盘-调试-优化错误 2025-10-14 15:32:23 +08:00
14f30dd692 新需求-活动需求-盲盒转盘调通盘-调试-优化错误 2025-10-14 15:23:36 +08:00
4440aee163 cp房列表条件筛选 2025-10-14 14:59:19 +08:00
d5332dadfd cp房列表条件筛选 2025-10-14 14:56:32 +08:00
d7c0170743 cp房列表条件筛选 2025-10-14 14:48:46 +08:00
a3a8d582e5 查看错误 2025-10-14 12:03:04 +08:00
2eaa7360e9 查看错误 2025-10-14 11:57:05 +08:00
51b78a0be3 新需求-活动需求-盲盒转盘调通盘-调试-优化错误 2025-10-14 11:42:17 +08:00
7062cd12ce 查看错误 2025-10-14 11:37:45 +08:00
5b26b8c57f 处理过期红包 2025-10-14 11:35:59 +08:00
2db084b7bd 红包列表返回数据处理 2025-10-14 11:32:43 +08:00
4651940f46 红包过期处理 2025-10-14 11:27:38 +08:00
6308a03610 新需求-活动需求-盲盒转盘调通盘-调试-优化错误 2025-10-14 11:26:45 +08:00
ec0607e1d6 抢红包返回结果重组 2025-10-14 11:23:44 +08:00
222493831b 抢红包返回结果重组 2025-10-14 11:19:53 +08:00
5523125c65 抢红包返回结果重组 2025-10-14 10:47:53 +08:00
40a297dc94 新需求-活动需求-盲盒转盘调通盘-调试-后台接口调整 2025-10-14 10:23:26 +08:00
a0801a7e58 Merge remote-tracking branch 'origin/develop' into develop 2025-10-14 10:21:29 +08:00
2ebc3bdd5a 新需求-活动需求-盲盒转盘调通盘-调试-后台接口调整 2025-10-14 10:21:22 +08:00
4d22b53936 抢红包优化,红包详情优化 2025-10-14 09:44:29 +08:00
b42d87294d 登录错误 优化 2025-10-14 09:13:15 +08:00
9c957165ff 新需求-活动需求-盲盒转盘调通盘-调试-后台接口调整 2025-10-13 21:01:12 +08:00
7516ee5289 Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 20:33:56 +08:00
8a3bb401cf 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 20:33:48 +08:00
aa8f10e4f6 小时榜优化 2025-10-13 19:58:19 +08:00
69e5922901 踢出房间 5分钟 改10分钟 2025-10-13 19:47:14 +08:00
769710c2dc cp房间列表 管理端 2025-10-13 19:11:37 +08:00
9ff949db23 Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 18:57:01 +08:00
24beb48c17 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 18:56:55 +08:00
c82bf56b88 红包超时退回 2025-10-13 18:52:42 +08:00
43f9a619b4 红包超时退回 2025-10-13 18:48:39 +08:00
aaa3bdb5dd 红包列表 2025-10-13 18:19:32 +08:00
e76e4a8e49 Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 18:07:16 +08:00
4628896157 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 18:07:08 +08:00
aadaee553a 管理端 cp房间列表 2025-10-13 17:53:45 +08:00
a17bcb1daf Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 17:06:29 +08:00
e0265dd287 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 17:06:22 +08:00
98771969fc 给前端推送 添加数据 2025-10-13 16:38:57 +08:00
f31fdc635f 给前端推送 添加数据 2025-10-13 16:37:47 +08:00
58d7411243 给前端推送 添加数据 2025-10-13 16:36:49 +08:00
e83173bd9c Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 16:21:48 +08:00
25fe6150ad 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 16:21:41 +08:00
7385361521 MQTT推送 2025-10-13 16:21:37 +08:00
f50609fffe 推送给前端 红包信息里面添加一个开抢时间 2025-10-13 16:13:36 +08:00
f187eb9abc Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 16:10:44 +08:00
b42927191a 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 16:10:37 +08:00
3ea90b555c 红包信息添加发送者的头像 2025-10-13 16:06:33 +08:00
e1c0f3c803 pan推送 2025-10-13 15:59:17 +08:00
4dcccc2896 红包添加备注 和校验 2025-10-13 15:56:46 +08:00
72f56a4fb4 Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 15:36:23 +08:00
ee65ea17d3 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 15:36:16 +08:00
76a782be82 账号验证码登录 异常拉黑 2025-10-13 15:31:01 +08:00
fcbe37f846 新需求-活动需求-盲盒转盘调通盘-调试 2025-10-13 15:03:20 +08:00
84695ac8a1 新需求-活动需求-盲盒转盘调通盘 2025-10-13 14:59:37 +08:00
98417ecf7f Merge remote-tracking branch 'origin/develop' into develop 2025-10-13 14:11:02 +08:00
7efdf519ce 新需求-活动需求-盲盒转盘调通盘 2025-10-13 14:10:54 +08:00
e60975581d 红包第13次修改 2025-10-13 11:49:27 +08:00
a720c696c6 红包第13次修改 2025-10-13 11:36:17 +08:00
9c0cd48425 新需求-活动需求-盲盒转盘调通盘 2025-10-13 11:26:30 +08:00
212c4faaf3 红包 有效期改为1200秒 2025-10-13 11:01:45 +08:00
645de3ecb7 登录解封 2025-10-13 10:58:54 +08:00
1cb3a00718 账号密码登录 2025-10-13 10:47:15 +08:00
8891e14154 账号密码登录 2025-10-13 10:42:11 +08:00
cb05d174c0 短信码验证 2025-10-13 10:19:48 +08:00
173a003dd7 短信码验证 2025-10-13 10:10:49 +08:00
e98b932eb3 短信码验证 2025-10-13 10:04:54 +08:00
23acefb6b1 短信码验证 2025-10-13 09:44:29 +08:00
4eae7d8375 新需求-活动需求-天降好礼 2025-10-12 17:43:14 +08:00
274750dc1d 新需求-活动需求-天降好礼 2025-10-12 17:17:24 +08:00
b0b3bb07a7 新需求-活动需求-天降好礼 2025-10-12 17:09:51 +08:00
977cb910df 新需求-活动需求-天降好礼 2025-10-12 17:06:17 +08:00
a17365bbe4 新需求-活动需求-天降好礼 2025-10-12 17:02:57 +08:00
77623330b3 新需求-活动需求-盲盒转盘-立即竞拍 2025-10-12 15:47:40 +08:00
2ffda46f91 新需求-活动需求-天降好礼 2025-10-12 14:38:07 +08:00
ef90015195 新需求-活动需求-盲盒转盘 2025-10-12 12:38:20 +08:00
a504005c8f 新需求-活动需求-天降好礼 2025-10-12 12:00:58 +08:00
ffdf765ef0 新需求-活动需求-天降好礼 2025-10-12 11:26:21 +08:00
dea9e225f2 新需求-活动需求-盲盒转盘重构 2025-10-12 10:09:07 +08:00
be57b42260 新需求-活动需求-天降首充好礼调整-新人充值好礼 接口提交 2025-10-12 09:43:16 +08:00
07f6e148ed Merge remote-tracking branch 'origin/develop' into develop 2025-10-12 09:20:05 +08:00
9cdf269f22 新需求-活动需求-天降首充好礼调整-新人充值好礼 接口提交 2025-10-12 09:19:56 +08:00
fcf912ac90 红包列表 修改1 2025-10-11 18:18:43 +08:00
d7c48a5ae0 发红包 推送 2025-10-11 18:09:36 +08:00
65bb1b0c53 红包第13次修改 2025-10-11 16:37:42 +08:00
d995df1b66 红包第12次修改 2025-10-11 16:30:11 +08:00
60283af40f 红包第11次修改 2025-10-11 16:26:18 +08:00
ec2110c07d 红包第10次修改 2025-10-11 16:19:19 +08:00
05f61dfe11 红包第9次修改 2025-10-11 16:07:12 +08:00
4846be3538 红包第8次修改 2025-10-11 15:23:35 +08:00
f5c2391032 红包第7次修改 2025-10-11 15:20:49 +08:00
27ad16bb52 红包第6次修改 2025-10-11 15:19:14 +08:00
4fe5b7e1f0 红包第5次修改 2025-10-11 15:14:10 +08:00
757c36c830 红包第4次修改 2025-10-11 15:08:25 +08:00
e76bf26819 红包第3次修改 2025-10-11 15:02:13 +08:00
8556184c1a 红包第二次修改 2025-10-11 14:58:51 +08:00
641368f78e 红包第一次修改 2025-10-11 14:54:43 +08:00
204c19ff6d 红包 2025-10-11 14:53:39 +08:00
7415193bba 红包 2025-10-11 14:49:25 +08:00
ac9182c566 新需求-活动需求-天降首充好礼调整-新人充值好礼 接口提交 2025-10-11 09:42:35 +08:00
7a18e94faf 支付回调 2025-10-10 19:25:42 +08:00
c606916057 红包 2025-10-10 19:15:41 +08:00
af6403d6aa 后台用户修改 2025-10-10 18:49:12 +08:00
323272b89b 后台用户密码修改 2025-10-10 18:23:06 +08:00
06a9fac6a9 Merge remote-tracking branch 'origin/develop' into develop 2025-10-10 17:12:49 +08:00
8c2d43dfb1 二级密码修改展示 2025-10-10 17:12:42 +08:00
36ce1a8c17 格式化 2025-10-10 16:22:53 +08:00
d3e89e9af8 新需求-活动需求-天降首充好礼调整-后台接口调整 2025-10-10 14:45:38 +08:00
059bf0095a 新需求-活动需求-天降首充好礼调整 2025-10-10 10:52:46 +08:00
d186cdf7b7 绑定的详情 字段转换 2025-10-09 19:24:58 +08:00
dd316482e7 房主收益计算 2025-10-09 10:32:40 +08:00
7b93166495 房主收益计算 2025-10-09 10:26:49 +08:00
255841e3dc 提交测试脚本 2025-10-09 09:51:43 +08:00
f1e0d9b220 国庆更新代码 2025-10-09 09:48:00 +08:00
4ef4486ffa 国庆更新代码 2025-10-09 09:46:02 +08:00
db3dcaaef7 国庆修改-房间周流水时间修改 2025-10-05 06:21:51 +08:00
9549b5adbc 国庆修改 2025-10-04 13:32:33 +08:00
35953326c6 小时榜礼物配置 2025-09-30 22:36:27 +08:00
b448d77d05 分页错误修改 2025-09-30 21:59:37 +08:00
80fe3afca6 小时榜礼物配置 2025-09-30 21:10:48 +08:00
38d81d3f47 加redis日志 2025-09-30 20:26:09 +08:00
2bc5edbab9 加redis日志 2025-09-30 19:19:40 +08:00
8d014150a2 加redis日志 2025-09-30 18:11:36 +08:00
e0004eb216 提现修改-调试 2025-09-30 17:31:49 +08:00
40f5222762 提现修改-调试 2025-09-30 17:04:24 +08:00
f571330267 提现修改-调试 2025-09-30 16:46:03 +08:00
404f195d57 提现修改-调试 2025-09-30 16:28:10 +08:00
cf2a49d020 提现修改 2025-09-30 16:15:53 +08:00
5a54381854 提现列表修改 2025-09-30 15:46:22 +08:00
2a9639e45c 提现列表修改 2025-09-30 15:33:14 +08:00
989985afe6 提现列表修改 2025-09-30 15:09:55 +08:00
89f6d32bd2 提现加提现方式判断 2025-09-30 14:50:58 +08:00
2a508ce4d4 小时榜礼物配置 2025-09-30 14:36:47 +08:00
ddb22e9556 提现列表添加税点字段 2025-09-30 14:08:09 +08:00
b3f5a5d62d 云账号SDK更换 2025-09-30 14:06:41 +08:00
4faaea51b8 工会流水计算 2025-09-30 12:04:35 +08:00
38d3600ced 小时榜礼物配置 2025-09-30 10:54:19 +08:00
f48d6ff512 工会流水计算 2025-09-30 10:53:49 +08:00
9772866432 工会流水计算 2025-09-30 10:21:09 +08:00
32dfeb8f9b 二卡八 不推送离线 2025-09-30 09:09:58 +08:00
f21032aa56 房间小时榜相关 2025-09-29 21:00:30 +08:00
6e86199ea5 房间小时榜相关 2025-09-29 20:06:47 +08:00
edf7adfdab 房间小时榜相关 2025-09-29 19:52:01 +08:00
fbe69d1fee 房间小时榜相关 2025-09-29 19:50:09 +08:00
bb1d02a0df 房间小时榜相关 2025-09-29 19:13:59 +08:00
1d28dc041c 房间小时榜相关 2025-09-29 19:11:57 +08:00
4006b9f83c 房间小时榜相关 2025-09-29 18:55:21 +08:00
eeae4df530 房间小时榜相关 2025-09-29 18:53:29 +08:00
ab278d25bb Merge remote-tracking branch 'origin/develop' into develop 2025-09-29 18:47:18 +08:00
3d63949019 工会流水计算 2025-09-29 18:46:21 +08:00
4ecd68f985 房间小时榜相关 2025-09-29 18:41:37 +08:00
b64e001e3f 工会流水计算 2025-09-29 18:40:02 +08:00
fb86fac9de 工会流水计算 2025-09-29 18:37:37 +08:00
0a2f05a928 房间小时榜相关 2025-09-29 18:29:08 +08:00
5279199cec 房间小时榜 2025-09-29 16:30:20 +08:00
76b01f975c 房间小时榜 2025-09-29 16:28:34 +08:00
ba9e883e0c 房间小时榜 2025-09-29 16:27:36 +08:00
a19338ab17 Merge remote-tracking branch 'origin/develop' into develop 2025-09-29 15:17:03 +08:00
c8551384e3 补贴计算 加金币转换钻石 2025-09-29 15:16:49 +08:00
8fca63d910 房间小时榜 2025-09-29 15:14:00 +08:00
80a6cc4459 房间小时榜 2025-09-29 14:57:41 +08:00
5ac02eabb6 房间小时榜 2025-09-29 14:33:56 +08:00
6e3eabbc8f 房间小时榜 2025-09-29 14:30:15 +08:00
550058ec45 房间小时榜 2025-09-29 14:29:08 +08:00
469063984e 房间小时榜 2025-09-29 14:26:04 +08:00
36fc715dd7 Merge remote-tracking branch 'origin/develop' into develop 2025-09-29 14:25:22 +08:00
86acddf2aa 巡乐会状态修改 2025-09-29 14:25:15 +08:00
3c9c22a2dc 房间小时榜 2025-09-29 14:23:25 +08:00
c08578072d 房间小时榜 2025-09-29 14:21:42 +08:00
5e5185a92a 房间小时榜 2025-09-29 14:18:14 +08:00
bd3af537cc 房间小时榜 2025-09-29 14:14:20 +08:00
2fb4b136ed 房间小时榜 2025-09-29 14:12:04 +08:00
a8eddc74eb Merge remote-tracking branch 'origin/develop' into develop 2025-09-29 11:29:58 +08:00
90a0862e8c 版本管理修改 2025-09-29 11:29:50 +08:00
f5416d6b9b 首页新搜索 2025-09-29 11:24:10 +08:00
0fa41cfd7b 首页新搜索 2025-09-29 10:29:29 +08:00
b2c229ace8 首页新搜索 2025-09-29 10:17:01 +08:00
c9264b6b93 重连后房间处理 2025-09-28 20:33:27 +08:00
fb70b146d2 盲盒转盘代码优化 2025-09-28 20:15:47 +08:00
2355ba0c26 重连后房间处理 2025-09-28 19:45:23 +08:00
d8de39462e 重连后房间处理 2025-09-28 19:34:27 +08:00
46b7afda8a 重连后房间处理 2025-09-28 19:32:13 +08:00
61a9478bf3 重连后房间处理 2025-09-28 18:49:49 +08:00
89206ee3e6 盲盒转盘代码优化 2025-09-28 18:26:08 +08:00
542cd9b3c2 盲盒转盘代码优化 2025-09-28 18:24:16 +08:00
c425b3c8c3 Merge remote-tracking branch 'origin/develop' into develop 2025-09-28 18:18:14 +08:00
84239c5653 盲盒转盘代码优化 2025-09-28 18:18:09 +08:00
56c919cb90 重连后房间处理 2025-09-28 18:16:58 +08:00
d9daa2410f 盲盒转盘代码优化 2025-09-28 17:48:02 +08:00
5972dc04cc 盲盒转盘修改 2025-09-28 16:21:24 +08:00
4dac5497f8 盲盒转盘盈亏统计修改 2025-09-28 15:55:51 +08:00
770c9a0fb8 重连后房间处理 2025-09-28 15:48:36 +08:00
3d66a47226 重连后房间处理 2025-09-28 13:26:15 +08:00
4e2b101c33 申请上麦 重新梳理 2025-09-28 11:27:05 +08:00
ea11467cc0 申请上麦 重新梳理 2025-09-28 11:20:28 +08:00
39e3436c69 申请上麦 重新梳理 2025-09-28 11:01:58 +08:00
feadb42002 盲盒转盘错误修改 2025-09-27 19:01:27 +08:00
37020e8b53 后台需求调整 2025-09-27 18:13:19 +08:00
10c8066469 后台需求调整 2025-09-27 17:40:36 +08:00
9fdcf751ea 后台时间搜索更换 2025-09-27 17:29:15 +08:00
e373fe3706 后台:首页统计调整 2025-09-27 17:07:12 +08:00
147f5fc32e 后台:首页统计调整 2025-09-27 16:11:53 +08:00
981f3ce605 后台:用户列表接口添加用户ID搜索 2025-09-27 15:52:02 +08:00
8b9ccfab14 提现失败退回修改 2025-09-27 14:50:42 +08:00
734182151f 提现失败退回修改 2025-09-27 14:47:34 +08:00
c0a1f3ea33 解决超出发放礼物问题-巡乐会-日志加缓存 2025-09-27 14:45:21 +08:00
7cc5ebd582 离线推送 暂停了 2025-09-27 14:13:04 +08:00
7cf865a39f 解决超出发放礼物问题-巡乐会-日志加缓存 2025-09-27 11:11:01 +08:00
d012b82fce 解决超出发放礼物问题-巡乐会-加清除缓存方法 2025-09-27 10:14:42 +08:00
3ad690fae4 解决超出发放礼物问题-巡乐会-加清除缓存方法 2025-09-27 09:38:29 +08:00
eccb8c3cb3 解决超出发放礼物问题-盲盒转盘-加Redis统计 2025-09-27 09:19:12 +08:00
aacd3e7f51 解决超出发放礼物问题-盲盒转盘 2025-09-27 00:20:06 +08:00
121f22b608 解决超出发放礼物问题-盲盒转盘 2025-09-26 23:40:42 +08:00
367222cda0 修复盲盒转盘多抽bug 2025-09-26 19:30:30 +08:00
4c7ff4a469 系统维护通知 2025-09-26 18:32:19 +08:00
d68e7fc955 巡乐会榜单 接口开发 2025-09-26 17:55:50 +08:00
a09b6af359 巡乐会榜单 接口开发 2025-09-26 17:38:38 +08:00
b3a1df9088 巡乐会榜单 接口开发 2025-09-26 17:06:48 +08:00
f0ef5b39a6 配合测试,修改错误提示 2025-09-26 15:18:07 +08:00
bfbc9daa33 主持人收益范围规范 2025-09-26 11:56:46 +08:00
040aa38659 配合测试,修改错误提示 2025-09-26 10:53:20 +08:00
826392fbda 房主收益为0 判断 2025-09-26 10:33:46 +08:00
90a34cc958 送盲盒转盘 报错解决 2025-09-26 03:33:20 +08:00
47457337da 送盲盒转盘 报错解决 2025-09-26 03:17:47 +08:00
3698e92545 巡乐会加房主信息 2025-09-25 19:36:32 +08:00
77b123d955 巡乐会加房主信息 2025-09-25 16:35:22 +08:00
128 changed files with 15160 additions and 1527 deletions

10
.env
View File

@@ -10,13 +10,21 @@ trace = false
; hostport = 3306 ; hostport = 3306
; prefix = fa_ ; prefix = fa_
hostname = 1.13.181.248 hostname = 1.13.181.248
database = midi database = midi
username = midi username = midi
password = YWbCxwkZKJ36nnDx password = 5B2zwShhTi5L7t2w
hostport = 3306 hostport = 3306
prefix = fa_ prefix = fa_
#hostname = 62.234.12.147
#database = midi
#username = midi
#password = EC6cak6fzXdXnERz
#hostport = 3306
#prefix = fa_
[mqtt] [mqtt]
mqtt_server = 1.13.181.248 mqtt_server = 1.13.181.248
mqtt_port = 1883 mqtt_port = 1883

View File

@@ -40,8 +40,9 @@ class Activities extends adminApi
public function first_charge_lists(){ public function first_charge_lists(){
$page = input('page', 1); $page = input('page', 1);
$page_limit = input('page_limit', 30); $page_limit = input('page_limit', 30);
$activities_id = input('activities_id', 1);
$where = []; $where = [];
$where['activities_id'] = 1; $where['activities_id'] = $activities_id;
$where['delete_time'] = 0; $where['delete_time'] = 0;
$count = db($this->table)->where($where)->count(); $count = db($this->table)->where($where)->count();
$lists = db($this->table)->where($where)->page($page, $page_limit)->select(); $lists = db($this->table)->where($where)->page($page, $page_limit)->select();
@@ -76,11 +77,12 @@ class Activities extends adminApi
$title1 = input('title1', ''); $title1 = input('title1', '');
$title2 = input('title2', ''); $title2 = input('title2', '');
$money = input('money', ''); $money = input('money', '');
$activities_id = input('activities_id', 1);
$return_data = [ $return_data = [
'name' => $name, 'name' => $name,
'title' => $title, 'title' => $title,
'status' => $status, 'status' => $status,
'activities_id' => 1, 'activities_id' => $activities_id,
]; ];
$ext = [ $ext = [
'title1' => $title1, 'title1' => $title1,
@@ -167,11 +169,12 @@ class Activities extends adminApi
$page_limit = input('page_limit', 30); $page_limit = input('page_limit', 30);
$user_id = input('user_id', ''); $user_id = input('user_id', '');
$gift_bag_id = input('gift_bag_id', ''); $gift_bag_id = input('gift_bag_id', '');
$activities_id = input('activities_id', 1);
$where = []; $where = [];
if($user_id){ if($user_id){
$where['user_id'] = $user_id; $where['user_id'] = $user_id;
} }
$gift_bag = db('vs_gift_bag')->where(['activities_id'=>1,'delete_time'=>0])->select(); $gift_bag = db('vs_gift_bag')->where(['activities_id'=>$activities_id,'delete_time'=>0])->select();
if($gift_bag_id){ if($gift_bag_id){
$where['gift_bag_id'] = $gift_bag_id; $where['gift_bag_id'] = $gift_bag_id;
@@ -360,6 +363,7 @@ class Activities extends adminApi
'foreign_id' => $gift_id, 'foreign_id' => $gift_id,
'name' => $gift['gift_name'], 'name' => $gift['gift_name'],
'quantity' => $num, 'quantity' => $num,
'gold' => $gift['gift_price'],
]; ];
} elseif($type == 3){ } elseif($type == 3){
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$gift_id])->find(); $decorate_price = DB::name('vs_decorate_price')->where(['id'=>$gift_id])->find();
@@ -373,6 +377,7 @@ class Activities extends adminApi
'foreign_id' => $gift_id, 'foreign_id' => $gift_id,
'name' => $gift['title'], 'name' => $gift['title'],
'days' => $decorate_price['day'], 'days' => $decorate_price['day'],
'gold' => $decorate_price['price'],
]; ];
} elseif($type == 4){ } elseif($type == 4){
$data = [ $data = [
@@ -433,17 +438,20 @@ class Activities extends adminApi
$money = input('money', ''); $money = input('money', '');
$money_str = input('money_str', ''); $money_str = input('money_str', '');
$diamond = input('diamond', ''); $diamond = input('diamond', '');
$activity_end_time = input('activity_end_time', '');
$id = input('id', 6); $id = input('id', 6);
$data = [ $data = [
'name' => $name, 'name' => $name,
'title' => $title, 'title' => $title,
'status' => $status 'status' => $status,
'money' => $money,
]; ];
$ext = [ $ext = [
'counter' => $counter, 'counter' => $counter,
'money_str' => $money_str, 'money_str' => $money_str,
'diamond' => $diamond, 'diamond' => $diamond,
'money' => $money 'money' => $money,
'activity_end_time' => $activity_end_time
]; ];
$data['ext'] = json_encode($ext); $data['ext'] = json_encode($ext);
$res = db::name($this->table)->where(['id'=>$id])->update($data); $res = db::name($this->table)->where(['id'=>$id])->update($data);

View File

@@ -168,7 +168,7 @@ class Admin extends adminApi
{ {
if ($this->request->isPost()) { if ($this->request->isPost()) {
$params = $this->request->post(); $params = $this->request->post();
$group = $params['group']; $group = $params['group']?? [];
unset($params['group']); unset($params['group']);
unset($params['__token__']); unset($params['__token__']);
if ($params) { if ($params) {
@@ -196,21 +196,21 @@ class Admin extends adminApi
return V(0,"失败", []); return V(0,"失败", []);
} }
// 先移除所有权限 if(!empty($group)){
model('admin/AuthGroupAccess')->where('uid', $params['id'])->delete(); // 先移除所有权限
model('admin/AuthGroupAccess')->where('uid', $params['id'])->delete();
// 过滤不允许的组别,避免越权
$group = array_intersect($this->childrenGroupIds, $group);
if (!$group) {
return V(0,"失败", []);
}
$dataset = [];
// 过滤不允许的组别,避免越权 foreach ($group as $value) {
$group = array_intersect($this->childrenGroupIds, $group); $dataset[] = ['uid' => $params['id'], 'group_id' => $value];
if (!$group) { }
return V(0,"失败", []); model('admin/AuthGroupAccess')->saveAll($dataset);
} }
$dataset = [];
foreach ($group as $value) {
$dataset[] = ['uid' => $params['id'], 'group_id' => $value];
}
model('admin/AuthGroupAccess')->saveAll($dataset);
Db::commit(); Db::commit();
return V(1,"成功", []); return V(1,"成功", []);
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -52,10 +52,10 @@ class Adminlog extends adminApi
$where['createtime'] = ['>=', strtotime($search_stime)]; $where['createtime'] = ['>=', strtotime($search_stime)];
} }
if ($search_etime) { if ($search_etime) {
$where['createtime'] = ['<=', strtotime($search_etime.' 23:59:59')]; $where['createtime'] = ['<=', strtotime($search_etime)];
} }
if(!empty($search_stime) && !empty($search_etime)){ if(!empty($search_stime) && !empty($search_etime)){
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
} }
$list_data = $this->model->where($where)->where('admin_id', 'in', $this->childrenAdminIds)->order('createtime', 'desc')->paginate($page_limit, false, ['page' => $page]); $list_data = $this->model->where($where)->where('admin_id', 'in', $this->childrenAdminIds)->order('createtime', 'desc')->paginate($page_limit, false, ['page' => $page]);

View File

@@ -9,6 +9,7 @@ use think\Db;
use think\Hook; use think\Hook;
use think\Session; use think\Session;
use think\Validate; use think\Validate;
use think\Cache;
/** /**
* 盲盒 * 盲盒
@@ -260,95 +261,95 @@ class BlindBox extends adminApi
return V(0,"请选择盲盒类型"); return V(0,"请选择盲盒类型");
} }
$gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select(); $gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select();
if(in_array($gift_bag_id,[10,11,12,13])){ // if(in_array($gift_bag_id,[10,11,12,13])){
$periods = 1; // $periods = 1;
$target_room_ids = []; // $target_room_ids = [];
if(!empty($room_id)){ // if(!empty($room_id)){
// 处理单个房间 // // 处理单个房间
$room_pan_detail = db::name('vs_room_pan') // $room_pan_detail = db::name('vs_room_pan')
->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id]) // ->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id])
->order('id desc') // ->order('id desc')
->find(); // ->find();
//
if($room_pan_detail){ // if($room_pan_detail){
$periods = $room_pan_detail['periods']; // $periods = $room_pan_detail['periods'];
} // }
// 删除指定房间的数据 // // 删除指定房间的数据
db::name('vs_room_pan') // db::name('vs_room_pan')
->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id]) // ->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])
->delete(); // ->delete();
//
$target_room_ids = [$room_id]; // $target_room_ids = [$room_id];
}else{ // }else{
// 处理所有房间 // // 处理所有房间
db::name('vs_room_pan') // db::name('vs_room_pan')
->where(['gift_bag_id'=>$gift_bag_id]) // ->where(['gift_bag_id'=>$gift_bag_id])
->delete(); // ->delete();
//
$target_room_ids = db::name('vs_room') // $target_room_ids = db::name('vs_room')
->where(['is_open_blind_box_turntable'=>1,'room_status'=>1]) // ->where(['is_open_blind_box_turntable'=>1,'room_status'=>1])
->column('id'); // ->column('id');
} // }
// 批量插入数据 // // 批量插入数据
$insert_data = []; // $insert_data = [];
$update_data = []; // $update_data = [];
foreach ($gift_bag_detail as $v){ // foreach ($gift_bag_detail as $v){
if(!empty($room_id)) { // if(!empty($room_id)) {
// 单个房间更新或插入 // // 单个房间更新或插入
$existing = db::name('vs_room_pan') // $existing = db::name('vs_room_pan')
->where([ // ->where([
'room_id' => $room_id, // 'room_id' => $room_id,
'gift_bag_detail_id' => $v['id'] // 'gift_bag_detail_id' => $v['id']
]) // ])
->find(); // ->find();
//
if($existing) { // if($existing) {
$update_data[] = [ // $update_data[] = [
'id' => $existing['id'], // 'id' => $existing['id'],
'remaining_number' => $v['quantity'], // 'remaining_number' => $v['quantity'],
'periods' => $periods // 'periods' => $periods
]; // ];
} else { // } else {
$insert_data[] = [ // $insert_data[] = [
'room_id' => $room_id, // 'room_id' => $room_id,
'gift_bag_id' => $gift_bag_id, // 'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'], // 'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'], // 'remaining_number' => $v['quantity'],
'periods' => $periods, // 'periods' => $periods,
'createtime' => time(), // 'createtime' => time(),
]; // ];
} // }
} else { // } else {
// 多个房间批量插入 // // 多个房间批量插入
foreach ($target_room_ids as $mid){ // foreach ($target_room_ids as $mid){
$insert_data[] = [ // $insert_data[] = [
'room_id' => $mid, // 'room_id' => $mid,
'gift_bag_id' => $gift_bag_id, // 'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'], // 'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'], // 'remaining_number' => $v['quantity'],
'periods' => $periods, // 'periods' => $periods,
'createtime' => time(), // 'createtime' => time(),
]; // ];
} // }
} // }
} // }
//
// 执行批量插入 // // 执行批量插入
if(!empty($insert_data)) { // if(!empty($insert_data)) {
db::name('vs_room_pan')->insertAll($insert_data); // db::name('vs_room_pan')->insertAll($insert_data);
} // }
// 执行批量更新 // // 执行批量更新
if(!empty($update_data)) { // if(!empty($update_data)) {
foreach($update_data as $update_item) { // foreach($update_data as $update_item) {
db::name('vs_room_pan') // db::name('vs_room_pan')
->where(['id' => $update_item['id']]) // ->where(['id' => $update_item['id']])
->update([ // ->update([
'remaining_number' => $update_item['remaining_number'], // 'remaining_number' => $update_item['remaining_number'],
'periods' => $update_item['periods'] // 'periods' => $update_item['periods']
]); // ]);
} // }
} // }
} // }
// 更新盲盒详情的剩余数量 // 更新盲盒详情的剩余数量
foreach ($gift_bag_detail as $k=>$v){ foreach ($gift_bag_detail as $k=>$v){
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]); $bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
@@ -594,6 +595,9 @@ class BlindBox extends adminApi
$ext = json_encode($ext); $ext = json_encode($ext);
$res = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->update(['ext'=>$ext]); $res = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->update(['ext'=>$ext]);
if($res){ if($res){
//删除缓存
$cacheKey = "xlh_config_13";
cache::rm($cacheKey);
return V(1,"成功"); return V(1,"成功");
}else{ }else{
return V(0,"失败"); return V(0,"失败");
@@ -726,7 +730,9 @@ class BlindBox extends adminApi
$stime = input('stime', ''); $stime = input('stime', '');
$etime = input('etime', ''); $etime = input('etime', '');
$where = []; $where = [];
$where['room_id'] = $room_id; if($room_id){
$where['room_id'] = $room_id;
}
if($gift_id){ if($gift_id){
$where['gift_id'] = $gift_id; $where['gift_id'] = $gift_id;
} }
@@ -751,8 +757,8 @@ class BlindBox extends adminApi
if($stime!=="" && $etime!==""){ if($stime!=="" && $etime!==""){
$where['createtime'] = ['between', [strtotime($stime), strtotime($etime.'23:59:59')]]; $where['createtime'] = ['between', [strtotime($stime), strtotime($etime.'23:59:59')]];
} }
$count = db::name('vs_gift_bag_receive_log')->where($where)->count(); $count = db::name('vs_gift_bag_receive_pan_log')->where($where)->count();
$lists_data = db::name('vs_gift_bag_receive_log')->where($where)->page($page, $page_limit)->order("id desc")->select(); $lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
$lists = []; $lists = [];
foreach ($lists_data as $key => $value) { foreach ($lists_data as $key => $value) {
$lists[$key]['id'] = $value['id']; $lists[$key]['id'] = $value['id'];
@@ -783,7 +789,7 @@ class BlindBox extends adminApi
$lists[$key]['gift_num'] = $value['num']; $lists[$key]['gift_num'] = $value['num'];
$lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']); $lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
} }
$all_lists_data = db::name('vs_gift_bag_receive_log')->where($where)->order("id desc")->select(); $all_lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->order("id desc")->select();
$total =0; $total =0;
$total_gift_money = 0; $total_gift_money = 0;
$total_money = 0; $total_money = 0;
@@ -798,13 +804,17 @@ class BlindBox extends adminApi
}else{ }else{
$ratio =round(($total_gift_money / $total_money),3); $ratio =round(($total_gift_money / $total_money),3);
} }
//盈亏 //用户盈亏
$profit_loss = $total_gift_money - $total_money; $profit_loss = $total_gift_money - $total_money;
//平台盈亏
$platform_profit_loss = $total_money - $total_gift_money;
if($profit_loss==0 || $total_money==0){ if($profit_loss==0 || $total_money==0){
$profit_loss_ratio = 0; $profit_loss_ratio = 0;
}else{ }else{
// 盈亏比 // 盈亏比
$profit_loss_ratio = round(($profit_loss / $total_money),3); $profit_loss_ratio = round(($profit_loss / $total_money),3);
//平台盈亏比
$platform_profit_loss_ratio = round(($platform_profit_loss / $total_money),3);
} }
$return_data = [ $return_data = [
'page' =>$page, 'page' =>$page,
@@ -818,6 +828,8 @@ class BlindBox extends adminApi
'ratio' => $ratio, 'ratio' => $ratio,
'profit_loss' => $profit_loss, 'profit_loss' => $profit_loss,
'profit_loss_ratio' => $profit_loss_ratio, 'profit_loss_ratio' => $profit_loss_ratio,
'platform_profit_loss' => $platform_profit_loss,
'platform_profit_loss_ratio' => $platform_profit_loss_ratio,
] ]
]; ];
return V(1,"成功", $return_data); return V(1,"成功", $return_data);
@@ -834,7 +846,9 @@ class BlindBox extends adminApi
$room_id = input('room_id', 0); $room_id = input('room_id', 0);
$periods = input('periods', ''); $periods = input('periods', '');
$where = []; $where = [];
$where['b.room_id'] = $room_id; if($room_id){
$where['b.room_id'] = $room_id;
}
if($gift_id){ if($gift_id){
$where['b.gift_id'] = $gift_id; $where['b.gift_id'] = $gift_id;
} }
@@ -872,6 +886,11 @@ class BlindBox extends adminApi
$lists[$key]['is_send'] = $value['is_send']; $lists[$key]['is_send'] = $value['is_send'];
$lists[$key]['is_send_str'] = $value['is_send']==1?"":""; $lists[$key]['is_send_str'] = $value['is_send']==1?"":"";
$lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']); $lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
$room = db::name('vs_room')->where('id',$value['room_id'])->find();
$lists[$key]['room_name'] = "";
if($room){
$lists[$key]['room_name'] = $room['room_number']."-".$room['room_name'];
}
} }
//今日锁定礼物数量 //今日锁定礼物数量
$today = strtotime(date('Y-m-d')); $today = strtotime(date('Y-m-d'));

View File

@@ -327,6 +327,7 @@ class Decorate extends adminApi
$type = input('type', ''); $type = input('type', '');
$where = []; $where = [];
if($user_id!=""){ if($user_id!=""){
$user_id = db::name('user')->where('user_code', $user_id)->value('id');
$where['user_id'] = $user_id; $where['user_id'] = $user_id;
} }
if($did!=""){ if($did!=""){
@@ -340,7 +341,8 @@ class Decorate extends adminApi
$return_list = []; $return_list = [];
foreach ($lists as $k=>$v){ foreach ($lists as $k=>$v){
$return_list[$k]['id'] = $v['udid']; $return_list[$k]['id'] = $v['udid'];
$return_list[$k]['user_name'] = $v['user_id']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname'); $user_data = db::name('user')->where(['id'=>$v['user_id']])->find();
$return_list[$k]['user_name'] = $user_data['user_code']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
$return_list[$k]['type'] = model('api/Decorate')->TypeArray[$v['type']]; $return_list[$k]['type'] = model('api/Decorate')->TypeArray[$v['type']];
if($v['type'] >= 6){ if($v['type'] >= 6){
$return_list[$k]['name'] = $v['special_num']; $return_list[$k]['name'] = $v['special_num'];

View File

@@ -56,11 +56,11 @@ class GiveGift extends adminApi
// 时间筛选优化 // 时间筛选优化
if (!empty($start_time) || !empty($end_time)) { if (!empty($start_time) || !empty($end_time)) {
if (!empty($start_time) && !empty($end_time)) { if (!empty($start_time) && !empty($end_time)) {
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]]; $where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
} elseif (!empty($start_time)) { } elseif (!empty($start_time)) {
$where['createtime'] = ['>=', strtotime($start_time)]; $where['createtime'] = ['>=', strtotime($start_time)];
} elseif (!empty($end_time)) { } elseif (!empty($end_time)) {
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; $where['createtime'] = ['<=', strtotime($end_time)];
} }
} }
//礼物总数 //礼物总数

View File

@@ -88,7 +88,7 @@ class Guild extends adminApi
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散'; $list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
$list[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']); $list[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
$list[$k]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']); $list[$k]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
$list[$k]['user_id'] = $user['user_code']; $list[$k]['user_id'] = $user['user_code']??"";
$list[$k]['intro'] = $v['intro']; $list[$k]['intro'] = $v['intro'];
} }
// 数组按today_money 排序 // 数组按today_money 排序
@@ -342,9 +342,9 @@ class Guild extends adminApi
$rum_lists[$k]['id']=$v['id']; $rum_lists[$k]['id']=$v['id'];
$rum_lists[$k]['user_id']=$v['user_id']; $rum_lists[$k]['user_id']=$v['user_id'];
$rum_lists[$k]['user_code']=model('api/Decorate')->user_decorate_detail($v['user_id'],6); $rum_lists[$k]['user_code']=model('api/Decorate')->user_decorate_detail($v['user_id'],6);
$rum_lists[$k]['nickname']=$user_info['nickname']; $rum_lists[$k]['nickname']=$user_info['nickname']?? '';
$rum_lists[$k]['charm_level']=$user_info['charm_level']; $rum_lists[$k]['charm_level']=$user_info['charm_level']??0;
$rum_lists[$k]['wealth_level']=$user_info['wealth_level']; $rum_lists[$k]['wealth_level']=$user_info['wealth_level']??0;
//用户流水 //用户流水
$consumption_sql = db::name('vs_user_money_log') $consumption_sql = db::name('vs_user_money_log')
->whereIn('change_type',$coin_consumption_type_array) ->whereIn('change_type',$coin_consumption_type_array)
@@ -623,12 +623,14 @@ class Guild extends adminApi
$search_status_time = input('search_status_time', ''); $search_status_time = input('search_status_time', '');
$search_end_time = input('search_end_time', ''); $search_end_time = input('search_end_time', '');
$search_status = input('search_status', ''); $search_status = input('search_status', '');
$where = ['b.delete_time'=>0]; // $where = ['b.delete_time'=>0];
$where = [];
if($search_user_id){ if($search_user_id){
$where['b.user_id'] = $search_user_id; $where['b.user_id'] = $search_user_id;
} }
if($search_guild_id){ if($search_guild_id){
$where['a.guild_id'] = $search_guild_id; //$where['a.guild_id'] = $search_guild_id;
$where['b.guild_special_id'] = $search_guild_id;
} }
if($search_status_time){ if($search_status_time){
$where['a.start_time'] = ['>=', $search_status_time]; $where['a.start_time'] = ['>=', $search_status_time];

View File

@@ -54,6 +54,15 @@ class Index extends adminApi
//总待付款笔数 //总待付款笔数
$return_data['all_wait_pay_num'] = db::name('vs_user_recharge')->where('pay_status',1)->count(); $return_data['all_wait_pay_num'] = db::name('vs_user_recharge')->where('pay_status',1)->count();
//周实时收入金额
$return_data['week_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'week')->sum('money');
//上周收入金额
$return_data['last_week_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'last week')->sum('money');
//月收入金额
$return_data['month_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'month')->sum('money');
//上月收入金额
$return_data['last_month_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'last month')->sum('money');
//待办事项 //待办事项
//房间审核数 //房间审核数
$return_data['room_audit_num'] = db::name('vs_room')->where('apply_status',1)->count(); $return_data['room_audit_num'] = db::name('vs_room')->where('apply_status',1)->count();

View File

@@ -656,8 +656,8 @@ class Room extends adminApi
} }
elseif ($type == 3){ elseif ($type == 3){
//周流水 //周流水
//周一 //周一
$begin_time = strtotime(date('Y-m-d 24:00:00',strtotime('-'.date('w').'days'))); $begin_time = strtotime(date('Y-m-d 00:00:00', strtotime('this week')));
$end_time = time(); $end_time = time();
$where['a.createtime'] = ['between', [$begin_time, $end_time]]; $where['a.createtime'] = ['between', [$begin_time, $end_time]];
} }
@@ -992,6 +992,10 @@ class Room extends adminApi
$search_room_number = input('search_room_number', ''); $search_room_number = input('search_room_number', '');
$search_onwer_number = input('search_onwer_number', ''); $search_onwer_number = input('search_onwer_number', '');
$room_status = input('room_status', ''); $room_status = input('room_status', '');
//开始 时间
$start_time = input('start_time', '');
//结束 时间
$end_time = input('end_time', '');
if($search_room_number!==''){ if($search_room_number!==''){
$where['room_number'] = $search_room_number; $where['room_number'] = $search_room_number;
@@ -1002,12 +1006,36 @@ class Room extends adminApi
if($room_status!==''){ if($room_status!==''){
$where['room_status'] = $room_status; $where['room_status'] = $room_status;
} }
// 检查并转换时间格式为时间戳
if($start_time !== '' && $end_time !== ''){
// 同时有开始和结束时间
$startTime = strtotime($start_time);
$endTime = strtotime($end_time);
if($startTime !== false && $endTime !== false){
$where['createtime'] = ['between', [$startTime, $endTime]];
}
}elseif($start_time !== ''){
// 只有开始时间
$startTime = strtotime($start_time);
if($startTime !== false){
$where['createtime'] = ['>=', $startTime];
}
}elseif($end_time !== ''){
// 只有结束时间
$endTime = strtotime($end_time);
if($endTime !== false){
$where['createtime'] = ['<=', $endTime];
}
}
$where['type_id'] = 6; $where['type_id'] = 6;
$count = db::name('vs_room')->where($where)->count(); $count = db::name('vs_room')->where($where)->count();
$lists = db::name('vs_room')->field('id,room_name,room_cover,room_number,user_id,room_status,createtime') $lists = db::name('vs_room')->field('id,room_name,room_cover,room_number,user_id,room_status,createtime')
->where($where) ->where($where)
->order('id desc') ->order('id desc')
->page($page, $page_limit)->select(); ->page($page, $page_limit)->select();
foreach ($lists as &$value) { foreach ($lists as &$value) {
$guild = model('Guild')->getGuildByUserId($value['user_id']); $guild = model('Guild')->getGuildByUserId($value['user_id']);
$value['createtime'] = date('Y-m-d H:i:s', $value['createtime']); $value['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
@@ -1018,7 +1046,27 @@ class Room extends adminApi
$value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7); $value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7);
//房间状态1正常2封禁3关闭 //房间状态1正常2封禁3关闭
$value['room_status_str'] = $value['room_status'] ==1 ? "正常" : ($value['room_status'] ==2 ? "封禁" : "关闭"); $value['room_status_str'] = $value['room_status'] ==1 ? "正常" : ($value['room_status'] ==2 ? "封禁" : "关闭");
$cpRoom = db::name('vs_room_cp_movie')->where('room_id',$value['id'])->find();
if($cpRoom){
if($cpRoom['user_id'] == $value['user_id']){
$value['cp_nickname'] = db::name('user')->where('id', $cpRoom['user_id1'])->value('nickname');
$value['cp_user_id'] = db::name('user')->where('id', $cpRoom['user_id1'])->value('user_code');
}
if($cpRoom['user_id1'] == $value['user_id']){
$value['cp_nickname'] = db::name('user')->where('id', $cpRoom['user_id'])->value('nickname');
$value['cp_user_id'] = db::name('user')->where('id', $cpRoom['user_id'])->value('user_code');
}
}
// 流水计算也应使用相同的时间范围
$liushuiWhere = ['from_id' => $value['id']];
if(isset($where['createtime'])){
$liushuiWhere['createtime'] = $where['createtime'];
}
$value['liushui'] = db::name('vs_give_gift')->where($liushuiWhere)->sum('total_price') * get_system_config_value('coin_charm_exp');
} }
$return_data = [ $return_data = [
'page' =>$page, 'page' =>$page,
'page_limit' => $page_limit, 'page_limit' => $page_limit,
@@ -1028,6 +1076,7 @@ class Room extends adminApi
return V(1,"成功", $return_data); return V(1,"成功", $return_data);
} }
//Cp电影房封禁 //Cp电影房封禁
public function cp_movie_room_forbid() public function cp_movie_room_forbid()
{ {
@@ -1465,10 +1514,10 @@ class Room extends adminApi
$where['createtime'] = ['>=',strtotime($stime)]; $where['createtime'] = ['>=',strtotime($stime)];
} }
if(!empty($etime)){ if(!empty($etime)){
$where['createtime'] = ['<=',strtotime($etime.' 23:59:59')]; $where['createtime'] = ['<=',strtotime($etime)];
} }
if(!empty($stime) && !empty($etime)){ if(!empty($stime) && !empty($etime)){
$where['createtime'] = ['between',[strtotime($stime),strtotime($etime.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
} }
$room_log_lists = db::name($this->table_room_log)->where($where)->order('id desc')->page($page, $page_limit)->select(); $room_log_lists = db::name($this->table_room_log)->where($where)->order('id desc')->page($page, $page_limit)->select();
$count = db::name($this->table_room_log)->where($where)->count(); $count = db::name($this->table_room_log)->where($where)->count();
@@ -1636,4 +1685,183 @@ class Room extends adminApi
return V(1,"成功", $result); return V(1,"成功", $result);
} }
// 房间红包列表
public function room_redpacket_list(){
$page = input('page', 1);
$page_limit = input('page_limit', 30);
$room_id = input('room_id', '');
//红包状态
$status = input('status', '');
//发红包的时间
$stime = input('stime', '');
$etime = input('etime', '');
$where = [];
if($room_id){
$where['room_id'] = $room_id;
}
if($status){
$where['status'] = $status;
}
if($stime){
$where['createtime'] = ['>=',strtotime($stime)];
}
if($etime){
$where['createtime'] = ['<=',strtotime($etime)];
}
$count = db::name("redpacket")->where($where)->count();
$room_redpacket_lists = db::name("redpacket")->where($where)->page($page, $page_limit)->order('id desc')->select();
//循环数据 获取发红的昵称和头像 时间格式化 状态:0=未开始,1=进行中,2=已结束,3=已退回' 币种(coin_type):1=金币,2=钻石',红包类型(type):1=普通红包,2=口令红包'
//多选条件逗号分隔存值conditions) 0=无1=收藏2=在麦上
if($room_redpacket_lists){
foreach ($room_redpacket_lists as $key => $value){
$room_redpacket_lists[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
$room_redpacket_lists[$key]['avatar'] = db::name('user')->where(['id'=>$value['user_id']])->value('avatar');
$room_redpacket_lists[$key]['user_code'] = db::name('user')->where(['id'=>$value['user_id']])->value('user_code');
$room_redpacket_lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
$room_redpacket_lists[$key]['status_text'] = $value['status'] == 0 ? '未开始' : ($value['status'] == 1 ? '进行中' : ($value['status'] == 2 ? '已结束' : '已退回'));
$room_redpacket_lists[$key]['coin_type_text'] = $value['coin_type'] == 1 ? '金币' : ($value['coin_type'] == 2 ? '钻石' : '未知');
$room_redpacket_lists[$key]['type_text'] = $value['type'] == 1 ? '普通红包' : ($value['type'] == 2 ? '口令红包' : '未知');
// 多选条件处理0=无不能和其他条件共存1=收藏2=在麦上
// 可以同时存在,也可以单独存在,同时存在时用逗号分隔
$conditions = explode(',',$value['conditions']);
// 过滤掉空值元素
$conditions = array_filter($conditions, function($item) {
return $item !== '' && $item !== null;
});
// 去除重复的条件
$conditions = array_unique($conditions);
// 重新索引数组,确保索引连续
$conditions = array_values($conditions);
// 特殊处理如果包含条件0无条件则只保留这一项
if (in_array('0', $conditions)) {
$room_redpacket_lists[$key]['conditions'] = ['无条件'];
} else {
// 将数字条件转换为对应的中文描述
$conditions_text = array_map(function($item){
// 0=无条件1=收藏2=在麦上
switch($item) {
case '0':
return '无条件';
case '1':
return '收藏';
case '2':
return '在麦上';
default:
return '未知';
}
}, $conditions);
$room_redpacket_lists[$key]['conditions'] = $conditions_text;
}
//房间名称
$room_redpacket_lists[$key]['room_name'] = db::name('vs_room')->where(['id'=>$value['room_id']])->value('room_name');
}
}
$return_data = [
'page' =>$page,
'page_limit' => $page_limit,
'count' => $count,
'lists' => $room_redpacket_lists
];
return V(1,"成功", $return_data);
}
// 获取房间红包详情
public function room_redpacket_detail(){
// 红包ID
$redpacket_id = input('redpacket_id', '');
if(empty($redpacket_id)){
return V(0, "红包ID不能为空");
}
// 获取红包基本信息
$redpacket_info = db::name("redpacket")->where(['id'=>$redpacket_id])->find();
if(!$redpacket_info){
return V(0, "红包不存在");
}
// 获取发红包用户信息
$redpacket_info['nickname'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('nickname');
$redpacket_info['avatar'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('avatar');
$redpacket_info['user_code'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('user_code');
$redpacket_info['createtime_text'] = date('Y-m-d H:i:s', $redpacket_info['createtime']);
$redpacket_info['start_time_text'] = date('Y-m-d H:i:s', $redpacket_info['start_time']);
$redpacket_info['end_time_text'] = date('Y-m-d H:i:s', $redpacket_info['end_time']);
//房间名称
$redpacket_info['room_name'] = db::name('vs_room')->where(['id'=>$redpacket_info['room_id']])->value('room_name');
// 红包状态文字描述
$status_map = [
0 => '未开始',
1 => '进行中',
2 => '已结束',
3 => '已退回'
];
$redpacket_info['status_text'] = $status_map[$redpacket_info['status']] ?? '未知';
// 币种文字描述
$coin_type_map = [
1 => '金币',
2 => '钻石'
];
$redpacket_info['coin_type_text'] = $coin_type_map[$redpacket_info['coin_type']] ?? '未知';
// 红包类型文字描述
$type_map = [
1 => '普通红包',
2 => '口令红包'
];
$redpacket_info['type_text'] = $type_map[$redpacket_info['type']] ?? '未知';
// 领取条件处理
$conditions = explode(',',$redpacket_info['conditions']);
$conditions = array_filter($conditions, function($item) {
return $item !== '' && $item !== null;
});
$conditions = array_unique($conditions);
$conditions = array_values($conditions);
// 特殊处理如果包含条件0无条件则只保留这一项
if (in_array('0', $conditions)) {
$redpacket_info['conditions_text'] = ['无条件'];
} else {
// 将数字条件转换为对应的中文描述
$conditions_text = array_map(function($item){
switch($item) {
case '0':
return '无条件';
case '1':
return '收藏';
case '2':
return '在麦上';
default:
return '未知';
}
}, $conditions);
$redpacket_info['conditions_text'] = $conditions_text;
}
// 领取详情 redpacket_record 表里面的数据
// 外键redpacket_id redpacket表的IDuser_id 外键user表的ID amount 抢到的金额 createtime抢红包的时间
// 红包领取详情 谁在什么时候 抢红包 抢了多少钱
$redpacket_record_lists = db::name("redpacket_record")->where(['redpacket_id'=>$redpacket_id])->order('createtime asc')->select();
if($redpacket_record_lists){
foreach ($redpacket_record_lists as $key => $value){
$redpacket_record_lists[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
$redpacket_record_lists[$key]['avatar'] = db::name('user')->where(['id'=>$value['user_id']])->value('avatar');
$redpacket_record_lists[$key]['user_code'] = db::name('user')->where(['id'=>$value['user_id']])->value('user_code');
$redpacket_record_lists[$key]['createtime_text'] = date('Y-m-d H:i:s', $value['createtime']);
}
}
$return_data = [
'redpacket_info' => $redpacket_info,
'record_lists' => $redpacket_record_lists
];
return V(1, "成功", $return_data);
}
} }

View File

@@ -0,0 +1,371 @@
<?php
namespace app\adminapi\controller;
use think\Db;
class RoomHourRanking
{
public static function withdraw_status (){
return [
// [25 => '全时段'],
[0 => '00:00-01:00'],
[1 => '01:00-02:00'],
[2 => '02:00-03:00'],
[3 => '03:00-04:00'],
[4 => '04:00-05:00'],
[5 => '05:00-06:00'],
[6 => '06:00-07:00'],
[7 => '07:00-08:00'],
[8 => '08:00-09:00'],
[9 => '09:00-10:00'],
[10 => '10:00-11:00'],
[11 => '11:00-12:00'],
[12 => '12:00-13:00'],
[13 => '13:00-14:00'],
[14 => '14:00-15:00'],
[15 => '15:00-16:00'],
[16 => '16:00-17:00'],
[17 => '17:00-18:00'],
[18 => '18:00-19:00'],
[19 => '19:00-20:00'],
[20 => '20:00-21:00'],
[21 => '21:00-22:00'],
[22 => '22:00-23:00'],
[23 => '23:00-00:00'],
];
}
//房间小时榜列表
public function room_hour_ranking()
{
$page = input('page', 1);
$page_limit = input('page_limit', 20);
$search_ranking = input('search_ranking', '');
$search_stime = input('search_stime', '');
$search_etime = input('search_etime', '');
$where = [];
if ($search_ranking) {
$where[] = ['room_name', 'like', '%' . $search_ranking . '%'];
}
if ($search_stime) {
$where[] = ['stime', '>=', $search_stime];
}
if ($search_etime) {
$where[] = ['etime', '<=', $search_etime];
}
$count = db::name('vs_hour_ranking')->where($where)->count();
$list = db::name('vs_hour_ranking')->where($where)->page($page, $page_limit)->order('id desc')->select();
if($list){
foreach ($list as &$v){
$v['room_name'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('room_name');
$v['user_id'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('user_id');
if($v['user_id']){
$v['nickname'] = db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
}
$v['stime'] = date('Y-m-d H:i', $v['stime']);
$v['etime'] = date('Y-m-d H:i', $v['etime']);
}
}
$return_data = [
'page' =>$page,
'page_limit' => $page_limit,
'count' => $count,
'lists' => $list
];
return V(1,"成功", $return_data);
}
//房间小时榜配置
public function room_hour_ranking_config()
{
$list = db::name('vs_hour_ranking_config')->where('id', '1')->find();
if($list){
//open_time 字段转化为2025-09-30 07:00 的格式
$list['open_time'] = $list['open_time'] ? date('Y-m-d H:i', $list['open_time']) : 0;
}
return V(1,"成功", $list);
}
//房间小时榜配置修改
public function room_hour_ranking_config_edit()
{
$id = input('id');
$data['is_open_red_pack'] = 0;//暂时不开启
$data['is_public_server'] = input('is_public_server');
$data['broadcast_times'] = input('broadcast_times');
$data['is_open_xlh'] = input('is_open_xlh');
$data['min_price'] = input('min_price');
$open_time = input('open_time');
$data['open_time'] = $open_time ? strtotime($open_time) : 0;
$data['createtime'] = time();
$data['updatetime'] = time();
$timeSlots = json_decode(input('timeJson'), true);
$timePeriods = $this->withdraw_status();
// 构建正确的时间映射关系
$timeMap = [];
foreach($timePeriods as $period) {
foreach($period as $key => $value) {
$timeMap[$key] = $value;
}
}
//$timeMap 里面 键值互换
$timeMap = array_flip($timeMap);
//开启事务
db::startTrans();
if($timeSlots){
$insertData = [];
foreach ($timeSlots as $timeSlot) {
// $timeRange = ;
$timeRange = $timeMap[$timeSlot['time']] ?? '99';
foreach ($timeSlot['reward'] as $rewardItem) {
$hasReward = !empty($rewardItem['content']);
if ($hasReward) {
// 有奖励内容:为每个奖励内容创建一条记录
foreach ($rewardItem['content'] as $rewardContent) {
if($rewardContent['type'] == 0){
$coin = $rewardContent['value'];
$gift_id = 0;
$gift_name = '';
}else{
$coin = 0;
$gift_id = $rewardContent['value'];
$gift_name = $rewardContent['name'];
}
$insertData[] = [
'time_id' => $timeRange,
'ranking' => $rewardItem['index'],
// 'rank_name' => $rewardItem['name'],
'gift_type' => $rewardContent['type'],
'gift_id' => $gift_id,
'coin' => $coin,
'name' => $gift_name,
'createtime' => time()
];
}
} else {
// 无奖励内容:插入一条空奖励记录
$insertData[] = [
'time_id' => $timeRange,
'ranking' => $rewardItem['index'],
// 'rank_name' => $rewardItem['name'],
'gift_type' => 0,
'gift_id' => 0,
'coin' => 0,
'name' => '',
'createtime' => time(),
];
}
}
}
// 批量插入
if (!empty($insertData)) {
$del = db::name('vs_hour_ranking_gift_config')->where('id','>',0)->delete();
$ins = db::name('vs_hour_ranking_gift_config')->insertAll($insertData);
}else{
$ins = false;
$del = false;
}
}else{
$del = true;
$ins = true;
}
// $res = db::name('vs_hour_ranking_config')->where('id', $id)->update($data);
$res = db::name('vs_hour_ranking_config')->where('id', $id)->update($data);
// if ($del && $ins && $res) {
if ($ins) {
db::commit();
return V(1, "成功");
} else {
db::rollback();
return V(0, "失败");
}
}
//时间段对应关系
public function time_period_correspondence()
{
$list = $this->withdraw_status();
$timePeriods = $this->withdraw_status();
$timeMap = [];
foreach($timePeriods as $period) {
foreach($period as $key => $value) {
$timeMap[$key] = $value;
}
}
return V(1,"成功", $timeMap);
}
//添加核心配置
public function add_core_config()
{
$data['is_public_server'] = input('is_public_server');
$data['createtime'] = time();
$data['updatetime'] = time();
$res = db::name('vs_hour_ranking_config')->insert($data);
}
//核心配置列表
public function core_config_list()
{
$timePeriods = $this->withdraw_status();
// 构建正确的时间映射关系
$timeMap = [];
foreach($timePeriods as $period) {
foreach($period as $key => $value) {
$timeMap[$key] = $value;
}
}
// 先按时间段和排名索引分组查询
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
->order('time_id')
->column('time_id');
$result = [];
foreach ($timeRanges as $timeRange) {
// 查询该时间段的所有数据
$rewards = db::name('vs_hour_ranking_gift_config')->where('time_id', $timeRange)
->field('ranking, gift_type, gift_id,coin,name')
->order('ranking')
->select();
$rewardMap = [];
foreach ($rewards as $reward) {
$rankIndex = $reward['ranking'];
if (!isset($rewardMap[$rankIndex])) {
$rewardMap[$rankIndex] = [
'index' => $rankIndex,
// 'name' => $reward['rank_name'],
'content' => []
];
}
// 添加奖励内容到content数组
if ($reward['gift_id'] != 0 || $reward['coin'] != 0) {
if($reward['gift_id'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['gift_id'],
// 'coin' => $reward['coin'],
'name' => $reward['name'],
];
}
if($reward['coin'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['coin'],
'name' => $reward['name'],
];
}
}
}
// 按index排序
ksort($rewardMap);
$result[] = [
'time' => $timeMap[$timeRange],
'reward' => array_values($rewardMap)
];
}
return V(1, "成功", $result);
}
// public function core_config_lists()
// {
// $list = db::name('vs_hour_ranking_gift_config')->select();
// $data = [];
//
// // 按 time_id 和 ranking 重组数据
// $reorganizedData = [];
// $timePeriods = $this->withdraw_status();
//
// // 构建正确的时间映射关系
// $timeMap = [];
// foreach($timePeriods as $period) {
// foreach($period as $key => $value) {
// $timeMap[$key] = $value;
// }
// }
//
// foreach ($list as $item) {
//// $timeId = $item['time_id'];
// $timeId = $timeMap[$item['time_id']] ?? '未知时间段';
// $ranking = $item['ranking'];
//
// $gift_name = '';
// if (!isset($reorganizedData[$timeId])) {
// $reorganizedData[$timeId] = [];
// }
// if (!isset($reorganizedData[$timeId][$ranking])) {
// $reorganizedData[$timeId][$ranking] = [];
// }
// if($item['gift_id']){
// if($item['gift_type'] == 2){
// $gift_name = db::name('vs_gift')->where(['gid'=>$item['gift_id']])->value('gift_name');
// }
// if($item['gift_type'] == 3 || $item['gift_type'] == 4){
// $gift_name = db::name('vs_decorate')->where(['did'=>$item['gift_id']])->value('title');
// }
//
// }else{
// $gift_name = '';
// }
// $reorganizedData[$timeId][$ranking][] = [
// 'gift_type' => $item['gift_type'],
// 'gift_id' => $item['gift_id'],
// 'gift_name' => $gift_name,
// 'coin' => $item['coin']
// ];
// }
//
// // 输出重组后的数据
// print_r($reorganizedData);
// return V(1, "成功", $data);
// }
}

View File

@@ -37,10 +37,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)]; $where['createtime'] = ['>=', strtotime($begin_time)];
} }
if($end_time !== ''){ if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; $where['createtime'] = ['<=', strtotime($end_time)];
} }
if(!empty($begin_time) && !empty($end_time)){ if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
} }
$where['pay_status'] = 2;//1待支付,2已支付 $where['pay_status'] = 2;//1待支付,2已支付
@@ -112,10 +112,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)]; $where['createtime'] = ['>=', strtotime($begin_time)];
} }
if($end_time !== ''){ if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; $where['createtime'] = ['<=', strtotime($end_time)];
} }
if(!empty($begin_time) && !empty($end_time)){ if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
} }
$count = db::name('vs_give_gift') $count = db::name('vs_give_gift')
->where($where) ->where($where)
@@ -177,10 +177,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)]; $where['createtime'] = ['>=', strtotime($begin_time)];
} }
if($end_time !== ''){ if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; $where['createtime'] = ['<=', strtotime($end_time)];
} }
if(!empty($begin_time) && !empty($end_time)){ if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
} }
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮 // 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换 // 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
@@ -239,10 +239,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)]; $where['createtime'] = ['>=', strtotime($begin_time)];
} }
if($end_time !== ''){ if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; $where['createtime'] = ['<=', strtotime($end_time)];
} }
if(!empty($begin_time) && !empty($end_time)){ if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
} }
//不为空 //不为空
$where['from'] = 2; $where['from'] = 2;
@@ -259,9 +259,14 @@ class Statistical extends adminApi
->select(); ->select();
foreach ($lists as $key => $value) { foreach ($lists as $key => $value) {
$room = db::name('vs_room')->where('id', $value['from_id'])->find(); $room = db::name('vs_room')->where('id', $value['from_id'])->find();
if($room){
$lists[$key]['room_name'] = $room['room_name'].'-'.$room['room_number'];
$lists[$key]['room_number'] = $room['room_number'];
}else{
$lists[$key]['room_name'] = "--";
$lists[$key]['room_number'] = "--";
}
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']); $lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
$lists[$key]['room_name'] = $room['room_name'].'-'.$room['room_number'];
$lists[$key]['room_number'] = $room['room_number'];
$lists[$key]['room_cover'] = db::name('vs_room')->where('id', $value['from_id'])->value('room_cover'); $lists[$key]['room_cover'] = db::name('vs_room')->where('id', $value['from_id'])->value('room_cover');
$label = db::name('vs_room')->where('id', $value['from_id'])->value('label_id'); $label = db::name('vs_room')->where('id', $value['from_id'])->value('label_id');
$lists[$key]['label'] = db::name('vs_room_label')->where('id', $label)->value('label_name'); $lists[$key]['label'] = db::name('vs_room_label')->where('id', $label)->value('label_name');
@@ -302,10 +307,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($pay_stime)]; $where['createtime'] = ['>=', strtotime($pay_stime)];
} }
if($pay_etime !== ''){ if($pay_etime !== ''){
$where['createtime'] = ['<=', strtotime($pay_etime.' 23:59:59')]; $where['createtime'] = ['<=', strtotime($pay_etime)];
} }
if(!empty($pay_stime) && !empty($pay_etime)){ if(!empty($pay_stime) && !empty($pay_etime)){
$where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime)]];
} }
if($pay_status !== ''){ if($pay_status !== ''){
$where['pay_status'] = $pay_status; $where['pay_status'] = $pay_status;
@@ -346,19 +351,21 @@ class Statistical extends adminApi
]; ];
//总收入 //总收入
$wherew=[]; $wherew=[];
$return_data['total_money'] = db::name('vs_user_recharge')->sum('money'); unset($where['pay_status']);
unset($where['pay_type']);
$return_data['total_money'] = db::name('vs_user_recharge')->where($where)->sum('money');
//未支付 //未支付
$return_data['unpaid_money'] = db::name('vs_user_recharge')->where('pay_status',1)->sum('money'); $return_data['unpaid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',1)->sum('money');
//已支付 //已支付
$return_data['paid_money'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('money'); $return_data['paid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('money');
//微信支付 //微信支付
$wherew['pay_type'] = ['in', [1,4]]; $wherew['pay_type'] = ['in', [1,4]];
$return_data['wx_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherew)->sum('money'); $return_data['wx_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherew)->sum('money');
//支付宝支付 //支付宝支付
$wherez['pay_type'] = ['in', [2,3]]; $wherez['pay_type'] = ['in', [2,3]];
$return_data['ali_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherez)->sum('money'); $return_data['ali_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherez)->sum('money');
//金币数量 //金币数量
$return_data['gold_num'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('coin'); $return_data['gold_num'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('coin');
return V(1,"成功", $return_data); return V(1,"成功", $return_data);
} }
@@ -383,10 +390,10 @@ class Statistical extends adminApi
$where['a.createtime'] = ['>=', strtotime($start_time)]; $where['a.createtime'] = ['>=', strtotime($start_time)];
} }
if($end_time !== ''){ if($end_time !== ''){
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; $where['a.createtime'] = ['<=', strtotime($end_time)];
} }
if($start_time !== '' && $end_time !== ''){ if($start_time !== '' && $end_time !== ''){
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]]; $where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
} }
$count = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')->count(); $count = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')->count();
@@ -429,10 +436,10 @@ class Statistical extends adminApi
$where['a.createtime'] = ['>=', strtotime($start_time)]; $where['a.createtime'] = ['>=', strtotime($start_time)];
} }
if($end_time !== ''){ if($end_time !== ''){
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; $where['a.createtime'] = ['<=', strtotime($end_time)];
} }
if($start_time !== '' && $end_time !== ''){ if($start_time !== '' && $end_time !== ''){
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]]; $where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
} }
$count = db::name('vs_admin_recharge_log') $count = db::name('vs_admin_recharge_log')
->alias('a')->join('user b', 'a.user_id = b.id') ->alias('a')->join('user b', 'a.user_id = b.id')

View File

@@ -33,6 +33,7 @@ class SysSet extends adminApi
'8' => '房间配置', '8' => '房间配置',
'9' => '弹窗内容设置', '9' => '弹窗内容设置',
'10' => '邀请奖励', '10' => '邀请奖励',
'11' => '二级密码',
]; ];
public function _initialize() public function _initialize()

View File

@@ -74,8 +74,8 @@ class User extends adminApi
}elseif($v=='coin2'){ }elseif($v=='coin2'){
$where['c.coin'] = ['<=',$input_data]; $where['c.coin'] = ['<=',$input_data];
}elseif($v=='createtime'){ }elseif($v=='createtime'){
$where['a.createtime'] = ['>=',strtotime($input_data.' 00:00:00')]; $where['a.createtime'] = ['>=',strtotime($input_data)];
$where['a.createtime'] = ['<=',strtotime($input_data.' 23:59:59')]; $where['a.createtime'] = ['<=',strtotime($input_data)];
}else{ }else{
$where['a.'.$v] = $input_data; $where['a.'.$v] = $input_data;
} }
@@ -231,7 +231,8 @@ class User extends adminApi
'type' => $type, 'type' => $type,
'type_text' => $type_text, 'type_text' => $type_text,
]; ];
$res = Db::name('block')->where($map)->delete(); Db::name('block')->where($map)->delete();
Db::name('sms_error')->where(['mobile' => $user_info['mobile']])->delete();
} }
return V(1,"成功", null); return V(1,"成功", null);
} }
@@ -735,7 +736,12 @@ class User extends adminApi
* 用户列表 * 用户列表
*/ */
public function get_user_list(){ public function get_user_list(){
$user = db::name('user')->field('id,nickname,avatar')->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select(); $user_code = input('user_code', 0);
$where = [];
if($user_code){
$where['user_code'] = $user_code;
}
$user = db::name('user')->field('id,nickname,avatar')->where($where)->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select();
return V(1,"操作成功", $user); return V(1,"操作成功", $user);
} }
} }

View File

@@ -69,7 +69,7 @@ class Version extends adminApi
$version = input('version', ''); $version = input('version', '');
$type = input('type', ''); $type = input('type', '');
$downloadurl = input('downloadurl', ''); $downloadurl = input('downloadurl', '');
$content = input('content', ''); $content = $_POST['content'] ?? '';
$enforce = input('enforce', ''); $enforce = input('enforce', '');
$version_code = input('version_code', ''); $version_code = input('version_code', '');
$status = input('status', 1); $status = input('status', 1);
@@ -101,7 +101,7 @@ class Version extends adminApi
$version = input('version', ''); $version = input('version', '');
$type = input('type', ''); $type = input('type', '');
$downloadurl = input('downloadurl', ''); $downloadurl = input('downloadurl', '');
$content = input('content', ''); $content = $_POST['content'] ?? '';
$enforce = input('enforce', ''); $enforce = input('enforce', '');
$version_code = input('version_code', ''); $version_code = input('version_code', '');
$status = input('status', 1); $status = input('status', 1);

View File

@@ -60,10 +60,10 @@ class Withdrawal extends adminApi
$where['a.createtime'] = ['>=', strtotime($search_stime)]; $where['a.createtime'] = ['>=', strtotime($search_stime)];
} }
if($search_etime !== ''){ if($search_etime !== ''){
$where['a.createtime'] = ['<=', strtotime($search_etime.' 23:59:59')]; $where['a.createtime'] = ['<=', strtotime($search_etime)];
} }
if(!empty($search_stime) && !empty($search_etime)){ if(!empty($search_stime) && !empty($search_etime)){
$where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]]; $where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
} }
$count = db::name('vs_user_withdrawal')->alias('a') $count = db::name('vs_user_withdrawal')->alias('a')
->join('user b', 'a.user_id = b.id', 'left') ->join('user b', 'a.user_id = b.id', 'left')
@@ -75,6 +75,7 @@ class Withdrawal extends adminApi
->field('a.*,b.nickname,b.user_code') ->field('a.*,b.nickname,b.user_code')
->order('a.createtime desc') ->order('a.createtime desc')
->where($where) ->where($where)
->page($page, $page_limit)
->select(); ->select();
$data_lists = []; $data_lists = [];
foreach ($lists as $key => $value) { foreach ($lists as $key => $value) {
@@ -255,19 +256,23 @@ class Withdrawal extends adminApi
//查询该用户云账户提现金额 //查询该用户云账户提现金额
$had_money = db::name('vs_user_withdrawal')->where(['user_id'=>$withdraw_info['user_id'],'deal_type'=>2,'status'=>6])->where('pay_time','month')->sum('general_money'); $had_money = db::name('vs_user_withdrawal')->where(['user_id'=>$withdraw_info['user_id'],'deal_type'=>2,'status'=>6])->where('pay_time','month')->sum('general_money');
$max_month_money = 98000; $max_month_money = 98000;
if(($had_money+$withdraw_info['general_money']) >= 98000){ if(($had_money+$withdraw_info['general_money']) >= $max_month_money){
return ['code' => 0, 'msg' => '单人单月云账户提现金额最大为98000元!', 'data' => null]; return ['code' => 0, 'msg' => '单人单月云账户提现金额最大为98000元!', 'data' => null];
} }
//查询该用户信息 //查询该用户信息
$user_info = model('api/user')->get_user_info($withdraw_info['user_id']); $user_info = model('api/user')->get_user_info($withdraw_info['user_id'], ['user','user_auth']);
if(empty($user_info)){ if(empty($user_info)){
return ['code' => 0, 'msg' => '用户信息错误!', 'data' => null]; return ['code' => 0, 'msg' => '用户信息错误!', 'data' => null];
} }
$real_name = $user_info['real_name']; $real_name = $user_info['real_name'];
$id_card = $user_info['card_id']; $id_card = $user_info['card_id'];
$order_id = $withdraw_info['order_sn']; $order_id = $withdraw_info['order_sn'];
$order_amount = $withdraw_info['general_money']; $order_amount = $withdraw_info['general_money'];
$phone = $user_info['mobile']; $phone = $user_info['mobile'];
if(empty($phone)) {
return ['code' => 0, 'msg' => '请先绑定手机号', 'data' => null];
}
if (empty($real_name) || empty($id_card)) { if (empty($real_name) || empty($id_card)) {
return ['code' => 0, 'msg' => '请先实名认证', 'data' => null]; return ['code' => 0, 'msg' => '请先实名认证', 'data' => null];
} }
@@ -281,7 +286,11 @@ class Withdrawal extends adminApi
} }
$card_no = $user_info['alipay_account']; $card_no = $user_info['alipay_account'];
$yun_pay = new YunPay($order_id, $real_name, $id_card, $card_no, $order_amount,$phone); $yun_pay = new YunPay($order_id, $real_name, $id_card, $card_no, $order_amount,$phone);
$result = $yun_pay->alipay(); $user_data = [
'nickname' => $user_info['nickname'],
'user_id' => $withdraw_info['user_id'],
];
$result = $yun_pay->alipay($user_data);
} elseif ($withdraw_info['type'] == 3) { } elseif ($withdraw_info['type'] == 3) {
if(empty($user_info['bank_card_number'])){ if(empty($user_info['bank_card_number'])){
return ['code' => 0, 'msg' => '请先绑定银行卡号', 'data' => null]; return ['code' => 0, 'msg' => '请先绑定银行卡号', 'data' => null];

View File

@@ -85,7 +85,7 @@ class Guild extends Model
->alias('g') ->alias('g')
->join('vs_guild gg','g.guild_id = gg.id') ->join('vs_guild gg','g.guild_id = gg.id')
->field('gg.*') ->field('gg.*')
->where(['g.user_id' => $user_id]) ->where(['g.user_id' => $user_id,'g.status' => 1,'g.delete_time' => 0])
->find(); ->find();
return $guild; return $guild;
} }
@@ -95,31 +95,29 @@ class Guild extends Model
*工会当日流水 *工会当日流水
*/ */
public function getTodayMoney($guild_id,$stoday="",$etoday=""){ public function getTodayMoney($guild_id,$stoday="",$etoday=""){
$where = [];
if(empty($stoday) && empty($etoday)){
$stoday = strtotime(date('Y-m-d 00:00:00'));
$etoday = strtotime(date('Y-m-d 23:59:59'));
$where['createtime'] = ['between', [$stoday, $etoday]];
}else{
if(!empty($stoday)){
$where['createtime'] = ['>=', strtotime($stoday."00:00:00")];
}
if(!empty($etoday)){
$where['createtime'] = ['<=', strtotime($etoday." 23:59:59")];
}
if(!empty($stoday) && !empty($etoday)){
$where['createtime'] = ['between', [strtotime($stoday." 00:00:00"), strtotime($etoday." 23:59:59")]];
}
}
//获取所有工会房间ID //获取所有工会房间ID
$room_ids = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id')->select(); $guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id,createtime,quit_time')->select();
$room_ids = array_column($room_ids, 'room_id'); $transaction = 0;
$transaction = db::name('vs_give_gift') foreach ($guild_user_data as $k => $v) {
->whereIn('from_id',$room_ids) if(empty($stoday) && empty($etoday)){
->where(['from'=>['in',[2,3,6]]]) $stoday_seach = strtotime(date('Y-m-d 00:00:00',time()));
->where($where) $etoday_seach = strtotime(date('Y-m-d 23:59:59',time()));
->sum('total_price'); }else{
$stoday_seach = strtotime($stoday);
$etoday_seach = strtotime($etoday);
}
if($v['createtime'] && $stoday_seach < $v['createtime']){
$stoday_seach = $v['createtime'];
}
if($v['quit_time'] && ($etoday > $v['quit_time'])){
$etoday_seach = $v['quit_time'];
}
$transaction_one = db::name('vs_give_gift')
->where('from_id',$v['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday_seach, $etoday_seach]]])
->sum('total_price');
$transaction += $transaction_one;
}
return $transaction; return $transaction;
} }

View File

@@ -75,13 +75,13 @@ class Room extends Model
$give_where['from_id'] = $room_id; $give_where['from_id'] = $room_id;
$give_where['from'] = ["in",[2,3,6]]; $give_where['from'] = ["in",[2,3,6]];
if(!empty($stime)){ if(!empty($stime)){
$give_where['createtime'] = ['>=',strtotime($stime.' 00:00:00')]; $give_where['createtime'] = ['>=',strtotime($stime)];
} }
if(!empty($etime)){ if(!empty($etime)){
$give_where['createtime'] = ['<=',strtotime($etime.' 23:59:59')]; $give_where['createtime'] = ['<=',strtotime($etime)];
} }
if(!empty($stime) && !empty($etime)){ if(!empty($stime) && !empty($etime)){
$give_where['createtime'] = ['between',[strtotime($stime.' 00:00:00'),strtotime($etime.' 23:59:59')]]; $give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
} }
$total_price = db::name('vs_give_gift')->where($give_where) $total_price = db::name('vs_give_gift')->where($give_where)
->sum('total_price'); ->sum('total_price');

View File

@@ -32,6 +32,7 @@ class Activities extends BaseCom
$data['name'] = $activities_title??""; $data['name'] = $activities_title??"";
$data['gift_bag'] = []; $data['gift_bag'] = [];
foreach ($gift_bag as $k=>$v){ foreach ($gift_bag as $k=>$v){
$data['gift_bag'][$k]['gift_bag_id'] = $v['id']??0;
$data['gift_bag'][$k]['name'] = $v['title']??""; $data['gift_bag'][$k]['name'] = $v['title']??"";
$ext = json_decode($v['ext'],true); $ext = json_decode($v['ext'],true);
$data['gift_bag'][$k]['title1'] = $ext['title1']??""; $data['gift_bag'][$k]['title1'] = $ext['title1']??"";
@@ -129,46 +130,51 @@ class Activities extends BaseCom
//礼包 //礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find(); $gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
$data = []; $data = [];
$data['gift_bag_id'] = $gift_bag['id']??0;
$data['name'] = $activities['title']??""; $data['name'] = $activities['title']??"";
$data['bag_name'] = $gift_bag['title']??""; $data['bag_name'] = $gift_bag['title']??"";
$data['effective_time'] = $activities['effective_time']??""; $data['effective_time'] = $activities['effective_time']??"";
//规则 //规则
$data['rule'] = get_system_config_value('web_site')."/api/Page/page_show?id=13"; $data['rule'] = get_system_config_value('web_site')."/api/Page/page_show?id=13";
$ext = json_decode($gift_bag['ext'],true); $ext = json_decode($gift_bag['ext'],true);
$data['money'] = $ext['money']; $data['money'] = $gift_bag['money'];
$data['counter']['counter'] = $ext['counter']; $data['counter'] = $ext['counter'];
$data['counter']['money'] = $ext['money_str']; $data['money_str'] = $ext['money_str'];
$data['counter']['diamond'] = $ext['diamond']; $data['diamond'] = $ext['diamond'];
$data['effective_time'] = $ext['activity_end_time']??"";
if(strtotime($ext['activity_end_time']) < time()){
return V(0,'活动已结束!',null);
}
$detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag['id']])->select(); $detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag['id']])->select();
$data['gift_list'] = []; $data['gift_list'] = [];
foreach ($detail as $k=>$v){ foreach ($detail as $k=>$v){
if($v['type'] == 1){ if($v['type'] == 1){
$list[$k]['name'] = "金币"; $list[$k]['gift_name'] = "金币";
$list[$k]['num'] = $v['gold']; $list[$k]['num'] = $v['gold'];
$list[$k]['gold'] = $v['gold']; $list[$k]['gift_price'] = $v['gold'];
$list[$k]['type'] = 1; $list[$k]['type'] = 1;
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png"); $list[$k]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
}elseif($v['type'] == 2) { }elseif($v['type'] == 2) {
$gift = DB::name('vs_gift')->where(['gid'=>$v['foreign_id']])->find(); $gift = DB::name('vs_gift')->where(['gid'=>$v['foreign_id']])->find();
$list[$k]['name'] = $gift['gift_name']; $list[$k]['gift_name'] = $gift['gift_name'];
$list[$k]['num'] = $v['quantity']; $list[$k]['num'] = $v['quantity'];
$list[$k]['gold'] = $gift['gift_price']; $list[$k]['gift_price'] = $gift['gift_price'];
$list[$k]['type'] =2; $list[$k]['type'] =2;
$list[$k]['icon'] = $gift['play_image']; $list[$k]['base_image'] = $gift['base_image'];
} elseif($v['type'] == 3) { } elseif($v['type'] == 3) {
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find(); $decorate_price = DB::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find(); $gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
$list[$k]['name'] = $gift['title']; //装扮名称 $list[$k]['gift_name'] = $gift['title']; //装扮名称
$list[$k]['num'] = $decorate_price['day']; //天数 $list[$k]['num'] = $decorate_price['day']; //天数
$list[$k]['gold'] = $decorate_price['price']; //价格 $list[$k]['gift_price'] = $decorate_price['price']; //价格
$list[$k]['type'] =3; $list[$k]['type'] =3;
$list[$k]['icon'] = $gift['base_image']; $list[$k]['base_image'] = $gift['base_image'];
}elseif($v['type'] == 4) { }elseif($v['type'] == 4) {
$list[$k]['name'] = "钻石"; $list[$k]['gift_name'] = "钻石";
$list[$k]['num'] = $v['quantity']; $list[$k]['num'] = $v['quantity'];
$list[$k]['gold'] = $v['gold']; $list[$k]['gift_price'] = $v['gold'];
$list[$k]['type'] = 4; $list[$k]['type'] = 4;
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png"); $list[$k]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
} }
} }
$data['gift_list'] = $list; $data['gift_list'] = $list;
@@ -179,13 +185,16 @@ class Activities extends BaseCom
{ {
$activities_id = 3;//天降好礼 $activities_id = 3;//天降好礼
$uid = input('uid',$this->uid); $uid = input('uid',$this->uid);
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find(); //礼包
if($permission){ $gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
return V(1,'操作成功', ['permission'=>0]); $permission = 0;
}else{ if($gift_bag){
return V(1,'操作成功', ['permission'=>1]); $ext = json_decode($gift_bag['ext'],true);
if($ext['activity_end_time'] <= time()){
$permission = 1;
}
} }
return V(1,'操作成功', ['permission'=>$permission]);
} }
//天降好礼发放 //天降好礼发放
public function drop_gift_send() public function drop_gift_send()
@@ -195,4 +204,155 @@ class Activities extends BaseCom
return V($reslut['code'],$reslut['msg'], $reslut['data']); return V($reslut['code'],$reslut['msg'], $reslut['data']);
} }
//新人好礼
public function new_charge_gift()
{
//活动信息
$activities_id = 7;
$activities_title = DB::name('vs_activities')->where(['id'=>$activities_id,'status'=>1,'delete_time'=>0])->value('title');
//礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->select();
$data = [];
$data['name'] = $activities_title??"";
$data['gift_bag'] = [];
//一键领取
$bag_receive_all = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>17,'user_id'=>$this->uid])->find();
foreach ($gift_bag as $k=>$v){
$data['gift_bag'][$k]['gift_bag_id'] = $v['id']??0;
$data['gift_bag'][$k]['name'] = $v['title']??"";
$ext = json_decode($v['ext'],true);
$data['gift_bag'][$k]['title1'] = $ext['title1']??"";
$data['gift_bag'][$k]['title2'] = $ext['title2']??"";
$data['gift_bag'][$k]['money'] = $ext['money'];
$data['gift_bag'][$k]['gift_list'] = [];
$detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$v['id']])->select();
$list = [];
foreach ($detail as $kk=>$vv){
if($vv['type'] == 1){
$list[$kk]['gift_name'] = "金币";
$list[$kk]['num'] = $vv['quantity'];
$list[$kk]['gift_price'] = $vv['gold'];
$list[$kk]['type'] = 1;
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
}elseif ($vv['type'] == 2) {
$gift = DB::name('vs_gift')->where(['gid'=>$vv['foreign_id']])->find();
if($gift){
$list[$kk]['gift_name'] = $gift['gift_name'];
$list[$kk]['num'] = $vv['quantity'];
$list[$kk]['gift_price'] = $gift['gift_price'];
$list[$kk]['type'] =2;
$list[$kk]['base_image'] = $gift['base_image'];
}
} elseif ($vv['type'] == 3) {
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$vv['foreign_id']])->find();
if($decorate_price){
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
$list[$kk]['gift_name'] = $gift['title']??""; //装扮名称
$list[$kk]['num'] = $decorate_price['day']??0; //天数
$list[$kk]['gift_price'] = $decorate_price['price']??0; //价格
$list[$kk]['type'] =3;
$list[$kk]['base_image'] = $gift['base_image'] ?? "";
}
}elseif ($vv['type'] == 4) {
$list[$kk]['gift_name'] = "钻石";
$list[$kk]['num'] = $vv['quantity'];
$list[$kk]['gift_price'] = $vv['gold'];
$list[$kk]['type'] = 4;
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/diamond.png");
}
}
$data['gift_bag'][$k]['gift_list'] = array_values($list);
if($bag_receive_all){
$data['gift_bag'][$k]['status'] = 0;
}else{
if($v['id']!=17){
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>$v['id'],'user_id'=>$this->uid])->find();
if($bag_receive_log){
$data['gift_bag'][$k]['status'] = 0;
} else {
$data['gift_bag'][$k]['status'] = 1;
}
}
}
}
return V(1,'操作成功', $data);
}
//新人好礼发放
public function new_charge_gift_receive()
{
$uid = input('uid',$this->uid);
$money = input('money',0);
$reslut = model('Activities')->new_charge_gift_send($uid,$money);
return V($reslut['code'],$reslut['msg'], $reslut['data']);
}
/*
* 活动权限
*/
public function activities_permission(){
$system = request()->header('system');
$app_version = request()->header('App-Version');
if(!$app_version){
$app_version = input('App-Version');
}
$api_version = 0;
if ($system == 'iOS') {
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
$result = version_compare($api_versions['oldversion'],$app_version);
if ($result < 0) {
$api_version = 1;
}
}
//首充
$activities_id = 1;
$uid = input('uid',$this->uid);
$first_charge_permission = 1;
//查询是否首充
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->count();
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
if($is_first_charge > 0){
$first_charge_permission = 0;
}
if($permission){
$first_charge_permission = 0;
}
//天降好礼
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
$day_drop_permission = 0;
if($gift_bag){
$ext = json_decode($gift_bag['ext'],true);
if(strtotime($ext['activity_end_time']) >= time()){
$day_drop_permission = 1;
}
}
//新人充值好礼
$activities = DB::name('vs_activities')->where(['id'=>7,'status'=>1,'delete_time'=>0])->find();
$bag_data = DB::name('vs_gift_bag')->where(['activities_id'=>7,'status'=>1,'delete_time'=>0])->select();
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>['in',array_column($bag_data,'id')],'user_id'=>$uid])->select();
$new_permission = 0;
$user_info = DB::name('user')->where(['id'=>$uid])->find();
if($user_info['createtime'] + $activities['effective_time'] >= time()){
$new_permission = 1;
}
$gift_bag_log_ids = array_column($bag_receive_log,'gift_bag_id');
if(in_array(17,$gift_bag_log_ids)){
$new_permission = 0;
}else{
$gift_bag_log_ids = array_intersect([14,15,16],$gift_bag_log_ids);
if(count($gift_bag_log_ids) == 3){
$new_permission = 0;
}
}
return V(1,'操作成功',[
'first_charge_permission'=>$first_charge_permission,
'day_drop_permission'=>$day_drop_permission,
'n_people_permission'=>$new_permission
],$api_version);
}
} }

View File

@@ -39,7 +39,8 @@ class BlindBoxTurntable extends BaseCom
$gift_user_ids = input('gift_user_ids',0); $gift_user_ids = input('gift_user_ids',0);
$num = input('num',1); $num = input('num',1);
$heart_id = input('heart_id',0); $heart_id = input('heart_id',0);
$reslut = model('BlindBoxTurntableGiftDraw')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id); $auction_id = input('auction_id',0);
$reslut = model('BlindBoxTurntableGiftDrawWorld')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
return v($reslut['code'], $reslut['msg'], $reslut['data']); return v($reslut['code'], $reslut['msg'], $reslut['data']);
} }
/* /*
@@ -92,7 +93,7 @@ class BlindBoxTurntable extends BaseCom
$user_id = $this->uid; $user_id = $this->uid;
$room_id = input('room_id',0); $room_id = input('room_id',0);
$num = input('num',1); $num = input('num',1);
$reslut = model('BlindBoxTurntableGiftDraw')->xlh_draw_gift($user_id,$num,$room_id); $reslut = model('BlindBoxTurntableGiftDrawWorld')->xlh_draw_gift($user_id,$num,$room_id);
return v($reslut['code'], $reslut['msg'], $reslut['data']); return v($reslut['code'], $reslut['msg'], $reslut['data']);
} }
/* /*
@@ -116,4 +117,15 @@ class BlindBoxTurntable extends BaseCom
$reslut = model('BlindBoxTurntableGift')->xlh_ranking($room_id,$page,$page_size); $reslut = model('BlindBoxTurntableGift')->xlh_ranking($room_id,$page,$page_size);
return v($reslut['code'], $reslut['msg'], $reslut['data']); return v($reslut['code'], $reslut['msg'], $reslut['data']);
} }
/*
* 巡乐会榜单 (以期数显示)
*/
public function get_xlh_ranking(){
$page = input('page',1);
$page_size = input('page_size',12);
$room_id = input('room_id',0);
$reslut = model('BlindBoxTurntableGift')->xlh_ranking_list($room_id,$page,$page_size);
return v($reslut['code'], $reslut['msg'], $reslut['data']);
}
} }

View File

@@ -6,7 +6,7 @@ use think\Controller;
use think\Db; use think\Db;
use think\Log; use think\Log;
class Ceshi extends Controller class Ceshi extends Controllers
{ {
//设置白名单ip访问本类接口 //设置白名单ip访问本类接口
protected $allowIp = [ protected $allowIp = [
@@ -211,17 +211,17 @@ class Ceshi extends Controller
$user = db::name('user')->where('id','>', 0)->select(); $user = db::name('user')->where('id','>', 0)->select();
if($user){ // if($user){
foreach ($user as &$v){ // foreach ($user as &$v){
if($v['id']){ // if($v['id']){
$j = 0; // $j = 0;
$data[$j] = [ // $data[$j] = [
'UserID' => 'u'.$v['id'], // 'UserID' => 'u'.$v['id'],
]; // ];
} // }
model('Tencent')->account_deletes($data); // // model('Tencent')->account_deletes($data);
} // }
} // }
$reslut9 = db::name('user')->where('id','>', 0)->delete(); $reslut9 = db::name('user')->where('id','>', 0)->delete();
if($reslut9){ if($reslut9){
@@ -458,9 +458,9 @@ class Ceshi extends Controller
//删除腾讯房间 //删除腾讯房间
$room = db::name('vs_room')->select(); $room = db::name('vs_room')->select();
foreach ($room as &$value){ // foreach ($room as &$value){
model('Tencent')->delete_group('room'.$value['id']); // // model('Tencent')->delete_group('room'.$value['id']);
} // }
$reslut35 = db::name('vs_room')->where('id','>', 0)->delete(); $reslut35 = db::name('vs_room')->where('id','>', 0)->delete();
if($reslut35){ if($reslut35){
$i++ ; $i++ ;

View File

@@ -43,4 +43,10 @@ class Cron
$cron = new \app\cron\controller\FriendEnd(); $cron = new \app\cron\controller\FriendEnd();
$cron->index(); $cron->index();
} }
//房间小时榜发礼物(每小时执行一次)
public function RoomHourRanking(){
$cron = new \app\cron\controller\RoomHourRanking();
$cron->index();
}
} }

View File

@@ -22,7 +22,6 @@ class Guild extends BaseCom
public function guild_list() public function guild_list()
{ {
$page = input('page',1); $page = input('page',1);
$page = $page > 0 ? $page : 1;
$limit = input('limit',10); $limit = input('limit',10);
$search = input('search_id',''); $search = input('search_id','');
$reslut = model('Guild')->get_guild_list($page,$limit,$search,$this->uid); $reslut = model('Guild')->get_guild_list($page,$limit,$search,$this->uid);

View File

@@ -26,6 +26,9 @@ class Payment extends Controller
$user_id = input('user_id', 0); $user_id = input('user_id', 0);
$money = input('money', 0); $money = input('money', 0);
$coin = input('coin', 0); $coin = input('coin', 0);
$type_params = input('type_params', 0);
$type_id = input('type_id', 0);
if(!$coin){ if(!$coin){
$coin = $money * get_system_config_value('rmb_coin_ratio'); $coin = $money * get_system_config_value('rmb_coin_ratio');
} }
@@ -60,7 +63,9 @@ class Payment extends Controller
$data['user_id'] = $user_id; $data['user_id'] = $user_id;
$data['pay_type'] = $type; $data['pay_type'] = $type;
$data['createtime'] = time(); $data['createtime'] = time();
$data['remarke'] = '充值到app用户'.($user_code ?? "") ."余额!";; $data['remarke'] = '充值到app用户'.($user_code ?? "") ."余额!";
$data['type_params'] = $type_params;
$data['type_id'] = $type_id;
$re = db::name('vs_user_recharge')->insert($data); $re = db::name('vs_user_recharge')->insert($data);
if (!$re) { if (!$re) {
@@ -105,6 +110,7 @@ class Payment extends Controller
$where['order_sn']=$out_trade_no; $where['order_sn']=$out_trade_no;
$where['order_type']=1; $where['order_type']=1;
$where['pay_type']=2; $where['pay_type']=2;
$where['pay_status']=1;
$data=[ $data=[
'trade_no'=>$trade_no 'trade_no'=>$trade_no
@@ -149,6 +155,7 @@ class Payment extends Controller
$where['order_sn']=$out_trade_no; $where['order_sn']=$out_trade_no;
$where['order_type']=1;//1 充值 $where['order_type']=1;//1 充值
$where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信 $where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信
$where['pay_status']=1;
$data=[ $data=[
'trade_no'=>$transaction_id 'trade_no'=>$transaction_id
@@ -204,6 +211,7 @@ class Payment extends Controller
$where['order_sn']=$out_trade_no; $where['order_sn']=$out_trade_no;
$where['order_type']=1;//1 充值 $where['order_type']=1;//1 充值
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信 $where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信
$where['pay_status']=1;
$data=[ $data=[
'trade_no'=>$trade_no 'trade_no'=>$trade_no
@@ -225,11 +233,16 @@ class Payment extends Controller
* 云账户回调(提现) * 云账户回调(提现)
*/ */
public function yun_callback(){ public function yun_callback(){
$data = input("data", ""); // $data = input("data", "");
$mess = input("mess", ""); // $mess = input("mess", "");
$timestamp = input("timestamp", ""); // $timestamp = input("timestamp", "");
$sign = input("sign", ""); // $sign = input("sign", "");
Log::record("云账户回调信息".json_encode($_POST),"info"); $data = $_POST['data']??"";
$mess = $_POST['mess']??"";
$timestamp = $_POST['timestamp']?? "";
$sign = $_POST['sign']??"";
write_log_redis("yunzhanghu_huidiao_原始数据",$_POST);
$yun_pay = new YunPay(); $yun_pay = new YunPay();
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign); $result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
if($result['code']==1){ if($result['code']==1){

View File

@@ -0,0 +1,119 @@
<?php
namespace app\api\controller;
use app\common\controller\BaseCom;
use app\common\service\RedpacketService;
use think\Db;
/**
* 红包接口
*/
class Redpacket extends BaseCom
{
/**
* 发红包
*/
public function create()
{
$data = $this->request->post();
$data['user_id'] = $this->uid;
$service = new RedpacketService();
$reslut = $service->create($data);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
/**
* 抢红包
*/
public function grab()
{
$redpacketId = input('redpacket_id', 0);
if (empty($redpacketId)) {
return V(0, '红包ID不能为空');
}
$service = new RedpacketService();
// 在抢红包前确保状态正确
$service->checkAndUpdateRedpacketStatus($redpacketId);
$reslut = $service->grabWithResult($redpacketId, $this->uid);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
/**
* 获取抢红包结果
*/
public function grabResult()
{
$redpacketId = $this->request->get('redpacket_id');
if (empty($redpacketId)) {
return V(0, '红包ID不能为空');
}
$service = new RedpacketService();
$result = $service->getGrabResult($redpacketId, $this->uid);
if (!$result) {
return V(0, '红包不存在');
}
return V(1, '获取成功', $result);
}
/**
* 红包详情
*/
public function detail()
{
$redpacketId = input('redpacket_id', 0);
if (empty($redpacketId)) {
return V(0, '红包ID不能为空');
}
$service = new RedpacketService();
// 在获取详情前确保状态正确
$service->checkAndUpdateRedpacketStatus($redpacketId);
$detail = $service->getDetail($redpacketId, $this->uid);
if (!$detail) {
return V(0, '红包不存在');
}
return V(1, '获取成功', $detail);
}
/**
* 获取倒计时选项
*/
public function countdownOptions()
{
$options = \app\common\model\Redpacket::$countdownOptions;
$this->success('获取成功', $options);
}
// 获取房间内红包列表
public function roomRedPackets()
{
$roomId = $this->request->get('room_id');
$result = Db::name('redpacket')->where(['room_id' => $roomId, 'status' => ['<=',1]])->select();
if($result){
foreach ($result as &$item) {
$item['redpacket_id'] = $item['id'];
$item['redpacket_time'] = get_system_config_value('red_packet_time');//展示时间
$item['nickname'] = Db::name('user')->where('id', $item['user_id'])->value('nickname');
$item['avatar'] = Db::name('user')->where('id', $item['user_id'])->value('avatar');
$is_qiang = Db::name('redpacket_record')->where(['redpacket_id' => $item['id'], 'user_id' => $this->uid])->find();
$item['is_qiang'] = $is_qiang ? 1 : 0;
}
}
return V(1, '获取成功', $result);
}
}

View File

@@ -451,4 +451,13 @@ class Room extends BaseCom
$reslut = model('Room')->user_reconnect($this->uid, $room_id); $reslut = model('Room')->user_reconnect($this->uid, $room_id);
return V($reslut['code'], $reslut['msg'], $reslut['data']); return V($reslut['code'], $reslut['msg'], $reslut['data']);
} }
//用户在房间内切后台保留机制
public function user_in_room_background()
{
$room_id = input('room_id', 0);
$type = input('type', 1);//1-切后台2-切前台
$reslut = model('Room')->user_in_room_background($this->uid, $room_id,$type);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
} }

View File

@@ -0,0 +1,34 @@
<?php
namespace app\api\controller;
use app\common\controller\BaseCom;
use think\Db;
class RoomHourRanking extends BaseCom
{
//房间小时榜是否开启
public function room_hour_ranking_is_open()
{
$open_time = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('open_time');
return V(1, '获取成功', ['open_time' => $open_time]);
}
//房间小时榜玩法
public function room_hour_ranking_play()
{
$introd = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('introd');
return V(1, '获取成功', ['introd' => $introd]);
}
//房间小时榜
public function room_hour_ranking()
{
$page = input('page', 1);
$page_limit = input('page_limit', 20);
$reslut = model('RoomHourRanking')->room_hour_ranking($page, $page_limit);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
}

View File

@@ -10,6 +10,8 @@ class RoomPit extends BaseCom
//申请上麦 //申请上麦
public function apply_pit() public function apply_pit()
{ {
$key_name = "api:room:apply_pit:" . $this->uid;
$room_id = input('room_id', 0); $room_id = input('room_id', 0);
$pit_number = input('pit_number', 0); $pit_number = input('pit_number', 0);
if($room_id == 0){ if($room_id == 0){
@@ -19,27 +21,19 @@ class RoomPit extends BaseCom
if($res['code'] != 1){ if($res['code'] != 1){
return V(0, '房间不存在', null); return V(0, '房间不存在', null);
} }
// //查询房间主持麦有人吗
// $room_host_info = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => 9])->value('user_id');
// //房主,管理,主持不受此限制
// $room_owner = db::name('vs_room')->where(['id' => $room_id, 'user_id' => $this->uid])->find();
// //管理
// $room_manager = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $this->uid,'type' => 2,'delete_time' => null])->find();
// //主持
// $room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $this->uid,'type' => 1,'delete_time' => null])->find();
// if($room_host_info == 0 && !$room_owner && !$room_manager && !$room_host){
// return V(0, '上麦请联系主持', null);
// }
$room_label = $res['data']['label_id']; $room_label = $res['data']['label_id'];
$room_type = $res['data']['type_id']; $room_type = $res['data']['type_id'];
redis_lock_exits($key_name);
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8))|| $room_type == 2 || $room_type == 7){ if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8))|| $room_type == 2 || $room_type == 7){
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number); $reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){ }elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number); $reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
}else{ }else{
redis_unlocks($key_name);
return V(0, '房间不存在', null); return V(0, '房间不存在', null);
} }
redis_unlocks($key_name);
//1-禁麦位2-清空消息3-清空魅力值4-加入黑名单5-踢出房间6-关闭麦克风7-申请上麦8-同意上麦9-拒绝上麦10-点歌11-开启PK', //1-禁麦位2-清空消息3-清空魅力值4-加入黑名单5-踢出房间6-关闭麦克风7-申请上麦8-同意上麦9-拒绝上麦10-点歌11-开启PK',
model('Room')->room_operation_record($this->uid,$room_id,7,0,$pit_number); model('Room')->room_operation_record($this->uid,$room_id,7,0,$pit_number);

View File

@@ -100,4 +100,59 @@ class Search extends BaseCom
return V(1, '获取成功', $lists); return V(1, '获取成功', $lists);
} }
//搜索
public function search_list()
{
$search = input('search', '');
if(is_numeric($search)){
$where = [
'user_code' => $search,
'status' => 1
];
$where1 = [
'room_number' => $search,
'apply_status' => 2,
'type_id' => ['<>',6],
'room_status' => 1
];
}else{
$where = [
'nickname' => ['like', '%'.$search . '%'],
'status' => 1
];
$where1 = [
'room_name' => ['like', '%'.$search . '%'],
'apply_status' => 2,
'type_id' => ['<>',6],
'room_status' => 1
];
}
$users = db::name('user')->field('id as user_id,nickname,avatar,user_code,sex')->where($where)->select();
if(isset($users)){
foreach ($users as &$v){
$v['room_id'] = 0;
//是否在房间
$is_room = db::name('vs_room_visitor')->where(['user_id' => $v['user_id'], 'is_delete' => 1])->order('id desc')->value('room_id');
if ($is_room) {
$v['room_id'] = $is_room;
}
$v['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标
$v['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标
}
}
$rooms = db::name('vs_room')->field('id as room_id,room_name,room_cover,room_number,label_id,today_hot_value')->where($where1)->select();
if(isset($rooms)){
foreach ($rooms as $vv){
$vv['label_icon'] = db::name('vs_room_label')->where('id', $vv['label_id'])->value('label_icon');
$vv['hot_value'] = $vv['today_hot_value'];
}
}
return V(1, '获取成功', ['users' => $users, 'rooms' => $rooms]);
}
} }

View File

@@ -234,6 +234,15 @@ class User extends BaseCom
return V($reslut['code'], $reslut['msg'], $reslut['data']); return V($reslut['code'], $reslut['msg'], $reslut['data']);
} }
//关注房间(红包专用)
public function follow_room()
{
$room_id = input('room_id', 0);
$type = input('type', 1);//1-收藏0-取消收藏
$reslut = model('user')->follow_room($this->uid, $room_id,$type);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
//用户关系卡(亲密拍)、关系位(真爱拍) //用户关系卡(亲密拍)、关系位(真爱拍)
public function user_cp_list() public function user_cp_list()
{ {

View File

@@ -0,0 +1,39 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Log;
use app\common\controller\BaseCom;
class Xintiao extends BaseCom
{
public function keep_xintiao()
{
$user_id = $this->uid;
$is_xintiao = db::name('vs_xintiao')->where('user_id' , $user_id)->find();
if($is_xintiao){
db::name('vs_xintiao')->where('user_id' , $user_id)->update(['updatetime' => time()]);
}else{
db::name('vs_xintiao')->insert([
'user_id' => $user_id,
'createtime' => time(),
'updatetime' => time()
]);
}
return true;
}
}

View File

@@ -0,0 +1,434 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Log;
use app\common\controller\Push;
class Xxiaoshi extends Controller
{
public function send_gift()
{
//获取上一个小时的开始时间和结束时间
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00'));
echo "开始时间:" .$start_time."\n";
echo "结束时间:" .$end_time."\n";
//当前小时的前一个小时24小时计时法0-23
$pre_hour = date('H', strtotime('-1 hour'));
echo "上个时间段:" .$pre_hour."\n";
$is_open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
if ($is_open_time == 0) {
echo "未开启时间段:" .$is_open_time."\n";
return;
}
//是否全局飘瓶
$is_public_server = db::name('vs_hour_ranking_config')->where('id', 1)->value('is_public_server');
if ($is_public_server == 1) {
//全局飘瓶时间段
$xlh_time_range = db::name('vs_hour_ranking_config')->where('id', 1)->value('broadcast_times');
if($xlh_time_range){
if($xlh_time_range == 25){
$is_piao = 1;
}else{
//当前的前一个小时是否在 $xlh_time_range中
if (in_array($pre_hour, explode(',', $xlh_time_range))) {
$is_piao = 1;
} else {
$is_piao = 0;
}
}
}else{
$is_piao = 0;
}
}else{
$is_piao = 0;
}
//获取上一个时间段的配置
// $gift_list = db::name('vs_hour_ranking_gift_config')->where('time_id',$pre_hour)->group('ranking')->order('id', 'desc')->select();
$gift_list = $this->get_hour_ranking($pre_hour);
// echo "上个时间段的配置:" .json_encode($gift_list)."\n";
// 提取所有有奖励的内容
$allRewards = $this->extractAllRewards($gift_list);
// 按index分组
$groupedRewards = $this->groupRewardsByIndex($allRewards);
// 按名次顺序分配奖励
$distributionResult = $this->distributeByRank($groupedRewards);
//获取上个数组的个数,从而获取配置了多少个名次
$count = count($distributionResult);
echo "上个时间段的配置总数:" .$count."\n";
//获取前一个小时的 前$count名房间排行
$room_list = model('api/RoomHourRanking')->room_hour_ranking(1, $count, $start_time, $end_time);
$room_owner = [];
if ($room_list['code'] == 1) {
//获取房间排行奖励最低值
$min_price = db::name('vs_hour_ranking_config')->where('id', 1)->value('min_price');
if ($room_list['data']['lists']) {
echo "房间列表:" .json_encode($room_list['data']['lists'])."\n";
foreach ($room_list['data']['lists'] as $v){
if ($v['total_price'] >= $min_price) {
$room_owner[] = [
'user_id' => $v['user_id'],
'room_name' => $v['room_name'],
'room_id' => $v['room_id'],
'total_price' => $v['total_price']
];
}
}
}
}
if ($distributionResult && $room_owner) {
$text_list_new = [];
echo "礼物数:" .json_encode($distributionResult)."\n";
echo "房主:" .json_encode($room_owner)."\n";
foreach ($distributionResult as $k => $value) {
//礼物全部给他偷偷放在装扮表及金额 中
//有几个用户就发几个
if(count($room_owner) > $k){
// 为每个房间添加一个标志,表示是否已处理推送信息
$hasProcessedPush = false;
foreach ($value['rewards'] as $v){
// if($v['type'] == 0){//1金币2礼物3头像4坐骑
// echo "发金币:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
// $res = $this->add_coin($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
// }elseif ($v['type'] == 1){
// echo "发礼物:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
// $res = $this->add_gift($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
// }elseif ($v['type'] == 2){
// $res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,3);
// }elseif ($v['type'] == 3){
// $res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,4);
// }
// 只有在第一次处理奖励时添加推送信息,避免重复推送
if(!$hasProcessedPush && $is_piao == 1) {
$room_name = $room_owner[$k]['room_name'];
//推送礼物横幅
if ($k == 0) {
$text = '新科状元!【' . $room_name . '】独占鳌头!';
} elseif ($k == 1) {
$text = '金榜榜眼!【' . $room_name . '】才气逼人!';
} elseif ($k == 2) {
$text = '风采探花!【' . $room_name . '】实力绽放!';
}
$text_list_new[] = [
'text' => $text ?? '恭喜【' . $room_name . '】获得礼物!',
'room_id' => $room_owner[$k]['room_id'],
'room_name' => $room_name,
'rank_number' => $k + 1,
];
$hasProcessedPush = true; // 标记已处理推送
}
}
}
}
if(!empty($text_list_new)){
$push = new Push();
$push->hourRankingcs($text_list_new);
Log::record("小时榜推送:".json_encode($text_list_new),"infos");
}
}
echo "送礼-共" . count($room_owner) . "个房间房主获益\n";
}
//添加金币到钱包
// public function add_coin($coin,$user_id,$ranking,$room_id,$total_price,$is_piao){
// if($coin > 0){
// $data = [
// 'user_id' => $user_id,
// 'change_value' => $coin,
// // 'room_id' => $room_ids,
// 'money_type' => 1,
// 'change_type' => 27,
// 'from_id' => 0,
// 'remarks' => '小时榜获得',
// 'createtime' => time()
// ];
// //开启事务
// Db::startTrans();
// $res = Db::name('vs_user_money_log')->insert($data);
// if(!$res){
// Db::rollback();
// }
// //增加用户金币
// $res1 = Db::name('user_wallet')->where(['user_id'=>$user_id])->setInc('coin',$coin);
// if(!$res1){
// Db::rollback();
// }
// //添加到排行表
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
// $res2 = db::name('vs_hour_ranking')->insert([
// 'ranking' => $ranking,
// 'room_id' => $room_id,
// 'flowing_water' => $total_price,
// 'coin' => $coin,
// 'time_id' => date('H', strtotime('-1 hour')),
// 'stime' => $start_time,
// 'etime' => $end_time,
// 'createtime' => time(),
// 'updatetime' => time(),
// 'is_public_server' => $is_piao
// ]);
// if(!$res2){
// Db::rollback();
// }
// Db::commit();
// }
// return true;
// }
// //添加礼物到背包
// public function add_gift($gift_id,$user_id,$ranking,$room_id,$total_price,$is_piao){
// $res = model('api/UserGiftPack')->change_user_gift_pack($user_id,$gift_id,1,model('UserGiftPack')::HOUR_RANK_GET,"小时榜获得");
// if($res['code'] == 0){
// Log::record("小时榜获取礼物失败:".$res['msg'],"info");
// }
// //添加到排行表
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
// $res2 = db::name('vs_hour_ranking')->insert([
// 'ranking' => $ranking,
// 'room_id' => $room_id,
// 'flowing_water' => $total_price,
// 'gift_id' => $gift_id,
// 'gift_type' => 2,
// 'time_id' => date('H', strtotime('-1 hour')),
// 'stime' => $start_time,
// 'etime' => $end_time,
// 'createtime' => time(),
// 'updatetime' => time(),
// 'is_public_server' => $is_piao
// ]);
// if(!$res2){
// Log::record("小时榜礼物锁定失败","info");
// }
// return true;
// }
// //添加装扮到背包
// public function add_decorate($avatar_id,$user_id,$ranking,$room_id,$total_price,$is_piao,$type){
// $decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$avatar_id])->find();
// if(empty($decorate_price_info)){
// Log::record("小时榜获取装扮失败:没有找到装扮!".$avatar_id,"info");
// }
// $res = model('api/Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],2);
// if($res['code'] == 0){
// Log::record("小时榜获取装扮失败:".$res['msg']."-".$avatar_id,"info");
// }
// //添加到排行表
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
// $res2 = db::name('vs_hour_ranking')->insert([
// 'ranking' => $ranking,
// 'room_id' => $room_id,
// 'flowing_water' => $total_price,
// 'gift_id' => $avatar_id,
// 'gift_type' => $type,
// 'time_id' => date('H', strtotime('-1 hour')),
// 'stime' => $start_time,
// 'etime' => $end_time,
// 'createtime' => time(),
// 'updatetime' => time(),
// 'is_public_server' => $is_piao,
// ]);
// if(!$res2){
// Log::record("小时榜咋装扮锁定失败","info");
// }
// return true;
// }
/**
* 提取所有有奖励的内容
*/
private function extractAllRewards($responseData)
{
$allRewards = [];
foreach ($responseData as $timeSlot) {
foreach ($timeSlot['reward'] as $rewardItem) {
$index = $rewardItem['index'];
$content = $rewardItem['content'];
// 只处理有奖励内容的数据
if (!empty($content)) {
foreach ($content as $rewardContent) {
$allRewards[] = [
'index' => $index,
'type' => $rewardContent['type'],
'value' => $rewardContent['value'],
'name' => $rewardContent['name'] ?? ''
];
}
}
}
}
return $allRewards;
}
/**
* 按index分组奖励
*/
private function groupRewardsByIndex($allRewards)
{
$grouped = [];
foreach ($allRewards as $reward) {
$index = $reward['index'];
if (!isset($grouped[$index])) {
$grouped[$index] = [];
}
$grouped[$index][] = $reward;
}
// 按index排序
ksort($grouped);
return $grouped;
}
/**
* 按名次顺序分配奖励
*/
private function distributeByRank($groupedRewards)
{
$distribution = [];
$currentRank = 0; // 从第1名开始
// 按index顺序分配index 0 = 第1名index 1 = 第2名以此类推
foreach ($groupedRewards as $index => $rewards) {
// 确保名次连续,如果有空缺则填充空名次
while ($currentRank < $index) {
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => []
];
$currentRank++;
}
// 分配当前名次的奖励
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => $rewards
];
$currentRank++;
}
return $distribution;
}
public function get_hour_ranking($time){
// 先按时间段和排名索引分组查询
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
->where('time_id', '=', $time)
->order('time_id')
->column('time_id');
$result = [];
foreach ($timeRanges as $timeRange) {
// 查询该时间段的所有数据
$rewards = db::name('vs_hour_ranking_gift_config')->where('time_id', $timeRange)
->field('ranking, gift_type, gift_id,coin,name')
->order('ranking')
->select();
$rewardMap = [];
foreach ($rewards as $reward) {
$rankIndex = $reward['ranking'];
if (!isset($rewardMap[$rankIndex])) {
$rewardMap[$rankIndex] = [
'index' => $rankIndex,
// 'name' => $reward['rank_name'],
'content' => []
];
}
// 添加奖励内容到content数组
if ($reward['gift_id'] != 0 || $reward['coin'] != 0) {
if($reward['gift_id'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['gift_id'],
// 'coin' => $reward['coin'],
'name' => $reward['name'],
];
}
if($reward['coin'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['coin'],
'name' => $reward['name'],
];
}
}
}
// 按index排序
ksort($rewardMap);
$result[] = [
'time' => $timeRange,
'reward' => array_values($rewardMap)
];
}
return $result;
}
public function give_gifts(){
$data = db::name('vs_give_gift')->where('from_id',5483)->select();
$num = 0;
$i=0;
$j = 0;
foreach($data as $v){
$j += $v['total_price'];
$nuu = db::name('vs_give_gift_ratio_log')->where('give_gift_id',$v['id'])->value('room_owner_earning');
$id = db::name('vs_give_gift_ratio_log')->where('give_gift_id',$v['id'])->value('id');
// echo $id."--".$nuu."\n";
$num += $nuu;
$i++;
}
echo $num;
echo "==".$i."==".$j;
// echo db::name()->where(['user_id' => 10857,'money_type' =>2,'change_type' =>18])-sum('change_value');
}
public function room_liushui(){
// $room = db::name('vs_give_gift')->where(['from_id' => ['<>',5418],'from' => 2])->group('from_id');
$dd = db::name('vs_user_gift_pack')->alias('a')->join('vs_gift b','a.gid = b.gid')->field('a.gid,a.num,b.gift_price')->where(['a.num' =>['>',0]])->select();
$count = 0;
foreach ($dd as $v){
$count += $v['gift_price'] * $v['num'];
}
echo $count;
}
}

View File

@@ -25,7 +25,8 @@ class Activities extends Model
public static function first_charge_gift_send($user_id,$money=0) public static function first_charge_gift_send($user_id,$money=0)
{ {
//礼包 //礼包
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'money'=>$money])->value('id'); $gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'delete_time'=>0,'money'=>['>=',$money]])->order('money desc')->find();
$gift_bag_id = $gift_bag['id'] ?? 0;
if (!$gift_bag_id) { if (!$gift_bag_id) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null]; return ['code' => 0, 'msg' => '礼包不存在','data' => null];
} }
@@ -98,14 +99,19 @@ class Activities extends Model
/* /*
* 天降好礼发放 * 天降好礼发放
*/ */
public static function drop_gift_send($user_id) public static function drop_gift_send($user_id,$money=0)
{ {
$activities_id = 3; $activities_id = 3;
//礼包 //礼包
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->value('id'); $gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
$gift_bag_id = $gift_bag['id'] ?? 0;
if (!$gift_bag_id) { if (!$gift_bag_id) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null]; return ['code' => 0, 'msg' => '礼包不存在','data' => null];
} }
if($money != $gift_bag['money']){
return ['code' => 0, 'msg' => '充值金额未命中天降好礼礼包','data' => null];
}
$gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select(); $gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
if (!$gift_bag_detail) { if (!$gift_bag_detail) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null]; return ['code' => 0, 'msg' => '礼包不存在','data' => null];
@@ -136,15 +142,20 @@ class Activities extends Model
Db::rollback(); Db::rollback();
return ['code' => 0, 'msg' => $res['msg'], 'data' => null]; return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
} }
// 记录日志
//添加礼盒记录
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'parent_id' => $v['id'],
'gift_id'=> $v['foreign_id'],
'num' => $v['quantity'],
'bag_price' => $gift_bag['money'],
'gift_price' => $v['gold'],
'createtime' => time(),
'updatetime' => time()
]);
} }
// 记录日志
//添加礼盒记录
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'createtime' => time(),
'updatetime' => time()
]);
// 添加活动记录 // 添加活动记录
$reslut = Db::name('vs_activities_receive')->insert([ $reslut = Db::name('vs_activities_receive')->insert([
'user_id' => $user_id, 'user_id' => $user_id,
@@ -160,4 +171,85 @@ class Activities extends Model
return ['code' => 0, 'msg' => "请重试", 'data' => null]; return ['code' => 0, 'msg' => "请重试", 'data' => null];
} }
} }
/*
* 新人好礼发放
*/
public static function new_charge_gift_send($user_id,$money=0)
{
//礼包
$activities_id = 7;
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1,'delete_time'=>0,'money'=>$money])->order('money desc')->find();
$gift_bag_id = $gift_bag['id'] ?? 0;
if (!$gift_bag_id) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
}
$gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
if (!$gift_bag_detail) {
return ['code' => 0, 'msg' => '礼包未配置','data' => null];
}
Db::startTrans();
try {
foreach ($gift_bag_detail as $k=>$v){
$gift_id =0;
$gift_price = 0;
$gift_num = $v['quantity'];
switch ($v['type']) {
case 1: //金币 方法1直接添加到用户钱包
$gift_price = $v['quantity'];
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::NEW_USER_CHARGE_GIFT,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NEW_USER_CHARGE_GIFT));
break;
case 2: //礼物 方法2添加到用户礼物背包
$gift_id = $v['foreign_id'];
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::NEW_CHARGE_GIFT,"新人好礼获得礼物");
break;
case 3: //坐骑 方法3添加到用户装扮
$gift_id = $v['foreign_id'];
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
if(empty($decorate_price_info)){
break;
}
$gift_price = $decorate_price_info['price'];
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],8);
break;
case 4: //道具 方法5钻石
$gift_price = $v['quantity'];
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::NEW_USER_CHARGE_GIFT,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NEW_USER_CHARGE_GIFT));
default:
break;
}
if ($res['code'] != 1) {
Db::rollback();
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
}
// 记录日志
//添加礼盒记录
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'parent_id' => $v['id'],
'gift_id'=> $v['foreign_id'],
'num' => $v['quantity'],
'bag_price' => $gift_bag['money'],
'gift_price' => $v['gold'],
'createtime' => time(),
'updatetime' => time()
]);
}
// 添加活动记录
$reslut = Db::name('vs_activities_receive')->insert([
'user_id' => $user_id,
'activities_id' => 1,
'createtime' => time(),
'updatetime' => time()
]);
Db::commit();
return ['code' => 1, 'msg' => '操作成功','data' => null];
}catch (\Exception $e) {
// 回滚事务
Db::rollback();
return ['code' => 0, 'msg' => "请重试", 'data' => null];
}
}
} }

View File

@@ -45,12 +45,11 @@ class BlindBoxTurntableGift extends Model
$xlh_ext = json_decode($xlh_box['ext'],true); $xlh_ext = json_decode($xlh_box['ext'],true);
$xlh = []; $xlh = [];
if($xlh_ext['inlet_bag_id'] == $box['id']){ if($xlh_ext['inlet_bag_id'] == $box['id']){
$room = db::name('vs_room')->field('id,xlh_periods,xlh_periods_num')->where(['id'=>$room_id])->find();
$is_xlh = 1; $is_xlh = 1;
$xlh['waiting_start_num'] = $xlh_ext['open_condition']['waiting_start_num'];//等待开奖次数 $xlh['waiting_start_num'] = $xlh_ext['open_condition']['waiting_start_num'];//等待开奖次数
$xlh['start_num'] = $xlh_ext['open_condition']['start_num'];//开始开奖次数 $xlh['start_num'] = $xlh_ext['open_condition']['start_num'];//开始开奖次数
//当前抽奖次数 //当前抽奖次数
$xlh['current_num'] = $room['xlh_periods_num']; $xlh['current_num'] = Cache::get("xlh_periods_num") ?? 0;
//状态 //状态
if($xlh['current_num'] >= $xlh_ext['open_condition']['start_num']){ if($xlh['current_num'] >= $xlh_ext['open_condition']['start_num']){
$xlh['status'] = 1;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始 $xlh['status'] = 1;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始
@@ -71,559 +70,6 @@ class BlindBoxTurntableGift extends Model
return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data]; return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data];
} }
/*
* 抽奖
*/
public function draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num=1,$room_id=0,$heart_id=0)
{
// 合并配置查询
$bag_data = db::name("vs_gift_bag")
->field('id,name,ext')
->where('id',$gift_bag_id)
->find();
if (!$bag_data) {
return ['code' => 0, 'msg' => '盲盒配置不存在', 'data' => null];
}
$ext = json_decode($bag_data['ext'],true);
// 合并盲盒和礼物信息查询
$bag_gift = db::name("vs_gift")
->where(['gid'=>$ext['gift_id']])
->find();
if (!$bag_gift) {
return ['code' => 0, 'msg' => '盲盒礼物不存在', 'data' => null];
}
// 合并巡乐会配置查询
$xlh_box = db::name('vs_gift_bag')
->where('id',13)
->find();
$xlh_ext = $xlh_box ? json_decode($xlh_box['ext'],true) : [];
$xlh_is_piao_ping = 0;
// 处理收礼用户数组(多个)
$toarray = explode(',',$gift_user_ids);
// 合并房间信息查询
$room = db::name('vs_room')
->field('id,room_name,xlh_periods,xlh_periods_num,is_open_blind_box_turntable')
->where(['id'=>$room_id])
->find();
if (!$room) {
return ['code' => 0, 'msg' => '房间不存在', 'data' => null];
}
$this_xlh_periods_num = $room['xlh_periods_num'];//本期当前抽奖次数(巡乐会出发条件)
// 判断是否有足够的金币
$user_waller = db::name('user_wallet')
->where(['user_id'=>$user_id])
->find();
if (!$user_waller) {
return ['code' => 0, 'msg' => '用户钱包不存在', 'data' => null];
}
// 抽奖总消耗金币
$bag_gift_price = $bag_gift['gift_price'] * $num;
if ($user_waller['coin'] < $bag_gift_price) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
}
if ($room['is_open_blind_box_turntable'] != 1) {
return ['code' => 0, 'msg' => '该房间未开启盲盒转盘', 'data' => null];
}
// 预计算抽奖结果,减少数据库事务中的查询
// 计算期数和抽奖次数
// 合并奖池总抽奖次数和房间奖池信息查询
$room_pan_info = db::name("vs_gift_bag_detail")
->alias('a')
->join('vs_room_pan b', 'b.gift_bag_detail_id = a.id AND b.room_id = ' . $room_id)
->where(['a.gift_bag_id' => $gift_bag_id])
->field('SUM(a.quantity) as total_quantity, SUM(b.remaining_number) as total_remaining, MAX(b.periods) as periods')
->find();
$total_quantity = $room_pan_info['total_quantity'] ?: 0;
$total_remaining = $room_pan_info['total_remaining'] ?: 0;
$periods = $room_pan_info['periods'] ?: 0;
// 本期当前第多少次后抽奖 总的抽奖次数- 剩余数量
$total_draw_times = $total_quantity - $total_remaining;
if($total_draw_times<0){
$total_draw_times = 0;
}
// 预计算所有抽奖结果
$precomputed_results = [];
$current_draw_times = $total_draw_times;
$current_periods = $periods;
$current_xlh_periods_num = $this_xlh_periods_num;
// 生成缓存键
$available_cache_key = 'blindbox_available_gifts_' . $gift_bag_id . '_' . $room_id;
$last_remaining_cache_key = 'blindbox_last_remaining_' . $gift_bag_id . '_' . $room_id;
// 获取所有可用礼物用于预计算
$available_gifts = $this->get_available_gifts_for_precompute($gift_bag_id, $room_id, $current_draw_times);
if (empty($available_gifts)) {
return ['code' => 0, 'msg' => '当前盲盒无可用礼物', 'data' => null];
}
$should_reset_all_gifts = false; // 标记是否需要重置所有礼物
//如果本期奖池数量小于抽奖次数,则重置奖池,并把上期剩余数量加到本期奖池中
//接收礼物人数
$receive_num = count($toarray);
//需要的礼物数量
$need_gift_num = $receive_num * $num;
$last_periods_remaining = [];
if ($total_remaining - $need_gift_num <= 0 ) {
//上期剩余礼物
$last_periods_remaining = $available_gifts;
//加入缓存
cache($last_remaining_cache_key, $last_periods_remaining);
// 重置奖池
$current_periods++;
$this->reset_gift_pool($room_id, $gift_bag_id, $current_periods);
//补充上期剩余数量
foreach ($available_gifts as $gift_data) {
db::name("vs_room_pan")
->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id,'gift_bag_detail_id'=>$gift_data['id']])
->setInc('remaining_number', $gift_data['remaining_number']);
}
// 重新获取可用礼物
$current_draw_times = 0;
$available_gifts = $this->get_available_gifts_for_precompute($gift_bag_id, $room_id, $current_draw_times);
$should_reset_all_gifts = false; // 重置标记
}
//加入缓存
cache($available_cache_key, $available_gifts);
// 预计算所有抽奖结果
foreach ($toarray as $gift_user_id) {
if($user_id == $gift_user_id){
return ['code' => 0, 'msg' => "收礼人不能包含自己", 'data' => null];
}
for($i = 0; $i < $num; $i++){
// 使用加权随机算法预计算单次抽奖结果
//从缓存中取出可用礼物
if(cache($available_cache_key)){
$available_gifts = cache($available_cache_key);
}
if(cache($last_remaining_cache_key)){
$last_periods_remaining = cache($last_remaining_cache_key);
}
$draw_result = $this->precompute_single_draw($gift_bag_id,$room_id,$available_gifts,$last_periods_remaining);
if (!$draw_result) {
return ['code' => 0, 'msg' => '预计算抽奖失败', 'data' => null];
}
$precomputed_results[] = [
'gift_user_id' => $gift_user_id,
'gift_bag_detail' => $draw_result['gift_bag_detail'],
'gift' => $draw_result['gift'],
'draw_times' => $current_draw_times,
'periods' => $current_periods
];
$current_draw_times++;
// 判断巡乐会飘屏判断
$current_xlh_periods_num++;
if(!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $gift_bag_id && $current_xlh_periods_num == $xlh_ext['open_condition']['waiting_start_num']){
$xlh_is_piao_ping = 1;
}
if(!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $gift_bag_id && $current_xlh_periods_num == $xlh_ext['open_condition']['start_num']){
$xlh_is_piao_ping = 2;
}
// 更新可用礼物数量(模拟数据库更新)
$total_remaining_after_update = 0;
foreach ($available_gifts as &$gift) {
if ($gift['id'] == $draw_result['gift_bag_detail']['id']) {
$gift['remaining_number']--;
}
// 计算更新后的总剩余数量
$total_remaining_after_update += $gift['remaining_number'];
}
// 检查是否需要重置所有礼物
if ($total_remaining_after_update <= 0) {
$should_reset_all_gifts = true;
$current_periods++; // 增加期数
}
}
}
// 清除相关缓存
cache($available_cache_key, null);
cache($last_remaining_cache_key, null);
// 开始数据库事务处理
db::startTrans();
try{
// 盲盒转盘抽奖记录
$box_turntable_log = db::name('vs_blind_box_turntable_log')->insertGetId([
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'num' => $num,
'room_id' => $room_id,
'bag_price' => $bag_gift['gift_price'],
'createtime' => time()
]);
if (!$box_turntable_log) {
db::rollback();
return ['code' => 0, 'msg' => '添加盲盒转盘记录失败', 'data' => null];
}
// 处理预计算的抽奖结果
$result_draw_gift = [];
$gift_counts = []; // 统计每个礼物的数量
$gift_user_counts = []; // 统计每个用户每个礼物的数量
foreach ($precomputed_results as $result) {
$gift_user_id = $result['gift_user_id'];
$gift_bag_detail = $result['gift_bag_detail'];
$gift = $result['gift'];
$pan_data = db::name("vs_room_pan")
->where(['room_id'=>$room_id,'gift_bag_detail_id'=>$gift_bag_detail['id']])->value("remaining_number");
if($pan_data < 1){
db::rollback();
return ['code' => 0, 'msg' => '礼物数量不足', 'data' => null];
}
// 构造返回数据
$result_data = [
'user_id' => $user_id,
'gift_user_id' => $gift_user_id,
'gift_id' => $gift_bag_detail['foreign_id'],
'gift_price' => $gift['gift_price'],
'is_public_screen' => $gift['is_public_screen'],
'periods' => $result['periods'],
];
$result_draw_gift[] = $result_data;
// 统计礼物数量
$gift_id = $gift_bag_detail['foreign_id'];
if (!isset($gift_counts[$gift_id])) {
$gift_counts[$gift_id] = [
'gift_id' => $gift_id,
'count' => 0,
'gift_price' => $gift['gift_price']
];
}
$gift_counts[$gift_id]['count']++;
// 统计用户礼物数量
$user_gift_key = $gift_user_id . '_' . $gift_id;
if (!isset($gift_user_counts[$user_gift_key])) {
$gift_user_counts[$user_gift_key] = [
'gift_user_id' => $gift_user_id,
'gift_id' => $gift_id,
'count' => 0,
'gift_price' => $gift['gift_price']
];
}
$gift_user_counts[$user_gift_key]['count']++;
// 处理礼包发放记录表
$data = [];
$data['user_id'] = $user_id;
$data['gift_user_id'] = $gift_user_id;
$data['parent_id'] = $box_turntable_log;
$data['gift_bag_id'] = $gift_bag_id;
$data['gift_id'] = $gift_bag_detail['foreign_id'];
$data['periods'] = $result['periods'];
$data['room_id'] = $room_id;
$data['gift_price'] = $gift['gift_price'];
$data['bag_price'] = $bag_gift['gift_price'];
$data['createtime'] = time();
$insert_result = db::name("vs_gift_bag_receive_log")->insert($data);
if(!$insert_result){
db::rollback();
return ['code' => 0, 'msg' => '插入礼包发放记录失败', 'data' => []];
}
// 减去盲盒包礼物数量
$ret = db::name("vs_room_pan")
->where(['room_id'=>$room_id,'gift_bag_detail_id'=>$gift_bag_detail['id'],"remaining_number"=>["<>",0]])
->setDec('remaining_number',1);
if(!$ret){
db::rollback();
return ['code' => 0, 'msg' => '更新礼物剩余数量失败', 'data' => []];
}
}
// 扣除抽奖消耗的金币
// 扣除用户金币并记录日志
$wallet_update = model('GiveGift')->change_user_cion_or_earnings_log($user_id,$bag_gift_price,$room_id,1,10,'盲盒转盘抽奖消耗');
if(!$wallet_update){
Db::rollback();
return ['code' => 0, 'msg' => '扣除用户金币失败', 'data' => null];
}
// 用户财富等级更新
$user_level = model('Level')->user_level_data_update($user_id,$bag_gift_price,1,$room_id);
if(!$user_level){
Db::rollback();
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
}
db::commit();
} catch(\Exception $e) {
db::rollback();
return V(0,$e->getMessage());
}
// 批量插入盲盒转盘结果记录
foreach ($gift_user_counts as $user_gift) {
$ret = db::name('vs_blind_box_turntable_results_log')->insert([
'tid' => $box_turntable_log,
'gift_user_id' => $user_gift['gift_user_id'],
'gift_id' => $user_gift['gift_id'],
'count' => $user_gift['count'],
'gift_price' => $user_gift['gift_price'],
'all_gift_price' => $user_gift['gift_price'] * $user_gift['count'],
'createtime' => time(),
'heart_id' => $heart_id
]);
if (!$ret) {
return ['code' => 0, 'msg' => '添加盲盒转盘结果记录失败', 'data' => null];
}
//给接收礼物的人送礼物
$give_gift_ext['gift_id'] = $user_gift['gift_id'];
$give_gift_ext['count'] = $user_gift['count'];
$give_gift_ext['gift_price'] = $user_gift['gift_price'];
$give_gift_ext['all_gift_price'] = $user_gift['gift_price'] * $user_gift['count'];
$give_gift_ext['is_draw_gift'] = 1;
$res = model('Room')->room_gift($user_id, $user_gift['gift_user_id'], $user_gift['gift_id'], $user_gift['count'], 1, $room_id, 0,$heart_id,$give_gift_ext);
if (isset($res) && $res['code'] != 1) {
db::rollback();
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
}
}
// 巡乐会
$xlh = [];
if(!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $gift_bag_id){
// 巡乐会飘屏
db::name("vs_room")->where('id',$room_id)->update([
'xlh_periods_num' => $current_xlh_periods_num
]);//加巡乐会条件次数
if($xlh_is_piao_ping == 1){
// 即将开始推送飘屏
$text = $room['room_name']."的巡乐会即将开始,请大家尽快参与哦!";
// 推送礼物横幅
$push = new Push(UID, $room_id);
$text_list_new = [
'text' => $text,
'room_id' => $room_id,
'from_type' => 1
];
$push->xunlehui($text_list_new);
}
if($xlh_is_piao_ping == 2){
// 正式开始推送飘屏
$text = $room['room_name']."的巡乐会正式开始,请大家尽快参与哦!";
// 推送礼物横幅
$push = new Push(UID, $room_id);
$text_list_new = [
'text' => $text,
'room_id' => $room_id,
'from_type' => 2
];
$push->xunlehui($text_list_new);
// 巡乐会正式开始
$this_xlh_periods = db::name('vs_room')->where('id',$room_id)->value('xlh_periods');
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
'room_id' => $room_id,
'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
'homeowner_gift_id' => $xlh_ext['locking_condition']['give_homeowner_gift_id'],
'periods' => $this_xlh_periods+1,
'num' => 0,
'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60,
'createtime' => time()
]);
if(!$pan_xlh_id){
return ['code' => 0, 'msg' => '创建巡乐会失败!', 'data' => []];
}
db::name("vs_room")->where('id',$room_id)->setInc('xlh_periods');//修改巡乐会期数
}
$xlh['waiting_start_num'] = $xlh_ext['open_condition']['waiting_start_num'];//等待开奖次数
$xlh['start_num'] = $xlh_ext['open_condition']['start_num'];//开始开奖次数
// 当前抽奖次数
$xlh['current_num'] = $current_xlh_periods_num;
// 状态
if($xlh['current_num'] >= $xlh_ext['open_condition']['start_num']){
$xlh['status'] = 1;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始
} elseif($xlh['current_num'] >= $xlh_ext['open_condition']['waiting_start_num'] && $xlh['current_num'] < $xlh_ext['open_condition']['start_num']){
$xlh['status'] = 2;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始
}else{
$xlh['status'] = 0;
}
// 推送
$text = [
'xlh_data' => $xlh,
'text' => ""
];
// 聊天室推送系统消息
model('Chat')->sendMsg(1056,$room_id,$text);
}
// 整理返回结果
$result_list = [];
foreach ($gift_counts as $gift) {
$result_list[] = [
'gift_id' => $gift['gift_id'],
'count' => $gift['count']
];
}
$reslut = [];
$reslut['blind_box_turntable_id'] = $box_turntable_log;
$reslut['reslut_list'] = $result_list;
return V(1,"成功", $reslut);
}
/**
* 重置奖池
* @param int $room_id 房间ID
* @param int $gift_bag_id 礼物包ID
* @param int $periods 期数
*/
private function reset_gift_pool($room_id, $gift_bag_id, $periods) {
// 重置奖池中所有礼物数量
db::name("vs_room_pan")
->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])
->update([
'remaining_number' => db::raw('(SELECT quantity FROM fa_vs_gift_bag_detail WHERE id = fa_vs_room_pan.gift_bag_detail_id)'),
'periods' => $periods
]);
// 更新总期数
db::name("vs_gift_bag")
->where('id', $gift_bag_id)
->setInc('periods');
}
/*
* 获取可用礼物用于预计算
*/
private function get_available_gifts_for_precompute($gift_bag_id, $room_id, $total_draw_times) {
$where = [
'a.gift_bag_id' => $gift_bag_id,
'a.quantity' => ['>',0],
'b.remaining_number' => ['>',0],
'b.room_id' => $room_id,
'a.weight' => ['<=', $total_draw_times],
];
return db::name("vs_gift_bag_detail")
->field('a.id,a.quantity,b.remaining_number,a.weight,a.foreign_id')
->alias('a')
->join('vs_room_pan b','b.gift_bag_detail_id = a.id','left')
->where($where)
->select();
}
/*
* 预计算单次抽奖结果
*/
private function precompute_single_draw($gift_bag_id, $room_id, $available_gifts, $last_periods_remaining = []) {
// 生成缓存键
$available_cache_key = 'blindbox_available_gifts_' . $gift_bag_id . '_' . $room_id;
$last_remaining_cache_key = 'blindbox_last_remaining_' . $gift_bag_id . '_' . $room_id;
// 保证有可用礼物
if (empty($available_gifts)) {
return false;
}
$last_remaining_all = array_sum(array_column($last_periods_remaining, 'remaining_number'));
if ($last_remaining_all == 0) {
$last_periods_remaining = [];
cache($last_remaining_cache_key, null);
}
$last_periods_remaining_flag = 0;
if (!empty($last_periods_remaining)) {
$available_gifts = $last_periods_remaining;
$last_periods_remaining_flag = 1;
}
// 循环尝试直到抽中有效礼物
$max_attempts = 5; // 最大尝试次数,防止无限循环
$attempt = 0;
$selected_gift = null;
while ($attempt < $max_attempts && !$selected_gift) {
// 实现加权随机算法:剩余数量越多,被抽中的概率越大
$remaining = 0;
foreach ($available_gifts as $gift) {
$remaining += $gift['remaining_number'];
}
if ($remaining <= 0) {
break; // 如果没有剩余数量,跳出循环
}
$rand_value = mt_rand(1, $remaining);
$current_sum = 0;
foreach ($available_gifts as $gift) {
if ($gift['remaining_number'] <= 0) {
continue;
}
$current_sum += $gift['remaining_number'];
if ($rand_value <= $current_sum) {
$selected_gift = $gift;
break;
}
}
$attempt++;
}
if (!$selected_gift) {
return false;
}
// 获取开出礼物的信息
$gift = db::name("vs_gift")
->where(['gid' => $selected_gift['foreign_id']])
->find();
if (!$gift) {
return false;
}
// 操作缓存,减去缓存中对应数据数量
foreach ($available_gifts as &$available_gifts_gift) {
if ($selected_gift['id'] == $available_gifts_gift['id']) {
$available_gifts_gift['remaining_number'] -= 1;
}
}
if ($available_gifts_gift['remaining_number'] == 0) {
unset($available_gifts_gift);
}
if ($last_periods_remaining_flag == 1) {
// 操作上一轮奖池
cache($last_remaining_cache_key, $available_gifts);
} else {
cache($available_cache_key, $available_gifts);
}
return [
'gift_bag_detail' => $selected_gift,
'gift' => $gift
];
}
/* /*
* 礼物特效播放 * 礼物特效播放
*/ */
@@ -764,7 +210,6 @@ class BlindBoxTurntableGift extends Model
* 巡乐会 * 巡乐会
*/ */
public function xlh_gift_list($room_id){ public function xlh_gift_list($room_id){
$room_data = db::name('vs_room')->field('xlh_periods,xlh_periods_num')-> where('id',$room_id)->find();
$gift_bag_id = 13; $gift_bag_id = 13;
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find(); $xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
$xlh_ext = json_decode($xlh_box['ext'],true); $xlh_ext = json_decode($xlh_box['ext'],true);
@@ -781,15 +226,18 @@ class BlindBoxTurntableGift extends Model
$gift_list[$key]['gift_price'] = $gift_data['gift_price']; $gift_list[$key]['gift_price'] = $gift_data['gift_price'];
} }
} }
//房主信息
// $room_user = db::name('user')->where('id',$room_data['user_id'])->find();
//房主礼物 //房主礼物
$room_user_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['give_homeowner_gift_id'])->find(); $room_user_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['give_homeowner_gift_id'])->find();
//巡乐会主礼物 //巡乐会主礼物
$xlh_main_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['locking_gift_id'])->find(); $xlh_main_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['locking_gift_id'])->find();
//中奖用户 //中奖用户
$xlh_periods = $room_data['xlh_periods']??0; $pan_xlh = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['>',time()]])->order('id desc')->find();
$pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$xlh_periods,'send_time'=>0])->find(); $xlh_periods_num = Cache::get("xlh_periods_num") ?? 0;
if(empty($pan_xlh)){ if(empty($pan_xlh)){
if($room_data['xlh_periods_num'] >= $xlh_ext['open_condition']['start_num']){ if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){
$xlh_periods = Cache::get("this_xlh_periods") ?? 0;
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([ $pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
'room_id' => $room_id, 'room_id' => $room_id,
'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'], 'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
@@ -799,13 +247,14 @@ class BlindBoxTurntableGift extends Model
'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60, 'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60,
'createtime' => time() 'createtime' => time()
]); ]);
db::name("vs_room")->where('id',$room_id)->setInc('xlh_periods');//修改巡乐会期数 Cache::set("this_xlh_periods", $xlh_periods+1, 0);//修改巡乐会期数
$pan_xlh = db::name('vs_room_pan_xlh')->where(['id'=>$pan_xlh_id])->find(); $pan_xlh = db::name('vs_room_pan_xlh')->where(['id'=>$pan_xlh_id])->find();
}else{ }else{
return ['code' => 0, 'msg' => '未开始', 'data' => null]; return ['code' => 0, 'msg' => '巡乐会已结束', 'data' => null];
} }
} }
$xlh_user_data= null; $xlh_user_data= null;
$room_user_data = null;
if($pan_xlh && $pan_xlh['user_id']){ if($pan_xlh && $pan_xlh['user_id']){
$xlh_user = db::name('user')->where('id',$pan_xlh['user_id'])->find(); $xlh_user = db::name('user')->where('id',$pan_xlh['user_id'])->find();
$xlh_user_data = [ $xlh_user_data = [
@@ -813,6 +262,15 @@ class BlindBoxTurntableGift extends Model
'nickname' => $xlh_user['nickname'], 'nickname' => $xlh_user['nickname'],
'avatar' => $xlh_user['avatar'], 'avatar' => $xlh_user['avatar'],
]; ];
if($pan_xlh['room_id']){
$room_data = db::name('vs_room')->field('xlh_periods,xlh_periods_num,user_id')-> where('id',$pan_xlh['room_id'])->find();
$room_user = db::name('user')->where('id',$room_data['user_id'])->find();
$room_user_data = [
'user_id' => $room_user['id'],
'nickname' => $room_user['nickname'],
'avatar' => $room_user['avatar'],
];
}
} }
//$gift_list 按gift_price 升序排序 //$gift_list 按gift_price 升序排序
usort($gift_list, function($a, $b) { usort($gift_list, function($a, $b) {
@@ -827,8 +285,10 @@ class BlindBoxTurntableGift extends Model
'give_homeowner_gift' => [ 'give_homeowner_gift' => [
'gift_id' => $room_user_gift['gid'], 'gift_id' => $room_user_gift['gid'],
'gift_name' => $room_user_gift['gift_name'], 'gift_name' => $room_user_gift['gift_name'],
'gift_price' => $room_user_gift['gift_price'],
'base_image' => $room_user_gift['base_image'], 'base_image' => $room_user_gift['base_image'],
], ],
'homeowner_user' => $room_user_data,
'locking_gift' => [ 'locking_gift' => [
'gift_id' => $xlh_main_gift['gid'], 'gift_id' => $xlh_main_gift['gid'],
'gift_name' => $xlh_main_gift['gift_name'], 'gift_name' => $xlh_main_gift['gift_name'],
@@ -842,255 +302,6 @@ class BlindBoxTurntableGift extends Model
return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data]; return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data];
} }
/*
* 巡乐会抽奖
*/
public function xlh_draw_gift($user_id,$num,$room_id){
$gift_bag_id = 13;
//获取盲盒配置
$bag_data = db::name("vs_gift_bag")->field('id,name,ext,periods')->where('id',$gift_bag_id)->find();
$ext = json_decode($bag_data['ext'],true);
//判断是否有足够的金币
$bag_gift_price = $ext['xlh_box_price'] * $num;
$user_waller = db::name('user_wallet')->where(['user_id'=>$user_id])->find();
if ($user_waller['coin'] < $bag_gift_price) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
}
$room = db::name('vs_room')->where(['id'=>$room_id])->find();
if ($room['is_open_blind_box_turntable'] != 1) {
return ['code' => 0, 'msg' => '该房间未开启盲盒转盘', 'data' => null];
}
//开始抽奖
$pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$room['xlh_periods']])->find();
if(empty($pan_xlh)){
return ['code' => 0, 'msg' => '未开始', 'data' => null];
}
if($pan_xlh['end_time']<=time()){
return ['code' => 0, 'msg' => '本轮已结束', 'data' => null];
}
if($pan_xlh['send_time']!=0){
return ['code' => 0, 'msg' => '本轮已结束,礼物已发放', 'data' => null];
}
$is_zhong_jiang = 0;
$pan_xlh_num = $pan_xlh['num'];
//奖池总的抽奖次数
$total_quantity = db::name("vs_gift_bag_detail")->where(['gift_bag_id' => $gift_bag_id])->sum('quantity');
db::startTrans();
try{
//扣除抽奖消耗的金币
//扣除用户金币并记录日志
$wallet_update = model('GiveGift')->change_user_cion_or_earnings_log($user_id,$bag_gift_price,$room_id,1,10,'巡乐会抽奖消耗');
if(!$wallet_update){
Db::rollback();
return ['code' => 0, 'msg' => '扣除用户金币失败', 'data' => null];
}
//用户财富等级更新
$user_level = model('Level')->user_level_data_update($user_id,$bag_gift_price,1,$room_id);
if(!$user_level){
Db::rollback();
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
}
//开始抽奖
for($i = 0; $i < $num; $i++){
//本期当前第多少次后抽奖 总的抽奖次数- 剩余数量
$room_pan = db::name("vs_room_pan")->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])->field('remaining_number,periods')->find();
if(empty($room_pan)){
return ['code' => 0, 'msg' => '当前房间未配置抽奖礼物,请联系管理员', 'data' => []];
}
$total_remaining = db::name("vs_room_pan")->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])->sum('remaining_number');
$total_draw_times = $total_quantity - $total_remaining;
//随机获取一个礼物
$where = [
'a.gift_bag_id' => $gift_bag_id,
'b.room_id' => $room_id,
'a.quantity' => ['>',0],
'b.remaining_number' => ['>',0],
'a.weight' => ['<=', $total_draw_times],
];
// 使用闭包条件来处理复杂的 weight 逻辑
// $where['a.weight'] = ['exp', Db::raw('= 0 OR a.weight < '.$total_draw_times)];
// 优化:基于剩余数量的加权随机选择
$gift_bag_details = db::name("vs_gift_bag_detail")
->field('a.id,a.quantity,b.remaining_number,a.weight,a.foreign_id')
->alias('a')
->join('vs_room_pan b','b.gift_bag_detail_id = a.id','left')
->where($where)
->select();
if (empty($gift_bag_details)) {
return ['code' => 0, 'msg' => '当前盲盒无可用礼物', 'data' => []];
}
// 实现加权随机算法:剩余数量越多,被抽中的概率越大
$remaining = 0;
foreach ($gift_bag_details as $gift) {
$remaining += $gift['remaining_number'];
}
$rand_value = mt_rand(1, $remaining);
$current_sum = 0;
$gift_bag_detail = null;
foreach ($gift_bag_details as $gift) {
if($gift['remaining_number'] <= 0){
continue;
}
$current_sum += $gift['remaining_number'];
if ($rand_value <= $current_sum) {
$gift_bag_detail = $gift;
break;
}
}
if($gift_bag_detail){
//获取开出礼物的信息
$gift = db::name("vs_gift")->where(['gid'=>$gift_bag_detail['foreign_id']])->find();
//抽中礼物落包
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$gift_bag_detail['foreign_id'],1,model('UserGiftPack')::XLH_DRAW_GIFT_GET,$bag_data['name']."抽奖所得");
if ($res['code'] != 1) {
db::rollback();
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
}
//处理抽中礼物命中主奖品逻辑
if($gift_bag_detail['foreign_id'] == $ext['locking_condition']['selected_gift_id']){
//中奖
$pan_xlh_num = $pan_xlh_num+1;
$cache_key = 'selected_gift_id_'.$room_id.$gift_bag_detail['foreign_id'];
if($pan_xlh_num <= 1){
$add_end_time = $ext['locking_time']['tow_no_locking_time'] * 60;
Cache::set($cache_key,$add_end_time,$add_end_time);
}else{
// $add_end_time = ($ext['locking_time']['tow_no_locking_time']-$ext['locking_time']['next_time']) * 60;
if(Cache::get($cache_key)){
$erci_xlh_num = Cache::get($cache_key);
$add_end_time = ($erci_xlh_num-$ext['locking_time']['next_time'] *60);
Cache::set($cache_key,$add_end_time,$add_end_time);
}else{
$add_end_time = ($ext['locking_time']['tow_no_locking_time']-$ext['locking_time']['next_time']) * 60;
}
}
if($add_end_time <= 30){
Cache::set($cache_key,30,30);
$add_end_time = 30;
}
$end_time = time() + $add_end_time;
db::name('vs_room_pan_xlh')->where('id',$pan_xlh['id'])->update([
'user_id' => $user_id,
'pay_price' =>$ext['xlh_box_price'],
'locking_gift_id' =>$gift_bag_detail['foreign_id'],
'num' => $pan_xlh_num,
'end_time' => $end_time,
'updatetime' => time()
]);
db::name('vs_room_pan_xlh_log')->insertGetId([
'xlh_id' => $pan_xlh['id'],
'user_id' => $user_id,
'num' => $pan_xlh_num,
'locking_end_time' => $end_time,
'createtime' => time()
]);
$is_zhong_jiang = 1;
}
//减去盲盒包礼物数量
$ret = db::name("vs_room_pan")->where(['room_id'=>$room_id,'gift_bag_detail_id'=>$gift_bag_detail['id']])->setDec('remaining_number',1);
if(!$ret){
db::rollback();
return ['code' => 0, 'msg' => '失败.', 'data' => []];
}
//判断剩余数量是否为0 为0重置进入下一期
$gift_bag_num = db::name("vs_room_pan")->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])->sum('remaining_number');
if($gift_bag_num <= 0){
db::name("vs_room_pan")->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])->setInc('periods');
db::name("vs_room_pan")->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])->update(
['remaining_number' => db::raw('(SELECT quantity FROM fa_vs_gift_bag_detail WHERE id = fa_vs_room_pan.gift_bag_detail_id)')]);
}
}else{
db::rollback();
return ['code' => 0, 'msg' => '失败!', 'data' => []];
}
$result_data[] = [
'user_id' => $user_id,
'gift_id'=>$gift_bag_detail['foreign_id'],
'gift_price'=>$gift['gift_price'],
'gift_name'=>$gift['gift_name'],
'base_image'=>$gift['base_image'],
];
}
$reslut_data = [];
foreach ($result_data as $key => $value) {
$gift_id = $value['gift_id'];
if (!isset($reslut_data[$gift_id])) {
$reslut_data[$gift_id] = [
'gift_id' => $gift_id,
'gift_price'=>$value['gift_price'],
'gift_name'=>$value['gift_name'],
'base_image'=>$value['base_image'],
'count' => 1
];
}else {
$reslut_data[$gift_id]['count']++;
}
}
$result_list = [];
foreach ($reslut_data as $key => $value) {
//处理礼包发放记录表
$data = [];
$data['user_id'] = $user_id;
$data['parent_id'] = $pan_xlh['id'];
$data['gift_bag_id'] = $gift_bag_id;
$data['gift_id'] = $value['gift_id'];
$data['periods'] = $room_pan['periods'];
$data['room_id'] = $room_id;
$data['num'] = $value['count'];
$data['gift_price'] = $value['gift_price'];
$data['bag_price'] = $ext['xlh_box_price'];
$data['createtime'] = time();
$result = db::name("vs_gift_bag_receive_log")->insert($data);
if(!$result){
db::rollback();
return ['code' => 0, 'msg' => '失败,', 'data' => []];
}
$result_list[]=[
'gift_id'=>$value['gift_id'],
'gift_name'=>$value['gift_name'],
'base_image' =>$value['base_image'],
'gift_price'=>$value['gift_price'],
'count'=>$value['count'],
];
}
// 添加活动记录
$reslut = Db::name('vs_activities_receive')->insert([
'user_id' => $user_id,
'activities_id' => 6,
'room_id' => $room_id,
'createtime' => time(),
'updatetime' => time()
]);
db::commit();
} catch(\Exception $e) {
db::rollback();
return V(0,$e->getMessage());
}
if($is_zhong_jiang == 1){
//推送
$FromUserInfo = db::name('user')->field('nickname,avatar')->where(['id'=>$user_id])->find();
$room_name = db::name('vs_room')->where(['id'=>$room_id])->value('room_name');
$gift_name = db::name('vs_gift')->where(['gid'=>$value['gift_id']])->value('gift_name');
$text = $FromUserInfo['nickname'] . ' 用户在 ' . $room_name.' 房间巡乐会中 ' .$gift_name.'礼物 x ' .$value['count']." 已收入背包";
$text = [
'gift_num' => $pan_xlh_num,
'FromUserInfo' => $FromUserInfo,
'end_time' => $end_time,
'text' => $text
];
//聊天室推送系统消息
model('Chat')->sendMsg(1057,$room_id,$text);
}
//返回结果排序
usort($result_list, function($a, $b) {
return $b['gift_price'] <=> $a['gift_price'];
});
return ['code' => 1, 'msg' => '成功', 'data' => $result_list];
}
/* /*
* 巡乐会抽奖记录 * 巡乐会抽奖记录
*/ */
@@ -1098,8 +309,7 @@ class BlindBoxTurntableGift extends Model
$where = []; $where = [];
$where['a.gift_bag_id'] = 13; $where['a.gift_bag_id'] = 13;
$where['a.user_id'] = $user_id; $where['a.user_id'] = $user_id;
$where['a.room_id'] = $room_id; $list = db('vs_gift_bag_receive_pan_log')
$list = db('vs_gift_bag_receive_log')
->alias('a') ->alias('a')
->join('vs_room_pan_xlh b','b.id = a.parent_id','left') ->join('vs_room_pan_xlh b','b.id = a.parent_id','left')
->join('vs_gift c','c.gid = a.gift_id','left') ->join('vs_gift c','c.gid = a.gift_id','left')
@@ -1120,9 +330,8 @@ class BlindBoxTurntableGift extends Model
public function xlh_ranking($room_id,$page=1,$page_size=12){ public function xlh_ranking($room_id,$page=1,$page_size=12){
$where = []; $where = [];
$where['a.gift_bag_id'] = 13; $where['a.gift_bag_id'] = 13;
$where['a.room_id'] = $room_id;
$where['e.is_world_show'] = 1; $where['e.is_world_show'] = 1;
$list = db('vs_gift_bag_receive_log') $list = db('vs_gift_bag_receive_pan_log')
->alias('a') ->alias('a')
->join('vs_room_pan_xlh b','b.id = a.parent_id','left') ->join('vs_room_pan_xlh b','b.id = a.parent_id','left')
->join('vs_gift c','c.gid = a.gift_id','left') ->join('vs_gift c','c.gid = a.gift_id','left')
@@ -1146,20 +355,14 @@ class BlindBoxTurntableGift extends Model
$gift_bag_id = 13; $gift_bag_id = 13;
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find(); $xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
$xlh_ext = json_decode($xlh_box['ext'],true); $xlh_ext = json_decode($xlh_box['ext'],true);
$room_data = db('vs_room') $xlh_data = db('vs_room_pan_xlh')->where(["send_time"=>0,"end_time"=>[">",time()]])->field('id,room_id,periods,end_time')->order('periods desc')->find();
->where(['id'=>$room_id])
->field('id,room_name,xlh_periods,xlh_periods_num')
->find();
$xlh_data = db('vs_room_pan_xlh')
->where(["room_id"=>$room_id,"periods"=>$room_data['xlh_periods']])
->field('id,room_id,periods,end_time')
->find();
//寻乐会状态 //寻乐会状态
$xlh_status = 0; $xlh_status = 0;
// 状态 // 状态
if($room_data['xlh_periods_num'] >= $xlh_ext['open_condition']['start_num']){ $xlh_periods_num = Cache::get("xlh_periods_num") ?? 0;
if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){
$xlh_status = 1;//状态 1:巡乐会开始 2:即将开始 0:等待开始 $xlh_status = 1;//状态 1:巡乐会开始 2:即将开始 0:等待开始
} elseif($room_data['xlh_periods_num'] >= $xlh_ext['open_condition']['waiting_start_num'] && $room_data['xlh_periods_num'] < $xlh_ext['open_condition']['start_num']){ } elseif($xlh_periods_num >= $xlh_ext['open_condition']['waiting_start_num'] && $xlh_periods_num < $xlh_ext['open_condition']['start_num']){
$xlh_status = 2;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始 $xlh_status = 2;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始
}else{ }else{
$xlh_status = 0;//未开始 $xlh_status = 0;//未开始
@@ -1171,4 +374,43 @@ class BlindBoxTurntableGift extends Model
'end_time'=>$xlh_data['end_time'] ?? 0, 'end_time'=>$xlh_data['end_time'] ?? 0,
]; ];
} }
/*
* 巡乐会榜单
*
*/
public function xlh_ranking_list($room_id,$page=1,$page_size=12){
$gift_bag_id = 13;
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
$xlh_ext = json_decode($xlh_box['ext'],true);
$pan_xlh = db::name('vs_room_pan_xlh')
->order('id desc')
->page($page,$page_size)
->select();
$list = [];
foreach ($pan_xlh as $key=>$value){
$list[$key]['periods'] = "".$value['periods']."";
if(!empty($value['user_id'])){
$list[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
}else{
$list[$key]['nickname'] = "";
}
if(!empty($value['gift_id'])){
$gift_data = db::name('vs_gift')->field('gift_name,base_image')->where(['gid'=>$value['gift_id']])->find();
$list[$key]['gift_name'] = 'x '.$value['num'].' '.$gift_data['gift_name'];
$list[$key]['base_image'] = $gift_data['base_image']??"";
}else{
$gift_data = db::name('vs_gift')->field('gift_name,base_image')->where(['gid'=>$xlh_ext['locking_condition']['locking_gift_id']])->find();
$list[$key]['gift_name'] = 'x 0 '.$gift_data['gift_name'];
$list[$key]['base_image'] = $gift_data['base_image']??"";
}
$list[$key]['createtime'] = $value['send_time'] ? date('Y-m-d H:i:s',$value['send_time']) : '' ;
}
return [
'code' => 1,
'msg' => '成功',
'data' => $list
];
}
} }

View File

@@ -7,16 +7,34 @@ use think\Log;
use think\Model; use think\Model;
use think\Db; use think\Db;
use think\Session; use think\Session;
use Redis;
/* /*
* 盲盒转盘优化后方法 * 盲盒转盘优化后方法
* *
*/ */
class BlindBoxTurntableGiftDraw extends Model class BlindBoxTurntableGiftDraw extends Model
{ {
private $redis;
public function __construct()
{
parent::__construct();
try {
$this->redis = new Redis();
// 连接到Redis服务器
$this->redis->connect(config('redis.host'), config('redis.port')); // 根据实际配置调整主机和端口
// 选择数据库1
$this->redis->select(1);
} catch (\Exception $e) {
Log::record('Redis连接失败: ' . $e->getMessage(), 'error');
$this->redis = null;
}
}
/** /**
* 重构后的抽奖方法 - 优化响应速度 * 重构后的抽奖方法 - 优化响应速度
*/ */
public function draw_gift($gift_bag_id, $user_id, $gift_user_ids, $num = 1, $room_id = 0, $heart_id = 0) public function draw_gift($gift_bag_id, $user_id, $gift_user_ids, $num = 1, $room_id = 0, $heart_id = 0, $auction_id = 0)
{ {
try { try {
// 1. 验证参数并提前处理错误 // 1. 验证参数并提前处理错误
@@ -26,7 +44,7 @@ class BlindBoxTurntableGiftDraw extends Model
} }
// 2. 预加载必要数据 // 2. 预加载必要数据
$loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id); $loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids);
if ($loadResult['code'] !== 1) { if ($loadResult['code'] !== 1) {
return $loadResult; return $loadResult;
} }
@@ -47,7 +65,12 @@ class BlindBoxTurntableGiftDraw extends Model
$availableGiftss = $precomputeResult['data']['availableGifts']; $availableGiftss = $precomputeResult['data']['availableGifts'];
$currentXlhPeriodsNum = $precomputeResult['data']['current_xlh_periods_num']; $currentXlhPeriodsNum = $precomputeResult['data']['current_xlh_periods_num'];
$xlhIsPiaoPing = $precomputeResult['data']['xlh_is_piao_ping']; $xlhIsPiaoPing = $precomputeResult['data']['xlh_is_piao_ping'];
$expectedCount = count(explode(',', $gift_user_ids)) * $num;
if(count($precomputedResults) != $expectedCount){
// 记录错误到Redis
$this->recordDrawErrorToRedis($expectedCount, count($precomputedResults), $room_id, $user_id, $gift_bag_id, $num, $gift_user_ids, $precomputedResults);
return ['code' => 0, 'msg' => '网络加载失败,请重试!', 'data' => null];
}
// 4. 执行抽奖事务(核心操作) // 4. 执行抽奖事务(核心操作)
$transactionResult = $this->executeDrawTransaction( $transactionResult = $this->executeDrawTransaction(
$bag_data, $bag_data,
@@ -55,7 +78,10 @@ class BlindBoxTurntableGiftDraw extends Model
$room_id, $room_id,
$num, $num,
$precomputedResults, $precomputedResults,
$availableGiftss $availableGiftss,
$gift_user_ids,
$heart_id,
$auction_id
); );
if ($transactionResult['code'] !== 1) { if ($transactionResult['code'] !== 1) {
return $transactionResult; return $transactionResult;
@@ -79,7 +105,9 @@ class BlindBoxTurntableGiftDraw extends Model
return $this->buildDrawResult($boxTurntableLog, $giftCounts); return $this->buildDrawResult($boxTurntableLog, $giftCounts);
} catch (\Exception $e) { } catch (\Exception $e) {
return ['code' => 0, 'msg' => "网络请求错误,请重试!", 'data' => null]; $key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
$this->redis->setex($key, 86400 * 7, $e->getMessage());
return ['code' => 0, 'msg' => "网络加载失败,请重试!", 'data' => null];
} }
} }
@@ -114,7 +142,7 @@ class BlindBoxTurntableGiftDraw extends Model
/** /**
* 预加载必要数据 * 预加载必要数据
*/ */
private function loadDrawData($gift_bag_id, $user_id, $room_id) private function loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids)
{ {
// 1. 合并查询盲盒配置和礼物信息 // 1. 合并查询盲盒配置和礼物信息
$bag_data = db::name("vs_gift_bag") $bag_data = db::name("vs_gift_bag")
@@ -150,7 +178,9 @@ class BlindBoxTurntableGiftDraw extends Model
if (!$user_waller) { if (!$user_waller) {
return ['code' => 0, 'msg' => '用户钱包不存在', 'data' => null]; return ['code' => 0, 'msg' => '用户钱包不存在', 'data' => null];
} }
if ($user_waller['coin'] < $bag_data['gift_price'] * $num * count(explode(',', $gift_user_ids))) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
}
// 4. 获取巡乐会配置(使用缓存) // 4. 获取巡乐会配置(使用缓存)
$xlh_ext = $this->getCachedXlhConfig(); $xlh_ext = $this->getCachedXlhConfig();
@@ -191,7 +221,7 @@ class BlindBoxTurntableGiftDraw extends Model
if (empty($availableGifts)) { if (empty($availableGifts)) {
$availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0); $availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0);
if (empty($availableGifts)) { if (empty($availableGifts)) {
return ['code' => 0, 'msg' => '重置奖池后仍无可用礼物', 'data' => null]; throw new \Exception('重置奖池后仍无可用礼物');
} }
} }
@@ -205,7 +235,7 @@ class BlindBoxTurntableGiftDraw extends Model
$remaining_available_gifts = $availableGifts; $remaining_available_gifts = $availableGifts;
$availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0); $availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0);
if (empty($availableGifts)) { if (empty($availableGifts)) {
return ['code' => 0, 'msg' => '重置奖池后仍无可用礼物', 'data' => null]; throw new \Exception('重置奖池后仍无可用礼物');
} }
$totalDrawTimes = 0; $totalDrawTimes = 0;
$num = abs($totalRemaining - $num); $num = abs($totalRemaining - $num);
@@ -226,7 +256,7 @@ class BlindBoxTurntableGiftDraw extends Model
$remaining_available_gifts $remaining_available_gifts
); );
if (empty($precomputedResults['precomputedResults'])) { if (empty($precomputedResults['precomputedResults'])) {
return ['code' => 0, 'msg' => '预计算抽奖结果失败', 'data' => null]; throw new \Exception('预计算抽奖结果失败');
} }
return [ return [
@@ -257,6 +287,15 @@ class BlindBoxTurntableGiftDraw extends Model
$roomId, $roomId,
$remaining_available_gifts $remaining_available_gifts
) { ) {
//计算$remaining_available_gifts 里面 remaining_number 的累加
$remaining_num = 0;
foreach ($remaining_available_gifts as $key=>$value) {
$remaining_num += $value['remaining_number'];
}
if($remaining_num > $num){
$availableGifts = $remaining_available_gifts;
$remaining_available_gifts = [];
}
$precomputedResults = []; $precomputedResults = [];
$precomputedResultss = []; $precomputedResultss = [];
$giftBagIdToGift = []; $giftBagIdToGift = [];
@@ -285,13 +324,10 @@ class BlindBoxTurntableGiftDraw extends Model
unset($remaining_available_gifts[$key]); unset($remaining_available_gifts[$key]);
} }
$numm = $num; $numm = $num;
// echo "好好玩";
}else{ }else{
$numm = $num+$remaining_num; $numm = $num+$remaining_num;
} }
// echo $numm."---";
for ($i = 0; $i < $numm; $i++) { for ($i = 0; $i < $numm; $i++) {
// echo "好好呀";
// 使用Alias Method选择礼物O(1)复杂度) // 使用Alias Method选择礼物O(1)复杂度)
$selectedGift = $this->selectGiftWithAliasMethod($aliasTable); $selectedGift = $this->selectGiftWithAliasMethod($aliasTable);
if (!$selectedGift) { if (!$selectedGift) {
@@ -340,7 +376,7 @@ class BlindBoxTurntableGiftDraw extends Model
} }
} }
return ['precomputedResults' => $precomputedResults,'precomputedResultss' => $precomputedResultss]; return ['precomputedResults' => $precomputedResults, 'precomputedResultss' => $precomputedResultss];
} }
/** /**
@@ -439,9 +475,10 @@ class BlindBoxTurntableGiftDraw extends Model
/** /**
* 执行抽奖事务(核心操作) * 执行抽奖事务(核心操作)
*/ */
private function executeDrawTransaction($bag_data, $user_id, $room_id, $num, $precomputedResults,$availableGiftss) private function executeDrawTransaction($bag_data, $user_id, $room_id, $num, $precomputedResults,$availableGiftss,$gift_user_ids,$heart_id,$auction_id)
{ {
$bagGiftPrice = $bag_data['gift_price'] * $num; $gift_user_num = count(explode(',', $gift_user_ids)); //人数
$bagGiftPrice = $bag_data['gift_price'] * $num * $gift_user_num;
db::startTrans(); db::startTrans();
try { try {
@@ -468,6 +505,12 @@ class BlindBoxTurntableGiftDraw extends Model
// 4. 扣除用户金币 // 4. 扣除用户金币
$this->deductUserCoins($user_id, $bagGiftPrice, $room_id); $this->deductUserCoins($user_id, $bagGiftPrice, $room_id);
//发送礼物
$result = $this->sendGiftsToRecipients($precomputedResults, $room_id,$user_id,$heart_id,$auction_id);
if (isset($result['code']) && $result['code'] !== 1) {
throw new \Exception($result['msg']);
}
db::commit(); db::commit();
// 5. 统计礼物数量 // 5. 统计礼物数量
@@ -511,7 +554,7 @@ class BlindBoxTurntableGiftDraw extends Model
if (!$ret) { if (!$ret) {
Log::record('巡乐会更新礼物剩余数量: ' . $room_id."【数据】".var_export($precomputedResults, true),"info"); Log::record('巡乐会更新礼物剩余数量: ' . $room_id."【数据】".var_export($precomputedResults, true),"info");
// throw new \Exception('更新礼物剩余数量失败'); throw new \Exception('更新礼物剩余数量失败');
} }
} }
} }
@@ -591,8 +634,8 @@ class BlindBoxTurntableGiftDraw extends Model
// 1. 批量插入盲盒转盘结果记录 // 1. 批量插入盲盒转盘结果记录
$this->batchInsertBlindBoxResults($precomputedResults, $boxTurntableLog, $room_id); $this->batchInsertBlindBoxResults($precomputedResults, $boxTurntableLog, $room_id);
// 2. 发送礼物给接收者 // 2. 发送礼物给接收者 (已前置)
$this->sendGiftsToRecipients($precomputedResults, $boxTurntableLog, $room_id,$user_id); // $this->sendGiftsToRecipients($precomputedResults, $room_id,$user_id);
// 3. 处理巡乐会相关操作 // 3. 处理巡乐会相关操作
if (!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $precomputedResults[0]['gift_bag_detail']['gift_bag_id']) { if (!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $precomputedResults[0]['gift_bag_detail']['gift_bag_id']) {
@@ -643,7 +686,7 @@ class BlindBoxTurntableGiftDraw extends Model
/** /**
* 发送礼物给接收者 * 发送礼物给接收者
*/ */
private function sendGiftsToRecipients($precomputedResults, $boxTurntableLog, $room_id,$user_id) private function sendGiftsToRecipients($precomputedResults, $room_id,$user_id,$heart_id,$auction_id)
{ {
// 统计每个用户每个礼物的数量 // 统计每个用户每个礼物的数量
$giftUserCounts = []; $giftUserCounts = [];
@@ -662,6 +705,9 @@ class BlindBoxTurntableGiftDraw extends Model
// 批量发送礼物 // 批量发送礼物
foreach ($giftUserCounts as $userGift) { foreach ($giftUserCounts as $userGift) {
if($userGift['count'] > 9){ //防止礼物超发礼物超10个则不发送
continue;
}
$giveGiftExt = [ $giveGiftExt = [
'gift_id' => $userGift['gift_id'], 'gift_id' => $userGift['gift_id'],
'count' => $userGift['count'], 'count' => $userGift['count'],
@@ -669,25 +715,28 @@ class BlindBoxTurntableGiftDraw extends Model
'all_gift_price' => $userGift['gift_price'] * $userGift['count'], 'all_gift_price' => $userGift['gift_price'] * $userGift['count'],
'is_draw_gift' => 1 'is_draw_gift' => 1
]; ];
if(!empty($auction_id)){
$res = model('Room')->room_gift( model('RoomAuction')->room_auction_join($auction_id,$user_id,$userGift['gift_id'],$userGift['count'],2,$giveGiftExt);
$user_id, }else{
$userGift['gift_user_id'], $res = model('Room')->room_gift(
$userGift['gift_id'], $user_id,
$userGift['count'], $userGift['gift_user_id'],
1, $userGift['gift_id'],
$room_id, $userGift['count'],
0, 1,
0, $room_id,
$giveGiftExt 0,
); $heart_id,
$giveGiftExt
);
}
if (isset($res) && $res['code'] != 1) { if (isset($res) && $res['code'] != 1) {
Log::record('发送礼物失败: ' . $res['msg'].$userGift['gift_user_id'],"info"); Log::record('发送礼物失败: ' . $res['msg'] . $userGift['gift_user_id'], "info");
return ['code' => 0, 'msg' => $res['msg'], 'data' => null]; return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
// \think\facade\Log::error('发送礼物失败: ' . $res['msg']);
} }
} }
return ['code' => 1, 'msg' => '发送礼物成功', 'data' => null];
} }
/** /**
@@ -1299,7 +1348,10 @@ class BlindBoxTurntableGiftDraw extends Model
// 7. 批量处理结果记录 // 7. 批量处理结果记录
try { try {
db::startTrans(); db::startTrans();
if(count($drawn_gifts) > $num){
Log::record('巡乐会抽奖失败-数量超限: ' . count($drawn_gifts),"infos");
return ['code' => 0, 'msg' => "抽奖中,请稍等...", 'data' => null];
}
// 批量插入礼包发放记录 // 批量插入礼包发放记录
$gift_records = []; $gift_records = [];
$periods = $room_pan_data[0]['periods'] ?? 0; $periods = $room_pan_data[0]['periods'] ?? 0;
@@ -1514,5 +1566,38 @@ class BlindBoxTurntableGiftDraw extends Model
return ['code' => 1, 'msg' => '成功', 'data' => $result_list]; return ['code' => 1, 'msg' => '成功', 'data' => $result_list];
} }
//错误日志记录-------------------------------------------------------
/**
* 记录抽奖错误日志到Redis
*/
private function recordDrawErrorToRedis($expectedCount, $actualCount, $room_id, $user_id, $gift_bag_id, $num, $gift_user_ids, $precomputedResults)
{
// 检查Redis连接是否可用
if (!$this->redis) {
Log::record('Redis连接不可用无法记录错误日志', 'error');
return;
}
try {
$errorData = [
'timestamp' => time(),
'expected_count' => $expectedCount,
'actual_count' => $actualCount,
'room_id' => $room_id,
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'num' => $num,
'gift_user_ids' => $gift_user_ids,
'precomputed_results_count' => count($precomputedResults),
'precomputed_results' => $precomputedResults,
'error_type' => 'draw_count_mismatch'
];
// 使用正确的Redis方法存储数据
$key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
$this->redis->setex($key, 86400 * 7, json_encode($errorData));
} catch (\Exception $e) {
Log::record('Redis操作失败: ' . $e->getMessage(), 'error');
}
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -119,6 +119,10 @@ class Chat extends Model
//清空个人魅力 //清空个人魅力
// ClearUserCharm = 1059, // ClearUserCharm = 1059,
//发红包
// RedPacket = 1060,
//红包领完推送
// RedPacketComplete = 1061,

View File

@@ -17,7 +17,7 @@ class Decorate extends Model
protected $updateTime = 'updatetime'; protected $updateTime = 'updatetime';
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号 // 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号']; public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号'];
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送']; protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼'];
public function __construct($data = []) public function __construct($data = [])
{ {
parent::__construct($data); parent::__construct($data);

View File

@@ -40,6 +40,10 @@ class GiveGift extends Model
*/ */
public function give_gift($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = []) public function give_gift($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
{ {
if(isset($ext['is_draw_gift']) && $ext['is_draw_gift'] == 1) {
$return_pan = $this->give_gift_to_pan($uid, $to_uid, $gid, $num, $from_type, $type, $from_id, $pit_number, $change_type, $ext);
return $return_pan;
}
//送的礼物信息 //送的礼物信息
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid]) $gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find(); ->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
@@ -262,11 +266,14 @@ class GiveGift extends Model
} }
//增加房主收益并记录日志 //增加房主收益并记录日志
$room_owner_earningss = $room_owner_earnings - $host_earnings; $room_owner_earningss = $room_owner_earnings - $host_earnings;
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益'); if($room_owner_earningss > 0){
if(!$room_owner_earning){ $room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益');
Db::rollback(); if(!$room_owner_earning){
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null]; Db::rollback();
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
}
} }
}else{ }else{
//增加房主收益并记录日志 //增加房主收益并记录日志
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益'); $room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
@@ -275,6 +282,13 @@ class GiveGift extends Model
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null]; return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
} }
} }
}else{
//增加房主收益并记录日志
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
if(!$room_owner_earning){
Db::rollback();
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
}
} }
} }
} }
@@ -303,7 +317,9 @@ class GiveGift extends Model
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益 //平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio; $app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
$app_earning = coin_earning($gv['gift_price'], $app_ratio); $app_earning = coin_earning($gv['gift_price'], $app_ratio);
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning); $receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
if (!$gift_rate) { if (!$gift_rate) {
Db::rollback(); Db::rollback();
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null]; return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
@@ -557,6 +573,308 @@ class GiveGift extends Model
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]]; return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
} }
/*
* 送礼物-盲盒转盘专用
* @param int $uid 用户id
* @param int $from_id 来源id
* @param str $to_uid 接收礼物用户id字符串逗号分隔
* @param int $gid 礼物id
* @param int $num 礼物数量
* @param int $from_type 来源 1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
* @param int $type 金币购买 1金币购买 2送背包礼物
* @param int $pit_number 坑位编号
* @return array
* 用户,在房间中,给谁,送了什么礼物,多少个,来源
*/
public function give_gift_to_pan($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
{
//送的礼物信息
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
if(empty($gift_info)){
return ['code' => 0, 'msg' => '礼物不存在', 'data' => null];
}
if(!$to_uid){
return ['code' => 0, 'msg' => '请选择收礼人', 'data' => null];
}
$toarray = explode(',',$to_uid);
if(in_array($uid,$toarray)){
return ['code' => 0, 'msg' => '收礼人不能包含自己', 'data' => null];
}
if (ceil($num) != $num) {
return ['code' => 0, 'msg' => '打赏礼物数量必须为整数', 'data' => null];
}
if ($num < 1) {
return ['code' => 0, 'msg' => '打赏礼物数量必须大于零', 'data' => null];
}
$user_info = Db::name('user')->where(['id'=>$uid,'status'=>1])->find();
if(empty($user_info)){
return ['code' => 301, 'msg' => '当前用户登录失效', 'data' => null];
}
//获取送礼用户昵称
$FromUserInfo = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($uid);//财富图标
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($uid);//魅力图标
//送给一人礼物的总价格(扣除用户的数额)
$gift_price = $gift_info['gift_price'] * $num;
$roomId = 0;
if($from_type == 2 || $from_type == 3 || $from_type == 6){
$roomId = $from_id;
}
//循环送礼
$gift_total = 0;
$give_gift = 0;
$gift_user_data = [];
foreach ($toarray as $k => $to_id){
$gift_user_data[]['user_id'] = $to_id;
$gift_box1 = [];
$gift_box = [];
$gift_total += $gift_price;
//收礼记录行为日志
$give_gift = $this -> change_user_give_gift_log($uid,$gid,$gift_price,$num,$to_id,$from_type,$type,$from_id,$pit_number);
if(!$give_gift){
return ['code' => 0, 'msg' => '送礼失败', 'data' => null];
}
$gift_user_data[$k]['gift_price'] = $gift_price;
//计算收礼人得益
$receiver_earnings = $this -> receiver_earnings($to_id,$gift_price,$from_type);
if($receiver_earnings <= 0){
return ['code' => 0, 'msg' => '收礼人收益配置有误', 'data' => null];
}
//1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
if($from_type == 1 || $from_type == 2 || $from_type == 3 ||$from_type == 4 || $from_type == 6){
//增加收益并记录日志
$receiver = $this -> change_user_cion_or_earnings_log($to_id,$receiver_earnings,$from_id,2,11,'收礼增加收益');
}elseif($from_type == 5){
//增加收益并记录日志
$receiver = $this -> change_user_cion_or_earnings_log($to_id,$receiver_earnings,$from_id,1,$change_type,'活动增加金币');
}else{
$receiver = false;
}
if(!$receiver){
return ['code' => 0, 'msg' => '收礼人收益失败', 'data' => null];
}
//用户魅力等级更新
$user_level = model('Level')->user_level_data_update($to_id,$gift_price,2,$roomId);
if(!$user_level){
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
}
$room_owner_earnings = 0;//房主收益
$room_owner_earningsg = 0;//公会会长收益
//是否在房间
if(isset($from_id) && ($from_type == 2 || $from_type == 6)){
if($from_type == 6){ //cp电影房
//房主有收益
if(get_system_config_value('room_cp_room_user_ratio') > 0){
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
//计算房主收益//room_author_ratio
$room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,699);
if($room_owner_earnings > 0){
//增加收益并记录日志
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
if(!$room_owner_earning){
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
}
}
}
//公会长收益
if(get_system_config_value('room_cp_guild_user_ratio') > 0){
$guild_id = Db::name('vs_guild_user')->where(['user_id'=>$to_uid,'status'=>1])->value('guild_id');
if($guild_id){
$room_guild = Db::name('vs_guild')->where(['id'=>$guild_id])->value('user_id');
//计算会长收益
$room_owner_earningsg = $this -> receiver_earnings($room_guild,$gift_price,698);
//增加收益并记录日志
$room_owner_earningg = $this -> change_user_cion_or_earnings_log($room_guild,$room_owner_earningsg,$from_id,2,21,'工会长收益');
if(!$room_owner_earningg){
return ['code' => 0, 'msg' => '工会长收益失败', 'data' => null];
}
}
}
}else{
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
//计算房主收益//room_author_ratio
$room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,99);//结果是钻石
if($room_owner_earnings > 0){
//主持人收益
//在主持位的主持人
$host_id = Db::name('vs_room_pit')->where(['room_id'=>$from_id,'pit_number'=>9])->value('user_id');
if($host_id){
//计算主持人收益
$host_earnings = $this -> receiver_earnings($host_id,$room_owner_earnings*get_system_config_value('rmb_coin_ratio'),98,$from_id);
if($host_earnings > 0){
//增加主持人收益并记录日志
$host_earnings_earning = $this -> change_user_cion_or_earnings_log($host_id,$host_earnings,$from_id,2,19,'主持人收益');
if(!$host_earnings_earning){
return ['code' => 0, 'msg' => '主持人收益失败', 'data' => null];
}
//增加房主收益并记录日志
$room_owner_earningss = $room_owner_earnings - $host_earnings;
if($room_owner_earningss > 0){
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益');
if(!$room_owner_earning){
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
}
}
}else{
//增加房主收益并记录日志
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
if(!$room_owner_earning){
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
}
}
}else{
//增加房主收益并记录日志
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
if(!$room_owner_earning){
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
}
}
}
}
if($gift_info['label'] == 2){
foreach ($gift_box as $gv) {
//记录送礼利率和各方收益
//收礼人是否加入公会
$configs = get_system_config();
$is_join_guild = Db::name('vs_guild_user')->where(['user_id' => $to_uid, 'status' => 1, 'quit_time' => 0])->field('guild_id')->find();
//收益增加 加入工会的收益
if ($is_join_guild) {
$ratiog = $configs['room_gift_guild_ratio'];
} else {
$ratiog = 0;
}
//未加入工会的收益
$ratiogr = $configs['room_gift_ratio'];
//收礼人最终的收益比例
$ratio = $ratiogr + $ratiog;
//房主收益大于0 就代表有收益 且在房间
if ($room_owner_earningsg > 0) {
$guid_ratio = $configs['room_cp_guild_user_ratio'];
} else {
$guid_ratio = 0;
}
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
$receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
if (!$gift_rate) {
Db::rollback();
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
}
}
}else{
//记录送礼利率和各方收益
//收礼人是否加入公会
$configs = get_system_config();
$is_join_guild = Db::name('vs_guild_user')->where(['user_id' => $to_uid, 'status' => 1, 'quit_time' => 0])->field('guild_id')->find();
//收益增加 加入工会的收益
if ($is_join_guild) {
$ratiog = $configs['room_gift_guild_ratio'];
} else {
$ratiog = 0;
}
//未加入工会的收益
$ratiogr = $configs['room_gift_ratio'];
//收礼人最终的收益比例
$ratio = $ratiogr + $ratiog;
//房主收益大于0 就代表有收益 且在房间
if ($room_owner_earningsg > 0) {
$guid_ratio = $configs['room_cp_guild_user_ratio'];
} else {
$guid_ratio = 0;
}
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
$app_earning = coin_earning($gift_price, $app_ratio);
$gift_rate = $this->change_give_gift_profit($give_gift, $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning);
if (!$gift_rate) {
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
}
}
}
$ToUserInfo = Db::name('user')->where(['id' => $to_id])->field('id as user_id,nickname,avatar,sex')->find();
$ToUserInfo['icon'][0] = model('UserData')->user_wealth_icon($to_id);//财富图标
$ToUserInfo['icon'][1] = model('UserData')->user_charm_icon($to_id);//魅力图标
$ToUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $to_id,'room_id' => $from_id])->value('charm');//魅力
if(isset($from_id) && ($from_type == 2 || $from_type == 6)){
//查询房间是否在PK中 是fa_vs_room_pk 表中的 room_id_a还是room_id_b
$room_pk = Db::name('vs_room_pk')->where(['status' => 3, 'room_id_a' => $from_id])->field('pk_id')->find();
if (!empty($room_pk)) {
// 当前 room_id 是 room_id_a 修改create_value_a
$rooma = Db::name('vs_room_pk')->where('pk_id', $room_pk['pk_id'])->setInc('create_value_a', $gift_price * 10);
$roomPKinfo = Db::name('vs_room_pk')->where('pk_id', $room_pk['pk_id'])->find();
//推送变化
$text = [
'room_id_a' => $roomPKinfo['room_id_a'],//发起者房间id
'create_value_a' => $roomPKinfo['create_value_a'],//发起者房间值
'room_id_b' => $roomPKinfo['room_id_b'],//接受者房间id
'receive_value_b' => $roomPKinfo['receive_value_b'],//接受者房间值
'text' => ''
];
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_a'],$text);
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_b'],$text);
} else {
// 当前 room_id 不是 room_id_a可能是 room_id_b 或者不存在
$room_pk_b = Db::name('vs_room_pk')->where(['status' => 3, 'room_id_b' => $from_id])->field('pk_id')->find();
if (!empty($room_pk_b)) {
// 当前 room_id 是 room_id_b
$roomb = Db::name('vs_room_pk')->where('pk_id', $room_pk_b['pk_id'])->setInc('receive_value_b', $gift_price * 10);
$roomPKinfo = Db::name('vs_room_pk')->where('pk_id', $room_pk_b['pk_id'])->find();
//推送变化
$text = [
'room_id_a' => $roomPKinfo['room_id_a'],//发起者房间id
'create_value_a' => $roomPKinfo['create_value_a'],//发起者房间值
'room_id_b' => $roomPKinfo['room_id_b'],//接受者房间id
'receive_value_b' => $roomPKinfo['receive_value_b'],//接受者房间值
'text' => ''
];
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_a'],$text);
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_b'],$text);
}
}
//直播间送礼物 每日任务
model('DailyTasks')->tasks_complete($uid,3);
}
}
//增加房间火热值hot_value
$gift_totalaa = $gift_total * get_system_config_value('coin_charm_exp');
db::name('vs_room')->where(['id' => $from_id])->inc('hot_value', $gift_totalaa)->inc('today_hot_value', $gift_totalaa)->update();
$roomtype = Db::name('vs_room')->where(['id' => $from_id])->value('type_id');
if($roomtype == 6){
//推送消息 交友房创建的私密房 倒计时增加
$value = db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)
->value('time_day');
if($value){
db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)
->setInc('time_day', $gift_total);
$text111 = [
'room_id' => $from_id,
'time_day' => db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)->value('time_day'),
'text' => '房间结束时间变化'
];
//聊天室推送系统消息
model('Chat')->sendMsg(1052,$from_id,$text111);
}
}
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
}
//送礼特效 //送礼特效
public function give_gift_effect($to_id,$FromUserInfo,$gift_info,$num,$from_id) public function give_gift_effect($to_id,$FromUserInfo,$gift_info,$num,$from_id)
{ {

View File

@@ -17,9 +17,9 @@ class Guild extends Model
* @param $page * @param $page
* @param $limit * @param $limit
*/ */
public function get_guild_list($page,$limit=10,$search='',$user_id=0) public function get_guild_list($page,$page_limit,$search='',$user_id=0)
{ {
$where ="1=1"; $where =[];
if ($search) { if ($search) {
$where = ['guild_special_id'=>['like',$search.'%']]; //通过工会ID搜索 $where = ['guild_special_id'=>['like',$search.'%']]; //通过工会ID搜索
} }
@@ -28,8 +28,7 @@ class Guild extends Model
->field('id,guild_special_id,user_id,guild_name,cover,num,intro,createtime,income') ->field('id,guild_special_id,user_id,guild_name,cover,num,intro,createtime,income')
->where(['is_show'=>1,'delete_time'=>0]) ->where(['is_show'=>1,'delete_time'=>0])
->where($where) ->where($where)
->order('income desc') ->page($page, $page_limit)
->page($page,$limit)
->select(); ->select();
$count = Db::name('vs_guild') $count = Db::name('vs_guild')
->where(['is_show'=>1,'delete_time'=>0]) ->where(['is_show'=>1,'delete_time'=>0])
@@ -62,7 +61,7 @@ class Guild extends Model
} }
$data =[ $data =[
'page' => $page, 'page' => $page,
'limit' => $limit, 'limit' => $page_limit,
'count' => $count, 'count' => $count,
'list' => $list 'list' => $list
]; ];
@@ -610,8 +609,8 @@ class Guild extends Model
//规则 //规则
$data['rule'] = get_system_config_value('web_site').'/api/Page/page_show?id=15'; $data['rule'] = get_system_config_value('web_site').'/api/Page/page_show?id=15';
//上周流水 //上周流水
$week_start = date('Y-m-d', strtotime('last monday')); $week_start = date('Y-m-d 00:00:00', strtotime('last week Monday'));
$week_end = date('Y-m-d', strtotime('last monday +6 days')); $week_end = date('Y-m-d 23:59:59', strtotime('last week Monday +6 days'));
$guild_subsidy = db::name('vs_guild_subsidy') $guild_subsidy = db::name('vs_guild_subsidy')
->where(["guild_id"=>$guild_id,'start_time' => $week_start, 'end_time' => $week_end]) ->where(["guild_id"=>$guild_id,'start_time' => $week_start, 'end_time' => $week_end])
->find(); ->find();
@@ -622,18 +621,38 @@ class Guild extends Model
$data['list'][0]['status_str'] = isset( $guild_subsidy['status'])&& $guild_subsidy['status']==1 ? "已发放" : "未发放"; $data['list'][0]['status_str'] = isset( $guild_subsidy['status'])&& $guild_subsidy['status']==1 ? "已发放" : "未发放";
//本周流水 //本周流水
//本周的第一天 //本周的第一天
$week = strtotime(date('Y-m-d', strtotime('this week Monday'))); $week = strtotime(date('Y-m-d 00:00:00', strtotime('this week Monday')));
$guild_user = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>null])->select(); $guild_user = db::name('vs_guild_user')->where(['guild_id' => $guild_id])->select();
$guild_user_ids = array_column($guild_user,'room_id'); $transaction = 0;
$total_transaction = db::name('vs_give_gift') foreach ($guild_user as $k => $v){
->where(['from'=>2,'from_id' => ['in',$guild_user_ids],'createtime' => ['between', [$week, time()]]]) $week_start_time_seach = $week;
->sum('total_price'); $week_end_time_seach = time();
if($v['createtime'] && $week_start_time_seach < $v['createtime']){
$week_start_time_seach = $v['createtime'];
}
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
$week_end_time_seach = $v['quit_time'];
}
$transaction_one = db::name('vs_give_gift')
->whereIn('from_id',$v['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
->sum('total_price');
$transaction += $transaction_one;
}
$total_transaction = $transaction;
$ss = 0; $ss = 0;
if($total_transaction){ if($total_transaction){
//根据工会流水 获取补贴比例 单位% //根据工会流水 获取补贴比例 单位%
$subsidy_config = db::name('vs_guild_subsidy_config')->where('start_amount <= '. $total_transaction) //获取补贴配置
->where('end_amount > '. $total_transaction)->getField('subsidy_ratio'); $config = db::name('vs_guild_subsidy_config')->where(['status' => 1])->order('end_amount desc')->select(); //配置查询
$ss = $total_transaction * ($subsidy_config / 100); foreach ($config as $k => $v) {
if ($total_transaction >= $v['end_amount']) {
$subsidy_ratio = $v['subsidy_ratio'];
$ss = ($total_transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石
break; // 找到匹配项后提前退出循环
}
}
} }
//待开发 //待开发
$data['list'][1]['name'] = "本周流水"; $data['list'][1]['name'] = "本周流水";
@@ -754,9 +773,15 @@ class Guild extends Model
$start_time_all = strtotime($start_time." 00:00:00"); $start_time_all = strtotime($start_time." 00:00:00");
$end_time_all = strtotime($end_time." 23:59:59"); $end_time_all = strtotime($end_time." 23:59:59");
} }
if($value['createtime'] && $start_time_all < $value['createtime']){
$start_time_all = $value['createtime'];
}
if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
$end_time_all = $value['quit_time'];
}
$transaction = db::name('vs_give_gift') $transaction = db::name('vs_give_gift')
->where('from_id',$value['room_id']) ->where('from_id',$value['room_id'])
->where(['from'=>2,'createtime' => ['between', [$start_time_all, $end_time_all]]]) ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_all, $end_time_all]]])
->sum('total_price'); ->sum('total_price');
$total_transaction = $total_transaction+$transaction; $total_transaction = $total_transaction+$transaction;
} }
@@ -771,11 +796,17 @@ class Guild extends Model
$i=0; $i=0;
foreach ($list as $k=>$v){ foreach ($list as $k=>$v){
if(!$start_time){ if(!$start_time){
$start_time = $v['createtime']; $start_time_seach = $value['createtime'];
$end_time = time(); $end_time_seach = time();
}else{ }else{
$start_time = strtotime($start_time." 00:00:00"); $start_time_seach = strtotime($start_time." 00:00:00");
$end_time = strtotime($end_time." 23:59:59"); $end_time_seach = strtotime($end_time." 23:59:59");
}
if($value['createtime'] && $start_time_all < $value['createtime']){
$start_time_seach = $value['createtime'];
}
if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
$end_time_seach = $value['quit_time'];
} }
$room_info = db::name('vs_room')->where(['id'=>$v['room_id'],'room_status'=>1,'delete_time'=>0])->find(); $room_info = db::name('vs_room')->where(['id'=>$v['room_id'],'room_status'=>1,'delete_time'=>0])->find();
if($room_info){ if($room_info){
@@ -785,7 +816,7 @@ class Guild extends Model
$room_data[$i]['room_cover'] = localpath_to_netpath($room_info['room_cover']); $room_data[$i]['room_cover'] = localpath_to_netpath($room_info['room_cover']);
$room_data[$i]['total_price'] = db::name('vs_give_gift') $room_data[$i]['total_price'] = db::name('vs_give_gift')
->where('from_id',$v['room_id']) ->where('from_id',$v['room_id'])
->where(['from'=>2,'createtime' => ['between', [$start_time, $end_time]]]) ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_seach, $end_time_seach]]])
->sum('total_price'); ->sum('total_price');
$i++; $i++;
} }

View File

@@ -109,6 +109,10 @@ class Login extends Model
if ($block) { if ($block) {
if($block['block_time'] != 0 && $block['block_time'] <= time()){ if($block['block_time'] != 0 && $block['block_time'] <= time()){
db('block')->where(['id' => $block['id']])->delete(); db('block')->where(['id' => $block['id']])->delete();
$sms_error = db::name('sms_error')->where(['mobile' => $user_info['mobile']])->find();
if($sms_error){
db::name('sms_error')->where(['mobile' => $user_info['mobile']])->delete();
}
}else{ }else{
if($block['block_time'] == 0){ if($block['block_time'] == 0){
return ['code' => 301, 'msg' => '用户已被永久封禁', 'data' => null]; return ['code' => 301, 'msg' => '用户已被永久封禁', 'data' => null];
@@ -293,24 +297,48 @@ class Login extends Model
if (empty($user_info)) { if (empty($user_info)) {
return ['code' => 0, 'msg' => '用户不存在', 'data' => null]; return ['code' => 0, 'msg' => '用户不存在', 'data' => null];
} }
//今天误次数
$sms_count = db::name('sms_error')->where(['mobile' => $user_name,'createtime' => ['between', [strtotime(date('Y-m-d')), time()]]])->count();
if (md5($password) != $user_info['password']) { if ($sms_count >= 5) {
return ['code' => 0, 'msg' => '密码错误', 'data' => null]; $user_id = db::name('user')->where('mobile', $user_name)->value('id');
$block_num = db::name('block')->where(['type' => 1, 'type_text' => $user_id])->find();
if(!$block_num){
//封禁账号
$error_data = [
'type' => 1,
'type_text' => $user_id,
'block_time' => time() + 60 * 60 * 24,
'block_note' => '账号登录异常被封禁24小时',
'createtime'=> time(),
];
db::name('block')->insert($error_data);
db::name('user')->where('id', $user_id)->update(['status' => 2]);
}
return ['code' => 0, 'msg' => '登录错误次数过多,账号已被封禁,请联系管理员处理','data' =>null];
}
$count_sms = max(5 - $sms_count, 0);
if (md5($password) != $user_info['password']) {
$data = [
'mobile' => $user_name,
'type' => 2,
'sms' => $password,
'createtime'=> time(),
];
db::name('sms_error')->insert($data);
return ['code' => 0, 'msg' => '密码错误,'.$count_sms.'次后账号将被封禁24小时', 'data' => null];
} }
// $multi_user = [];
// //查询手机号绑定的账号
// $phone_user = $this->phone_login_query($user_name);
// if($phone_user['code'] == 1){
// //获取返回数据的长度
// if(count($phone_user['data']) >= 2){
// $multi_user = $phone_user['data'];
// }
// }
$login = $this->login($user_info,$system,$login_device); $login = $this->login($user_info,$system,$login_device);
if($login['code'] != 1){ if($login['code'] != 1){
return $login; return $login;
} }
//登陆成功后 把所有的登录错误删除掉
db::name('sms_error')->where(['mobile' => $user_name])->delete();
return ['code' => 1, 'msg' => '登录成功', 'data' => $login['data']]; return ['code' => 1, 'msg' => '登录成功', 'data' => $login['data']];
} }

View File

@@ -691,7 +691,7 @@ class Room extends Model
if (!$is_join) { if (!$is_join) {
db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time()]); db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time()]);
} }
// db::name('user_data')->where('user_id', $user_id)->update(['room_id' => $room_id]); db::name('user_data')->where('user_id', $user_id)->update(['room_id' => $room_id]);
$room['is_use_code'] = 0; $room['is_use_code'] = 0;
$liang = model('api/Decorate')->user_decorate_detail($room['id'],7); $liang = model('api/Decorate')->user_decorate_detail($room['id'],7);
@@ -850,7 +850,16 @@ class Room extends Model
} }
$xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id); $xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id);
$open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
if($open_time > 0){
if($open_time <= time()){
$hour_open = 1;//开启
}else{
$hour_open = 0;//关闭
}
}else{
$hour_open = 0;//关闭
}
return ['code' => 1, return ['code' => 1,
'msg' => '成功', 'msg' => '成功',
'data' => ['room_info' => $room_info, 'data' => ['room_info' => $room_info,
@@ -864,6 +873,7 @@ class Room extends Model
'song_pit_list' => $song_pit_list, 'song_pit_list' => $song_pit_list,
'friend_info' => $friend, 'friend_info' => $friend,
'gift_cycle' => $xlh_info, 'gift_cycle' => $xlh_info,
'hour_ranking_open' => $hour_open
] ]
]; ];
} }
@@ -1147,7 +1157,7 @@ class Room extends Model
}else{ }else{
$room_typer = '管理员'; $room_typer = '管理员';
} }
db::name('vs_room_black')->insert(['room_id' => $room_id, 'user_id' => $uid,'black_id' => $user_id,'type' => 1,'kick_time' => time()+300,'createtime' => time()]); db::name('vs_room_black')->insert(['room_id' => $room_id, 'user_id' => $uid,'black_id' => $user_id,'type' => 1,'kick_time' => time()+600,'createtime' => time()]);
//发送消息 //发送消息
$text['text'] = '用户 ' . $nickname . ' 被 '. $room_typer .' 踢出房间'; $text['text'] = '用户 ' . $nickname . ' 被 '. $room_typer .' 踢出房间';
@@ -1292,9 +1302,17 @@ class Room extends Model
$room_user = db::name('vs_room_visitor')->where(['room_id' => $room_id])->select(); $room_user = db::name('vs_room_visitor')->where(['room_id' => $room_id])->select();
if($room_user){ if($room_user){
foreach ($room_user as $vv){ foreach ($room_user as $vv){
if(Db::name('user')->where('id', $vv['user_id'])->value('is_online') == 0){ if(($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 8) && $label_type['data']['label_id'] == 1){
model('Room')->quit_room($vv['user_id'], $room_id,$vv['user_id'],2); //不做处理
}else{
//查询是否有切后台的操作
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $room_id,'user_id' => $vv['user_id']])->find();
if(Db::name('user')->where('id', $vv['user_id'])->value('is_online') == 0 && !$bg_room){
model('Room')->quit_room($vv['user_id'], $room_id,$vv['user_id'],2);
}
} }
} }
} }
@@ -1596,6 +1614,9 @@ class Room extends Model
if(!$is_host){ if(!$is_host){
return ['code' => 0, 'msg' => '用户不是主持人,不能设置收益', 'data' => null]; return ['code' => 0, 'msg' => '用户不是主持人,不能设置收益', 'data' => null];
} }
if($profit < 0 || $profit > 100){
return ['code' => 0, 'msg' => '请输入正确的比例 0-100', 'data' => null];
}
$res = db::name('vs_room_host')->where(['room_id' => $room_id,'user_id' => $user_id,'type' => 1,'delete_time' => null]) $res = db::name('vs_room_host')->where(['room_id' => $room_id,'user_id' => $user_id,'type' => 1,'delete_time' => null])
->update(['ratio' => $profit]); ->update(['ratio' => $profit]);
if(!$res){ if(!$res){
@@ -2003,6 +2024,16 @@ class Room extends Model
} }
$xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id); $xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id);
$open_time = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('open_time');
if($open_time > 0){
if($open_time <= time()){
$hour_open = 1;//开启
}else{
$hour_open = 0;//关闭
}
}else{
$hour_open = 0;//关闭
}
return ['code' => 1, return ['code' => 1,
'msg' => '成功', 'msg' => '成功',
@@ -2017,6 +2048,7 @@ class Room extends Model
'song_pit_list'=>$song_pit_list, 'song_pit_list'=>$song_pit_list,
'friend_info' => $friend, 'friend_info' => $friend,
'gift_cycle' => $xlh_info, 'gift_cycle' => $xlh_info,
'hour_ranking_open' => $hour_open
] ]
]; ];
} }
@@ -2222,7 +2254,7 @@ class Room extends Model
->join('user c','a.user_id2 = c.id','left') ->join('user c','a.user_id2 = c.id','left')
->join('vs_relation d','a.relation_id = d.id','left')//关系 ->join('vs_relation d','a.relation_id = d.id','left')//关系
->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image') ->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image')
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'d.id' => ['>',0]]) ->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
->order('a.updatetime desc') ->order('a.updatetime desc')
->select(); ->select();
$room_auction2 = db::name('vs_room_auction_relation')->alias('a') $room_auction2 = db::name('vs_room_auction_relation')->alias('a')
@@ -2230,7 +2262,7 @@ class Room extends Model
->join('user c','a.user_id2 = c.id','left') ->join('user c','a.user_id2 = c.id','left')
->join('vs_relation d','a.relation_id = d.id','left')//关系 ->join('vs_relation d','a.relation_id = d.id','left')//关系
->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image') ->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image')
->where(['a.user_id2' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0]) ->where(['a.user_id2' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
->order('a.updatetime desc') ->order('a.updatetime desc')
->select(); ->select();
@@ -2523,15 +2555,80 @@ class Room extends Model
public function user_reconnect($user_id,$room_id) public function user_reconnect($user_id,$room_id)
{ {
if(!$room_id){ if(!$room_id){
$room_id = Db::name('vs_room_visitor')->where('user_id', $user_id)->order('id desc')->value('room_id'); // $room_id = Db::name('user_data')->where('user_id', $user_id)->value('room_id');
} }
$room = db::name('vs_room_visitor')->where(['user_id' => $user_id,'room_id' => $room_id])->find(); if(!$room_id){
if(!$room){ return ['code' => 0, 'msg' => '参数错误', 'data' => null];
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time()]); }
//查询用户在几个房间
$room = db::name('vs_room_visitor')->where('user_id', $user_id)->select();
if($room){
$userinroom = 0;
foreach ($room as $v){
if($v['room_id'] == $room_id){
$userinroom = $room_id;
break;
}
}
if($userinroom == $room_id){
$room_info = db::name('vs_room_visitor')->where(['id' => $room_id])->update(['room_id' => $room_id, 'user_id' => $user_id, 'updatetime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){
return ['code' => 0, 'msg' => '更新加入房间失败', 'data' => null];
}
}else
{
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){
return ['code' => 0, 'msg' => '加入房间失败', 'data' => null];
}
}
}else{
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){ if(!$room_info){
return ['code' => 0, 'msg' => '加入房间失败', 'data' => null]; return ['code' => 0, 'msg' => '加入房间失败', 'data' => null];
} }
} }
return ['code' => 1, 'msg' => '操作成功', 'data' => null];
}
//用户在房间内切后台保留机制
public function user_in_room_background($user_id,$room_id,$type)
{
if(!$room_id){
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
}
$room_t = db::name('vs_room')->field('type_id,label_id')->where('id',$room_id)->find();
if(!(($room_t['type_id'] == 1 || $room_t['type_id'] == 8) && $room_t['label_id'] == 1)){
if($type == 1){//1-切后台2-切前台
$is_bg = db::name('vs_user_in_room_bg')->where(['user_id' => $user_id,'room_id' => $room_id])->find();
if($is_bg){
$up_bg = [
'updatetime' => time(),
];
db::name('vs_user_in_room_bg')->where('id',$is_bg['id'])->update($up_bg);
}else{
$data = [
'user_id' => $user_id,
'room_id' => $room_id,
'createtime' => time(),
'updatetime' => time(),
];
$room_background = db::name('vs_user_in_room_bg')->insert($data);
if(!$room_background){
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
}
}
}else{
db::name('vs_user_in_room_bg')->where(['user_id' => $user_id,'room_id' => $room_id])->delete();
}
}
return ['code' => 1, 'msg' => '操作成功', 'data' => null]; return ['code' => 1, 'msg' => '操作成功', 'data' => null];
} }
} }

View File

@@ -109,7 +109,7 @@ class RoomAuction extends Model
//参与竞拍 //参与竞拍
public function room_auction_join($auction_id,$user_id,$gift_id,$num,$type) public function room_auction_join($auction_id,$user_id,$gift_id,$num,$type,$ext=[])
{ {
if(!$auction_id){ if(!$auction_id){
return ['code' => 0, 'msg' => '拍卖已经结束','data' => null]; return ['code' => 0, 'msg' => '拍卖已经结束','data' => null];
@@ -127,7 +127,7 @@ class RoomAuction extends Model
} }
//走送礼流程 //走送礼流程
$ree = model('GiveGift')->give_gift($user_id,$auction['user_id'],$gift_id,$num,2,$type,$auction['room_id'],0,0); $ree = model('GiveGift')->give_gift($user_id,$auction['user_id'],$gift_id,$num,2,$type,$auction['room_id'],0,0,$ext);
if($ree['code'] != 1){ if($ree['code'] != 1){
return ['code' => $ree['code'], 'msg' => $ree['msg'],'data' => null]; return ['code' => $ree['code'], 'msg' => $ree['msg'],'data' => null];
} }

View File

@@ -0,0 +1,73 @@
<?php
namespace app\api\model;
use think\Db;
use think\Model;
class RoomHourRanking extends Model
{
//房间小时榜
public function room_hour_ranking($page, $page_limit,$start_time = null, $end_time = null)
{
//当前小时开始时间
if($start_time == null){
$start_time = strtotime(date('Y-m-d H:00:00'));
}
//结束时间
if($end_time == null){
$end_time = strtotime(date('Y-m-d H:59:59'));
}
//判断是否开启
$open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
if ($open_time == 0) {
return ['code' => 0, 'msg' => '排行榜暂未开启', 'data' => null];
}
//是否开启巡乐会
$is_open_xlh = db::name('vs_hour_ranking_config')->where('id', 1)->value('is_open_xlh');
// 更进一步的优化版本:
$subQuery = Db::name('vs_give_gift')
->where('from', 2)
->whereBetween('createtime', [$start_time, $end_time])
->buildSql();
$profit = db::name('vs_room')->alias('a')
->join([$subQuery => 'b'], 'a.id = b.from_id', 'left')
->join('vs_room_label c', 'a.label_id = c.id','left')
->field('a.id as room_id,a.user_id,a.room_name,a.label_id,a.room_cover,IFNULL(SUM(b.total_price), 0) as total_price,c.label_icon')
->where('a.room_status', 1)
->where('a.apply_status', 2)
->where('a.type_id', '<>', 6)
->group('a.id')
->order('total_price', 'desc')
->page($page, $page_limit)
->select();
if($profit){
foreach ($profit as &$v) {
$v['total_price'] = $v['total_price'] * get_system_config_value('coin_charm_exp');
if($v['room_id'] > 0 && $is_open_xlh == 1){
$xlh_status = model('BlindBoxTurntableGift')->get_user_xlh_info($v['room_id']);
$v['xlh_status'] = $xlh_status['xlh_status'];
}else{
$v['xlh_status'] = 0;
}
//查询房间是否有红包
if($v['room_id'] > 0){
$red_pack_status = Db::name('redpacket')->where(['room_id' => $v['room_id'], 'status' => ['<=',1]])->count();
$v['redpacket_status'] = $red_pack_status;
}else{
$v['redpacket_status'] = 0;
}
}
}
//当前小时开始时间 和结束时间 00:00-00:59 这样的格式
$time_range = date('H:') . '00-' . date('H:'). '59';
return ['code' => 1, 'msg' => '获取成功', 'data' => ['time_range' => $time_range, 'lists' =>$profit]];
}
}

View File

@@ -192,24 +192,30 @@ class RoomPit extends Model
return ['code' => 0, 'msg' => '房间违规或关闭', 'data' => null]; return ['code' => 0, 'msg' => '房间违规或关闭', 'data' => null];
} }
if($pit_number == 9){
//检查用户是否是房主或主持
$is_room_owner =db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
$is_room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->field('id')->find();
if(!$is_room_owner && !$is_room_host){
return ['code' => 0, 'msg' => '没有权限', 'data' => null];
}
}
if($pit_number == 10){ if($pit_number == 10){
return ['code' => 0, 'msg' => '请等待主持抱麦', 'data' => null]; return ['code' => 0, 'msg' => '请等待主持抱麦', 'data' => null];
} }
//检查是否在坑位上 //检查是否在坑位上
$pit_infos = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $user_id])->field('id,pit_number')->find(); $pit_infos = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $user_id])->field('id,pit_number')->find();
// if($pit_infos){
// return ['code' => 0, 'msg' => '您已上麦', 'data' => null];
// }
if($room_info['label_id'] == 5 && $room_info['step'] != 1 && $pit_number < 9){ if($room_info['label_id'] == 5 && $room_info['step'] != 1 && $pit_number < 9){
return ['code' => 0, 'msg' => '交友房 此阶段不可操作', 'data' => null]; return ['code' => 0, 'msg' => '互娱房 此阶段不可操作', 'data' => null];
} }
//自由麦 //自由麦
if($room_info['room_up_pit_type'] == 2){ if($room_info['room_up_pit_type'] == 2){
if($pit_number > 0){ if($pit_number > 0){
if($room_info['label_id'] == 5){//交友 if($room_info['label_id'] == 5){//交友(互娱)
if($pit_number == 7 || $pit_number == 8){ if($pit_number == 7 || $pit_number == 8){
return ['code' => 0, 'msg' => '该麦位已锁定了', 'data' => null]; return ['code' => 0, 'msg' => '该麦位已锁定了', 'data' => null];
} }
@@ -228,15 +234,6 @@ class RoomPit extends Model
if($pit_info['is_lock'] == 1){ if($pit_info['is_lock'] == 1){
return ['code' => 0, 'msg' => '该麦位被锁定', 'data' => null]; return ['code' => 0, 'msg' => '该麦位被锁定', 'data' => null];
} }
if($pit_number ==9){
//检查用户是否是房主或主持
$is_room_owner =db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
$is_room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->field('id')->find();
if(!$is_room_owner && !$is_room_host){
return ['code' => 0, 'msg' => '您还不是房间主持人', 'data' => null];
}
}
}else{ }else{
if($room_info['label_id'] == 5){//交友 if($room_info['label_id'] == 5){//交友
$pit_number = $this->getRoomNullPitWithout($room_id, [7,8,9,10]); $pit_number = $this->getRoomNullPitWithout($room_id, [7,8,9,10]);
@@ -248,13 +245,9 @@ class RoomPit extends Model
return ['code' => 0, 'msg' => '当前房间没有空麦位', 'data' => null]; return ['code' => 0, 'msg' => '当前房间没有空麦位', 'data' => null];
} }
} }
//换麦使用 //换麦使用
if(isset($pit_infos) && $pit_infos['pit_number'] > 0){ if(isset($pit_infos) && $pit_infos['pit_number'] > 0){
// //下麦
// $dow = $this ->DownPit($user_id,$room_id,$pit_infos['pit_number']);
// if($dow['code'] != 1){
// return ['code' => 0, 'msg' => '操作失败', 'data' => null];
// }
$exchange1 = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_infos['pit_number']])->update([ 'user_id' => 0]); $exchange1 = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_infos['pit_number']])->update([ 'user_id' => 0]);
$exchange = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_number])->update([ 'user_id' => $user_id]); $exchange = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_number])->update([ 'user_id' => $user_id]);
if(!$exchange || !$exchange1){ if(!$exchange || !$exchange1){
@@ -278,79 +271,81 @@ class RoomPit extends Model
$text['to_pit_number'] = $pit_number; $text['to_pit_number'] = $pit_number;
model('Chat')->sendMsg(1039,$room_id,$text); model('Chat')->sendMsg(1039,$room_id,$text);
return ['code' => 1, 'msg' => '上麦成功', 'data' => null]; return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
} }else{
$ompit = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位 $ompit = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位
if($ompit['code'] != 1){ if($ompit['code'] != 1){
return ['code' => 0, 'msg' => '上麦失败', 'data' => null]; return ['code' => 0, 'msg' => '上麦失败', 'data' => null];
}
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}else{
if($pit_number == 9){
//检查用户是否是房主或主持
$is_room_owner = db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
$is_room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->field('id')->find();
//查看主持坑9坑
$host_pit = $this->where(['room_id' => $room_id, 'pit_number' => 9])->value('user_id');
if(($is_room_owner || $is_room_host) && $host_pit == 0){
//查询用户是否在麦位上
$is_on = $this->where(['room_id' => $room_id, 'user_id' => $user_id])->value('pit_number');
if($is_on){
//下麦
$dow = $this ->DownPit($user_id,$room_id,$is_on);
if($dow['code'] != 1){
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
}
}
//直接上主持麦
$ont = $this->OnPit($user_id,$room_id,9);//用户上了这个房间的几号麦位
if($ont['code'] != 1){
return ['code' => 0, 'msg' => '上麦失败', 'data' => null];
}
//查找是否在申请列表里
$apply_pit = db::name('vs_room_pit_apply')->where(['room_id' => $room_id, 'user_id' => $user_id])->find();
if($apply_pit){
$this->clear_apply_pit_list($user_id, $room_id, $user_id);
// db::name('vs_room_pit_apply')->where(['room_id' => $room_id, 'user_id' => $user_id])->delete();
// $count = db::name('vs_room_pit_apply')->where(['room_id' => $room_id,'status' => 0])->count();
// //申请上麦推送消息
// $text = [
// 'text' => '申请上麦',
// 'count' => $count
// ];
// model('Chat')->sendMsg(1034,$room_id,$text);
}
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
} }
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
} }
//检查用户是否已经申请 }else{//排麦
$apply_pit_info = db::name('vs_room_pit_apply')->where(['room_id' => $room_id, 'user_id' => $user_id,'apply_type' =>1])->field('id')->find(); if($pit_number == 9){
if($apply_pit_info){ $host_pit = $this->where(['room_id' => $room_id, 'pit_number' => 9])->value('user_id');
return ['code' => 0, 'msg' => '请勿重复申请', 'data' => null]; if ($host_pit > 0) {
} if ($host_pit == $user_id) {
return ['code' => 0, 'msg' => '您已在主持麦位', 'data' => null];
} else {
return ['code' => 0, 'msg' => '该麦位有人', 'data' => null];
}
}else{
if(isset($pit_infos) && $pit_infos['pit_number'] > 0){
$exchange1 = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_infos['pit_number']])->update([ 'user_id' => 0]);
$exchange = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_number])->update([ 'user_id' => $user_id]);
if(!$exchange || !$exchange1){
return ['code' => 0, 'msg' => '换麦失败', 'data' => null];
}
$FromUserInfo = db::name('user')->where('id',$user_id)->field('id as user_id,nickname,avatar,sex')->find();
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($user_id);//财富图标
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($user_id);//魅力图标
$FromUserInfo['dress'] = model('Decorate')->user_decorate_detail($user_id,1);
$FromUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $user_id,'room_id' => $room_id])->value('charm');
if(isset($pit_infos) && $pit_infos['pit_number'] > 0){ $text['text'] = $FromUserInfo['nickname'].' 换到主持麦 ';
return ['code' => 0, 'msg' => '用户已在麦上,请先下麦后再申请', 'data' => null]; $text['FromUserInfo'] = $FromUserInfo;
} $text['from_pit_number'] = $pit_infos['pit_number'];
$text['to_pit_number'] = $pit_number;
model('Chat')->sendMsg(1039,$room_id,$text);
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}else{
//直接上主持麦
$ont = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位
if($ont['code'] != 1){
return ['code' => 0, 'msg' => '上麦失败', 'data' => null];
}
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}
}
}else{
//检查用户是否已经申请
$apply_pit_info = db::name('vs_room_pit_apply')->where(['room_id' => $room_id, 'user_id' => $user_id,'apply_type' =>1])->field('id')->find();
if($apply_pit_info){
return ['code' => 0, 'msg' => '请勿重复申请', 'data' => null];
}
//放入等待区 if(isset($pit_infos) && $pit_infos['pit_number'] > 0){
$data = [ return ['code' => 0, 'msg' => '用户已在麦上,请先下麦后再申请', 'data' => null];
'room_id' => $room_id, }
'user_id' => $user_id,
'status' => 0, //放入等待区
'apply_type' => 1 $data = [
]; 'room_id' => $room_id,
$reslut = db::name('vs_room_pit_apply')->insert($data); 'user_id' => $user_id,
if(!$reslut){ 'status' => 0,
return ['code' => 0, 'msg' => '申请失败', 'data' => null]; 'apply_type' => 1
];
$reslut = db::name('vs_room_pit_apply')->insert($data);
if(!$reslut){
return ['code' => 0, 'msg' => '申请失败', 'data' => null];
}
$count = db::name('vs_room_pit_apply')->where(['room_id' => $room_id,'status' => 0])->count();
//申请上麦推送消息
$text = [
'text' => '申请上麦',
'count' => $count
];
model('Chat')->sendMsg(1034,$room_id,$text);
return ['code' => 1, 'msg' => '申请成功,请等待房主审核', 'data' => null];
} }
$count = db::name('vs_room_pit_apply')->where(['room_id' => $room_id,'status' => 0])->count();
//申请上麦推送消息
$text = [
'text' => '申请上麦',
'count' => $count
];
model('Chat')->sendMsg(1034,$room_id,$text);
return ['code' => 1, 'msg' => '申请成功,请等待房主审核', 'data' => null];
} }
} }
@@ -366,15 +361,6 @@ class RoomPit extends Model
'a.status' => 0, 'a.status' => 0,
]; ];
// $res = model('Room')->get_room_label($room_id);
// $room_label = $res['data']['label_id'];
// $room_type = $res['data']['type_id'];
// if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
// $where['a.apply_type'] = 1;
// }elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
// $where['a.apply_type'] = 2;
// }
$list['regular'] = db::name('vs_room_pit_apply')->alias('a')->join('user b','a.user_id = b.id') $list['regular'] = db::name('vs_room_pit_apply')->alias('a')->join('user b','a.user_id = b.id')
->where($where)->where('a.type',0)->field('a.user_id,a.rank_value,b.nickname,b.avatar') ->where($where)->where('a.type',0)->field('a.user_id,a.rank_value,b.nickname,b.avatar')
->order('a.rank_value desc')->select(); ->order('a.rank_value desc')->select();

View File

@@ -20,6 +20,28 @@ class Sms extends Model
if (!checkMobile($mobile)) { if (!checkMobile($mobile)) {
return ['code' => 0, 'msg' => '手机号不正确','data' =>null]; return ['code' => 0, 'msg' => '手机号不正确','data' =>null];
} }
//今天验证码错误次数
$sms_count = db::name('sms_error')->where(['mobile' => $mobile,'createtime' => ['between', [strtotime(date('Y-m-d')), time()]]])->count();
if ($sms_count >= 5) {
$user_id = db::name('user')->where('mobile', $mobile)->value('id');
$block_num = db::name('block')->where(['type' => 1, 'type_text' => $user_id])->find();
if(!$block_num){
//封禁账号
$error_data = [
'type' => 1,
'type_text' => $user_id,
'block_time' => time() + 60 * 60 * 24,
'block_note' => '账号登录异常被封禁24小时',
'createtime'=> time(),
];
db::name('block')->insert($error_data);
db::name('user')->where('id', $user_id)->update(['status' => 2]);
}
return ['code' => 0, 'msg' => '验证码错误次数过多,账号已被封禁,请联系管理员处理','data' =>null];
}
$is_code = db::name('sms')->where(['mobile' => $mobile, 'event' => $type])->order('id desc')->find(); $is_code = db::name('sms')->where(['mobile' => $mobile, 'event' => $type])->order('id desc')->find();
if ($is_code && $is_code['code'] == $code) { if ($is_code && $is_code['code'] == $code) {
//验证码正确 //验证码正确
@@ -34,9 +56,19 @@ class Sms extends Model
} }
} }
db::name('sms')->where(['mobile' => $mobile, 'event' => $type])->delete(); db::name('sms')->where(['mobile' => $mobile, 'event' => $type])->delete();
//登陆成功后 把所有的登录错误删除掉
db::name('sms_error')->where(['mobile' => $mobile])->delete();
return ['code' =>1, 'msg' =>'验证码正确','data' =>null]; return ['code' =>1, 'msg' =>'验证码正确','data' =>null];
} else { } else {
return ['code' => 0, 'msg' => '验证码错误','data' =>null]; //验证码错误次数
$count_sms = max(5 - $sms_count, 0);
$data = [
'mobile' => $mobile,
'sms' => $code,
'createtime'=> time(),
];
db::name('sms_error')->insert($data);
return ['code' => 0, 'msg' => '验证码错误,'.$count_sms.'次后账号将被封禁24小时','data' =>null];
} }
} }

View File

@@ -915,25 +915,40 @@ class Tencent extends Model
} }
//腾讯IM监控在线状态更新 //腾讯IM监控在线状态更新
public function tencent_member_status_change($info){ public function tencent_member_status_changeee($info){
$uid = substr($info['To_Account'],1); $uid = substr($info['To_Account'],1);
$action = $info['Action']; $action = $info['Action'];
if($action == 'Disconnect') { if($action == 'Disconnect') {
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]); Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select(); $quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
Log::record("腾讯离线推送,房间信息".json_encode($quit_room),"infos");
if($quit_room) { if($quit_room) {
foreach ($quit_room as $v){ foreach ($quit_room as &$v){
$room_type = db::name('vs_room')->where(['id' => $v['room_id'],'room_status' => 1])->field('step,type_id')->find(); if(isset($v['room_id'])){
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){ $room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
$text['text'] = '掉线!'; Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
$text['user_id'] = $uid; if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
$text['type'] = 2; Log::record("腾讯离线推送,我是二卡八","infos");
model('Chat')->sendMsg(1058,$v['room_id'],$text); Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
}else{ }else{
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2); if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
$text['text'] = '掉线!';
$text['user_id'] = $uid;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$v['room_id'],$text);
}else {
//查询是否有切后台的操作
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
if(!$bg_room){
Log::record("腾讯离线推送,要踢你","infos");
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
} }
}
$room_type = null;
} }
} }
@@ -946,12 +961,117 @@ class Tencent extends Model
$text['type'] = 1; $text['type'] = 1;
model('Chat')->sendMsg(1058,$room,$text); model('Chat')->sendMsg(1058,$room,$text);
}elseif ($action == 'Logout'){ }elseif ($action == 'Logout'){
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]); // Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
// $room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
// $text['text'] = '掉线!';
// $text['user_id'] = $uid;
// $text['type'] = 2;
// model('Chat')->sendMsg(1058,$room,$text);
}
return true;
}
//腾讯IM监控在线状态更新
public function tencent_member_status_change($info){
$uid = substr($info['To_Account'],1);
$action = $info['Action'];
if($action == 'Disconnect') {
$is_keep = 1;
$keep = db::name('vs_xintiao')->where('user_id' , $uid)->find();
if(isset($keep)){
if(time() - $keep['updatetime'] >= 60){
$is_keep = 0;
}
}
//判断保活用户是否安卓用户
$user_system = db::name('user')->where('id' , $uid)->value('system');
if($user_system == 'android'){
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
Log::record("腾讯离线推送,用户安卓所在房间信息".json_encode($quit_room),"infos");
if($quit_room) {
foreach ($quit_room as &$v){
if(isset($v['room_id'])){
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
// Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
// Log::record("腾讯离线推送,我是二卡八","infos");
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
}else{
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
$text['text'] = '掉线!';
$text['user_id'] = $uid;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$v['room_id'],$text);
}else {
//查询是否有切后台的操作
// $bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
// if(!$bg_room){
// // Log::record("腾讯离线推送,要踢你","infos");
// model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
// }
Log::record("腾讯离线推送,判断心跳".$is_keep,"infos");
if($is_keep == 0){
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
}
}
$room_type = null;
}
}
}else{
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
// Log::record("腾讯离线推送,房间信息".json_encode($quit_room),"infos");
if($quit_room) {
foreach ($quit_room as &$v){
if(isset($v['room_id'])){
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
// Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
// Log::record("腾讯离线推送,我是二卡八","infos");
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
}else{
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
$text['text'] = '掉线!';
$text['user_id'] = $uid;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$v['room_id'],$text);
}else {
//查询是否有切后台的操作
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
if(!$bg_room){
// Log::record("腾讯离线推送,要踢你","infos");
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
}
}
$room_type = null;
}
}
}
} elseif ($action == 'Login') {
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
$room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id'); $room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
$text['text'] = '掉线!';
$text['text'] = '重新上线!';
$text['user_id'] = $uid; $text['user_id'] = $uid;
$text['type'] = 2; $text['type'] = 1;
model('Chat')->sendMsg(1058,$room,$text); model('Chat')->sendMsg(1058,$room,$text);
}elseif ($action == 'Logout'){
// Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
// $room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
// $text['text'] = '掉线!';
// $text['user_id'] = $uid;
// $text['type'] = 2;
// model('Chat')->sendMsg(1058,$room,$text);
} }
return true; return true;
} }

View File

@@ -841,6 +841,35 @@ class User extends Model
} }
//关注房间(红包专用)
public function follow_room($user_id,$room_id,$type){
if(empty($room_id)){
return ['code' => 0, 'msg' => '房间ID不能为空', 'data' => null];
}
if($type == 0){
//取消关注
$re = db::name('user_follow')->where(['user_id' => $user_id,'follow_id' => $room_id,'type' => 2])->delete();
if(!$re){
return ['code' => 0, 'msg' => '取消关注失败', 'data' => null];
}
return ['code' => 1, 'msg' => '取消关注成功', 'data' => null];
}else{
//关注
$data = [
'user_id' => $user_id,
'follow_id' => $room_id,
'type' => 2,
'createtime' => time()
];
$re = db::name('user_follow')->insert($data);
if(!$re){
return ['code' => 0, 'msg' => '关注失败', 'data' => null];
}
return ['code' => 1, 'msg' => '关注成功', 'data' => null];
}
}
//更新用户ip //更新用户ip
public function update_user_ip($user_id,$ip){ public function update_user_ip($user_id,$ip){
//判断$ip是否是汉字 //判断$ip是否是汉字

View File

@@ -594,6 +594,16 @@ class UserData extends Model
if($type == 3){ if($type == 3){
$data = db::name('user_data')->where('user_id',$user_id)->field('id,bank_card_number,bank_user_name,bank_card,open_bank')->find(); $data = db::name('user_data')->where('user_id',$user_id)->field('id,bank_card_number,bank_user_name,bank_card,open_bank')->find();
} }
if($data['bank_card_number']==0){
$data['bank_card_number'] = '';
}
if($data['bank_card']==0){
$data['bank_card'] = '';
}
if($data['open_bank']==0){
$data['open_bank'] = '';
}
return ['code' => 1, 'msg' => '获取成功','data' =>$data]; return ['code' => 1, 'msg' => '获取成功','data' =>$data];
} }
} }

View File

@@ -34,6 +34,10 @@ class UserGiftPack extends Model
const DRAW_GIFT = 7; const DRAW_GIFT = 7;
//巡乐会抽奖所得 //巡乐会抽奖所得
const XLH_DRAW_GIFT_GET = 8; const XLH_DRAW_GIFT_GET = 8;
//小时榜获得
const HOUR_RANK_GET = 9;
//新人充值好礼
const NEW_CHARGE_GIFT = 10;
public static function init() public static function init()
{ {
@@ -51,7 +55,9 @@ class UserGiftPack extends Model
self::GIFT_USE => '礼物使用', self::GIFT_USE => '礼物使用',
self::FIRST_CHARGE => '首充获得', self::FIRST_CHARGE => '首充获得',
self::DRAW_GIFT => '天降好礼获得', self::DRAW_GIFT => '天降好礼获得',
self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得' self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得',
self::HOUR_RANK_GET => '小时榜获得',
self::NEW_CHARGE_GIFT => '新人充值好礼'
]; ];
} }
@@ -100,6 +106,7 @@ class UserGiftPack extends Model
self::FIRST_CHARGE, self::FIRST_CHARGE,
self::DRAW_GIFT, self::DRAW_GIFT,
self::XLH_DRAW_GIFT_GET self::XLH_DRAW_GIFT_GET
,self::HOUR_RANK_GET
]; ];
//获取背包日志列表 //获取背包日志列表
$log_model = Db::name('vs_user_gift_pack_log')->where(['user_id'=>$uid])->whereIn('type', $type) $log_model = Db::name('vs_user_gift_pack_log')->where(['user_id'=>$uid])->whereIn('type', $type)

View File

@@ -50,17 +50,18 @@ class UserWallet extends Model
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮 // 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换 // 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
// 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益20.发布头条扣除余额,21.公会长收益,22.提现驳回或提现失败返还,23.财富等级奖励金币领取,24.删除关系扣金币 // 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益20.发布头条扣除余额,21.公会长收益,22.提现驳回或提现失败返还,23.财富等级奖励金币领取,24.删除关系扣金币
//27.小时榜获得28-新人充值好礼,32-发红包金币29-发红包钻石30-抢红包金币31-抢红包(钻石) 33-红包剩余退回金币34-红包剩余退回(钻石)
if($gift_type == 1){ //1金币2收益钻石 if($gift_type == 1){ //1金币2收益钻石
if($in_out_type == 1){//1收入 if($in_out_type == 1){//1收入
$in_out_types = [2,5,6,8,13,14,15,16,22,23,26]; $in_out_types = [2,5,6,8,13,14,15,16,22,23,26,27,30,28,33];
}elseif($in_out_type == 2){//2支出 }elseif($in_out_type == 2){//2支出
$in_out_types = [4,7,10,17,20,24,25]; $in_out_types = [4,7,10,17,20,24,25,32];
} }
}elseif($gift_type == 2){ //1金币2收益钻石 }elseif($gift_type == 2){ //1金币2收益钻石
if($in_out_type == 1){//1收入 if($in_out_type == 1){//1收入
$in_out_types = [6,9,11,12,18,19,21]; $in_out_types = [6,9,11,12,18,19,21,22,31,28,34];
}elseif($in_out_type == 2){//2支出 }elseif($in_out_type == 2){//2支出
$in_out_types = [3,14]; $in_out_types = [3,14,29];
} }
} }

View File

@@ -43,6 +43,13 @@ class UserWithdrawal extends Model
if(!$age){ if(!$age){
return ['code' => 0, 'msg' => '该身份证号未满18岁', 'data' => null]; return ['code' => 0, 'msg' => '该身份证号未满18岁', 'data' => null];
} }
if(empty($type)){
return ['code' => 0, 'msg' => '请选择提现方式', 'data' => null];
}
//提现不能有小数
if($number != floor($number)){
return ['code' => 0, 'msg' => '提现不能有小数!', 'data' => null];
}
//判断用户是否签约云账户 //判断用户是否签约云账户
$yun_pay = new YunPay(); $yun_pay = new YunPay();
$sign_status = $yun_pay->getApiUserSignStatus($user_info['real_name'],$user_info['card_id']); $sign_status = $yun_pay->getApiUserSignStatus($user_info['real_name'],$user_info['card_id']);
@@ -192,10 +199,10 @@ class UserWithdrawal extends Model
$where['createtime'] = ['>=',strtotime($search_stime)]; $where['createtime'] = ['>=',strtotime($search_stime)];
} }
if($search_etime){ if($search_etime){
$where['createtime'] = ['<=',strtotime($search_etime.' 23:59:59')]; $where['createtime'] = ['<=',strtotime($search_etime)];
} }
if(!empty($search_stime) && !empty($search_etime)){ if(!empty($search_stime) && !empty($search_etime)){
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]]; $where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
} }
$withdraw_list = db::name('vs_user_withdrawal') $withdraw_list = db::name('vs_user_withdrawal')
->where($where) ->where($where)
@@ -207,6 +214,26 @@ class UserWithdrawal extends Model
$return_data[$key]['money'] = $value['money']; $return_data[$key]['money'] = $value['money'];
$return_data[$key]['status'] = $value['status']; $return_data[$key]['status'] = $value['status'];
$return_data[$key]['status_str'] = $this->withdraw_status[$value['status']]; $return_data[$key]['status_str'] = $this->withdraw_status[$value['status']];
//手续费
$return_data[$key]['withdraw_fee'] = $value['server_money'] ?? 0;
$return_data[$key]['personal_tax_rate'] = $value['personal_tax_rate'] ?? 0; //税率
$return_data[$key]['received_tax_amount'] = $value['received_tax_amount'] ?? 0; //税费
//预计到账金额
//1待处理2已通过3已拒绝 4打款中[云账户]5打款失败[云账户]6已打款[云账户]
if($value['status'] == 1 || $value['status'] == 2 || $value['status'] ==4){
$surplus_money = $value['money'] - $value['server_money'];
$return_data[$key]['received_tax_amount'] = 0;
}elseif($value['status'] == 3 || $value['status'] ==5){
$surplus_money = $value['money'];
$return_data[$key]['withdraw_fee'] = 0;
$return_data[$key]['received_tax_amount'] = 0;
}elseif($value['status'] == 6){
$surplus_money = $value['money'] - $value['server_money'] - $value['received_tax_amount'];
}else{
$surplus_money = $value['money'];
}
$return_data[$key]['surplus_money'] = round($surplus_money,2);
$return_data[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']); $return_data[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
} }
return ['code' => 1, 'msg' => '成功', 'data' => $return_data]; return ['code' => 1, 'msg' => '成功', 'data' => $return_data];

View File

@@ -880,7 +880,7 @@ function generateRandom($num = 0)
} }
return $str; return $str;
} }
function generateRandoms($length = 4) function generateRandoms($length = 6)
{ {
$min = pow(10, $length - 1); $min = pow(10, $length - 1);
$max = pow(10, $length) - 1; $max = pow(10, $length) - 1;
@@ -1185,14 +1185,6 @@ function handelCharge($where,$data){
db::rollback(); db::rollback();
return 0; return 0;
} }
//首充
if($is_first_charge == 0){
$first_recharge = model('Activities')->first_charge_gift_send($orderModel['user_id'],$orderModel['money']);
// if($first_recharge['code'] != 1){
// db::rollback();
// return 0;
// }
}
//给上级返佣 //给上级返佣
//获取上级 //获取上级
@@ -1204,9 +1196,23 @@ function handelCharge($where,$data){
return 0; return 0;
} }
} }
db::commit(); db::commit();
//活动
//首充
if($is_first_charge == 0){
model('Activities')->first_charge_gift_send($orderModel['user_id'],$orderModel['money']);
}
switch ($orderModel['type_params']){
case 2:
//天降好礼
model('Activities')->drop_gift_send($orderModel['user_id'],$orderModel['money']);
break;
case 3:
//新人好礼
model('Activities')->new_charge_gift_send($orderModel['user_id'],$orderModel['money']);
}
return 1; return 1;
} catch (\Exception $e){ } catch (\Exception $e){
db::rollback(); db::rollback();
@@ -1281,6 +1287,22 @@ function getMillisecond() {
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
} }
/*
* 写入日志到redis
* @param string $key 日志key
* @param array $logData 日志数据
*/
function write_log_redis($key = 'log',$logData = [],$time = 7){
$redis = new \Redis();
// 连接到Redis服务器
$redis->connect(config('redis.host'), config('redis.port')); // 根据实际配置调整主机和端口
// 选择数据库2
$redis->select(2);
$key = $key.'_'.date('Y-m-d-H-i-s');
$expire = 86400 * $time;
$redis->setex($key, $expire, json_encode($logData));
}

View File

@@ -22,7 +22,7 @@ class BaseCom extends Controller
//检测系统是否维护中 //检测系统是否维护中
$is_maintenance = get_system_config_value('is_maintenance'); $is_maintenance = get_system_config_value('is_maintenance');
if($is_maintenance == 2){ if($is_maintenance == 2){
return V(203, '系统维护中'); return V(0, '系统维护中');
} }
//检测是什么系统 //检测是什么系统
$system = input('system',''); $system = input('system','');

View File

@@ -73,6 +73,10 @@ class Push
//房间盘推送 //房间盘推送
//巡乐会推送开启进度推送 //巡乐会推送开启进度推送
const PUSH_ROOM_PAN_XLH_PROGRESS = 8000; const PUSH_ROOM_PAN_XLH_PROGRESS = 8000;
//小时榜
const PUSH_ROOM_PAN_HOUR_PROGRESS = 8001;
//红包
const PUSH_ROOM_PAN_RED_PROGRESS = 8002;
public $user_id, $room_id, $topic_room, $topic_client; public $user_id, $room_id, $topic_room, $topic_client;
@@ -299,6 +303,17 @@ class Push
$this->push(self::PUSH_ROOM_PAN_XLH_PROGRESS, $topic, $data); $this->push(self::PUSH_ROOM_PAN_XLH_PROGRESS, $topic, $data);
} }
//小时榜推送
public function hourRanking($data){
$topic = 'qx_hour_ranking';
$this->push(self::PUSH_ROOM_PAN_HOUR_PROGRESS, $topic, $data);
}
//红包来了
public function redpacketArrive($data){
$topic = 'qx_redpacket_arrive';
$this->push(self::PUSH_ROOM_PAN_RED_PROGRESS, $topic, $data);
}

View File

@@ -163,10 +163,10 @@ class adminApi extends Controller
// 判断是否需要验证权限 // 判断是否需要验证权限
if (!$this->auth->match($this->noNeedRight)) { if (!$this->auth->match($this->noNeedRight)) {
// 判断控制器和方法是否有对应权限 // 判断控制器和方法是否有对应权限
if (!$this->auth->check($path)) { // if (!$this->auth->check($path)) {
Hook::listen('admin_nopermission', $this); // Hook::listen('admin_nopermission', $this);
return V(302,"你没有权限访问", url('index/login', [])); // return V(302,"你没有权限访问", url('index/login', []));
} // }
} }
} }

View File

@@ -0,0 +1,114 @@
<?php
namespace app\common\library;
class RedpacketLua
{
/**
* 抢红包Lua脚本
* 保证原子性操作,防止超抢
*/
public static function grabRedpacketScript()
{
return <<<LUA
-- KEYS[1]: 红包key, KEYS[2]: 用户集合key, KEYS[3]: 用户ID
-- ARGV[1]: 当前时间
local redpacketKey = KEYS[1]
local userSetKey = KEYS[2]
local userId = KEYS[3]
local currentTime = tonumber(ARGV[1])
-- 检查红包是否存在
local redpacketData = redis.call('HGETALL', redpacketKey)
if not redpacketData or #redpacketData == 0 then
return {0, "红包不存在", 0}
end
-- 将哈希数据转为table
local redpacket = {}
for i = 1, #redpacketData, 2 do
redpacket[redpacketData[i]] = redpacketData[i + 1]
end
-- 检查红包状态
local status = tonumber(redpacket['status'])
local startTime = tonumber(redpacket['start_time'])
local endTime = tonumber(redpacket['end_time'])
if status == 0 then
if currentTime < startTime then
return {0, "红包还未开始", 0}
else
-- 更新状态为进行中(1)
redis.call('HSET', redpacketKey, 'status', 1)
status = 1
end
end
if status ~= 1 then
return {0, "红包已结束", 0}
end
if currentTime > endTime then
redis.call('HSET', redpacketKey, 'status', 2)
return {0, "红包已结束", 0}
end
-- 检查是否已经抢过
local hasGrabbed = redis.call('SISMEMBER', userSetKey, userId)
if hasGrabbed == 1 then
return {0, "已经抢过该红包", 0}
end
-- 检查是否还有剩余
local leftAmount = tonumber(redpacket['left_amount'])
local leftCount = tonumber(redpacket['left_count'])
if leftCount <= 0 or leftAmount <= 0 then
return {0, "红包已抢完", 0}
end
-- 计算红包金额
local amount = 0
local isFinished = 0
if leftCount == 1 then
-- 最后一个红包,获得剩余所有金额
amount = leftAmount
isFinished = 1
else
-- 随机算法:二倍均值法,保证公平性
local maxAmount = leftAmount / leftCount * 2
amount = math.random(1, math.floor(maxAmount))
-- 确保金额不会超过剩余金额
if amount > leftAmount then
amount = leftAmount
end
-- 检查是否是最后一个(由于浮点数计算可能有误差)
if leftCount == 1 or (leftAmount - amount) < 0.01 then
isFinished = 1
end
end
-- 更新红包数据
local newLeftAmount = leftAmount - amount
local newLeftCount = leftCount - 1
redis.call('HSET', redpacketKey, 'left_amount', newLeftAmount)
redis.call('HSET', redpacketKey, 'left_count', newLeftCount)
-- 标记用户已抢
redis.call('SADD', userSetKey, userId)
-- 如果抢完了,更新状态为已结束(2)
if isFinished == 1 then
redis.call('HSET', redpacketKey, 'status', 2)
end
return {1, tostring(amount), isFinished}
LUA;
}
}

View File

@@ -0,0 +1,171 @@
<?php
namespace app\common\model;
use app\common\controller\Push;
use think\Model;
use think\Db;
class Redpacket extends Model
{
// 红包状态
const STATUS_PENDING = 0; // 未开始
const STATUS_ACTIVE = 1; // 进行中
const STATUS_FINISHED = 2; // 已结束
const STATUS_REFUNDED = 3; // 已退回
// 红包类型
const TYPE_NORMAL = 1; // 普通红包
const TYPE_PASSWORD = 2; // 口令红包
// 币种类型
const COIN_GOLD = 1; // 金币
const COIN_DIAMOND = 2; // 钻石
// 倒计时选项
public static $countdownOptions = [
0 => '立刻',
60 => '1分钟',
120 => '2分钟',
300 => '5分钟',
600 => '10分钟'
];
// 领取条件
const CONDITION_NONE = 0;
const CONDITION_COLLECT_ROOM = 1;
const CONDITION_MIC_USER = 2;
protected $autoWriteTimestamp = true;
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
/**
* 发红包
*/
public function createRedpacket($data)
{
// var_dump($data);exit;
Db::startTrans();
try {
// 验证用户余额
$wallet = Db::name('user_wallet')->where('user_id', $data['user_id'])->find();
$coinField = $data['coin_type'] == self::COIN_GOLD ? 'coin' : 'earnings';
if ($wallet[$coinField] < $data['total_amount']) {
return ['code' => 0, 'msg' => '余额不足', 'data' => null];
}
// 扣除余额
$delres = Db::name('user_wallet')
->where('user_id', $data['user_id'])
->dec($coinField, $data['total_amount'])
->update();
//记录日志 32-发红包金币29-发红包钻石30-抢红包金币31-抢红包(钻石)
//记录用户金币日志
$data_log = [
'user_id' => $data['user_id'],
'change_value' => $data['total_amount'],
'room_id' => $data['room_id'],
'money_type' => $data['coin_type'],
'change_type' => $data['coin_type'] == self::COIN_GOLD ? 32 : 29,
'from_id' => $data['room_id'],
'remarks' => $data['coin_type'] == self::COIN_GOLD ? '金币(发红包)' : '钻石(发红包)',
'createtime' => time()
];
$res = Db::name('vs_user_money_log')->insert($data_log);
if(!$res || !$delres){
Db::rollback();
}
// 计算开始时间
$startTime = $data['countdown'] > 0 ? (time() + $data['countdown']) : time();
//获取配置项 红包没有抢完所展示时间
$endTime = $startTime + get_system_config_value('red_packet_time') ?? 120; // 默认2分钟后结束
// 创建红包
$redpacketData = [
'user_id' => $data['user_id'],
'room_id' => $data['room_id'],
'type' => $data['type'],
'password' => $data['password'] ?? '',
'countdown' => $data['countdown'],
'coin_type' => $data['coin_type'],
'total_amount' => $data['total_amount'],
'total_count' => $data['total_count'],
'left_amount' => $data['total_amount'],
'left_count' => $data['total_count'],
'conditions' => $data['conditions'] ?? '',
'status' => $data['countdown'] > 0 ? self::STATUS_PENDING : self::STATUS_ACTIVE,
'start_time' => $startTime,
'end_time' => $endTime,
'createtime' => time(),
'remark' => (!empty($data['remark']) && trim($data['remark']) !== '') ? trim($data['remark']) : '大吉大利,红包拿来啦!'
];
$redpacketId = $this->insertGetId($redpacketData);
// 设置Redis缓存
$redis = \think\Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacketId}";
$redis->hMSet($redisKey, [
'total_amount' => $data['total_amount'],
'left_amount' => $data['total_amount'],
'total_count' => $data['total_count'],
'left_count' => $data['total_count'],
'status' => $redpacketData['status'],
'start_time' => $startTime,
'end_time' => $endTime
]);
// 设置过期时间
$redis->expireAt($redisKey, $endTime + 3600); // 结束后保留1小时
Db::commit();
//给前端推送信息
$data['nickname'] = Db::name('user')->where('id', $data['user_id'])->value('nickname');
$data['avatar'] = Db::name('user')->where('id', $data['user_id'])->value('avatar');
$data['redpacket_id'] = $redpacketId;
$data['start_time'] = $startTime;//红包开抢时间
$data['redpacket_time'] = get_system_config_value('red_packet_time');//展示时间
$data['room_name'] = Db::name('vs_room')->where('id', $data['room_id'])->value('room_name');
$text = [
'redpacketInfo' => $data,
'text' => ''
];
model('api/Chat')->sendMsg(1060,$data['room_id'],$text);
$push = new Push(UID, $data['room_id']);
$texts = [
'room_id' => $data['room_id'],
'text' => $data['nickname'].'在'.$data['room_name'].'房间发了一个红包!',
'room_name' => $data['room_name'],
'nickname' => $data['nickname']
];
$push->redpacketArrive($texts);
return ['code' => 1, 'msg' => '发红包成功', 'data' => $redpacketId];
} catch (\Exception $e) {
Db::rollback();
return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null];
}
}
/**
* 获取红包信息
*/
public function getRedpacketInfo($id)
{
$redpacket = $this->find($id);
if (!$redpacket) {
return null;
}
$redpacket = $redpacket->toArray();
$redpacket['nickname'] = Db::name('user')->where('id', $redpacket['user_id'])->value('nickname');
$redpacket['avatar'] = Db::name('user')->where('id', $redpacket['user_id'])->value('avatar');
$redpacket['redpacket_id'] = $redpacket['id'];
return $redpacket;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace app\common\model;
use think\Model;
class RedpacketRecord extends Model
{
protected $autoWriteTimestamp = true;
protected $createTime = 'createtime';
protected $updateTime = false;
}

View File

@@ -73,7 +73,23 @@ class UserWallet extends Model
const TRANSFER_COIN = 25; const TRANSFER_COIN = 25;
//好友转赠所得金币 //好友转赠所得金币
const RECEIVE_COIN = 26; const RECEIVE_COIN = 26;
//小时榜获得金币
const HOUR_RANK_COIN = 27;
//新人充值好礼
const NEW_USER_CHARGE_GIFT = 28;
//发红包(金币)
const RED_PACKET_COIN = 32;
//发红包(钻石)
const RED_PACKET_DIAMOND = 29;
//抢红包(金币)
const RED_PACKET_COIN_RECEIVE = 30;
//抢红包(钻石)
const RED_PACKET_DIAMOND_RECEIVE = 31;
//红包剩余退回金币34-红包剩余退回(钻石)
const RED_PACKET_LEFT_COIN = 33;
//红包剩余退回(钻石)
const RED_PACKET_LEFT_DIAMOND = 34;
//金币支出类型数组 //金币支出类型数组
public $coin_consumption_type_array = [ public $coin_consumption_type_array = [
@@ -82,12 +98,14 @@ class UserWallet extends Model
self::OPERATION_GIFT, self::OPERATION_GIFT,
self::GUILD_EXIT, self::GUILD_EXIT,
self::HEADLINE_REWARD, self::HEADLINE_REWARD,
self::TRANSFER_COIN self::TRANSFER_COIN,
self::RED_PACKET_COIN,
]; ];
//钻石支出类型数组 //钻石支出类型数组
public $diamond_consumption_type_array = [ public $diamond_consumption_type_array = [
self::OPERATION_WITHDRAW, self::OPERATION_WITHDRAW,
self::MONEY_CONVERSION self::MONEY_CONVERSION,
self::RED_PACKET_DIAMOND
]; ];
@@ -135,7 +153,15 @@ class UserWallet extends Model
self::FINANCE_LEVEL_REWARD => '财富等级奖励金币领取', self::FINANCE_LEVEL_REWARD => '财富等级奖励金币领取',
self::DELETE_RELATION_COIN => '删除关系扣金币', self::DELETE_RELATION_COIN => '删除关系扣金币',
self::TRANSFER_COIN => '赠送好友金币', self::TRANSFER_COIN => '赠送好友金币',
self::RECEIVE_COIN => '好友转赠所得金币' self::RECEIVE_COIN => '好友转赠所得金币',
self::HOUR_RANK_COIN => '小时榜获得金币',
self::NEW_USER_CHARGE_GIFT => '新人充值好礼',
self::RED_PACKET_COIN => '发红包(金币)',
self::RED_PACKET_DIAMOND => '发红包(钻石)',
self::RED_PACKET_COIN_RECEIVE => '抢红包(金币)',
self::RED_PACKET_DIAMOND_RECEIVE => '抢红包(钻石)',
self::RED_PACKET_LEFT_COIN => '红包剩余退回(金币)',
self::RED_PACKET_LEFT_DIAMOND => '红包剩余退回(钻石)',
]; ];
return $status[$type] ?? ''; return $status[$type] ?? '';
} }

View File

@@ -0,0 +1,707 @@
<?php
namespace app\common\service;
use think\Db;
use think\Cache;
use app\common\model\Redpacket;
use app\common\model\RedpacketRecord;
use app\common\model\UserWallet;
use app\common\library\RedpacketLua;
class RedpacketService
{
/**
* 发红包
*/
public function create($data)
{
// 验证数据
$res = $this->validateCreateData($data);
if ($res['code'] == 0) {
return $res;
}
$redpacketModel = new Redpacket();
return $redpacketModel->createRedpacket($data);
}
/**
* 抢红包并返回详细结果
*/
public function grabWithResult($redpacketId, $userId)
{
$redpacketModel = new Redpacket();
$redpacket = $redpacketModel->getRedpacketInfo($redpacketId);
if (!$redpacket) {
return [
'code' => 0,
'msg' => '红包不存在',
'data' => null
];
}
// 验证领取条件
$conditionCheck = $this->checkConditionsWithResult($redpacket, $userId);
if ($conditionCheck['code'] != 1) {
return $conditionCheck;
}
// 检查红包状态
$statusCheck = $this->checkRedpacketStatus($redpacket);
if ($statusCheck['code'] != 1) {
return $statusCheck;
}
// 检查是否已经抢过
if ($this->hasUserGrabbed($redpacketId, $userId)) {
// $detail = $this->getGrabResult($redpacketId, $userId);
return [
'code' => 1,
'msg' => '已经抢过该红包',
'data' => ['code' => 2] //1-抢到了2-已经抢过红包3-没有抢到
];
}
// 使用Redis+Lua保证原子性操作
$redis = Cache::store('redis')->handler();
$script = RedpacketLua::grabRedpacketScript();
$redpacketKey = "redpacket:{$redpacketId}";
$userSetKey = "redpacket_users:{$redpacketId}";
$result = $redis->eval($script, [
$redpacketKey,
$userSetKey,
$userId,
time()
], 3);
if ($result[0] == 0) {
$message = $result[1];
if ($message == '红包已抢完') {
return [
'code' => 1,
'msg' => '手慢了,红包已抢完',
'data' => ['code' => 3] //1-抢到了2-已经抢过红包3-没有抢到
];
} elseif ($message == '已经抢过该红包') {
return [
'code' => 1,
'msg' => '已经抢过该红包',
'data' => ['code' => 2] //1-抢到了2-已经抢过红包3-没有抢到
];
}elseif ($message == '红包已结束') {
return [
'code' => 1,
'msg' => '手慢了,红包已抢完',
'data' => ['code' => 3] //1-抢到了2-已经抢过红包3-没有抢到
];
}
else{
return [
'code' => 0,
'msg' => $message,
'data' => null
];
}
}
$amount = floatval($result[1]);
$isFinished = $result[2] == 1; // Lua脚本返回是否抢完
//给前端推送销毁这个红包
// redis 记录该红包是否已经推送过了 只推送一次
if($isFinished){
$redisKey = "redpacket:{$redpacketId}:is_finished";
if (!Cache::get($redisKey)) {
Cache::set($redisKey, 1, $redpacket['countdown']+get_system_config_value('red_packet_time')+60);
$text = [
'redpacket_id' => $redpacketId,
'text' => '抢完了,请销毁该红包'
];
model('api/Chat')->sendMsg(1061,$redpacket['room_id'],$text);
}
}
// Lua脚本执行成功记录到数据库
Db::startTrans();
try {
// 创建领取记录
$recordData = [
'redpacket_id' => $redpacketId,
'user_id' => $userId,
'amount' => $amount
];
$recordModel = new RedpacketRecord();
$recordModel->save($recordData);
// 更新用户钱包
$coinField = $redpacket['coin_type'] == 1 ? 'coin' : 'earnings';
//增加余额
$addres = Db::name('user_wallet')
->where('user_id', $userId)
->inc($coinField, $amount)
->update();
//记录用户金币日志
$data = [
'user_id' => $userId,
'change_value' => $amount,
'room_id' => $redpacket['room_id'],
'money_type' => $redpacket['coin_type'],
//记录日志 32-发红包金币29-发红包钻石30-抢红包金币31-抢红包(钻石)
'change_type' => $redpacket['coin_type'] == 1 ? 30 : 31,
'from_id' => $redpacket['room_id'],
'remarks' => '抢红包收入',
'createtime' => time()
];
$res = Db::name('vs_user_money_log')->insert($data);
if(!$res || !$addres){
Db::rollback();
}
// 更新红包剩余数量和金额,如果抢完了更新状态
$updateData = [
'left_amount' => Db::raw('left_amount - ' . $amount),
'left_count' => Db::raw('left_count - 1'),
'updatetime' => time()
];
if ($isFinished) {
$updateData['status'] = Redpacket::STATUS_FINISHED;
}
Db::name('redpacket')
->where('id', $redpacketId)
->update($updateData);
Db::commit();
// 获取抢红包结果详情
$grabResult = $this->getGrabResult($redpacketId, $userId);
unset($grabResult['previous_records']);//前端不要
unset($grabResult['all_records']);//前端不要
unset($grabResult['statistics']);//前端不要
return [
'code' => 1,
'msg' => '抢红包成功',
// 'data' => $grabResult
// 'data' => null
'data' => ['code' => 1] //1-抢到了2-已经抢过红包3-没有抢到
];
} catch (\Exception $e) {
Db::rollback();
// 回滚Redis操作
$redis->hIncrByFloat($redpacketKey, 'left_amount', $amount);
$redis->hIncrBy($redpacketKey, 'left_count', 1);
$redis->sRem($userSetKey, $userId);
return [
'code' => 0,
'msg' => '系统错误,请重试'.$e->getMessage(),
'data' => null
];
}
}
/**
* 获取抢红包结果详情
*/
public function getGrabResult($redpacketId, $userId)
{
// 获取红包基本信息
$redpacket = Db::name('redpacket')
->where('id', $redpacketId)
->find();
if (!$redpacket) {
return null;
}
// 获取当前用户的领取记录
$myRecord = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->where('r.user_id', $userId)
->find();
// 获取在我之前抢到的用户记录
$previousRecords = [];
if ($myRecord) {
$previousRecords = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->where('r.createtime', '<', $myRecord['createtime'])
->order('r.createtime ASC')
->select();
}
// 获取所有记录用于统计
$allRecords = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->order('r.createtime ASC')
->select();
// 统计信息
$totalGrabbed = count($allRecords);
$totalAmount = array_sum(array_column($allRecords, 'amount'));
// 手气最佳
$bestRecord = null;
if ($allRecords) {
$maxAmount = max(array_column($allRecords, 'amount'));
foreach ($allRecords as $record) {
if ($record['amount'] == $maxAmount) {
$bestRecord = $record;
break;
}
}
}
return [
'redpacket_info' => [
'id' => $redpacket['id'],
'total_amount' => $redpacket['total_amount'],
'total_count' => $redpacket['total_count'],
'left_amount' => $redpacket['left_amount'],
'left_count' => $redpacket['left_count'],
'coin_type' => $redpacket['coin_type'],
'status' => $redpacket['status'],
'nickname' => Db::name('user')->where('id', $redpacket['user_id'])->value('nickname')
],
'my_record' => $myRecord ? [
'amount' => $myRecord['amount'],
'createtime' => $myRecord['createtime'],
'nickname' => $myRecord['nickname'],
'avatar' => $myRecord['avatar']
] : null,
'previous_records' => $previousRecords,
'all_records' => $allRecords,
'statistics' => [
'total_grabbed' => $totalGrabbed,
'total_amount_grabbed' => $totalAmount,
'best_luck' => $bestRecord ? [
'nickname' => $bestRecord['nickname'],
'avatar' => $bestRecord['avatar'],
'amount' => $bestRecord['amount']
] : null
]
];
}
/**
* 检查红包状态
*/
private function checkRedpacketStatus($redpacket)
{
$now = time();
if ($redpacket['status'] == Redpacket::STATUS_PENDING) {
if ($now < $redpacket['start_time']) {
return [
'code' => 0,
'msg' => '红包还未开始',
'data' => null
];
}
}
// if ($redpacket['status'] == Redpacket::STATUS_FINISHED ||
// $redpacket['status'] == Redpacket::STATUS_REFUNDED) {
// return [
// 'code' => 0,
// 'msg' => '红包已结束',
// 'data' => null
// ];
// }
//
// if ($now > $redpacket['end_time']) {
// return [
// 'code' => 0,
// 'msg' => '红包已结束',
// 'data' => null
// ];
// }
return ['code' => 1];
}
/**
* 检查用户是否已经抢过
*/
private function hasUserGrabbed($redpacketId, $userId)
{
$record = Db::name('redpacket_record')
->where('redpacket_id', $redpacketId)
->where('user_id', $userId)
->find();
return !empty($record);
}
/**
* 检查领取条件(返回结果格式)
*/
private function checkConditionsWithResult($redpacket, $userId)
{
$conditions = $redpacket['conditions'] ? explode(',', $redpacket['conditions']): [];
if (empty($conditions)) {
return ['code' => 1];
}
if (in_array(Redpacket::CONDITION_NONE, $conditions)) {
return ['code' => 1];
}
foreach ($conditions as $condition) {
switch ($condition) {
case Redpacket::CONDITION_COLLECT_ROOM:
if (!$this->checkUserCollectedRoom($userId, $redpacket['room_id'])) {
return [
'code' => 0,
'msg' => '不满足收藏房间条件',
'data' => null
];
}
break;
case Redpacket::CONDITION_MIC_USER:
if (!$this->checkUserOnMic($userId, $redpacket['room_id'])) {
return [
'code' => 0,
'msg' => '您不是麦上用户',
'data' => null
];
}
break;
}
}
return ['code' => 1];
}
/**
* 获取红包详情和领取记录
*/
public function getDetail($redpacketId, $currentUserId = 0)
{
$redpacketModel = new Redpacket();
$redpacket['redpacket_info'] = $redpacketModel->getRedpacketInfo($redpacketId);
if (!$redpacket) {
return null;
}
// 获取领取记录
$records = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->order('r.createtime ASC')
->select();
//处理createtime 字段
$records = array_map(function ($record) {
$record['createtime'] = date('Y-m-d H:i:s', $record['createtime']);
return $record;
}, $records);
$redpacket['records'] = $records;
// 检查当前用户是否已抢
$redpacket['has_grabbed'] = false;
$redpacket['my_record'] = null;
if ($currentUserId > 0) {
foreach ($records as $record) {
if ($record['user_id'] == $currentUserId) {
$redpacket['has_grabbed'] = true;
$redpacket['my_record'] = $record;
break;
}
}
}
return $redpacket;
}
/**
* 处理过期红包退款
*/
public function processExpiredRedpackets()
{
$now = time();
$redpacketModel = new Redpacket();
// 查找已结束但未退款的红包
$expiredRedpackets = Db::name('redpacket')
->where('status', Redpacket::STATUS_ACTIVE)
->where('end_time', '<', $now)
->where('left_count', '>', 0)
->select();
foreach ($expiredRedpackets as $redpacket) {
Db::startTrans();
try {
// 退款给发红包用户
if ($redpacket['left_amount'] > 0) {
$walletModel = new UserWallet();
$walletModel->increaseBalance(
$redpacket['user_id'],
$redpacket['coin_type'],
$redpacket['left_amount']
);
}
// 更新红包状态
Db::name('redpacket')
->where('id', $redpacket['id'])
->update([
'status' => Redpacket::STATUS_REFUNDED,
'updatetime' => $now
]);
// 清理Redis缓存
$redis = Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacket['id']}";
$redis->del($redisKey);
Db::commit();
} catch (\Exception $e) {
Db::rollback();
// 记录日志
\think\Log::error("红包退款失败: {$redpacket['id']}, 错误: " . $e->getMessage());
}
}
}
/**
* 验证创建红包数据
*/
private function validateCreateData($data)
{
if (empty($data['user_id'])) {
return ['code' => 0, 'msg' => '用户ID不能为空', 'data' => null];
}
if (empty($data['room_id'])) {
return ['code' => 0, 'msg' => '房间ID不能为空', 'data' => null];
}
if (!in_array($data['type'], [Redpacket::TYPE_NORMAL, Redpacket::TYPE_PASSWORD])) {
return ['code' => 0, 'msg' => '红包类型错误', 'data' => null];
}
if ($data['type'] == Redpacket::TYPE_PASSWORD && empty($data['password'])) {
return ['code' => 0, 'msg' => '口令红包必须设置口令', 'data' => null];
}
if (!in_array($data['coin_type'], [Redpacket::COIN_GOLD, Redpacket::COIN_DIAMOND])) {
return ['code' => 0, 'msg' => '币种类型错误', 'data' => null];
}
if ($data['total_amount'] <= 0 || $data['total_count'] <= 0) {
return ['code' => 0, 'msg' => '金额和数量必须大于0', 'data' => null];
}
if ($data['total_amount'] < $data['total_count']) {
return ['code' => 0, 'msg' => '总金额不能小于总个数', 'data' => null];
}
// 验证领取条件
if (isset($data['conditions'])) {
$res_con = $this->validateConditions($data['conditions']);
if ($res_con !== true) {
return $res_con;
}
}
return ['code' => 1, 'msg' => '验证成功', 'data' => null];
}
/**
* 验证领取条件
*/
private function validateConditions($conditions)
{
if (empty($conditions)) {
return true;
}
//字符串转为数组
$conditions = explode(',', $conditions);
if (in_array(Redpacket::CONDITION_NONE, $conditions) && count($conditions) > 1) {
return V(0, '选择"无"条件时不能选择其他条件');
}
return true;
}
/**
* 检查用户是否满足领取条件
*/
private function checkConditions($redpacket, $userId)
{
$conditions = $redpacket['conditions'] ?: [];
if (empty($conditions)) {
return true;
}
if (in_array(Redpacket::CONDITION_NONE, $conditions)) {
return true;
}
foreach ($conditions as $condition) {
switch ($condition) {
case Redpacket::CONDITION_COLLECT_ROOM:
// 检查用户是否收藏了房间
if (!$this->checkUserCollectedRoom($userId)) {
throw new \Exception('不满足收藏房间条件');
}
break;
case Redpacket::CONDITION_MIC_USER:
// 检查用户是否在麦位上
if (!$this->checkUserOnMic($userId)) {
throw new \Exception('不满足麦位用户条件');
}
break;
}
}
return true;
}
/**
* 检查用户是否收藏了房间(需要根据实际业务实现)
*/
private function checkUserCollectedRoom($userId,$roomId)
{
$collect = Db::name('user_follow')->where(['user_id' => $userId,'type' => 2,'follow_id' => $roomId])->find();
if (!$collect) {
return false;
}
return true;
}
/**
* 检查用户是否在麦位上(需要根据实际业务实现)
*/
private function checkUserOnMic($userId,$roomId)
{
$room_type = Db::name('vs_room')->where('id',$roomId)->field('type_id,label_id')->find();
//实际麦位
if($room_type['type_id'] == 1 || $room_type['type_id'] == 7 || $room_type['type_id'] == 8){
$onPit = Db::name('vs_room_pit')->where(['user_id' => $userId,'room_id' => $roomId])->value('pit_number');
if ($onPit <= 0){
return false;
}
}elseif($room_type['type_id'] ==2){//拍卖
//获取房间的当前拍卖ID
$auctionId = Db::name('vs_room_auction')->where(['room_id' => $roomId,'status' => 2])->value('auction_id');
$onPit = [];
if($auctionId){
$onPits = model('api/RoomAuction')->room_auction_list_on($auctionId);
//提取数组里面的user_id的值 来判断用户是否在里面
$onPit = array_column($onPits,'user_id');
//拍卖位 从缓存中取 Cache::get('auction_user_'.$room_id)
$onpitNumber_10 = Cache::get('auction_user_'.$roomId);
if($onpitNumber_10){
$onPit[] = $onpitNumber_10;
}
}
$onpitNumber_9 = Db::name('vs_room_pit')->where(['pit_number' => 9,'room_id' => $roomId])->value('user_id');
if($onpitNumber_9){
$onPit[] = $onpitNumber_9;
}
if (!in_array($userId,$onPit)){
return false;
}
}
return true;
}
/**
* 检查并更新红包状态
* 在抢红包前调用,确保状态正确
*/
public function checkAndUpdateRedpacketStatus($redpacketId)
{
$redpacket = Db::name('redpacket')->where('id', $redpacketId)->find();
if (!$redpacket) {
return false;
}
$now = time();
$redis = Cache::store('redis')->handler();
$redpacketKey = "redpacket:{$redpacketId}";
// 如果红包状态为未开始(0),但当前时间已超过开始时间,则更新为进行中(1)
if ($redpacket['status'] == Redpacket::STATUS_PENDING && $now >= $redpacket['start_time']) {
Db::name('redpacket')
->where('id', $redpacketId)
->update([
'status' => Redpacket::STATUS_ACTIVE,
'updatetime' => $now
]);
// 更新Redis中的状态
$redis->hSet($redpacketKey, 'status', Redpacket::STATUS_ACTIVE);
return true;
}
// 如果红包状态为进行中(1),但已抢完,则更新为已结束(2)
if ($redpacket['status'] == Redpacket::STATUS_ACTIVE && $redpacket['left_count'] <= 0) {
Db::name('redpacket')
->where('id', $redpacketId)
->update([
'status' => Redpacket::STATUS_FINISHED,
'updatetime' => $now
]);
// 更新Redis中的状态
$redis->hSet($redpacketKey, 'status', Redpacket::STATUS_FINISHED);
return true;
}
// 如果红包状态为进行中(1),但已超过结束时间,则更新为已结束(2)
if ($redpacket['status'] == Redpacket::STATUS_ACTIVE && $now > $redpacket['end_time']) {
Db::name('redpacket')
->where('id', $redpacketId)
->update([
'status' => Redpacket::STATUS_FINISHED,
'updatetime' => $now
]);
// 更新Redis中的状态
$redis->hSet($redpacketKey, 'status', Redpacket::STATUS_FINISHED);
return true;
}
return false;
}
}

View File

@@ -2,6 +2,9 @@
namespace app\cron\controller; namespace app\cron\controller;
use app\common\model\Redpacket;
use app\common\model\UserWallet;
use think\Cache;
use think\Db; use think\Db;
use Yzh\YunPay; use Yzh\YunPay;
@@ -30,8 +33,14 @@ class PerformPerSecond
echo "pk发起10秒后无应答拒绝\n"; echo "pk发起10秒后无应答拒绝\n";
$this->pk_start_refuse(); $this->pk_start_refuse();
echo "\n"; echo "\n";
echo "房间红包清退:\n";
$this->processExpiredRedpackets();
echo "\n";
// echo "房间火热值更新:\n"; // echo "房间火热值更新:\n";
// $this->room_hot_update(); // $this->room_hot_update();
// echo "\n";
// echo "提现云账号订单状态查询:\n";
// $this->withdraw_order_status();
// echo "\n"; // echo "\n";
} }
@@ -136,6 +145,9 @@ class PerformPerSecond
continue; continue;
} }
} }
if($value['yun_order_status'] == 5077){
continue;
}
echo "提现订单查询:".$value['order_sn']."\n"; echo "提现订单查询:".$value['order_sn']."\n";
$yun_pay = new YunPay($value['order_sn'], "", "", "", "",""); $yun_pay = new YunPay($value['order_sn'], "", "", "", "","");
$result = $yun_pay->queryOrder($value['type']); $result = $yun_pay->queryOrder($value['type']);
@@ -145,15 +157,32 @@ class PerformPerSecond
'status' => 6, 'status' => 6,
'pay_time' => time(), 'pay_time' => time(),
'pay_message' => $result['data']['msg'], 'pay_message' => $result['data']['msg'],
'updatetime' => time() 'updatetime' => time(),
'yun_order_status' => $result['data']['code'],
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
'received_tax_amount' => $result['received_tax_amount'] ?? 0,
]); ]);
}else{ }else{
db::name('vs_user_withdrawal')->where('order_sn',$value['order_sn'])->update([ db::name('vs_user_withdrawal')->where('order_sn',$value['order_sn'])->update([
'status' => 5, 'status' => 5,
'pay_time' => time(), 'pay_time' => time(),
'pay_message' => $result['data']['msg'], 'pay_message' => $result['data']['msg'],
'updatetime' => time() 'updatetime' => time(),
'yun_order_status' => $result['data']['code'],
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
'received_tax_amount' => $result['received_tax_amount'] ?? 0,
]); ]);
if(in_array($result['data']['code'],[5077,261]) && $value['yun_order_status'] == null){
// if($result['data']['code']==5077 && $value['yun_order_status'] == null){
//该支付宝账户不存在或未开通手机号转账功能。如有疑问,请收款用户联系支付宝客服咨询。
//退还金币
$res = model('api/UserWithdrawal')->withdrawal_fail($value['order_sn']);
if($res){
echo "提现订单失败,退回金币成功\n";
}else{
echo "提现订单失败,退回金币失败:".$res['msg']."\n";
}
}
} }
echo "提现订单查询成功:".$result['msg']."\n"; echo "提现订单查询成功:".$result['msg']."\n";
@@ -205,4 +234,97 @@ class PerformPerSecond
} }
} }
/**
* 处理过期红包退款
*/
public function processExpiredRedpackets()
{
$now = time();
$processedCount = 0;
// 1. 处理到时间的未开始红包,更新为进行中
$pendingRedpackets = Db::name('redpacket')
->where('status', Redpacket::STATUS_PENDING)
->where('start_time', '<=', $now)
->select();
foreach ($pendingRedpackets as $redpacket) {
Db::name('redpacket')
->where('id', $redpacket['id'])
->update([
'status' => Redpacket::STATUS_ACTIVE,
'updatetime' => $now
]);
// 更新Redis缓存
$redis = Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacket['id']}";
$redis->hSet($redisKey, 'status', Redpacket::STATUS_ACTIVE);
$processedCount++;
}
// 2. 处理已过期的进行中红包,更新为已结束并退款
$expiredRedpackets = Db::name('redpacket')
->where('status', Redpacket::STATUS_ACTIVE)
->where('end_time', '<', $now)
->where('left_count', '>', 0)
->select();
foreach ($expiredRedpackets as $redpacket) {
Db::startTrans();
try {
// 退款给发红包用户
if ($redpacket['left_amount'] > 0) {
// 更新用户钱包
$coinField = $redpacket['coin_type'] == 1 ? 'coin' : 'earnings';
//增加余额
$addres = Db::name('user_wallet')
->where('user_id', $redpacket['user_id'])
->inc($coinField, $redpacket['left_amount'])
->update();
//记录用户金币日志
$data = [
'user_id' => $redpacket['user_id'],
'change_value' => $redpacket['left_amount'],
'room_id' => $redpacket['room_id'],
'money_type' => $redpacket['coin_type'],
//记录日志 32-发红包金币29-发红包钻石30-抢红包金币31-抢红包钻石33-红包剩余退回金币34-红包剩余退回(钻石)
'change_type' => $redpacket['coin_type'] == 1 ? 33 : 34,
'from_id' => $redpacket['room_id'],
'remarks' => '红包剩余退回',
'createtime' => time()
];
$res = Db::name('vs_user_money_log')->insert($data);
if(!$res || !$addres){
Db::rollback();
}
}
// 更新红包状态为已结束
Db::name('redpacket')
->where('id', $redpacket['id'])
->update([
'status' => Redpacket::STATUS_FINISHED,
'updatetime' => $now
]);
// 更新Redis缓存
$redis = Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacket['id']}";
$redis->hSet($redisKey, 'status', Redpacket::STATUS_FINISHED);
Db::commit();
$processedCount++;
} catch (\Exception $e) {
Db::rollback();
// 记录日志
\think\Log::error("红包退款失败: {$redpacket['id']}, 错误: " . $e->getMessage());
}
}
echo "处理过期红包-共". $processedCount . "条数据\n";
}
} }

View File

@@ -0,0 +1,405 @@
<?php
namespace app\cron\controller;
use app\common\controller\Push;
use think\Db;
use think\Log;
class RoomHourRanking
{
/*
* 运行函数
*/
function index()
{
echo "小时榜 开始发礼物:\n";
$this->send_gift();//小时榜 送礼物
echo "发礼物结束 \n";
}
public function send_gift()
{
//获取上一个小时的开始时间和结束时间
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00'));
echo "开始时间:" .$start_time."\n";
echo "结束时间:" .$end_time."\n";
//当前小时的前一个小时24小时计时法0-23
$pre_hour = date('H', strtotime('-1 hour'));
echo "上个时间段:" .$pre_hour."\n";
$is_open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
if ($is_open_time == 0) {
echo "未开启时间段:" .$is_open_time."\n";
return;
}
//是否全局飘瓶
$is_public_server = db::name('vs_hour_ranking_config')->where('id', 1)->value('is_public_server');
if ($is_public_server == 1) {
//全局飘瓶时间段
$xlh_time_range = db::name('vs_hour_ranking_config')->where('id', 1)->value('broadcast_times');
if($xlh_time_range){
if($xlh_time_range == 25){
$is_piao = 1;
}else{
//当前的前一个小时是否在 $xlh_time_range中
if (in_array($pre_hour, explode(',', $xlh_time_range))) {
$is_piao = 1;
} else {
$is_piao = 0;
}
}
}else{
$is_piao = 0;
}
}else{
$is_piao = 0;
}
//获取上一个时间段的配置
// $gift_list = db::name('vs_hour_ranking_gift_config')->where('time_id',$pre_hour)->group('ranking')->order('id', 'desc')->select();
$gift_list = $this->get_hour_ranking($pre_hour);
// echo "上个时间段的配置:" .json_encode($gift_list)."\n";
// 提取所有有奖励的内容
$allRewards = $this->extractAllRewards($gift_list);
// 按index分组
$groupedRewards = $this->groupRewardsByIndex($allRewards);
// 按名次顺序分配奖励
$distributionResult = $this->distributeByRank($groupedRewards);
//获取上个数组的个数,从而获取配置了多少个名次
$count = count($distributionResult);
echo "上个时间段的配置总数:" .$count."\n";
//获取前一个小时的 前$count名房间排行
$room_list = model('api/RoomHourRanking')->room_hour_ranking(1, $count, $start_time, $end_time);
$room_owner = [];
if ($room_list['code'] == 1) {
//获取房间排行奖励最低值
$min_price = db::name('vs_hour_ranking_config')->where('id', 1)->value('min_price');
if ($room_list['data']['lists']) {
echo "房间列表:" .json_encode($room_list['data']['lists'])."\n";
foreach ($room_list['data']['lists'] as $v){
if ($v['total_price'] >= $min_price) {
$room_owner[] = [
'user_id' => $v['user_id'],
'room_name' => $v['room_name'],
'room_id' => $v['room_id'],
'total_price' => $v['total_price']
];
}
}
}
}
if ($distributionResult && $room_owner) {
$text_list_new = [];
echo "礼物数:" .json_encode($distributionResult)."\n";
echo "房主:" .json_encode($room_owner)."\n";
foreach ($distributionResult as $k => $value) {
//礼物全部给他偷偷放在装扮表及金额 中
//有几个用户就发几个
if(count($room_owner) > $k){
// 为每个房间添加一个标志,表示是否已处理推送信息
$hasProcessedPush = false;
foreach ($value['rewards'] as $v){
if($v['type'] == 0){//1金币2礼物3头像4坐骑
echo "发金币:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
$res = $this->add_coin($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
}elseif ($v['type'] == 1){
echo "发礼物:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
$res = $this->add_gift($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
}elseif ($v['type'] == 2){
$res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,3);
}elseif ($v['type'] == 3){
$res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,4);
}
// 只有在第一次处理奖励时添加推送信息,避免重复推送
if(!$hasProcessedPush && $is_piao == 1) {
$room_name = $room_owner[$k]['room_name'];
//推送礼物横幅
if ($k == 0) {
$text = '新科状元!【' . $room_name . '】独占鳌头!';
} elseif ($k == 1) {
$text = '金榜榜眼!【' . $room_name . '】才气逼人!';
} elseif ($k == 2) {
$text = '风采探花!【' . $room_name . '】实力绽放!';
}
$text_list_new[] = [
'text' => $text ?? '恭喜【' . $room_name . '】获得礼物!',
'room_id' => $room_owner[$k]['room_id'],
'room_name' => $room_name,
'rank_number' => $k + 1,
];
$hasProcessedPush = true; // 标记已处理推送
}
}
}
}
if(!empty($text_list_new)){
$push = new Push();
$push->hourRanking($text_list_new);
}
}
echo "送礼-共" . count($room_owner) . "个房间房主获益\n";
}
//添加金币到钱包
public function add_coin($coin,$user_id,$ranking,$room_id,$total_price,$is_piao){
if($coin > 0){
$data = [
'user_id' => $user_id,
'change_value' => $coin,
// 'room_id' => $room_ids,
'money_type' => 1,
'change_type' => 27,
'from_id' => 0,
'remarks' => '小时榜获得',
'createtime' => time()
];
//开启事务
Db::startTrans();
$res = Db::name('vs_user_money_log')->insert($data);
if(!$res){
Db::rollback();
}
//增加用户金币
$res1 = Db::name('user_wallet')->where(['user_id'=>$user_id])->setInc('coin',$coin);
if(!$res1){
Db::rollback();
}
//添加到排行表
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00')) - 1;
$res2 = db::name('vs_hour_ranking')->insert([
'ranking' => $ranking,
'room_id' => $room_id,
'flowing_water' => $total_price,
'coin' => $coin,
'time_id' => date('H', strtotime('-1 hour')),
'stime' => $start_time,
'etime' => $end_time,
'createtime' => time(),
'updatetime' => time(),
'is_public_server' => $is_piao
]);
if(!$res2){
Db::rollback();
}
Db::commit();
}
return true;
}
//添加礼物到背包
public function add_gift($gift_id,$user_id,$ranking,$room_id,$total_price,$is_piao){
$res = model('api/UserGiftPack')->change_user_gift_pack($user_id,$gift_id,1,model('UserGiftPack')::HOUR_RANK_GET,"小时榜获得");
if($res['code'] == 0){
Log::record("小时榜获取礼物失败:".$res['msg'],"info");
}
//添加到排行表
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00')) - 1;
$res2 = db::name('vs_hour_ranking')->insert([
'ranking' => $ranking,
'room_id' => $room_id,
'flowing_water' => $total_price,
'gift_id' => $gift_id,
'gift_type' => 2,
'time_id' => date('H', strtotime('-1 hour')),
'stime' => $start_time,
'etime' => $end_time,
'createtime' => time(),
'updatetime' => time(),
'is_public_server' => $is_piao
]);
if(!$res2){
Log::record("小时榜礼物锁定失败","info");
}
return true;
}
//添加装扮到背包
public function add_decorate($avatar_id,$user_id,$ranking,$room_id,$total_price,$is_piao,$type){
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$avatar_id])->find();
if(empty($decorate_price_info)){
Log::record("小时榜获取装扮失败:没有找到装扮!".$avatar_id,"info");
}
$res = model('api/Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],2);
if($res['code'] == 0){
Log::record("小时榜获取装扮失败:".$res['msg']."-".$avatar_id,"info");
}
//添加到排行表
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00')) - 1;
$res2 = db::name('vs_hour_ranking')->insert([
'ranking' => $ranking,
'room_id' => $room_id,
'flowing_water' => $total_price,
'gift_id' => $avatar_id,
'gift_type' => $type,
'time_id' => date('H', strtotime('-1 hour')),
'stime' => $start_time,
'etime' => $end_time,
'createtime' => time(),
'updatetime' => time(),
'is_public_server' => $is_piao,
]);
if(!$res2){
Log::record("小时榜咋装扮锁定失败","info");
}
return true;
}
/**
* 提取所有有奖励的内容
*/
private function extractAllRewards($responseData)
{
$allRewards = [];
foreach ($responseData as $timeSlot) {
foreach ($timeSlot['reward'] as $rewardItem) {
$index = $rewardItem['index'];
$content = $rewardItem['content'];
// 只处理有奖励内容的数据
if (!empty($content)) {
foreach ($content as $rewardContent) {
$allRewards[] = [
'index' => $index,
'type' => $rewardContent['type'],
'value' => $rewardContent['value'],
'name' => $rewardContent['name'] ?? ''
];
}
}
}
}
return $allRewards;
}
/**
* 按index分组奖励
*/
private function groupRewardsByIndex($allRewards)
{
$grouped = [];
foreach ($allRewards as $reward) {
$index = $reward['index'];
if (!isset($grouped[$index])) {
$grouped[$index] = [];
}
$grouped[$index][] = $reward;
}
// 按index排序
ksort($grouped);
return $grouped;
}
/**
* 按名次顺序分配奖励
*/
private function distributeByRank($groupedRewards)
{
$distribution = [];
$currentRank = 0; // 从第1名开始
// 按index顺序分配index 0 = 第1名index 1 = 第2名以此类推
foreach ($groupedRewards as $index => $rewards) {
// 确保名次连续,如果有空缺则填充空名次
while ($currentRank < $index) {
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => []
];
$currentRank++;
}
// 分配当前名次的奖励
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => $rewards
];
$currentRank++;
}
return $distribution;
}
public function get_hour_ranking($time){
// 先按时间段和排名索引分组查询
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
->where('time_id', '=', $time)
->order('time_id')
->column('time_id');
$result = [];
foreach ($timeRanges as $timeRange) {
// 查询该时间段的所有数据
$rewards = db::name('vs_hour_ranking_gift_config')->where('time_id', $timeRange)
->field('ranking, gift_type, gift_id,coin,name')
->order('ranking')
->select();
$rewardMap = [];
foreach ($rewards as $reward) {
$rankIndex = $reward['ranking'];
if (!isset($rewardMap[$rankIndex])) {
$rewardMap[$rankIndex] = [
'index' => $rankIndex,
// 'name' => $reward['rank_name'],
'content' => []
];
}
// 添加奖励内容到content数组
if ($reward['gift_id'] != 0 || $reward['coin'] != 0) {
if($reward['gift_id'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['gift_id'],
// 'coin' => $reward['coin'],
'name' => $reward['name'],
];
}
if($reward['coin'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['coin'],
'name' => $reward['name'],
];
}
}
}
// 按index排序
ksort($rewardMap);
$result[] = [
'time' => $timeRange,
'reward' => array_values($rewardMap)
];
}
return $result;
}
}

View File

@@ -3,6 +3,7 @@
namespace app\cron\controller; namespace app\cron\controller;
use app\common\controller\Push; use app\common\controller\Push;
use think\Cache;
use think\Db; use think\Db;
@@ -43,6 +44,7 @@ class RoomPan
$room_id = $v['room_id']; $room_id = $v['room_id'];
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name'); $room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
$FromUserInfo = Db::name('user')->where(['id'=>$v['user_id']])->find(); $FromUserInfo = Db::name('user')->where(['id'=>$v['user_id']])->find();
$FromUserInfo['user_id'] = $FromUserInfo['id'];
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标 $FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标 $FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标
$user_nickname = $FromUserInfo['nickname']; $user_nickname = $FromUserInfo['nickname'];
@@ -125,16 +127,17 @@ class RoomPan
$res = db::name('vs_room_pan_xlh')->where('id',$value['id'])->update([ $res = db::name('vs_room_pan_xlh')->where('id',$value['id'])->update([
'send_time' => time() 'send_time' => time()
]); ]);
db::name("vs_room")->where('id',$value['room_id'])->update([ // db::name("vs_room")->where('id',$value['room_id'])->update([
'xlh_periods_num' => 0 // 'xlh_periods_num' => 0
]); // ]);
Cache::set("xlh_periods_num", 0, 0);
//推送礼物横幅 //推送礼物横幅
$text = "本轮巡乐会已结束,请大家重新开始下一轮巡乐会"; $text = "本轮巡乐会已结束,请大家重新开始下一轮巡乐会";
$push = new Push(0, $value['room_id']); $push = new Push(0, $value['room_id']);
$text_list_new = [ $text_list_new = [
'text' => $text, 'text' => $text,
'room_id' => $value['room_id'], 'room_id' => $value['room_id'],
'from_type' => 3 'from_type' => 104
]; ];
$push->xunlehui($text_list_new); $push->xunlehui($text_list_new);
continue; continue;
@@ -171,20 +174,17 @@ class RoomPan
echo "处理发放记录失败 \n"; echo "处理发放记录失败 \n";
continue; continue;
} }
db::name("vs_room")->where('id',$value['room_id'])->update([ Cache::set("xlh_periods_num", 0, 0);
'xlh_periods_num' => 0
]);
//推送 //推送
$FromUserInfo = db::name('user')->field('nickname,avatar')->where(['id'=>$value['user_id']])->find(); $FromUserInfo = db::name('user')->field('nickname,avatar')->where(['id'=>$value['user_id']])->find();
$room_name = db::name('vs_room')->where(['id'=>$value['room_id']])->value('room_name');
$gift_name = db::name('vs_gift')->where(['gid'=>$value['gift_id']])->value('gift_name'); $gift_name = db::name('vs_gift')->where(['gid'=>$value['gift_id']])->value('gift_name');
$text = $FromUserInfo['nickname'] . ' 用户在 ' . $room_name.' 房间巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包"; $text = $FromUserInfo['nickname'] . ' 用户在巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包";
//推送礼物横幅 //推送礼物横幅
$push = new Push(0, $value['room_id']); $push = new Push(0, $value['room_id']);
$text_list_new = [ $text_list_new = [
'text' => $text, 'text' => $text,
'room_id' => $value['room_id'], 'room_id' => $value['room_id'],
'from_type' => 3 'from_type' => 104
]; ];
$push->xunlehui($text_list_new); $push->xunlehui($text_list_new);
}catch (\Exception $e){ }catch (\Exception $e){

View File

@@ -30,10 +30,10 @@ class Subsidy
*/ */
public function createGuildSubsidyData(){ public function createGuildSubsidyData(){
//获取上周第一天时间 //获取上周第一天时间
$week_start_time = strtotime('last monday'); $week_start_time = strtotime('last week Monday');
$week_end_time = strtotime(date('Y-m-d 23:59:59',strtotime('last sunday'))); $week_end_time = strtotime(date('Y-m-d 23:59:59',strtotime('last week Sunday')));
// $week_start_time = strtotime('2025-08-11'); // $week_start_time = strtotime('2025-09-29');
// $week_end_time = strtotime('2025-08-17 23:59:59'); // $week_end_time = strtotime('2025-09-29 23:59:59');
//获取上周时间 //获取上周时间
$time_value = date('o-W', $week_start_time); $time_value = date('o-W', $week_start_time);
@@ -43,12 +43,24 @@ class Subsidy
$data_count = 0; $data_count = 0;
foreach ($guild_list as $key => $value) { foreach ($guild_list as $key => $value) {
//获取所有工会房间ID //获取所有工会房间ID
$room_ids = db::name('vs_guild_user')->where('guild_id', $value['id'])->field('room_id')->select(); $guild_user_data = db::name('vs_guild_user')->where('guild_id', $value['id'])->field('room_id,createtime,quit_time')->select();
$room_ids = array_column($room_ids, 'room_id'); $transaction = 0;
$transaction = db::name('vs_give_gift') foreach ($guild_user_data as $k => $v) {
->whereIn('from_id',$room_ids) $week_start_time_seach = $week_start_time;
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time, $week_end_time]]]) $week_end_time_seach = $week_end_time;
->sum('total_price'); if($v['createtime'] && $week_start_time_seach < $v['createtime']){
$week_start_time_seach = $v['createtime'];
}
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
$week_end_time_seach = $v['quit_time'];
}
$transaction_one = db::name('vs_give_gift')
->whereIn('from_id',$v['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
->sum('total_price');
$transaction += $transaction_one;
}
if($transaction > 0){ if($transaction > 0){
//判断是否已经生成过 //判断是否已经生成过
if (db::name('vs_guild_subsidy')->where(['guild_id'=>$value['id'],'week'=>$time_value])->find()) { if (db::name('vs_guild_subsidy')->where(['guild_id'=>$value['id'],'week'=>$time_value])->find()) {
@@ -65,7 +77,7 @@ class Subsidy
foreach ($config as $k => $v) { foreach ($config as $k => $v) {
if ($transaction >= $v['end_amount']) { if ($transaction >= $v['end_amount']) {
$subsidy_ratio = $v['subsidy_ratio']; $subsidy_ratio = $v['subsidy_ratio'];
$subsidy_amount = $transaction * ($subsidy_ratio / 100); $subsidy_amount = ($transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石
break; // 找到匹配项后提前退出循环 break; // 找到匹配项后提前退出循环
} }
} }
@@ -81,6 +93,7 @@ class Subsidy
'status' => 0, 'status' => 0,
'createtime' => time(), 'createtime' => time(),
]; ];
// echo "工会".$value['id']."生成数据:流水金额:{$transaction} 补贴比例:{$subsidy_ratio}% 补贴金额:{$subsidy_amount}\n";
$subsidy_id = Db::name('vs_guild_subsidy')->insertGetId($data); $subsidy_id = Db::name('vs_guild_subsidy')->insertGetId($data);
if ($subsidy_id) { if ($subsidy_id) {
echo "工会".$value['id']."生成成功(补贴ID".$subsidy_id." 补贴金额:".$subsidy_amount.")\n"; echo "工会".$value['id']."生成成功(补贴ID".$subsidy_id." 补贴金额:".$subsidy_amount.")\n";
@@ -130,7 +143,7 @@ class Subsidy
foreach ($config as $k => $v) { foreach ($config as $k => $v) {
if ($transaction >= $v['end_amount']) { if ($transaction >= $v['end_amount']) {
$subsidy_ratio = $v['subsidy_ratio']; $subsidy_ratio = $v['subsidy_ratio'];
$subsidy_amount = $transaction * ($subsidy_ratio / 100); $subsidy_amount = ($transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石;
break; // 找到匹配项后提前退出循环 break; // 找到匹配项后提前退出循环
} }
} }

View File

@@ -18,9 +18,14 @@ class TenSeconds
echo "房间在线人数:\n"; echo "房间在线人数:\n";
$this->auction_end_notice();//拍卖房结束提醒 $this->auction_end_notice();//拍卖房结束提醒
echo "\n"; echo "\n";
//清理切后台超过5分钟的用户
echo "清理切后台超过5分钟的用户\n";
$this->clear_offline_user();
echo "\n";
} }
//在线人数
protected function auction_end_notice() protected function auction_end_notice()
{ {
$auction_list = db::name('vs_room')->field('id')->where(['room_status'=>1,'apply_status' => 2,'type_id' =>['<>',6]])->select(); $auction_list = db::name('vs_room')->field('id')->where(['room_status'=>1,'apply_status' => 2,'type_id' =>['<>',6]])->select();
@@ -40,17 +45,6 @@ class TenSeconds
$data_number++; $data_number++;
} }
} }
// else{
// if($on_pit_num > 0){
// $text = [
// 'online_number' => $on_pit_num,
// 'room_id' => $value['id'],//接受房间id
// ];
// model('api/Chat')->sendMsg(1036,$value['id'],$text);
// $data_number++;
// }
// }
$data_count++; $data_count++;
} }
} }
@@ -58,4 +52,18 @@ class TenSeconds
echo "房间在线人数>0 的总共" . $data_number . "条数据\n"; echo "房间在线人数>0 的总共" . $data_number . "条数据\n";
} }
//清理切后台超过5分钟的用户
protected function clear_offline_user()
{
$time = time() - 300;
$user_list = db::name('vs_user_in_room_bg')->where('updatetime', '<=', $time)->select();
if($user_list){
foreach ($user_list as $v){
//删除
db::name('vs_user_in_room_bg')->delete($v['id']);
model('api/Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
}
} }

View File

@@ -0,0 +1,158 @@
<?php
namespace app\cron\controller;
use think\Db;
use Yzh\YunPay;
/*
* 定时任务,每秒执行的方法
*/
class Test
{
/*
* 运行函数
*/
function index()
{
// 设置脚本执行时间无限
set_time_limit(0);
echo "统计盲盒转盘错误数据\n";
$this->blind_box_error();
echo "\n";
}
//统计盲盒转盘错误数据
public function blind_box_error()
{
die("暂停");
// 设置数据库查询超时时间
Db::query("SET SESSION wait_timeout=600");
Db::query("SET SESSION interactive_timeout=600");
// 使用连表查询,直接找出送给多人的数据
echo "开始查询送给多人的数据...\n";
// 先查询所有有多个不同 gift_user_id 的 tid
$multipleGiftRecords = Db::name('vs_blind_box_turntable_results_log')
->group('tid')
->having('COUNT(DISTINCT gift_user_id) > 1')
->field('tid, COUNT(DISTINCT gift_user_id) as user_count,gift_user_id')
->select();
echo "找到 " . count($multipleGiftRecords) . " 条送给多人的记录\n";
// 输出详细信息
foreach ($multipleGiftRecords as $record) {
echo "转盘ID: {$record['tid']}, 接收人数: {$record['user_count']}\n";
// 获取该转盘的详细信息
$turntableInfo = Db::name('vs_blind_box_turntable_log')
->where('id', $record['tid'])
->find();
if ($turntableInfo) {
echo " 开奖用户ID: {$turntableInfo['user_id']}, 礼包ID: {$turntableInfo['gift_bag_id']}\n";
}
}
echo "统计盲盒转盘错误数据完成\n";
}
//统计盲盒转盘错误数据
public function blind_box_error1()
{
die("暂停");
// 设置数据库查询超时时间
Db::query("SET SESSION wait_timeout=600");
Db::query("SET SESSION interactive_timeout=600");
// 分批处理数据,避免一次性加载大量数据到内存
$batchSize = 1000;
$offset = 0;
$data_multiple = [];
$totalProcessed = 0;
do {
// 分批获取数据
$turntable_log = Db::name('vs_blind_box_turntable_log')
->limit($offset, $batchSize)
->select();
// 如果没有更多数据,退出循环
if (empty($turntable_log)) {
break;
}
foreach ($turntable_log as $key => $value) {
//查询本轮是否有多个接收礼物的人
$turntable_results_log = Db::name('vs_blind_box_turntable_results_log')
->where('tid', $value['id'])
->group('gift_user_id')
->select();
// 统计送给多人的数据
if (count($turntable_results_log) > 1) {
$data_multiple[] = [
'turntable_id' => $value['id'],
'recipient_count' => count($turntable_results_log),
'data' => $value
];
}
$totalProcessed++;
// 每处理100条记录输出一次进度
if ($totalProcessed % 100 == 0) {
echo "已处理 {$totalProcessed} 条记录...\n";
// 每100条记录后清理内存
gc_collect_cycles();
}
}
// 更新偏移量
$offset += $batchSize;
// 释放内存
unset($turntable_log);
unset($turntable_results_log);
} while ($totalProcessed <= 1400);
echo "送给多人的数据共 " . count($data_multiple) . " 条记录\n";
echo "统计盲盒转盘错误数据完成-共处理 " . $totalProcessed . " 条数据\n";
// 输出详细信息
foreach ($data_multiple as $item) {
echo "转盘ID: {$item['turntable_id']}, 接收人数: {$item['recipient_count']}\n";
}
}
public function RoomOwners()
{
$room = Db::name('vs_room')->where(['room_status' => 1,'apply_status' => 2])->select();
$arr = [];
foreach ($room as $key => $value) {
$liushui = Db::name('vs_give_gift')->where(['from_id' => $value['id'],'from' => 2])->sum('total_price');
$usercode = Db::name('user')->where(['id' => $value['user_id']])->value('user_code');
$nickname = Db::name('user')->where(['id' => $value['user_id']])->value('nickname');
$arr[] = [
'room_id' => $value['id'],
'user_id' => $value['user_id'],
'user_code' => $usercode,
'nickname' => $nickname,
'liushui' => $liushui
];
}
//房主的收益
foreach ($arr as $key => $v){
$shouyi = db::name('vs_user_money_log')->where(['user_id' => $v['user_id'],'change_type' => 18,'money_type' =>2,'createtime'=>['<',1759585380]])->sum('change_value');
$arr[$key]['shouyi'] = $shouyi;
$arr[$key]['duibi'] = $shouyi.'-'.$v['liushui']/10/10;
$arr[$key]['chazhi'] = $v['liushui']/10/10 - $shouyi;
}
var_dump($arr);
}
}

View File

@@ -0,0 +1,12 @@
<?php
return [
'host' => '127.0.0.1',
'port' => 6379,
'password' => '',
'select' => 0,
'timeout' => 0,
'expire' => 0,
'persistent' => false,
'prefix' => 'fa_redpacket_',
];

View File

@@ -17,7 +17,7 @@ defined("JSON_UNESCAPED_UNICODE") or define("JSON_UNESCAPED_UNICODE", 256);
class BaseClient class BaseClient
{ {
const SDK_NAME = "yunzhanghu-sdk-php"; const SDK_NAME = "yunzhanghu-sdk-php";
const SDK_VERSION = "2.0.15"; const SDK_VERSION = "2.0.22";
const ENV_PROD = "yzh_env_prod"; const ENV_PROD = "yzh_env_prod";
const ENV_SANDBOX = "yzh_env_sandbox"; const ENV_SANDBOX = "yzh_env_sandbox";
@@ -44,6 +44,8 @@ class BaseClient
'bizlicxjjh5service' => 'https://api-aic.yunzhanghu.com', // 个体工商户注册服务(云账户新经济 H5接口域名 'bizlicxjjh5service' => 'https://api-aic.yunzhanghu.com', // 个体工商户注册服务(云账户新经济 H5接口域名
'ins' => 'https://api-ins.yunzhanghu.com', // 保险服务接口域名 'ins' => 'https://api-ins.yunzhanghu.com', // 保险服务接口域名
'task' => 'https://api-task.yunzhanghu.com', // 任务库服务接口域名 'task' => 'https://api-task.yunzhanghu.com', // 任务库服务接口域名
'usercollectservice' => 'https://api-user.yunzhanghu.com', // 用户信息收集接口域名
'calculatelaborservice' => 'https://api-service.yunzhanghu.com', // 连续劳务税费试算接口域名
), ),
self::ENV_SANDBOX => array( // 沙箱环境 self::ENV_SANDBOX => array( // 沙箱环境
@@ -51,8 +53,10 @@ class BaseClient
'authentication' => 'https://api-service.yunzhanghu.com/sandbox', // 用户信息验证接口域名 'authentication' => 'https://api-service.yunzhanghu.com/sandbox', // 用户信息验证接口域名
'apiusersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // API 签约接口域名 'apiusersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // API 签约接口域名
'h5usersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // H5 签约接口域名 'h5usersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // H5 签约接口域名
'calculatelaborservice' => 'https://api-service.yunzhanghu.com/sandbox', // 连续劳务税费试算接口域名
'realnameservice' => 'https://api-service.yunzhanghu.com/sandbox', // 连续劳务税费试算接口域名
'ins' => '', // 保险服务接口域名 'ins' => '', // 保险服务接口域名
'aic' => '', // 个体工商户注册服务接口域名 'aic' => 'https://api-aic.yunzhanghu.com/sandbox', // 个体工商户注册服务接口域名
'task' => '', // 任务库服务接口域名 'task' => '', // 任务库服务接口域名
'dataservice' => '', // 数据服务接口域名 'dataservice' => '', // 数据服务接口域名
), ),

View File

@@ -0,0 +1,81 @@
<?php
namespace Yzh;
use Yzh\Exception\ConfigException;
use Yzh\Exception\ExceptionCode;
use Yzh\Model\Calculatelabor\LaborCaculatorRequest;
use Yzh\Model\Calculatelabor\LaborCaculatorResponse;
use Yzh\Model\Calculatelabor\CalcTaxRequest;
use Yzh\Model\Calculatelabor\CalcTaxResponse;
use Yzh\Model\Calculatelabor\CalculationYearH5UrlRequest;
use Yzh\Model\Calculatelabor\CalculationYearH5UrlResponse;
use Yzh\Model\Calculatelabor\CalculationH5UrlRequest;
use Yzh\Model\Calculatelabor\CalculationH5UrlResponse;
/**
* 连续劳务税费试算
* Class CalculateLaborServiceClient
*/
class CalculateLaborServiceClient extends BaseClient
{
protected static $service_name = 'calculatelaborservice';
/**
* 连续劳务税费试算(计算器)
* @param LaborCaculatorRequest $request
* @param null $option
* @return LaborCaculatorResponse
*/
public function laborCaculator($request, $option = null)
{
if (!$request instanceof LaborCaculatorRequest) {
throw new ConfigException("Calculatelabor->laborCaculator request 必须是 Yzh\\Model\\Calculatelabor\\LaborCaculatorRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('POST', '/api/tax/v1/labor-caculator', $request, "Yzh\\Model\\Calculatelabor\\LaborCaculatorResponse", $option);
}
/**
* 订单税费试算
* @param CalcTaxRequest $request
* @param null $option
* @return CalcTaxResponse
*/
public function calcTax($request, $option = null)
{
if (!$request instanceof CalcTaxRequest) {
throw new ConfigException("Calculatelabor->calcTax request 必须是 Yzh\\Model\\Calculatelabor\\CalcTaxRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('POST', '/api/payment/v1/calc-tax', $request, "Yzh\\Model\\Calculatelabor\\CalcTaxResponse", $option);
}
/**
* 连续劳务年度税费测算-H5
* @param CalculationYearH5UrlRequest $request
* @param null $option
* @return CalculationYearH5UrlResponse
*/
public function calculationYearH5Url($request, $option = null)
{
if (!$request instanceof CalculationYearH5UrlRequest) {
throw new ConfigException("Calculatelabor->calculationYearH5Url request 必须是 Yzh\\Model\\Calculatelabor\\CalculationYearH5UrlRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('GET', '/api/labor/service/calculation/year/h5url', $request, "Yzh\\Model\\Calculatelabor\\CalculationYearH5UrlResponse", $option);
}
/**
* 连续劳务单笔结算税费测算-H5
* @param CalculationH5UrlRequest $request
* @param null $option
* @return CalculationH5UrlResponse
*/
public function calculationH5Url($request, $option = null)
{
if (!$request instanceof CalculationH5UrlRequest) {
throw new ConfigException("Calculatelabor->calculationH5Url request 必须是 Yzh\\Model\\Calculatelabor\\CalculationH5UrlRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('GET', '/api/labor/service/calculation/h5url', $request, "Yzh\\Model\\Calculatelabor\\CalculationH5UrlResponse", $option);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Yzh;
use Yzh\Utils\Rsa;
use Yzh\Utils\Hmac;
use Yzh\Utils\MessString;
/**
* 专属客服链接
* Class CustomerLinkClient
*/
class CustomerLinkClient extends BaseClient
{
/**
* 获取客服链接
* @return str
*/
public function getCustomerLink($base_url, $member_id)
{
$mess = MessString::rand(16);
$timestamp = time();
$signature = "";
$encodesign = "";
// 签名
$signdata = "data=member_id=".$member_id."&mess=".$mess."&timestamp=".$timestamp."&key=".$this->config->app_key;
if ($this->config->sign_type == Config::SIGN_TYPE_RSA) {
$signature = $this->rsa->sign($signdata);
}else if($this->config->sign_type == Config::SIGN_TYPE_HMAC) {
$signature = $this->hmac->sign($signdata);
}
$encodesign = urlencode($signature);
$url = $base_url."?sign_type=".$this->config->sign_type."&sign=".$encodesign."&member_id=".$member_id."&mess=".$mess."&timestamp=".$timestamp;
return $url;
}
}

View File

@@ -70,6 +70,11 @@ class UserExemptedInfoRequest extends BaseRequest
* @var string * @var string
*/ */
public $ref; public $ref;
/**
* 证件照片 URL 地址
* @var string[]
*/
public $image_urls;
public function __construct($params = array()) public function __construct($params = array())
{ {

View File

@@ -0,0 +1,335 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 税费明细
* Class CalcTaxDetail
*/
class CalcTaxDetail extends BaseModel
{
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 云账户预扣个税
* @var string
*/
protected $broker_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 云账户预扣增值税
* @var string
*/
protected $broker_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 云账户预扣附加税费
* @var string
*/
protected $broker_additional_tax;
/**
* 预扣个税税率
* @var string
*/
protected $personal_tax_rate;
/**
* 预扣个税速算扣除数
* @var string
*/
protected $deduct_tax;
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 云账户预扣个税
* @var string $broker_personal_tax
*/
public function setBrokerPersonalTax($broker_personal_tax)
{
$this->broker_personal_tax = $broker_personal_tax;
}
/**
* 云账户预扣个税
* @return string
*/
public function getBrokerPersonalTax()
{
return $this->broker_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 云账户预扣增值税
* @var string $broker_value_added_tax
*/
public function setBrokerValueAddedTax($broker_value_added_tax)
{
$this->broker_value_added_tax = $broker_value_added_tax;
}
/**
* 云账户预扣增值税
* @return string
*/
public function getBrokerValueAddedTax()
{
return $this->broker_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 云账户预扣附加税费
* @var string $broker_additional_tax
*/
public function setBrokerAdditionalTax($broker_additional_tax)
{
$this->broker_additional_tax = $broker_additional_tax;
}
/**
* 云账户预扣附加税费
* @return string
*/
public function getBrokerAdditionalTax()
{
return $this->broker_additional_tax;
}
/**
* 预扣个税税率
* @var string $personal_tax_rate
*/
public function setPersonalTaxRate($personal_tax_rate)
{
$this->personal_tax_rate = $personal_tax_rate;
}
/**
* 预扣个税税率
* @return string
*/
public function getPersonalTaxRate()
{
return $this->personal_tax_rate;
}
/**
* 预扣个税速算扣除数
* @var string $deduct_tax
*/
public function setDeductTax($deduct_tax)
{
$this->deduct_tax = $deduct_tax;
}
/**
* 预扣个税速算扣除数
* @return string
*/
public function getDeductTax()
{
return $this->deduct_tax;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 订单税费试算请求
* Class CalcTaxRequest
*/
class CalcTaxRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 姓名
* @var string
*/
public $real_name;
/**
* 证件号
* @var string
*/
public $id_card;
/**
* 测算金额
* @var string
*/
public $pay;
/**
* 测算类型
* @var string
*/
public $tax_type;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 订单税费试算返回
* Class CalcTaxResponse
*/
class CalcTaxResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return CalcTaxResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new CalcTaxResponseData($data);
return $this;
}
}

View File

@@ -0,0 +1,405 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 订单税费试算返回
* Class CalcTaxResponseData
*/
class CalcTaxResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 测算金额
* @var string
*/
protected $pay;
/**
* 税费总额
* @var string
*/
protected $tax;
/**
* 税后结算金额
* @var string
*/
protected $after_tax_amount;
/**
* 缴税明细
* @var CalcTaxDetail
*/
protected $tax_detail;
/**
* 税前订单金额
* @var string
*/
protected $before_tax_amount;
/**
* 用户税费总额
* @var string
*/
protected $user_tax;
/**
* 平台企业税费总额
* @var string
*/
protected $dealer_tax;
/**
* 云账户税费总额
* @var string
*/
protected $broker_tax;
/**
* 用户服务费
* @var string
*/
protected $user_fee;
/**
* 结果
* @var string
*/
protected $status;
/**
* 结果详细状态码
* @var string
*/
protected $status_detail;
/**
* 结果说明
* @var string
*/
protected $status_message;
/**
* 结果详细状态码描述
* @var string
*/
protected $status_detail_message;
/**
* 用户实收金额(未扣除追缴的增附税)
* @var string
*/
protected $user_real_excluding_vat_amount;
/**
* 用户还未缴清的增附税
* @var string
*/
protected $user_remaining_repayment_amount;
/**
* 已追缴增附税(本笔订单)
* @var string
*/
protected $user_recover_tax_amount;
/**
* 待追缴增附税总金额
* @var string
*/
protected $user_total_recover_tax_amount;
/**
* 测算金额
* @var string $pay
*/
public function setPay($pay)
{
$this->pay = $pay;
}
/**
* 测算金额
* @return string
*/
public function getPay()
{
return $this->pay;
}
/**
* 税费总额
* @var string $tax
*/
public function setTax($tax)
{
$this->tax = $tax;
}
/**
* 税费总额
* @return string
*/
public function getTax()
{
return $this->tax;
}
/**
* 税后结算金额
* @var string $after_tax_amount
*/
public function setAfterTaxAmount($after_tax_amount)
{
$this->after_tax_amount = $after_tax_amount;
}
/**
* 税后结算金额
* @return string
*/
public function getAfterTaxAmount()
{
return $this->after_tax_amount;
}
/**
* 缴税明细
* @var CalcTaxDetail $tax_detail
*/
public function setTaxDetail($tax_detail)
{
$this->tax_detail = $tax_detail;
}
/**
* 缴税明细
* @return CalcTaxDetail
*/
public function getTaxDetail()
{
return $this->tax_detail;
}
/**
* 税前订单金额
* @var string $before_tax_amount
*/
public function setBeforeTaxAmount($before_tax_amount)
{
$this->before_tax_amount = $before_tax_amount;
}
/**
* 税前订单金额
* @return string
*/
public function getBeforeTaxAmount()
{
return $this->before_tax_amount;
}
/**
* 用户税费总额
* @var string $user_tax
*/
public function setUserTax($user_tax)
{
$this->user_tax = $user_tax;
}
/**
* 用户税费总额
* @return string
*/
public function getUserTax()
{
return $this->user_tax;
}
/**
* 平台企业税费总额
* @var string $dealer_tax
*/
public function setDealerTax($dealer_tax)
{
$this->dealer_tax = $dealer_tax;
}
/**
* 平台企业税费总额
* @return string
*/
public function getDealerTax()
{
return $this->dealer_tax;
}
/**
* 云账户税费总额
* @var string $broker_tax
*/
public function setBrokerTax($broker_tax)
{
$this->broker_tax = $broker_tax;
}
/**
* 云账户税费总额
* @return string
*/
public function getBrokerTax()
{
return $this->broker_tax;
}
/**
* 用户服务费
* @var string $user_fee
*/
public function setUserFee($user_fee)
{
$this->user_fee = $user_fee;
}
/**
* 用户服务费
* @return string
*/
public function getUserFee()
{
return $this->user_fee;
}
/**
* 结果
* @var string $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* 结果
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* 结果详细状态码
* @var string $status_detail
*/
public function setStatusDetail($status_detail)
{
$this->status_detail = $status_detail;
}
/**
* 结果详细状态码
* @return string
*/
public function getStatusDetail()
{
return $this->status_detail;
}
/**
* 结果说明
* @var string $status_message
*/
public function setStatusMessage($status_message)
{
$this->status_message = $status_message;
}
/**
* 结果说明
* @return string
*/
public function getStatusMessage()
{
return $this->status_message;
}
/**
* 结果详细状态码描述
* @var string $status_detail_message
*/
public function setStatusDetailMessage($status_detail_message)
{
$this->status_detail_message = $status_detail_message;
}
/**
* 结果详细状态码描述
* @return string
*/
public function getStatusDetailMessage()
{
return $this->status_detail_message;
}
/**
* 用户实收金额(未扣除追缴的增附税)
* @var string $user_real_excluding_vat_amount
*/
public function setUserRealExcludingVatAmount($user_real_excluding_vat_amount)
{
$this->user_real_excluding_vat_amount = $user_real_excluding_vat_amount;
}
/**
* 用户实收金额(未扣除追缴的增附税)
* @return string
*/
public function getUserRealExcludingVatAmount()
{
return $this->user_real_excluding_vat_amount;
}
/**
* 用户还未缴清的增附税
* @var string $user_remaining_repayment_amount
*/
public function setUserRemainingRepaymentAmount($user_remaining_repayment_amount)
{
$this->user_remaining_repayment_amount = $user_remaining_repayment_amount;
}
/**
* 用户还未缴清的增附税
* @return string
*/
public function getUserRemainingRepaymentAmount()
{
return $this->user_remaining_repayment_amount;
}
/**
* 已追缴增附税(本笔订单)
* @var string $user_recover_tax_amount
*/
public function setUserRecoverTaxAmount($user_recover_tax_amount)
{
$this->user_recover_tax_amount = $user_recover_tax_amount;
}
/**
* 已追缴增附税(本笔订单)
* @return string
*/
public function getUserRecoverTaxAmount()
{
return $this->user_recover_tax_amount;
}
/**
* 待追缴增附税总金额
* @var string $user_total_recover_tax_amount
*/
public function setUserTotalRecoverTaxAmount($user_total_recover_tax_amount)
{
$this->user_total_recover_tax_amount = $user_total_recover_tax_amount;
}
/**
* 待追缴增附税总金额
* @return string
*/
public function getUserTotalRecoverTaxAmount()
{
return $this->user_total_recover_tax_amount;
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 连续劳务单笔结算税费测算-H5 请求
* Class CalculationH5UrlRequest
*/
class CalculationH5UrlRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 姓名
* @var string
*/
public $real_name;
/**
* 证件号
* @var string
*/
public $id_card;
/**
* 主题颜色
* @var string
*/
public $color;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 连续劳务单笔结算税费测算-H5 返回
* Class CalculationH5UrlResponse
*/
class CalculationH5UrlResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return CalculationH5UrlResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new CalculationH5UrlResponseData($data);
return $this;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 连续劳务单笔结算税费测算-H5 返回
* Class CalculationH5UrlResponseData
*/
class CalculationH5UrlResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 连续劳务单笔结算税费测算 H5 页面 URL
* @var string
*/
protected $url;
/**
* 连续劳务单笔结算税费测算 H5 页面 URL
* @var string $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* 连续劳务单笔结算税费测算 H5 页面 URL
* @return string
*/
public function getUrl()
{
return $this->url;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 连续劳务年度税费测算-H5 请求
* Class CalculationYearH5UrlRequest
*/
class CalculationYearH5UrlRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 主题颜色
* @var string
*/
public $color;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 连续劳务年度税费测算-H5 返回
* Class CalculationYearH5UrlResponse
*/
class CalculationYearH5UrlResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return CalculationYearH5UrlResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new CalculationYearH5UrlResponseData($data);
return $this;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 连续劳务年度税费测算-H5 返回
* Class CalculationYearH5UrlResponseData
*/
class CalculationYearH5UrlResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 年度劳务测算 H5 页面 URL
* @var string
*/
protected $url;
/**
* 年度劳务测算 H5 页面 URL
* @var string $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* 年度劳务测算 H5 页面 URL
* @return string
*/
public function getUrl()
{
return $this->url;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 连续劳务税费试算(计算器)请求
* Class LaborCaculatorRequest
*/
class LaborCaculatorRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 月度收入列表
* @var MonthSettlement[]
*/
public $month_settlement_list;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 连续劳务税费试算(计算器)返回
* Class LaborCaculatorResponse
*/
class LaborCaculatorResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return LaborCaculatorResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new LaborCaculatorResponseData($data);
return $this;
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 连续劳务税费试算(计算器)返回
* Class LaborCaculatorResponseData
*/
class LaborCaculatorResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 综合所得汇算清缴
* @var YearTaxInfo
*/
protected $year_tax_info;
/**
* 月度税务信息列表
* @var MontTax[]
*/
protected $month_tax_list;
/**
* 综合所得汇算清缴
* @var YearTaxInfo $year_tax_info
*/
public function setYearTaxInfo($year_tax_info)
{
$this->year_tax_info = $year_tax_info;
}
/**
* 综合所得汇算清缴
* @return YearTaxInfo
*/
public function getYearTaxInfo()
{
return $this->year_tax_info;
}
/**
* @var array $items
*/
public function setMonthTaxList($items)
{
$this->month_tax_list = array();
foreach ($items as $k => $v) {
array_push($this->month_tax_list, new MontTax($v));
}
}
/**
* 月度税务信息列表
* @return MontTax[]
*/
public function getMonthTaxList()
{
return $this->month_tax_list;
}
}

View File

@@ -0,0 +1,243 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 月度税务信息
* Class MontTax
*/
class MontTax extends BaseModel
{
/**
* 月份
* @var int32
*/
protected $month;
/**
* 含增值税收入
* @var string
*/
protected $pre_tax_amount;
/**
* 不含增值税收入
* @var string
*/
protected $excluding_vat_amount;
/**
* 增值税
* @var string
*/
protected $value_added_tax;
/**
* 附加税
* @var string
*/
protected $additional_tax;
/**
* 个税
* @var string
*/
protected $personal_tax;
/**
* 个税税率
* @var string
*/
protected $personal_tax_rate;
/**
* 速算扣除数
* @var string
*/
protected $deduct_tax;
/**
* 税后金额
* @var string
*/
protected $post_tax_amount;
/**
* 税负率
* @var string
*/
protected $total_tax_rate;
/**
* 月份
* @var int32 $month
*/
public function setMonth($month)
{
$this->month = $month;
}
/**
* 月份
* @return int32
*/
public function getMonth()
{
return $this->month;
}
/**
* 含增值税收入
* @var string $pre_tax_amount
*/
public function setPreTaxAmount($pre_tax_amount)
{
$this->pre_tax_amount = $pre_tax_amount;
}
/**
* 含增值税收入
* @return string
*/
public function getPreTaxAmount()
{
return $this->pre_tax_amount;
}
/**
* 不含增值税收入
* @var string $excluding_vat_amount
*/
public function setExcludingVatAmount($excluding_vat_amount)
{
$this->excluding_vat_amount = $excluding_vat_amount;
}
/**
* 不含增值税收入
* @return string
*/
public function getExcludingVatAmount()
{
return $this->excluding_vat_amount;
}
/**
* 增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 附加税
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 附加税
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 个税税率
* @var string $personal_tax_rate
*/
public function setPersonalTaxRate($personal_tax_rate)
{
$this->personal_tax_rate = $personal_tax_rate;
}
/**
* 个税税率
* @return string
*/
public function getPersonalTaxRate()
{
return $this->personal_tax_rate;
}
/**
* 速算扣除数
* @var string $deduct_tax
*/
public function setDeductTax($deduct_tax)
{
$this->deduct_tax = $deduct_tax;
}
/**
* 速算扣除数
* @return string
*/
public function getDeductTax()
{
return $this->deduct_tax;
}
/**
* 税后金额
* @var string $post_tax_amount
*/
public function setPostTaxAmount($post_tax_amount)
{
$this->post_tax_amount = $post_tax_amount;
}
/**
* 税后金额
* @return string
*/
public function getPostTaxAmount()
{
return $this->post_tax_amount;
}
/**
* 税负率
* @var string $total_tax_rate
*/
public function setTotalTaxRate($total_tax_rate)
{
$this->total_tax_rate = $total_tax_rate;
}
/**
* 税负率
* @return string
*/
public function getTotalTaxRate()
{
return $this->total_tax_rate;
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 月度收入
* Class MonthSettlement
*/
class MonthSettlement extends BaseModel
{
/**
* 月份
* @var int32
*/
protected $month;
/**
* 月度收入
* @var string
*/
protected $month_pre_tax_amount;
/**
* 月份
* @var int32 $month
*/
public function setMonth($month)
{
$this->month = $month;
}
/**
* 月份
* @return int32
*/
public function getMonth()
{
return $this->month;
}
/**
* 月度收入
* @var string $month_pre_tax_amount
*/
public function setMonthPreTaxAmount($month_pre_tax_amount)
{
$this->month_pre_tax_amount = $month_pre_tax_amount;
}
/**
* 月度收入
* @return string
*/
public function getMonthPreTaxAmount()
{
return $this->month_pre_tax_amount;
}
}

View File

@@ -0,0 +1,151 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 综合所得汇算清缴信息
* Class YearTaxInfo
*/
class YearTaxInfo extends BaseModel
{
/**
* 连续劳务年度个税
* @var string
*/
protected $continuous_month_personal_tax;
/**
* 综合所得汇算清缴年度个税
* @var string
*/
protected $personal_tax;
/**
* 年度扣除费用
* @var string
*/
protected $deduct_cost;
/**
* 个税税率
* @var string
*/
protected $personal_tax_rate;
/**
* 速算扣除数
* @var string
*/
protected $deduct_tax;
/**
* 税负率
* @var string
*/
protected $total_tax_rate;
/**
* 连续劳务年度个税
* @var string $continuous_month_personal_tax
*/
public function setContinuousMonthPersonalTax($continuous_month_personal_tax)
{
$this->continuous_month_personal_tax = $continuous_month_personal_tax;
}
/**
* 连续劳务年度个税
* @return string
*/
public function getContinuousMonthPersonalTax()
{
return $this->continuous_month_personal_tax;
}
/**
* 综合所得汇算清缴年度个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 综合所得汇算清缴年度个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 年度扣除费用
* @var string $deduct_cost
*/
public function setDeductCost($deduct_cost)
{
$this->deduct_cost = $deduct_cost;
}
/**
* 年度扣除费用
* @return string
*/
public function getDeductCost()
{
return $this->deduct_cost;
}
/**
* 个税税率
* @var string $personal_tax_rate
*/
public function setPersonalTaxRate($personal_tax_rate)
{
$this->personal_tax_rate = $personal_tax_rate;
}
/**
* 个税税率
* @return string
*/
public function getPersonalTaxRate()
{
return $this->personal_tax_rate;
}
/**
* 速算扣除数
* @var string $deduct_tax
*/
public function setDeductTax($deduct_tax)
{
$this->deduct_tax = $deduct_tax;
}
/**
* 速算扣除数
* @return string
*/
public function getDeductTax()
{
return $this->deduct_tax;
}
/**
* 税负率
* @var string $total_tax_rate
*/
public function setTotalTaxRate($total_tax_rate)
{
$this->total_tax_rate = $total_tax_rate;
}
/**
* 税负率
* @return string
*/
public function getTotalTaxRate()
{
return $this->total_tax_rate;
}
}

View File

@@ -21,25 +21,145 @@ class DailyOrderSummary extends BaseModel
*/ */
protected $pay; protected $pay;
/** /**
* 加成服务费金额 * 应收综合服务主体加成服务费金额
* @var string * @var string
*/ */
protected $broker_fee; protected $broker_fee;
/** /**
* 加成服务费实收金额 * 应收余额账户支出加成服务费金额
* @var string * @var string
*/ */
protected $broker_real_fee; protected $broker_real_fee;
/** /**
* 已抵扣加成服务费金额 * 应收加成服务费抵扣金额
* @var string * @var string
*/ */
protected $broker_rebate_fee; protected $broker_rebate_fee;
/** /**
* 用户加成服务费金额 * 应收用户加成服务费金额
* @var string * @var string
*/ */
protected $user_fee; protected $user_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/**
* 实收余额账户支出加成服务费金额
* @var string
*/
protected $received_broker_real_fee;
/**
* 实收加成服务费抵扣金额
* @var string
*/
protected $received_broker_deduct_fee;
/**
* 实收用户加成服务费金额
* @var string
*/
protected $received_user_fee;
/**
* 预扣税费总额
* @var string
*/
protected $tax;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 实缴个税
* @var string
*/
protected $received_personal_tax;
/**
* 实缴增值税
* @var string
*/
protected $received_value_added_tax;
/**
* 实缴附加税费
* @var string
*/
protected $received_additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 用户实缴个税
* @var string
*/
protected $user_received_personal_tax;
/**
* 平台企业实缴个税
* @var string
*/
protected $dealer_received_personal_tax;
/**
* 用户实缴增值税
* @var string
*/
protected $user_received_value_added_tax;
/**
* 平台企业实缴增值税
* @var string
*/
protected $dealer_received_value_added_tax;
/**
* 用户实缴附加税费
* @var string
*/
protected $user_received_additional_tax;
/**
* 平台企业实缴附加税费
* @var string
*/
protected $dealer_received_additional_tax;
/** /**
* 订单数量 * 订单数量
@@ -78,7 +198,7 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费金额 * 应收综合服务主体加成服务费金额
* @var string $broker_fee * @var string $broker_fee
*/ */
public function setBrokerFee($broker_fee) public function setBrokerFee($broker_fee)
@@ -87,7 +207,7 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费金额 * 应收综合服务主体加成服务费金额
* @return string * @return string
*/ */
public function getBrokerFee() public function getBrokerFee()
@@ -96,7 +216,7 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费实收金额 * 应收余额账户支出加成服务费金额
* @var string $broker_real_fee * @var string $broker_real_fee
*/ */
public function setBrokerRealFee($broker_real_fee) public function setBrokerRealFee($broker_real_fee)
@@ -105,7 +225,7 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费实收金额 * 应收余额账户支出加成服务费金额
* @return string * @return string
*/ */
public function getBrokerRealFee() public function getBrokerRealFee()
@@ -114,7 +234,7 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 已抵扣加成服务费金额 * 应收加成服务费抵扣金额
* @var string $broker_rebate_fee * @var string $broker_rebate_fee
*/ */
public function setBrokerRebateFee($broker_rebate_fee) public function setBrokerRebateFee($broker_rebate_fee)
@@ -123,7 +243,7 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 已抵扣加成服务费金额 * 应收加成服务费抵扣金额
* @return string * @return string
*/ */
public function getBrokerRebateFee() public function getBrokerRebateFee()
@@ -132,7 +252,7 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 用户加成服务费金额 * 应收用户加成服务费金额
* @var string $user_fee * @var string $user_fee
*/ */
public function setUserFee($user_fee) public function setUserFee($user_fee)
@@ -141,11 +261,443 @@ class DailyOrderSummary extends BaseModel
} }
/** /**
* 用户加成服务费金额 * 应收用户加成服务费金额
* @return string * @return string
*/ */
public function getUserFee() public function getUserFee()
{ {
return $this->user_fee; return $this->user_fee;
} }
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @var string $received_broker_real_fee
*/
public function setReceivedBrokerRealFee($received_broker_real_fee)
{
$this->received_broker_real_fee = $received_broker_real_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @return string
*/
public function getReceivedBrokerRealFee()
{
return $this->received_broker_real_fee;
}
/**
* 实收加成服务费抵扣金额
* @var string $received_broker_deduct_fee
*/
public function setReceivedBrokerDeductFee($received_broker_deduct_fee)
{
$this->received_broker_deduct_fee = $received_broker_deduct_fee;
}
/**
* 实收加成服务费抵扣金额
* @return string
*/
public function getReceivedBrokerDeductFee()
{
return $this->received_broker_deduct_fee;
}
/**
* 实收用户加成服务费金额
* @var string $received_user_fee
*/
public function setReceivedUserFee($received_user_fee)
{
$this->received_user_fee = $received_user_fee;
}
/**
* 实收用户加成服务费金额
* @return string
*/
public function getReceivedUserFee()
{
return $this->received_user_fee;
}
/**
* 预扣税费总额
* @var string $tax
*/
public function setTax($tax)
{
$this->tax = $tax;
}
/**
* 预扣税费总额
* @return string
*/
public function getTax()
{
return $this->tax;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 实缴个税
* @var string $received_personal_tax
*/
public function setReceivedPersonalTax($received_personal_tax)
{
$this->received_personal_tax = $received_personal_tax;
}
/**
* 实缴个税
* @return string
*/
public function getReceivedPersonalTax()
{
return $this->received_personal_tax;
}
/**
* 实缴增值税
* @var string $received_value_added_tax
*/
public function setReceivedValueAddedTax($received_value_added_tax)
{
$this->received_value_added_tax = $received_value_added_tax;
}
/**
* 实缴增值税
* @return string
*/
public function getReceivedValueAddedTax()
{
return $this->received_value_added_tax;
}
/**
* 实缴附加税费
* @var string $received_additional_tax
*/
public function setReceivedAdditionalTax($received_additional_tax)
{
$this->received_additional_tax = $received_additional_tax;
}
/**
* 实缴附加税费
* @return string
*/
public function getReceivedAdditionalTax()
{
return $this->received_additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 用户实缴个税
* @var string $user_received_personal_tax
*/
public function setUserReceivedPersonalTax($user_received_personal_tax)
{
$this->user_received_personal_tax = $user_received_personal_tax;
}
/**
* 用户实缴个税
* @return string
*/
public function getUserReceivedPersonalTax()
{
return $this->user_received_personal_tax;
}
/**
* 平台企业实缴个税
* @var string $dealer_received_personal_tax
*/
public function setDealerReceivedPersonalTax($dealer_received_personal_tax)
{
$this->dealer_received_personal_tax = $dealer_received_personal_tax;
}
/**
* 平台企业实缴个税
* @return string
*/
public function getDealerReceivedPersonalTax()
{
return $this->dealer_received_personal_tax;
}
/**
* 用户实缴增值税
* @var string $user_received_value_added_tax
*/
public function setUserReceivedValueAddedTax($user_received_value_added_tax)
{
$this->user_received_value_added_tax = $user_received_value_added_tax;
}
/**
* 用户实缴增值税
* @return string
*/
public function getUserReceivedValueAddedTax()
{
return $this->user_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @var string $dealer_received_value_added_tax
*/
public function setDealerReceivedValueAddedTax($dealer_received_value_added_tax)
{
$this->dealer_received_value_added_tax = $dealer_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @return string
*/
public function getDealerReceivedValueAddedTax()
{
return $this->dealer_received_value_added_tax;
}
/**
* 用户实缴附加税费
* @var string $user_received_additional_tax
*/
public function setUserReceivedAdditionalTax($user_received_additional_tax)
{
$this->user_received_additional_tax = $user_received_additional_tax;
}
/**
* 用户实缴附加税费
* @return string
*/
public function getUserReceivedAdditionalTax()
{
return $this->user_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @var string $dealer_received_additional_tax
*/
public function setDealerReceivedAdditionalTax($dealer_received_additional_tax)
{
$this->dealer_received_additional_tax = $dealer_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @return string
*/
public function getDealerReceivedAdditionalTax()
{
return $this->dealer_received_additional_tax;
}
} }

View File

@@ -51,10 +51,15 @@ class DealerOrderInfo extends BaseModel
*/ */
protected $broker_amount; protected $broker_amount;
/** /**
* 综合服务主体加成服务费 * 应收综合服务主体加成服务费金额
* @var string * @var string
*/ */
protected $broker_fee; protected $broker_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/** /**
* 支付路径流水号 * 支付路径流水号
* @var string * @var string
@@ -115,6 +120,21 @@ class DealerOrderInfo extends BaseModel
* @var string * @var string
*/ */
protected $finished_time; protected $finished_time;
/**
* 预扣税费总额
* @var string
*/
protected $tax_amount;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 缴税明细
* @var OrderTaxDetail
*/
protected $tax_detail;
/** /**
* 综合服务主体 ID * 综合服务主体 ID
@@ -261,7 +281,7 @@ class DealerOrderInfo extends BaseModel
} }
/** /**
* 综合服务主体加成服务费 * 应收综合服务主体加成服务费金额
* @var string $broker_fee * @var string $broker_fee
*/ */
public function setBrokerFee($broker_fee) public function setBrokerFee($broker_fee)
@@ -270,7 +290,7 @@ class DealerOrderInfo extends BaseModel
} }
/** /**
* 综合服务主体加成服务费 * 应收综合服务主体加成服务费金额
* @return string * @return string
*/ */
public function getBrokerFee() public function getBrokerFee()
@@ -278,6 +298,24 @@ class DealerOrderInfo extends BaseModel
return $this->broker_fee; return $this->broker_fee;
} }
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/** /**
* 支付路径流水号 * 支付路径流水号
* @var string $bill * @var string $bill
@@ -493,4 +531,58 @@ class DealerOrderInfo extends BaseModel
{ {
return $this->finished_time; return $this->finished_time;
} }
/**
* 预扣税费总额
* @var string $tax_amount
*/
public function setTaxAmount($tax_amount)
{
$this->tax_amount = $tax_amount;
}
/**
* 预扣税费总额
* @return string
*/
public function getTaxAmount()
{
return $this->tax_amount;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 缴税明细
* @var OrderTaxDetail $tax_detail
*/
public function setTaxDetail($tax_detail)
{
$this->tax_detail = $tax_detail;
}
/**
* 缴税明细
* @return OrderTaxDetail
*/
public function getTaxDetail()
{
return $this->tax_detail;
}
} }

View File

@@ -56,10 +56,15 @@ class DealerOrderInfoV2 extends BaseModel
*/ */
protected $broker_amount; protected $broker_amount;
/** /**
* 综合服务主体加成服务费 * 应收综合服务主体加成服务费金额
* @var string * @var string
*/ */
protected $broker_fee; protected $broker_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/** /**
* 支付路径流水号 * 支付路径流水号
* @var string * @var string
@@ -130,6 +135,21 @@ class DealerOrderInfoV2 extends BaseModel
* @var string * @var string
*/ */
protected $pay_ref; protected $pay_ref;
/**
* 预扣税费总额
* @var string
*/
protected $tax_amount;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 缴税明细
* @var OrderTaxDetail
*/
protected $tax_detail;
/** /**
* 综合服务主体 ID * 综合服务主体 ID
@@ -294,7 +314,7 @@ class DealerOrderInfoV2 extends BaseModel
} }
/** /**
* 综合服务主体加成服务费 * 应收综合服务主体加成服务费金额
* @var string $broker_fee * @var string $broker_fee
*/ */
public function setBrokerFee($broker_fee) public function setBrokerFee($broker_fee)
@@ -303,7 +323,7 @@ class DealerOrderInfoV2 extends BaseModel
} }
/** /**
* 综合服务主体加成服务费 * 应收综合服务主体加成服务费金额
* @return string * @return string
*/ */
public function getBrokerFee() public function getBrokerFee()
@@ -311,6 +331,24 @@ class DealerOrderInfoV2 extends BaseModel
return $this->broker_fee; return $this->broker_fee;
} }
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/** /**
* 支付路径流水号 * 支付路径流水号
* @var string $bill * @var string $bill
@@ -562,4 +600,58 @@ class DealerOrderInfoV2 extends BaseModel
{ {
return $this->pay_ref; return $this->pay_ref;
} }
/**
* 预扣税费总额
* @var string $tax_amount
*/
public function setTaxAmount($tax_amount)
{
$this->tax_amount = $tax_amount;
}
/**
* 预扣税费总额
* @return string
*/
public function getTaxAmount()
{
return $this->tax_amount;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 缴税明细
* @var OrderTaxDetail $tax_detail
*/
public function setTaxDetail($tax_detail)
{
$this->tax_detail = $tax_detail;
}
/**
* 缴税明细
* @return OrderTaxDetail
*/
public function getTaxDetail()
{
return $this->tax_detail;
}
} }

View File

@@ -21,25 +21,145 @@ class MonthlyOrderSummary extends BaseModel
*/ */
protected $pay; protected $pay;
/** /**
* 加成服务费金额 * 应收综合服务主体加成服务费金额
* @var string * @var string
*/ */
protected $broker_fee; protected $broker_fee;
/** /**
* 加成服务费实收金额 * 应收余额账户支出加成服务费金额
* @var string * @var string
*/ */
protected $broker_real_fee; protected $broker_real_fee;
/** /**
* 已抵扣加成服务费金额 * 应收加成服务费抵扣金额
* @var string * @var string
*/ */
protected $broker_rebate_fee; protected $broker_rebate_fee;
/** /**
* 用户加成服务费金额 * 应收用户加成服务费金额
* @var string * @var string
*/ */
protected $user_fee; protected $user_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/**
* 实收余额账户支出加成服务费金额
* @var string
*/
protected $received_broker_real_fee;
/**
* 实收加成服务费抵扣金额
* @var string
*/
protected $received_broker_deduct_fee;
/**
* 实收用户加成服务费金额
* @var string
*/
protected $received_user_fee;
/**
* 预扣税费总额
* @var string
*/
protected $tax;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 实缴个税
* @var string
*/
protected $received_personal_tax;
/**
* 实缴增值税
* @var string
*/
protected $received_value_added_tax;
/**
* 实缴附加税费
* @var string
*/
protected $received_additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 用户实缴个税
* @var string
*/
protected $user_received_personal_tax;
/**
* 平台企业实缴个税
* @var string
*/
protected $dealer_received_personal_tax;
/**
* 用户实缴增值税
* @var string
*/
protected $user_received_value_added_tax;
/**
* 平台企业实缴增值税
* @var string
*/
protected $dealer_received_value_added_tax;
/**
* 用户实缴附加税费
* @var string
*/
protected $user_received_additional_tax;
/**
* 平台企业实缴附加税费
* @var string
*/
protected $dealer_received_additional_tax;
/** /**
* 订单数量 * 订单数量
@@ -78,7 +198,7 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费金额 * 应收综合服务主体加成服务费金额
* @var string $broker_fee * @var string $broker_fee
*/ */
public function setBrokerFee($broker_fee) public function setBrokerFee($broker_fee)
@@ -87,7 +207,7 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费金额 * 应收综合服务主体加成服务费金额
* @return string * @return string
*/ */
public function getBrokerFee() public function getBrokerFee()
@@ -96,7 +216,7 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费实收金额 * 应收余额账户支出加成服务费金额
* @var string $broker_real_fee * @var string $broker_real_fee
*/ */
public function setBrokerRealFee($broker_real_fee) public function setBrokerRealFee($broker_real_fee)
@@ -105,7 +225,7 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 加成服务费实收金额 * 应收余额账户支出加成服务费金额
* @return string * @return string
*/ */
public function getBrokerRealFee() public function getBrokerRealFee()
@@ -114,7 +234,7 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 已抵扣加成服务费金额 * 应收加成服务费抵扣金额
* @var string $broker_rebate_fee * @var string $broker_rebate_fee
*/ */
public function setBrokerRebateFee($broker_rebate_fee) public function setBrokerRebateFee($broker_rebate_fee)
@@ -123,7 +243,7 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 已抵扣加成服务费金额 * 应收加成服务费抵扣金额
* @return string * @return string
*/ */
public function getBrokerRebateFee() public function getBrokerRebateFee()
@@ -132,7 +252,7 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 用户加成服务费金额 * 应收用户加成服务费金额
* @var string $user_fee * @var string $user_fee
*/ */
public function setUserFee($user_fee) public function setUserFee($user_fee)
@@ -141,11 +261,443 @@ class MonthlyOrderSummary extends BaseModel
} }
/** /**
* 用户加成服务费金额 * 应收用户加成服务费金额
* @return string * @return string
*/ */
public function getUserFee() public function getUserFee()
{ {
return $this->user_fee; return $this->user_fee;
} }
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @var string $received_broker_real_fee
*/
public function setReceivedBrokerRealFee($received_broker_real_fee)
{
$this->received_broker_real_fee = $received_broker_real_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @return string
*/
public function getReceivedBrokerRealFee()
{
return $this->received_broker_real_fee;
}
/**
* 实收加成服务费抵扣金额
* @var string $received_broker_deduct_fee
*/
public function setReceivedBrokerDeductFee($received_broker_deduct_fee)
{
$this->received_broker_deduct_fee = $received_broker_deduct_fee;
}
/**
* 实收加成服务费抵扣金额
* @return string
*/
public function getReceivedBrokerDeductFee()
{
return $this->received_broker_deduct_fee;
}
/**
* 实收用户加成服务费金额
* @var string $received_user_fee
*/
public function setReceivedUserFee($received_user_fee)
{
$this->received_user_fee = $received_user_fee;
}
/**
* 实收用户加成服务费金额
* @return string
*/
public function getReceivedUserFee()
{
return $this->received_user_fee;
}
/**
* 预扣税费总额
* @var string $tax
*/
public function setTax($tax)
{
$this->tax = $tax;
}
/**
* 预扣税费总额
* @return string
*/
public function getTax()
{
return $this->tax;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 实缴个税
* @var string $received_personal_tax
*/
public function setReceivedPersonalTax($received_personal_tax)
{
$this->received_personal_tax = $received_personal_tax;
}
/**
* 实缴个税
* @return string
*/
public function getReceivedPersonalTax()
{
return $this->received_personal_tax;
}
/**
* 实缴增值税
* @var string $received_value_added_tax
*/
public function setReceivedValueAddedTax($received_value_added_tax)
{
$this->received_value_added_tax = $received_value_added_tax;
}
/**
* 实缴增值税
* @return string
*/
public function getReceivedValueAddedTax()
{
return $this->received_value_added_tax;
}
/**
* 实缴附加税费
* @var string $received_additional_tax
*/
public function setReceivedAdditionalTax($received_additional_tax)
{
$this->received_additional_tax = $received_additional_tax;
}
/**
* 实缴附加税费
* @return string
*/
public function getReceivedAdditionalTax()
{
return $this->received_additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 用户实缴个税
* @var string $user_received_personal_tax
*/
public function setUserReceivedPersonalTax($user_received_personal_tax)
{
$this->user_received_personal_tax = $user_received_personal_tax;
}
/**
* 用户实缴个税
* @return string
*/
public function getUserReceivedPersonalTax()
{
return $this->user_received_personal_tax;
}
/**
* 平台企业实缴个税
* @var string $dealer_received_personal_tax
*/
public function setDealerReceivedPersonalTax($dealer_received_personal_tax)
{
$this->dealer_received_personal_tax = $dealer_received_personal_tax;
}
/**
* 平台企业实缴个税
* @return string
*/
public function getDealerReceivedPersonalTax()
{
return $this->dealer_received_personal_tax;
}
/**
* 用户实缴增值税
* @var string $user_received_value_added_tax
*/
public function setUserReceivedValueAddedTax($user_received_value_added_tax)
{
$this->user_received_value_added_tax = $user_received_value_added_tax;
}
/**
* 用户实缴增值税
* @return string
*/
public function getUserReceivedValueAddedTax()
{
return $this->user_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @var string $dealer_received_value_added_tax
*/
public function setDealerReceivedValueAddedTax($dealer_received_value_added_tax)
{
$this->dealer_received_value_added_tax = $dealer_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @return string
*/
public function getDealerReceivedValueAddedTax()
{
return $this->dealer_received_value_added_tax;
}
/**
* 用户实缴附加税费
* @var string $user_received_additional_tax
*/
public function setUserReceivedAdditionalTax($user_received_additional_tax)
{
$this->user_received_additional_tax = $user_received_additional_tax;
}
/**
* 用户实缴附加税费
* @return string
*/
public function getUserReceivedAdditionalTax()
{
return $this->user_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @var string $dealer_received_additional_tax
*/
public function setDealerReceivedAdditionalTax($dealer_received_additional_tax)
{
$this->dealer_received_additional_tax = $dealer_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @return string
*/
public function getDealerReceivedAdditionalTax()
{
return $this->dealer_received_additional_tax;
}
} }

View File

@@ -0,0 +1,427 @@
<?php
namespace Yzh\Model\Dataservice;
use Yzh\Model\BaseModel;
/**
* 缴税明细
* Class OrderTaxDetail
*/
class OrderTaxDetail extends BaseModel
{
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 实缴个税
* @var string
*/
protected $received_personal_tax;
/**
* 实缴增值税
* @var string
*/
protected $received_value_added_tax;
/**
* 实缴附加税费
* @var string
*/
protected $received_additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 用户实缴个税
* @var string
*/
protected $user_received_personal_tax;
/**
* 平台企业实缴个税
* @var string
*/
protected $dealer_received_personal_tax;
/**
* 用户实缴增值税
* @var string
*/
protected $user_received_value_added_tax;
/**
* 平台企业实缴增值税
* @var string
*/
protected $dealer_received_value_added_tax;
/**
* 用户实缴附加税费
* @var string
*/
protected $user_received_additional_tax;
/**
* 平台企业实缴附加税费
* @var string
*/
protected $dealer_received_additional_tax;
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 实缴个税
* @var string $received_personal_tax
*/
public function setReceivedPersonalTax($received_personal_tax)
{
$this->received_personal_tax = $received_personal_tax;
}
/**
* 实缴个税
* @return string
*/
public function getReceivedPersonalTax()
{
return $this->received_personal_tax;
}
/**
* 实缴增值税
* @var string $received_value_added_tax
*/
public function setReceivedValueAddedTax($received_value_added_tax)
{
$this->received_value_added_tax = $received_value_added_tax;
}
/**
* 实缴增值税
* @return string
*/
public function getReceivedValueAddedTax()
{
return $this->received_value_added_tax;
}
/**
* 实缴附加税费
* @var string $received_additional_tax
*/
public function setReceivedAdditionalTax($received_additional_tax)
{
$this->received_additional_tax = $received_additional_tax;
}
/**
* 实缴附加税费
* @return string
*/
public function getReceivedAdditionalTax()
{
return $this->received_additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 用户实缴个税
* @var string $user_received_personal_tax
*/
public function setUserReceivedPersonalTax($user_received_personal_tax)
{
$this->user_received_personal_tax = $user_received_personal_tax;
}
/**
* 用户实缴个税
* @return string
*/
public function getUserReceivedPersonalTax()
{
return $this->user_received_personal_tax;
}
/**
* 平台企业实缴个税
* @var string $dealer_received_personal_tax
*/
public function setDealerReceivedPersonalTax($dealer_received_personal_tax)
{
$this->dealer_received_personal_tax = $dealer_received_personal_tax;
}
/**
* 平台企业实缴个税
* @return string
*/
public function getDealerReceivedPersonalTax()
{
return $this->dealer_received_personal_tax;
}
/**
* 用户实缴增值税
* @var string $user_received_value_added_tax
*/
public function setUserReceivedValueAddedTax($user_received_value_added_tax)
{
$this->user_received_value_added_tax = $user_received_value_added_tax;
}
/**
* 用户实缴增值税
* @return string
*/
public function getUserReceivedValueAddedTax()
{
return $this->user_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @var string $dealer_received_value_added_tax
*/
public function setDealerReceivedValueAddedTax($dealer_received_value_added_tax)
{
$this->dealer_received_value_added_tax = $dealer_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @return string
*/
public function getDealerReceivedValueAddedTax()
{
return $this->dealer_received_value_added_tax;
}
/**
* 用户实缴附加税费
* @var string $user_received_additional_tax
*/
public function setUserReceivedAdditionalTax($user_received_additional_tax)
{
$this->user_received_additional_tax = $user_received_additional_tax;
}
/**
* 用户实缴附加税费
* @return string
*/
public function getUserReceivedAdditionalTax()
{
return $this->user_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @var string $dealer_received_additional_tax
*/
public function setDealerReceivedAdditionalTax($dealer_received_additional_tax)
{
$this->dealer_received_additional_tax = $dealer_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @return string
*/
public function getDealerReceivedAdditionalTax()
{
return $this->dealer_received_additional_tax;
}
}

View File

@@ -61,12 +61,12 @@ class StatementDetail extends BaseModel
*/ */
protected $reex_amount; protected $reex_amount;
/** /**
* 加成服务费金额 * 实收综合服务主体加成服务费金额
* @var string * @var string
*/ */
protected $fee_amount; protected $fee_amount;
/** /**
* 加成服务费抵扣金额 * 实收加成服务费抵扣金额
* @var string * @var string
*/ */
protected $deduct_rebate_fee_amount; protected $deduct_rebate_fee_amount;
@@ -95,6 +95,11 @@ class StatementDetail extends BaseModel
* @var string * @var string
*/ */
protected $project_name; protected $project_name;
/**
* 实纳税费金额
* @var string
*/
protected $received_tax_amount;
/** /**
* 账单 ID * 账单 ID
@@ -277,7 +282,7 @@ class StatementDetail extends BaseModel
} }
/** /**
* 加成服务费金额 * 实收综合服务主体加成服务费金额
* @var string $fee_amount * @var string $fee_amount
*/ */
public function setFeeAmount($fee_amount) public function setFeeAmount($fee_amount)
@@ -286,7 +291,7 @@ class StatementDetail extends BaseModel
} }
/** /**
* 加成服务费金额 * 实收综合服务主体加成服务费金额
* @return string * @return string
*/ */
public function getFeeAmount() public function getFeeAmount()
@@ -295,7 +300,7 @@ class StatementDetail extends BaseModel
} }
/** /**
* 加成服务费抵扣金额 * 实收加成服务费抵扣金额
* @var string $deduct_rebate_fee_amount * @var string $deduct_rebate_fee_amount
*/ */
public function setDeductRebateFeeAmount($deduct_rebate_fee_amount) public function setDeductRebateFeeAmount($deduct_rebate_fee_amount)
@@ -304,7 +309,7 @@ class StatementDetail extends BaseModel
} }
/** /**
* 加成服务费抵扣金额 * 实收加成服务费抵扣金额
* @return string * @return string
*/ */
public function getDeductRebateFeeAmount() public function getDeductRebateFeeAmount()
@@ -401,4 +406,22 @@ class StatementDetail extends BaseModel
{ {
return $this->project_name; return $this->project_name;
} }
/**
* 实纳税费金额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实纳税费金额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
} }

View File

@@ -35,6 +35,11 @@ class H5UserPresignRequest extends BaseRequest
* @var int32 * @var int32
*/ */
public $certificate_type; public $certificate_type;
/**
* 是否收集手机号码 0不收集默认 1收集手机号码
* @var int32
*/
public $collect_phone_no;
public function __construct($params = array()) public function __construct($params = array())
{ {

View File

@@ -41,7 +41,7 @@ class BatchOrderInfo extends BaseModel
*/ */
protected $phone_no; protected $phone_no;
/** /**
* 项目标识 * 业务线标识
* @var string * @var string
*/ */
protected $project_id; protected $project_id;
@@ -60,6 +60,21 @@ class BatchOrderInfo extends BaseModel
* @var string * @var string
*/ */
protected $notify_url; protected $notify_url;
/**
* 互联网平台名称
* @var string
*/
protected $dealer_platform_name;
/**
* 用户名称/昵称
* @var string
*/
protected $dealer_user_nickname;
/**
* 用户唯一标识码
* @var string
*/
protected $dealer_user_id;
/** /**
* 平台企业订单号 * 平台企业订单号
@@ -170,7 +185,7 @@ class BatchOrderInfo extends BaseModel
} }
/** /**
* 项目标识 * 业务线标识
* @var string $project_id * @var string $project_id
*/ */
public function setProjectId($project_id) public function setProjectId($project_id)
@@ -179,7 +194,7 @@ class BatchOrderInfo extends BaseModel
} }
/** /**
* 项目标识 * 业务线标识
* @return string * @return string
*/ */
public function getProjectId() public function getProjectId()
@@ -240,4 +255,58 @@ class BatchOrderInfo extends BaseModel
{ {
return $this->notify_url; return $this->notify_url;
} }
/**
* 互联网平台名称
* @var string $dealer_platform_name
*/
public function setDealerPlatformName($dealer_platform_name)
{
$this->dealer_platform_name = $dealer_platform_name;
}
/**
* 互联网平台名称
* @return string
*/
public function getDealerPlatformName()
{
return $this->dealer_platform_name;
}
/**
* 用户名称/昵称
* @var string $dealer_user_nickname
*/
public function setDealerUserNickname($dealer_user_nickname)
{
$this->dealer_user_nickname = $dealer_user_nickname;
}
/**
* 用户名称/昵称
* @return string
*/
public function getDealerUserNickname()
{
return $this->dealer_user_nickname;
}
/**
* 用户唯一标识码
* @var string $dealer_user_id
*/
public function setDealerUserId($dealer_user_id)
{
$this->dealer_user_id = $dealer_user_id;
}
/**
* 用户唯一标识码
* @return string
*/
public function getDealerUserId()
{
return $this->dealer_user_id;
}
} }

View File

@@ -61,7 +61,7 @@ class CreateAlipayOrderRequest extends BaseRequest
*/ */
public $notify_url; public $notify_url;
/** /**
* 项目标识 * 业务线标识
* @var string * @var string
*/ */
public $project_id; public $project_id;
@@ -70,6 +70,21 @@ class CreateAlipayOrderRequest extends BaseRequest
* @var string * @var string
*/ */
public $check_name; public $check_name;
/**
* 互联网平台名称
* @var string
*/
public $dealer_platform_name;
/**
* 用户名称/昵称
* @var string
*/
public $dealer_user_nickname;
/**
* 用户唯一标识码
* @var string
*/
public $dealer_user_id;
public function __construct($params = array()) public function __construct($params = array())
{ {

View File

@@ -61,10 +61,25 @@ class CreateBankpayOrderRequest extends BaseRequest
*/ */
public $notify_url; public $notify_url;
/** /**
* 项目标识 * 业务线标识
* @var string * @var string
*/ */
public $project_id; public $project_id;
/**
* 互联网平台名称
* @var string
*/
public $dealer_platform_name;
/**
* 用户名称/昵称
* @var string
*/
public $dealer_user_nickname;
/**
* 用户唯一标识码
* @var string
*/
public $dealer_user_id;
public function __construct($params = array()) public function __construct($params = array())
{ {

View File

@@ -71,7 +71,7 @@ class CreateWxpayOrderRequest extends BaseRequest
*/ */
public $wxpay_mode; public $wxpay_mode;
/** /**
* 项目标识 * 业务线标识
* @var string * @var string
*/ */
public $project_id; public $project_id;
@@ -80,6 +80,21 @@ class CreateWxpayOrderRequest extends BaseRequest
* @var string * @var string
*/ */
public $notes; public $notes;
/**
* 互联网平台名称
* @var string
*/
public $dealer_platform_name;
/**
* 用户名称/昵称
* @var string
*/
public $dealer_user_nickname;
/**
* 用户唯一标识码
* @var string
*/
public $dealer_user_id;
public function __construct($params = array()) public function __construct($params = array())
{ {

View File

@@ -0,0 +1,37 @@
<?php
namespace Yzh\Model\Payment;
use Yzh\Model\BaseRequest;
/**
* 查询劳务模式单笔订单信息请求
* Class GetOrderLxlwRequest
*/
class GetOrderLxlwRequest extends BaseRequest
{
/**
* 平台企业订单号
* @var string
*/
public $order_id;
/**
* 支付路径
* @var string
*/
public $channel;
/**
* 数据类型
* @var string
*/
public $data_type;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More