373 Commits

Author SHA1 Message Date
4edc124d15 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 22:11:14 +08:00
92831bcd13 新需求-活动需求-盲盒转盘调通盘-巡乐会-调试 2025-10-16 21:59:35 +08:00
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
848d491d59 充值上限 2025-09-25 14:36:26 +08:00
a71257de2f 错误修改 2025-09-25 03:42:21 +08:00
423f0cf7a4 任务推荐房间修改 2025-09-25 02:56:05 +08:00
a43acf509c 在线列表 2025-09-25 01:30:26 +08:00
df4343ccbb 注销流程改变 2025-09-24 23:29:29 +08:00
f1879d1905 错误屏蔽 2025-09-24 22:52:40 +08:00
8a60cc55f9 Merge remote-tracking branch 'origin/develop' into develop 2025-09-24 18:22:03 +08:00
f78ec648de 魅力等级显示错误修改 2025-09-24 18:21:53 +08:00
1b7f5d70b9 注销流程改变 2025-09-24 17:17:19 +08:00
a3376691bf 重新连接处理没有在房间是的情况 2025-09-24 17:05:55 +08:00
8856d82479 Merge remote-tracking branch 'origin/develop' into develop 2025-09-24 16:41:56 +08:00
b6c8ce98ee 魅力等级显示错误修改 2025-09-24 16:41:47 +08:00
0cab204745 后端 房间标签删除 2025-09-24 16:40:30 +08:00
9f1ebf2657 进入房间状态 2025-09-24 15:15:27 +08:00
4a6e0f4e0f 图片上传空格处理 2025-09-24 10:53:27 +08:00
7adc5bb6b3 换房间类型 拍卖位处理 2025-09-24 09:58:06 +08:00
8efa22b517 换房间类型 拍卖位处理 2025-09-23 23:28:28 +08:00
f19efd80ea 等级修改bug修改 跟新等级取值错误 2025-09-23 23:03:42 +08:00
fa3c0f648c 登录封禁判断处理 2025-09-23 22:49:37 +08:00
1f267f7636 登录封禁判断处理 2025-09-23 22:43:52 +08:00
0bf849d1c4 拍卖房切换 下拍卖位没有选关系的用户 2025-09-23 22:01:37 +08:00
983a3a2cdc 登录封禁返回 301 2025-09-23 21:43:11 +08:00
6e67b896af 房间在线列表过滤 2025-09-23 21:22:25 +08:00
09b3452795 我创建的房间 过滤 2025-09-23 19:51:00 +08:00
08ab3d18a1 Merge remote-tracking branch 'origin/develop' into develop 2025-09-23 19:04:18 +08:00
9cd5c78290 等级修改bug修改 2025-09-23 19:04:11 +08:00
01f63041a5 封禁登录提示 2025-09-23 19:03:05 +08:00
8abfa49494 等级修改bug修改 2025-09-23 15:55:22 +08:00
0728b51c8e 创建房间bug修改 2025-09-23 14:49:15 +08:00
09e5802e2b 创建房间兼容后台驳回房间。 2025-09-23 11:38:17 +08:00
e77293e8f1 后台用户为空兼容 2025-09-23 10:32:46 +08:00
c97e347923 飘屏文字修改 2025-09-22 21:52:55 +08:00
b75e4a0ddd Merge remote-tracking branch 'origin/develop' into develop 2025-09-22 20:36:43 +08:00
9a6c707f62 加是否可以发布动态字段 2025-09-22 20:36:36 +08:00
cc74849b2b 切后台 回来后 列表添加用户 2025-09-22 20:36:30 +08:00
849b0db43e Merge remote-tracking branch 'origin/develop' into develop 2025-09-22 20:24:42 +08:00
4f9c235787 加是否可以发布动态字段 2025-09-22 20:24:34 +08:00
1859c0edcf 切后台 回来后 列表添加用户 2025-09-22 19:41:53 +08:00
aef3a44910 房间审核加 系统信息推送 2025-09-22 18:35:44 +08:00
f803c33f4b Merge remote-tracking branch 'origin/develop' into develop 2025-09-22 16:47:32 +08:00
86f865d163 房间审核加 系统信息推送 2025-09-22 16:47:21 +08:00
e6f5decfca 房间群组创建 2025-09-22 16:22:47 +08:00
fa177cd610 寻乐会 和消息 2025-09-22 14:27:35 +08:00
2f241a1a20 定版之后bug修改-获取用户当前房间的巡乐会信息接口提交 2025-09-22 14:20:17 +08:00
db1bcb6e46 Merge remote-tracking branch 'origin/develop' into develop 2025-09-22 11:33:16 +08:00
63cb3a1c93 定版之后bug修改-获取用户当前房间的巡乐会信息接口提交 2025-09-22 11:33:09 +08:00
0e4bcb9f5a 关系过滤 2025-09-22 10:26:15 +08:00
e53494c0f5 定版之后bug修改 2025-09-22 09:28:10 +08:00
38cb41d57f 关系过滤 2025-09-22 09:23:40 +08:00
d9b65ff494 定版之后bug修改 2025-09-20 01:07:53 +08:00
a9e0411993 定版之后bug修改--寻乐会报错修复。 2025-09-20 00:04:11 +08:00
d668ec5e74 搜索房间 过滤注销房间 2025-09-19 19:33:11 +08:00
06068665e9 搜索房间 过滤注销房间 2025-09-19 19:29:43 +08:00
4380381a87 清除房间不在线用户 2025-09-19 19:22:05 +08:00
3655647b33 注销清掉实名 2025-09-19 18:58:34 +08:00
601f80d118 注销清掉实名 2025-09-19 18:45:07 +08:00
821048612d Merge remote-tracking branch 'origin/develop' into develop 2025-09-19 18:37:20 +08:00
f369d9c2d2 定版之后bug修改--缓存同意方法封装 2025-09-19 18:37:13 +08:00
d8e954493e 礼物墙里面 去掉盲盒礼物 2025-09-19 18:32:27 +08:00
3153404aaf 房间类型 2025-09-19 17:51:25 +08:00
2104552429 转盘礼物发送 2025-09-19 17:38:56 +08:00
73382d1460 定版之后bug修改 2025-09-19 17:33:23 +08:00
39d8853569 定版之后bug修改 2025-09-19 16:44:26 +08:00
90e5d2541d 定版之后bug修改 2025-09-19 16:13:41 +08:00
f499949d3e 房间类型合并 2025-09-19 15:40:22 +08:00
a3d3d7a47e 首页房间过滤条件 2025-09-19 14:42:02 +08:00
f2c221168c 首页房间过滤条件 2025-09-19 14:26:42 +08:00
3df9899e17 注销 登录限制 2025-09-19 11:43:29 +08:00
423452241e 定版之后bug修改----抽奖重构。 2025-09-19 10:25:18 +08:00
24a65ad21a 不在房间内 消息隐藏 2025-09-18 18:56:37 +08:00
10044688e7 不在房间内 消息隐藏 2025-09-18 18:18:16 +08:00
663e927b12 房间背景图更换 2025-09-18 17:35:26 +08:00
50ebe80013 名称注销后 可重复使用 2025-09-18 16:14:32 +08:00
9a8900739d 名称注销后 可重复使用 2025-09-18 15:40:00 +08:00
ff46a81bde 实名处理 2025-09-17 22:47:11 +08:00
ee59ee91b7 实名处理 2025-09-17 22:39:05 +08:00
7fb92fb7ab 定版之后bug修改----礼物按价格排序。巡乐会。 2025-09-17 21:07:08 +08:00
3c07a370e8 Merge remote-tracking branch 'origin/develop' into develop 2025-09-17 20:49:06 +08:00
ca2d1da548 定版之后bug修改----数组格式转换 2025-09-17 20:48:58 +08:00
68ff3cfdea 交友结束后 卡顿造成的没有收到推送,重新推送 2025-09-17 20:40:32 +08:00
d4923b8e56 地址更新处理 2025-09-17 19:51:39 +08:00
3d2735653e 定版之后bug修改----盲盒转盘记录日期修改 2025-09-17 18:45:07 +08:00
f7b6fb82b5 定版之后bug修改----盲盒转盘并发问题处理 2025-09-17 18:11:17 +08:00
1f0412d4a9 定版之后bug修改 2025-09-17 16:34:17 +08:00
c02872789e 定版之后bug修改 2025-09-17 16:00:43 +08:00
139 changed files with 17408 additions and 1918 deletions

10
.env
View File

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

View File

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

View File

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

View File

@@ -52,10 +52,10 @@ class Adminlog extends adminApi
$where['createtime'] = ['>=', strtotime($search_stime)];
}
if ($search_etime) {
$where['createtime'] = ['<=', strtotime($search_etime.' 23:59:59')];
$where['createtime'] = ['<=', strtotime($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]);

View File

@@ -9,6 +9,7 @@ use think\Db;
use think\Hook;
use think\Session;
use think\Validate;
use think\Cache;
/**
* 盲盒
@@ -75,6 +76,10 @@ class BlindBox extends adminApi
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
}
//$lists 按gift_price 降序排序
usort($lists, function($a, $b) {
return $b['gift_price'] - $a['gift_price'];
});
//统计
$total_data = [];
//每期总次数
@@ -256,95 +261,95 @@ class BlindBox extends adminApi
return V(0,"请选择盲盒类型");
}
$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])){
$periods = 1;
$target_room_ids = [];
if(!empty($room_id)){
// 处理单个房间
$room_pan_detail = db::name('vs_room_pan')
->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id])
->order('id desc')
->find();
if($room_pan_detail){
$periods = $room_pan_detail['periods'];
}
// 删除指定房间的数据
db::name('vs_room_pan')
->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])
->delete();
$target_room_ids = [$room_id];
}else{
// 处理所有房间
db::name('vs_room_pan')
->where(['gift_bag_id'=>$gift_bag_id])
->delete();
$target_room_ids = db::name('vs_room')
->where(['is_open_blind_box_turntable'=>1,'room_status'=>1])
->column('id');
}
// 批量插入数据
$insert_data = [];
$update_data = [];
foreach ($gift_bag_detail as $v){
if(!empty($room_id)) {
// 单个房间更新或插入
$existing = db::name('vs_room_pan')
->where([
'room_id' => $room_id,
'gift_bag_detail_id' => $v['id']
])
->find();
if($existing) {
$update_data[] = [
'id' => $existing['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods
];
} else {
$insert_data[] = [
'room_id' => $room_id,
'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods,
'createtime' => time(),
];
}
} else {
// 多个房间批量插入
foreach ($target_room_ids as $mid){
$insert_data[] = [
'room_id' => $mid,
'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods,
'createtime' => time(),
];
}
}
}
// 执行批量插入
if(!empty($insert_data)) {
db::name('vs_room_pan')->insertAll($insert_data);
}
// 执行批量更新
if(!empty($update_data)) {
foreach($update_data as $update_item) {
db::name('vs_room_pan')
->where(['id' => $update_item['id']])
->update([
'remaining_number' => $update_item['remaining_number'],
'periods' => $update_item['periods']
]);
}
}
}
// if(in_array($gift_bag_id,[10,11,12,13])){
// $periods = 1;
// $target_room_ids = [];
// if(!empty($room_id)){
// // 处理单个房间
// $room_pan_detail = db::name('vs_room_pan')
// ->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id])
// ->order('id desc')
// ->find();
//
// if($room_pan_detail){
// $periods = $room_pan_detail['periods'];
// }
// // 删除指定房间的数据
// db::name('vs_room_pan')
// ->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])
// ->delete();
//
// $target_room_ids = [$room_id];
// }else{
// // 处理所有房间
// db::name('vs_room_pan')
// ->where(['gift_bag_id'=>$gift_bag_id])
// ->delete();
//
// $target_room_ids = db::name('vs_room')
// ->where(['is_open_blind_box_turntable'=>1,'room_status'=>1])
// ->column('id');
// }
// // 批量插入数据
// $insert_data = [];
// $update_data = [];
// foreach ($gift_bag_detail as $v){
// if(!empty($room_id)) {
// // 单个房间更新或插入
// $existing = db::name('vs_room_pan')
// ->where([
// 'room_id' => $room_id,
// 'gift_bag_detail_id' => $v['id']
// ])
// ->find();
//
// if($existing) {
// $update_data[] = [
// 'id' => $existing['id'],
// 'remaining_number' => $v['quantity'],
// 'periods' => $periods
// ];
// } else {
// $insert_data[] = [
// 'room_id' => $room_id,
// 'gift_bag_id' => $gift_bag_id,
// 'gift_bag_detail_id' => $v['id'],
// 'remaining_number' => $v['quantity'],
// 'periods' => $periods,
// 'createtime' => time(),
// ];
// }
// } else {
// // 多个房间批量插入
// foreach ($target_room_ids as $mid){
// $insert_data[] = [
// 'room_id' => $mid,
// 'gift_bag_id' => $gift_bag_id,
// 'gift_bag_detail_id' => $v['id'],
// 'remaining_number' => $v['quantity'],
// 'periods' => $periods,
// 'createtime' => time(),
// ];
// }
// }
// }
//
// // 执行批量插入
// if(!empty($insert_data)) {
// db::name('vs_room_pan')->insertAll($insert_data);
// }
// // 执行批量更新
// if(!empty($update_data)) {
// foreach($update_data as $update_item) {
// db::name('vs_room_pan')
// ->where(['id' => $update_item['id']])
// ->update([
// 'remaining_number' => $update_item['remaining_number'],
// 'periods' => $update_item['periods']
// ]);
// }
// }
// }
// 更新盲盒详情的剩余数量
foreach ($gift_bag_detail as $k=>$v){
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
@@ -590,6 +595,9 @@ class BlindBox extends adminApi
$ext = json_encode($ext);
$res = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->update(['ext'=>$ext]);
if($res){
//删除缓存
$cacheKey = "xlh_config_13";
cache::rm($cacheKey);
return V(1,"成功");
}else{
return V(0,"失败");
@@ -722,7 +730,9 @@ class BlindBox extends adminApi
$stime = input('stime', '');
$etime = input('etime', '');
$where = [];
if($room_id){
$where['room_id'] = $room_id;
}
if($gift_id){
$where['gift_id'] = $gift_id;
}
@@ -747,8 +757,8 @@ class BlindBox extends adminApi
if($stime!=="" && $etime!==""){
$where['createtime'] = ['between', [strtotime($stime), strtotime($etime.'23:59:59')]];
}
$count = db::name('vs_gift_bag_receive_log')->where($where)->count();
$lists_data = db::name('vs_gift_bag_receive_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
$count = db::name('vs_gift_bag_receive_pan_log')->where($where)->count();
$lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
$lists = [];
foreach ($lists_data as $key => $value) {
$lists[$key]['id'] = $value['id'];
@@ -779,7 +789,7 @@ class BlindBox extends adminApi
$lists[$key]['gift_num'] = $value['num'];
$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_gift_money = 0;
$total_money = 0;
@@ -794,13 +804,17 @@ class BlindBox extends adminApi
}else{
$ratio =round(($total_gift_money / $total_money),3);
}
//盈亏
//用户盈亏
$profit_loss = $total_gift_money - $total_money;
//平台盈亏
$platform_profit_loss = $total_money - $total_gift_money;
if($profit_loss==0 || $total_money==0){
$profit_loss_ratio = 0;
}else{
// 盈亏比
$profit_loss_ratio = round(($profit_loss / $total_money),3);
//平台盈亏比
$platform_profit_loss_ratio = round(($platform_profit_loss / $total_money),3);
}
$return_data = [
'page' =>$page,
@@ -814,6 +828,8 @@ class BlindBox extends adminApi
'ratio' => $ratio,
'profit_loss' => $profit_loss,
'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);
@@ -830,7 +846,9 @@ class BlindBox extends adminApi
$room_id = input('room_id', 0);
$periods = input('periods', '');
$where = [];
if($room_id){
$where['b.room_id'] = $room_id;
}
if($gift_id){
$where['b.gift_id'] = $gift_id;
}
@@ -856,7 +874,8 @@ class BlindBox extends adminApi
foreach ($lists_data as $key => $value) {
$lists[$key]['id'] = $value['id'];
$lists[$key]['periods'] = $value['periods'];
$lists[$key]['user'] = $value['user_id']."-".db::name('user')->where('id',$value['user_id'])->value('nickname');
$user = db::name('user')->field('user_code,nickname')->where('id',$value['user_id'])->find();
$lists[$key]['user'] = $user['user_code']."-".$user['nickname'];
//支付价格
$lists[$key]['pay_price'] = $value['pay_price'];
$gift = db::name('vs_gift')->field('gid,gift_name,gift_price')->where('gid',$value['locking_gift_id'])->find();
@@ -867,10 +886,17 @@ class BlindBox extends adminApi
$lists[$key]['is_send'] = $value['is_send'];
$lists[$key]['is_send_str'] = $value['is_send']==1?"":"";
$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'));
$locking_num = db::name('vs_room_pan_xlh_log')->where('createtime','>=',$today)->count();
$locking_num = db::name('vs_room_pan_xlh_log')->alias('a')
->join('vs_room_pan_xlh b', 'a.xlh_id = b.id')
->where('a.createtime','>=',$today)->where(['a.is_send'=>1,'b.room_id'=>$room_id])->sum('a.num');
$return_data = [
'page' =>$page,
'page_limit' => $page_limit,

View File

@@ -327,6 +327,7 @@ class Decorate extends adminApi
$type = input('type', '');
$where = [];
if($user_id!=""){
$user_id = db::name('user')->where('user_code', $user_id)->value('id');
$where['user_id'] = $user_id;
}
if($did!=""){
@@ -340,7 +341,8 @@ class Decorate extends adminApi
$return_list = [];
foreach ($lists as $k=>$v){
$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']];
if($v['type'] >= 6){
$return_list[$k]['name'] = $v['special_num'];

View File

@@ -1,7 +1,7 @@
<?php
namespace app\adminapi\controller;
ini_set('memory_limit', '512M'); // 临时增加到512MB
use app\common\controller\adminApi;
use think\Db;
@@ -54,12 +54,14 @@ class GiveGift extends adminApi
$where['from'] = $from;
}
// 时间筛选优化
if(!empty($start_time) && !empty($end_time)){
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
} elseif(!empty($start_time)){
if (!empty($start_time) || !empty($end_time)) {
if (!empty($start_time) && !empty($end_time)) {
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
} elseif (!empty($start_time)) {
$where['createtime'] = ['>=', strtotime($start_time)];
} elseif(!empty($end_time)){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
} elseif (!empty($end_time)) {
$where['createtime'] = ['<=', strtotime($end_time)];
}
}
//礼物总数
$gift_num = db::name('vs_give_gift')->where($where)->sum('number');
@@ -73,24 +75,32 @@ class GiveGift extends adminApi
$room_owner_earning = 0;
// 获取所有送礼记录
$list = db::name('vs_give_gift')->where($where)->order('id', 'desc')->select();
$gift_ids = array_column($list, 'id');
$lists = db::name('vs_give_gift')->where($where)->order('id', 'desc')->page($page, $page_limit)->select();
$count = db::name('vs_give_gift')->where($where)->count();
$earning_list = [];
if(!empty($where)){
$gift_ids = db::name('vs_give_gift')->where($where)->column('id');
if (!empty($gift_ids)) {
// 批量获取所有收益记录
$earning_list = db::name('vs_give_gift_ratio_log')
->field('app_earning,gift_user_earning,room_owner_earning')
->where('give_gift_id', 'in', $gift_ids)
->order('id', 'desc')
->select();
}
}else{
// 批量获取所有收益记录
$earning_list = db::name('vs_give_gift_ratio_log')
->field('app_earning,gift_user_earning,room_owner_earning')
->order('id', 'desc')
->select();
}
// 计算总收益
foreach ($earning_list as $earning) {
$app_earning += $earning['app_earning'];
$receive_earning += $earning['gift_user_earning'];
$room_owner_earning += $earning['room_owner_earning'];
}
}
$count = count($list);
$lists = $this->array_pagination($list, $page, $page_limit);
// 提取所有需要关联查询的ID
$user_ids = array_merge(

View File

@@ -88,7 +88,7 @@ class Guild extends adminApi
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
$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]['user_id'] = $user['user_code'];
$list[$k]['user_id'] = $user['user_code']??"";
$list[$k]['intro'] = $v['intro'];
}
// 数组按today_money 排序
@@ -342,9 +342,9 @@ class Guild extends adminApi
$rum_lists[$k]['id']=$v['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]['nickname']=$user_info['nickname'];
$rum_lists[$k]['charm_level']=$user_info['charm_level'];
$rum_lists[$k]['wealth_level']=$user_info['wealth_level'];
$rum_lists[$k]['nickname']=$user_info['nickname']?? '';
$rum_lists[$k]['charm_level']=$user_info['charm_level']??0;
$rum_lists[$k]['wealth_level']=$user_info['wealth_level']??0;
//用户流水
$consumption_sql = db::name('vs_user_money_log')
->whereIn('change_type',$coin_consumption_type_array)
@@ -623,12 +623,14 @@ class Guild extends adminApi
$search_status_time = input('search_status_time', '');
$search_end_time = input('search_end_time', '');
$search_status = input('search_status', '');
$where = ['b.delete_time'=>0];
// $where = ['b.delete_time'=>0];
$where = [];
if($search_user_id){
$where['b.user_id'] = $search_user_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){
$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['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();
@@ -114,6 +123,15 @@ class Index extends adminApi
$return_data['register_count'] = db::name('user')->where('status', 1)->where('is_robot', 0)->whereTime('createtime', 'today')->count();
//充值会员数
$return_data['recharge_count'] = db::name('vs_user_recharge')->where('pay_status',2)->group('user_id')->count();
if(empty($return_data['member_count'])){
$return_data['recharge_count_percent'] = 0;
$return_data['no_recharge_count'] = 0;
$return_data['no_recharge_count_percent'] = 0;
$return_data['no_recharge_count'] = 0;
$return_data['ios_count_percent'] = 0;
$return_data['android_count'] = 0;
$return_data['android_count_percent'] = 0;
}else{
//充值会员百分比
$return_data['recharge_count_percent'] = round(($return_data['recharge_count'] / $return_data['member_count']) * 100);
//未充值会员数
@@ -125,6 +143,7 @@ class Index extends adminApi
//安卓用户数
$return_data['android_count'] = $return_data['member_count']-$return_data['ios_count'];
$return_data['android_count_percent'] = round(($return_data['android_count'] / $return_data['member_count']) * 100);
}
//礼物打赏实时统计
//一个月内的礼物打赏

View File

@@ -93,18 +93,19 @@ class Level extends adminApi
if(!$level_id){
return V(0,"添加失败");
}
if(!empty($gift_id)){
//等级特权
$decorate = db::name("vs_decorate")->where(['did' => $gift_id, 'delete_time' => 0])->find();
if(empty($decorate)){
return V(0,"请选择等级特权");
}
if($gift_id){
db::name('vs_wealth_level_rights')->insert([
'level_id' => $level_id,
'gift_id' => $gift_id,
'createtime' => time()
]);
}
return V(1,"成功", ['id'=>$level]);
}
/*

View File

@@ -186,7 +186,7 @@ class Room extends adminApi
$page = input('page', 1);
$page_limit = input('page_limit', 30);
$search_name = input('search_name', '');
$where=[];
$where['deletetime'] = 0;
//标签名称
if($search_name!==''){
$where['label_name'] = ['like', '%'.$search_name.'%'];
@@ -237,7 +237,7 @@ class Room extends adminApi
if(!$type_data){
return V(0,"房间类型不存在");
}
$result = db::name($this->table_room_type)->where(['id'=>$type_id])->delete();
$result = db::name($this->table_room_type)->where(['id'=>$type_id])->update(['deletetime'=>time()]);
if(!$result){
return V(0,"删除失败");
}
@@ -656,8 +656,8 @@ class Room extends adminApi
}
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();
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
}
@@ -926,9 +926,22 @@ class Room extends adminApi
if($status){
$data['status'] = $status;
}
$bg_url = db::name('vs_room_background')->where('id',$id)->value('image_url');
$res = db::name('vs_room_background')->where('id',$id)->update($data);
if($res){
if($bg_url != $image_url){
//查询使用默认背景的房间
$room_list = db::name('vs_room')->field('id,room_background')->where(['room_status' => ['<>',3]])->select();
if($room_list){
foreach ($room_list as $v){
//判断是否使用默认背景room_background 字段值是否是以 get_system_config_value('web_site') 开头
if(strpos($v['room_background'],get_system_config_value('web_site')) !== FALSE){
db::name('vs_room')->where('id',$v['id'])->update(['room_background' => $image_url]);
}
}
}
}
return V(1,"成功");
}
else{
@@ -979,6 +992,10 @@ class Room extends adminApi
$search_room_number = input('search_room_number', '');
$search_onwer_number = input('search_onwer_number', '');
$room_status = input('room_status', '');
//开始 时间
$start_time = input('start_time', '');
//结束 时间
$end_time = input('end_time', '');
if($search_room_number!==''){
$where['room_number'] = $search_room_number;
@@ -989,12 +1006,36 @@ class Room extends adminApi
if($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;
$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')
->where($where)
->order('id desc')
->page($page, $page_limit)->select();
foreach ($lists as &$value) {
$guild = model('Guild')->getGuildByUserId($value['user_id']);
$value['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
@@ -1005,7 +1046,27 @@ class Room extends adminApi
$value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7);
//房间状态1正常2封禁3关闭
$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 = [
'page' =>$page,
'page_limit' => $page_limit,
@@ -1015,6 +1076,7 @@ class Room extends adminApi
return V(1,"成功", $return_data);
}
//Cp电影房封禁
public function cp_movie_room_forbid()
{
@@ -1228,7 +1290,7 @@ class Room extends adminApi
if($apply_status!==''){
$where['apply_status'] = $apply_status;
}else{
$where['apply_status'] = ['<>',2];
$where['apply_status'] = 1;
}
$count = db::name($this->table)->where($where)->count();
@@ -1255,6 +1317,7 @@ class Room extends adminApi
//房间审核
public function room_audit(){
$id = input('id', '');
$remark = input('remark', '');
if($id == ''){
return V(0,"参数错误");
}
@@ -1262,6 +1325,10 @@ class Room extends adminApi
if($apply_status == ''){
return V(0,"参数错误");
}
$room_data = db::name('vs_room')->where(['id'=>$id])->find();
if(!$room_data){
return V(0,"参数错误");
}
$result = db::name('vs_room')->where(['id'=>$id])->update([
'apply_status'=>$apply_status,
'is_open_blind_box_turntable'=>1,
@@ -1270,8 +1337,28 @@ class Room extends adminApi
if(!$result){
return V(0,"修改失败");
}
//发系统信息
if($apply_status ==2){
$deal_content = '审核通过';
}elseif($apply_status ==3){
$deal_content = '审核未通过';
}
if(!empty($remark)){
$deal_content .= ',原因:'.$remark;
}
db::name('system_message')->insert([
'title' => '房间审核结果',
'content' => '您创建的房间'.$room_data['room_name'].$deal_content,
'type' => 1,
'admin_id' => Session::get('admin_id'),
'receiving_id' => $room_data['user_id'],
'createtime' => time(),
]);
//房间绑定盘
model('Room')->bindPan($id);
return V(1,"成功");
}
@@ -1427,10 +1514,10 @@ class Room extends adminApi
$where['createtime'] = ['>=',strtotime($stime)];
}
if(!empty($etime)){
$where['createtime'] = ['<=',strtotime($etime.' 23:59:59')];
$where['createtime'] = ['<=',strtotime($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();
$count = db::name($this->table_room_log)->where($where)->count();
@@ -1598,4 +1685,183 @@ class Room extends adminApi
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)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
$where['createtime'] = ['<=', strtotime($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已支付
@@ -112,10 +112,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
$where['createtime'] = ['<=', strtotime($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')
->where($where)
@@ -177,10 +177,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
$where['createtime'] = ['<=', strtotime($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.购买装扮
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
@@ -239,10 +239,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
$where['createtime'] = ['<=', strtotime($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;
@@ -259,9 +259,14 @@ class Statistical extends adminApi
->select();
foreach ($lists as $key => $value) {
$room = db::name('vs_room')->where('id', $value['from_id'])->find();
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
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]['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');
$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)];
}
if($pay_etime !== ''){
$where['createtime'] = ['<=', strtotime($pay_etime.' 23:59:59')];
$where['createtime'] = ['<=', strtotime($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 !== ''){
$where['pay_status'] = $pay_status;
@@ -346,19 +351,21 @@ class Statistical extends adminApi
];
//总收入
$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]];
$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]];
$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);
}
@@ -383,10 +390,10 @@ class Statistical extends adminApi
$where['a.createtime'] = ['>=', strtotime($start_time)];
}
if($end_time !== ''){
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
$where['a.createtime'] = ['<=', strtotime($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();
@@ -429,10 +436,10 @@ class Statistical extends adminApi
$where['a.createtime'] = ['>=', strtotime($start_time)];
}
if($end_time !== ''){
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
$where['a.createtime'] = ['<=', strtotime($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')
->alias('a')->join('user b', 'a.user_id = b.id')

View File

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

View File

@@ -159,7 +159,7 @@ class Underage extends adminApi
*/
public function content_List(){
$page = input('page', 1);
$page_limit = input('pageSize', 30);
$page_limit = input('page_limit', 10);
$search_name = input('search_name', '');
$where = [];
if($search_name){
@@ -167,6 +167,7 @@ class Underage extends adminApi
}
$list = DB::name('vs_underage_mode_content')->where($where)->order('sort,id', 'asc')->page($page, $page_limit)->select();
$count = DB::name('vs_underage_mode_content')->where($where)->count();
$return_lists = [];
foreach ($list as $key => $value) {
$return_lists[$key]['id'] = $value['id'];
$return_lists[$key]['type_id'] = $value['type_id'];
@@ -266,7 +267,7 @@ class Underage extends adminApi
$type_id = input('type_id', '');
$title = input('title', '');
$introduced = input('introduced', '');
$content = input('content', '');
$content = $_POST['content']??"";
$url = input('url', '');
$img = input('img', '');
$from = input('from', 1);
@@ -303,9 +304,6 @@ class Underage extends adminApi
$data['content'] = $content;
}
$result = db::name('vs_underage_mode_content')->where(['id'=>$id])->update($data);
if(!$result){
return V(0,"修改失败");
}
return V(1,"成功", ['id'=>$id]);
}
}

View File

@@ -45,6 +45,9 @@ class UploadFile extends Upload
$fileName = $pinyin->permalink($fileName, ''); // 转换为无分隔符的拼音
}
// 去除文件名中的空格
$fileName = str_replace(' ', '', $fileName);
// 添加唯一标识符(时间戳+随机数)
$uniqueId = time() . mt_rand(1000, 9999);
$objectName = $fileName . '_' . $uniqueId . '.' . $extension;

View File

@@ -74,8 +74,8 @@ class User extends adminApi
}elseif($v=='coin2'){
$where['c.coin'] = ['<=',$input_data];
}elseif($v=='createtime'){
$where['a.createtime'] = ['>=',strtotime($input_data.' 00:00:00')];
$where['a.createtime'] = ['<=',strtotime($input_data.' 23:59:59')];
$where['a.createtime'] = ['>=',strtotime($input_data)];
$where['a.createtime'] = ['<=',strtotime($input_data)];
}else{
$where['a.'.$v] = $input_data;
}
@@ -231,7 +231,8 @@ class User extends adminApi
'type' => $type,
'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);
}
@@ -735,7 +736,12 @@ class User extends adminApi
* 用户列表
*/
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);
}
}

View File

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

View File

@@ -60,10 +60,10 @@ class Withdrawal extends adminApi
$where['a.createtime'] = ['>=', strtotime($search_stime)];
}
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)){
$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')
->join('user b', 'a.user_id = b.id', 'left')
@@ -75,6 +75,7 @@ class Withdrawal extends adminApi
->field('a.*,b.nickname,b.user_code')
->order('a.createtime desc')
->where($where)
->page($page, $page_limit)
->select();
$data_lists = [];
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');
$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];
}
//查询该用户信息
$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)){
return ['code' => 0, 'msg' => '用户信息错误!', 'data' => null];
}
$real_name = $user_info['real_name'];
$id_card = $user_info['card_id'];
$order_id = $withdraw_info['order_sn'];
$order_amount = $withdraw_info['general_money'];
$phone = $user_info['mobile'];
if(empty($phone)) {
return ['code' => 0, 'msg' => '请先绑定手机号', 'data' => null];
}
if (empty($real_name) || empty($id_card)) {
return ['code' => 0, 'msg' => '请先实名认证', 'data' => null];
}
@@ -281,7 +286,11 @@ class Withdrawal extends adminApi
}
$card_no = $user_info['alipay_account'];
$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) {
if(empty($user_info['bank_card_number'])){
return ['code' => 0, 'msg' => '请先绑定银行卡号', 'data' => null];

View File

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

View File

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

View File

@@ -32,6 +32,7 @@ class Activities extends BaseCom
$data['name'] = $activities_title??"";
$data['gift_bag'] = [];
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']??"";
@@ -129,46 +130,51 @@ class Activities extends BaseCom
//礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
$data = [];
$data['gift_bag_id'] = $gift_bag['id']??0;
$data['name'] = $activities['title']??"";
$data['bag_name'] = $gift_bag['title']??"";
$data['effective_time'] = $activities['effective_time']??"";
//规则
$data['rule'] = get_system_config_value('web_site')."/api/Page/page_show?id=13";
$ext = json_decode($gift_bag['ext'],true);
$data['money'] = $ext['money'];
$data['counter']['counter'] = $ext['counter'];
$data['counter']['money'] = $ext['money_str'];
$data['counter']['diamond'] = $ext['diamond'];
$data['money'] = $gift_bag['money'];
$data['counter'] = $ext['counter'];
$data['money_str'] = $ext['money_str'];
$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();
$data['gift_list'] = [];
foreach ($detail as $k=>$v){
if($v['type'] == 1){
$list[$k]['name'] = "金币";
$list[$k]['gift_name'] = "金币";
$list[$k]['num'] = $v['gold'];
$list[$k]['gold'] = $v['gold'];
$list[$k]['gift_price'] = $v['gold'];
$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) {
$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]['gold'] = $gift['gift_price'];
$list[$k]['gift_price'] = $gift['gift_price'];
$list[$k]['type'] =2;
$list[$k]['icon'] = $gift['play_image'];
$list[$k]['base_image'] = $gift['base_image'];
} elseif($v['type'] == 3) {
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->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]['gold'] = $decorate_price['price']; //价格
$list[$k]['gift_price'] = $decorate_price['price']; //价格
$list[$k]['type'] =3;
$list[$k]['icon'] = $gift['base_image'];
$list[$k]['base_image'] = $gift['base_image'];
}elseif($v['type'] == 4) {
$list[$k]['name'] = "钻石";
$list[$k]['gift_name'] = "钻石";
$list[$k]['num'] = $v['quantity'];
$list[$k]['gold'] = $v['gold'];
$list[$k]['gift_price'] = $v['gold'];
$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;
@@ -179,13 +185,16 @@ class Activities extends BaseCom
{
$activities_id = 3;//天降好礼
$uid = input('uid',$this->uid);
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
if($permission){
return V(1,'操作成功', ['permission'=>0]);
}else{
return V(1,'操作成功', ['permission'=>1]);
//礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
$permission = 0;
if($gift_bag){
$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()
@@ -195,4 +204,155 @@ class Activities extends BaseCom
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,18 +39,19 @@ class BlindBoxTurntable extends BaseCom
$gift_user_ids = input('gift_user_ids',0);
$num = input('num',1);
$heart_id = input('heart_id',0);
$reslut = model('BlindBoxTurntableGift')->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']);
}
/*
* 礼物发放
*/
public function gift_send(){
$key_name = "api:blind_box_turntable:gift_send:" . $this->uid;
redis_lock_exit($key_name);
// $key_name = "api:blind_box_turntable:gift_send:" . $this->uid;
// redis_lock_exit($key_name);
$send_id = input('send_id',0);
$reslut = model('BlindBoxTurntableGift')->gift_send($send_id);
redis_unlock($key_name);
// redis_unlock($key_name);
return v($reslut['code'], $reslut['msg'], $reslut['data']);
}
@@ -92,7 +93,7 @@ class BlindBoxTurntable extends BaseCom
$user_id = $this->uid;
$room_id = input('room_id',0);
$num = input('num',1);
$reslut = model('BlindBoxTurntableGift')->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']);
}
/*
@@ -116,4 +117,15 @@ class BlindBoxTurntable extends BaseCom
$reslut = model('BlindBoxTurntableGift')->xlh_ranking($room_id,$page,$page_size);
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\Log;
class Ceshi extends Controller
class Ceshi extends Controllers
{
//设置白名单ip访问本类接口
protected $allowIp = [
@@ -211,17 +211,17 @@ class Ceshi extends Controller
$user = db::name('user')->where('id','>', 0)->select();
if($user){
foreach ($user as &$v){
if($v['id']){
$j = 0;
$data[$j] = [
'UserID' => 'u'.$v['id'],
];
}
model('Tencent')->account_deletes($data);
}
}
// if($user){
// foreach ($user as &$v){
// if($v['id']){
// $j = 0;
// $data[$j] = [
// 'UserID' => 'u'.$v['id'],
// ];
// }
// // model('Tencent')->account_deletes($data);
// }
// }
$reslut9 = db::name('user')->where('id','>', 0)->delete();
if($reslut9){
@@ -458,9 +458,9 @@ class Ceshi extends Controller
//删除腾讯房间
$room = db::name('vs_room')->select();
foreach ($room as &$value){
model('Tencent')->delete_group('room'.$value['id']);
}
// foreach ($room as &$value){
// // model('Tencent')->delete_group('room'.$value['id']);
// }
$reslut35 = db::name('vs_room')->where('id','>', 0)->delete();
if($reslut35){
$i++ ;

View File

@@ -43,4 +43,10 @@ class Cron
$cron = new \app\cron\controller\FriendEnd();
$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()
{
$page = input('page',1);
$page = $page > 0 ? $page : 1;
$limit = input('limit',10);
$search = input('search_id','');
$reslut = model('Guild')->get_guild_list($page,$limit,$search,$this->uid);

View File

@@ -20,7 +20,7 @@ class Index extends BaseCom
$is_top = input('is_top', 0); //1非置顶2置顶
$label_id = input('label_id', 0);
$page = input('page', 1);
$page_limit = input('page_limit', 15);
$page_limit = input('page_limit', 20);
$reslut = model('Room')->room_list($label_id,$is_top, $page, $page_limit);
return V($reslut['code'], $reslut['msg'], $reslut['data'], $reslut['api_version']);
@@ -29,7 +29,7 @@ class Index extends BaseCom
//房间类型列表
public function room_type_list()
{
$list = db::name('vs_room_type')->where('status', 1)->field('id,type_name as label_name')->order('sort asc')->select();
$list = db::name('vs_room_type')->where(['status' => 1, 'deletetime' => 0])->field('id,type_name as label_name')->order('sort asc')->select();
//给前面添加一组数据
array_unshift($list, ['id' => -1, 'label_name' => '热门']);
return V(1, '获取成功', $list);

View File

@@ -26,6 +26,9 @@ class Payment extends Controller
$user_id = input('user_id', 0);
$money = input('money', 0);
$coin = input('coin', 0);
$type_params = input('type_params', 0);
$type_id = input('type_id', 0);
if(!$coin){
$coin = $money * get_system_config_value('rmb_coin_ratio');
}
@@ -47,7 +50,7 @@ class Payment extends Controller
return V(0, '未成年不可充值!', null);
}
if (!is_numeric($money) || floor($money) != $money || $money <= 0 || $money >= 2000) {
if (!is_numeric($money) || floor($money) != $money || $money <= 0 || $money > 2000) {
return V(0, '请选择正确的充值金额', null);
}
$user_code = db::name('user')->where(["id" => $user_id])->value('user_code');
@@ -60,7 +63,9 @@ class Payment extends Controller
$data['user_id'] = $user_id;
$data['pay_type'] = $type;
$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);
if (!$re) {
@@ -105,6 +110,7 @@ class Payment extends Controller
$where['order_sn']=$out_trade_no;
$where['order_type']=1;
$where['pay_type']=2;
$where['pay_status']=1;
$data=[
'trade_no'=>$trade_no
@@ -149,6 +155,7 @@ class Payment extends Controller
$where['order_sn']=$out_trade_no;
$where['order_type']=1;//1 充值
$where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信
$where['pay_status']=1;
$data=[
'trade_no'=>$transaction_id
@@ -204,6 +211,7 @@ class Payment extends Controller
$where['order_sn']=$out_trade_no;
$where['order_type']=1;//1 充值
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信
$where['pay_status']=1;
$data=[
'trade_no'=>$trade_no
@@ -225,11 +233,16 @@ class Payment extends Controller
* 云账户回调(提现)
*/
public function yun_callback(){
$data = input("data", "");
$mess = input("mess", "");
$timestamp = input("timestamp", "");
$sign = input("sign", "");
Log::record("云账户回调信息".json_encode($_POST),"info");
// $data = input("data", "");
// $mess = input("mess", "");
// $timestamp = input("timestamp", "");
// $sign = input("sign", "");
$data = $_POST['data']??"";
$mess = $_POST['mess']??"";
$timestamp = $_POST['timestamp']?? "";
$sign = $_POST['sign']??"";
write_log_redis("yunzhanghu_huidiao_原始数据",$_POST);
$yun_pay = new YunPay();
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
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

@@ -430,4 +430,34 @@ class Room extends BaseCom
$reslut = model('Room')->room_user_charm_list($room_id, $user_id);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
// //创建房间
// public function create_rooms()
// {
// //查询所有的房间信息
// $room = db::name('vs_room')->field('id,user_id')->where(['room_status' => ['<>',3]])->select();
// $i = 0;
// foreach ($room as $value) {
// $reslut = model('Tencent')->create_group($value['user_id'],'room'.$value['id']);
// $i++;
// }
// return['code' => 1, 'msg' => '成功创建了'.$i.'个房间', 'data' => null];
// }
//用户重连
public function user_reconnect()
{
$room_id = input('room_id', 0);
$reslut = model('Room')->user_reconnect($this->uid, $room_id);
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()
{
$key_name = "api:room:apply_pit:" . $this->uid;
$room_id = input('room_id', 0);
$pit_number = input('pit_number', 0);
if($room_id == 0){
@@ -19,27 +21,19 @@ class RoomPit extends BaseCom
if($res['code'] != 1){
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_type = $res['data']['type_id'];
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4))|| $room_type == 2 || $room_type == 7){
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){
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
}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);
}else{
redis_unlocks($key_name);
return V(0, '房间不存在', null);
}
redis_unlocks($key_name);
//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);
@@ -113,9 +107,9 @@ class RoomPit extends BaseCom
}
$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)) || $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')->DownPit($this->uid, $room_id,$pit_number);
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
$reslut = model('RoomSong')->down_kpit($this->uid, $room_id);
}

View File

@@ -36,13 +36,15 @@ class Search extends BaseCom
$where = [
'room_number' => $search,
'apply_status' => 2,
'type_id' => ['<>',6]
'type_id' => ['<>',6],
'room_status' => 1
];
}else{
$where = [
'room_name' => ['like', '%'.$search . '%'],
'apply_status' => 2,
'type_id' => ['<>',6]
'type_id' => ['<>',6],
'room_status' => 1
];
}
@@ -98,4 +100,59 @@ class Search extends BaseCom
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']);
}
//关注房间(红包专用)
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()
{

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)
{
//礼包
$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) {
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;
//礼包
$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) {
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();
if (!$gift_bag_detail) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
@@ -136,15 +142,20 @@ class Activities extends Model
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,
@@ -160,4 +171,85 @@ class Activities extends Model
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

@@ -9,11 +9,11 @@ class Banner extends Model
{
protected $table = 'fa_vs_banner';
public $ShowType = [
// 1 => '引导页',
// 2 => '启动页',
1 => '引导页',
2 => '启动页',
3 => '首页轮播图',
4 => '工会',
5 => '帮助反馈'
4 => '房间首页',
5 => '工会列表页广告位'
];
//1纯展示 2文章 3房间 4个人主页 5外站'
public $Type = [

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -135,13 +135,13 @@ class DailyTasks extends Model
$v['processing_type'] = 2;
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
//跳转的房间路径
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
$v['target_quantity'] = $v['target_quantity'] * 60;
$v['is_time'] = 1;
}elseif(in_array($v['task_id'],[10])){
$v['processing_type'] = 7;
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
} else{
$v['processing_type'] = 9;
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];

View File

@@ -17,7 +17,7 @@ class Decorate extends Model
protected $updateTime = 'updatetime';
// 定义字段类型 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 = [])
{
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 = [])
{
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])
->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;
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){
Db::rollback();
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,'房主收益');
@@ -275,6 +282,13 @@ class GiveGift extends Model
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_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) {
Db::rollback();
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
@@ -389,16 +405,18 @@ class GiveGift extends Model
if($gift_box){
// 统计相同礼物的数量
$giftCount = [];
foreach ($gift_box as $gv) {
foreach ($gift_box as $key=>$gv) {
$gift_info = Db::name('vs_gift')->where(['gid'=>$gv['gift_id']])
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
if (isset($giftCount[$gv['gift_id']])) {
$giftCount[$gv['gift_id']]['count']++;
} else {
$giftCount[$gv['gift_id']] = [
'gift_info' => Db::name('vs_gift')->where(['gid'=>$gv['gift_id']])
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find(),
'gift_info' => $gift_info,
'count' => 1
];
}
$gift_box[$key]['gift_name'] = $gift_info['gift_name'];
}
// 构建文字消息内容
@@ -413,9 +431,9 @@ class GiveGift extends Model
$textMessage = $FromUserInfo['nickname'] . ' 送给 ' . $ToUserInfo['nickname'].' 趣味礼物 ' . implode('', $giftTextList);
$textData = [
'FromUserInfo' => $FromUserInfo,
// 'ToUserInfo' => $ToUserInfo,
// 'GiftInfo' => $gift_info,
// 'GiftNum' => $num,
'ToUserInfo' => $ToUserInfo,
'GiftInfos' => array_values($gift_box),
'GiftNum' => $num,
'text' => $textMessage
];
// 聊天室推送文字消息
@@ -555,6 +573,308 @@ class GiveGift extends Model
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)
{

View File

@@ -17,9 +17,9 @@ class Guild extends Model
* @param $page
* @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) {
$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')
->where(['is_show'=>1,'delete_time'=>0])
->where($where)
->order('income desc')
->page($page,$limit)
->page($page, $page_limit)
->select();
$count = Db::name('vs_guild')
->where(['is_show'=>1,'delete_time'=>0])
@@ -62,7 +61,7 @@ class Guild extends Model
}
$data =[
'page' => $page,
'limit' => $limit,
'limit' => $page_limit,
'count' => $count,
'list' => $list
];
@@ -610,8 +609,8 @@ class Guild extends Model
//规则
$data['rule'] = get_system_config_value('web_site').'/api/Page/page_show?id=15';
//上周流水
$week_start = date('Y-m-d', strtotime('last monday'));
$week_end = date('Y-m-d', strtotime('last monday +6 days'));
$week_start = date('Y-m-d 00:00:00', strtotime('last week Monday'));
$week_end = date('Y-m-d 23:59:59', strtotime('last week Monday +6 days'));
$guild_subsidy = db::name('vs_guild_subsidy')
->where(["guild_id"=>$guild_id,'start_time' => $week_start, 'end_time' => $week_end])
->find();
@@ -622,18 +621,38 @@ class Guild extends Model
$data['list'][0]['status_str'] = isset( $guild_subsidy['status'])&& $guild_subsidy['status']==1 ? "已发放" : "未发放";
//本周流水
//本周的第一天
$week = strtotime(date('Y-m-d', strtotime('this week Monday')));
$guild_user = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>null])->select();
$guild_user_ids = array_column($guild_user,'room_id');
$total_transaction = db::name('vs_give_gift')
->where(['from'=>2,'from_id' => ['in',$guild_user_ids],'createtime' => ['between', [$week, time()]]])
$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])->select();
$transaction = 0;
foreach ($guild_user as $k => $v){
$week_start_time_seach = $week;
$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;
if($total_transaction){
//根据工会流水 获取补贴比例 单位%
$subsidy_config = db::name('vs_guild_subsidy_config')->where('start_amount <= '. $total_transaction)
->where('end_amount > '. $total_transaction)->getField('subsidy_ratio');
$ss = $total_transaction * ($subsidy_config / 100);
//获取补贴配置
$config = db::name('vs_guild_subsidy_config')->where(['status' => 1])->order('end_amount desc')->select(); //配置查询
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'] = "本周流水";
@@ -754,9 +773,15 @@ class Guild extends Model
$start_time_all = strtotime($start_time." 00:00:00");
$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')
->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');
$total_transaction = $total_transaction+$transaction;
}
@@ -771,11 +796,17 @@ class Guild extends Model
$i=0;
foreach ($list as $k=>$v){
if(!$start_time){
$start_time = $v['createtime'];
$end_time = time();
$start_time_seach = $value['createtime'];
$end_time_seach = time();
}else{
$start_time = strtotime($start_time." 00:00:00");
$end_time = strtotime($end_time." 23:59:59");
$start_time_seach = strtotime($start_time." 00:00:00");
$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();
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]['total_price'] = db::name('vs_give_gift')
->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');
$i++;
}

View File

@@ -27,6 +27,7 @@ class Level extends Model
{
//规则
$return['rule_url'] = get_system_config_value('web_site')."/api/Page/page_show?id=10";
$return['coin_charm_exp'] = get_system_config_value('coin_charm_exp');
//用户信息
$user = model('User')->get_user_info($uid);
//用户头像
@@ -53,7 +54,7 @@ class Level extends Model
//距离下个等级需要的经验
$return['user']['next_level'] = $user['charm_level']+1;
$return['user']['next_level_str'] = 'Lv.'.$return['user']['next_level'];
$next_exp = $user_level['next_level_exp'] - $user['wealth_exp'];
$next_exp = $user_level['next_level_exp'] - $user['charm_exp'];
$return['user']['next_exp'] = $next_exp <= 0 ? 0 : $next_exp;
$return['user']['next_rights_icon'] = $user_level['next_rights_icon'];
}
@@ -61,7 +62,7 @@ class Level extends Model
//获取等级
// 获取用户当前等级
$currentUserLevel = $user['charm_level'];
if($currentUserLevel == 0){
if($currentUserLevel == 1){
$level = Db::name('vs_charm_level')
->where('status', 1)
->order('level', 'asc')
@@ -90,7 +91,7 @@ class Level extends Model
$return['level'][$key]['name'] = $value['name'];
$return['level'][$key]['change_value'] = $value['change_value'];
//当前用户距离当前段位的距离
$return['level'][$key]['distance'] = $value['change_value'] - $user['wealth_exp'];
$return['level'][$key]['distance'] = $value['change_value'] - $user['charm_exp'];
$return['level'][$key]['rights_icon'] = $value['rights_icon'];
}
}
@@ -108,6 +109,7 @@ class Level extends Model
{
//规则
$return['rule_url'] = get_system_config_value('web_site')."/api/Page/page_show?id=11";
$return['coin_wealth_exp'] = get_system_config_value('coin_wealth_exp');
//用户信息
$user = model('User')->get_user_info($uid);
//用户头像
@@ -150,7 +152,7 @@ class Level extends Model
//获取等级
// 获取用户当前等级
$currentUserLevel = $user['wealth_level'];
if($currentUserLevel == 0){
if($currentUserLevel == 1){
$level = Db::name('vs_wealth_level')
->where('status', 1)
->order('level', 'asc')
@@ -228,11 +230,11 @@ class Level extends Model
$return['next_level_icon'] = $next_level_data['image'];
$return['next_coins'] = $next_level_data['coins'];
}else{
$return['next_level'] = 0;
$return['next_level_name'] = '';
$return['next_level_exp'] = 0;
$return['next_level_icon'] = '';
$return['next_coins'] = 0;
$return['next_level'] = $level_data['level'];
$return['next_level_name'] = $level_data['name'];
$return['next_level_exp'] = $level_data['change_value'];
$return['next_level_icon'] = $level_data['image'];
$return['next_coins'] = $level_data['coins'];
}
return $return;
}
@@ -266,11 +268,11 @@ class Level extends Model
$return['next_level_icon'] = $next_level_data['image'];
$return['next_rights_icon'] = $next_level_data['rights_icon'];
}else{
$return['next_level'] = 0;
$return['next_level_name'] = '';
$return['next_level_exp'] = 0;
$return['next_level_icon'] = '';
$return['next_rights_icon'] = "";
$return['next_level'] = $level_data['level'];
$return['next_level_name'] = $level_data['name'];
$return['next_level_exp'] = $level_data['change_value'];
$return['next_level_icon'] = $level_data['image'];
$return['next_rights_icon'] = $level_data['rights_icon'];
}
return $return;
}
@@ -291,10 +293,11 @@ class Level extends Model
$user_wealth_level = $user['wealth_level'];
$user_wealth_exp = $user['wealth_exp'] + $wealth_exp;
//判断是否达到下一级别
$user_wealth = $this->get_wealth_level_to_level($user_wealth_level);
if($user_wealth_exp>= $user_wealth['exp']){
$user_wealth_level= $user_wealth['next_level'];
}
$user_wealth = $this->get_wealth_level_to_level_vlue($user_wealth_exp);
// if($user_wealth_level>= $user_wealth['level']){
// $user_wealth_level= $user_wealth['level'];
// }
$user_wealth_level= $user_wealth['level'];
$update_data = [];
$update_data['wealth_level'] = $user_wealth_level;
$update_data['wealth_exp'] = $user_wealth_exp;
@@ -321,10 +324,11 @@ class Level extends Model
$user_charm_level = $user['charm_level'];
$user_charm_exp = $user['charm_exp'] + $charm_exp;
//判断是否达到下一级别
$user_charm = $this->get_charm_level_to_level($user_charm_level);
if($user_charm_exp>= $user_charm['exp']){
$user_charm_level= $user_charm['next_level'];
}
$user_charm = $this->get_charm_level_to_level_vlue($user_charm_exp);
// if($user_charm_level != $user_charm['level']){
// $user_charm_level = $user_charm['level'];
// }
$user_charm_level = $user_charm['level'];
$update_data = [];
$update_data['charm_level'] = $user_charm_level;
$update_data['charm_exp'] = $user_charm_exp;
@@ -414,4 +418,45 @@ class Level extends Model
}
return ['code' => 1, 'msg' => "成功", 'data' => null];
}
/*
* 通过魅力值获取对应等级
*/
public function get_charm_level_to_level_vlue($charm_level){
$return = [];
$level_data = Db::name('vs_charm_level')->where(["change_value"=>['<',$charm_level]])->order('change_value','desc')->find();
if($level_data){
$return['level'] = $level_data['level'];
$return['level_name'] = $level_data['name'];
$return['exp'] = $level_data['change_value'];
$return['level_icon'] = $level_data['image'];
}else{
$return['level'] = 0;
$return['level_name'] = '';
$return['exp'] = 0;
$return['level_icon'] = '';
$return['rights_icon'] = "";
}
return $return;
}
/*
* 通过财富值获取对应等级
*/
public function get_wealth_level_to_level_vlue($wealth_level){
$return = [];
$level_data = Db::name('vs_wealth_level')->where(["change_value"=>['<',$wealth_level]])->order('change_value','desc')->find();
if($level_data){
$return['level'] = $level_data['level'];
$return['level_name'] = $level_data['name'];
$return['exp'] = $level_data['change_value'];
$return['level_icon'] = $level_data['image'];
}else{
$return['level'] = 0;
$return['level_name'] = '';
$return['exp'] = 0;
$return['level_icon'] = '';
$return['rights_icon'] = "";
}
return $return;
}
}

View File

@@ -107,16 +107,44 @@ class Login extends Model
$block = db::name('block')->where(['type_text' => $user_info['id'],'type' => 1])->find();
if ($block) {
return ['code' => 0, 'msg' => '用户已被封禁', 'data' => null];
if($block['block_time'] != 0 && $block['block_time'] <= time()){
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{
if($block['block_time'] == 0){
return ['code' => 301, 'msg' => '用户已被永久封禁', 'data' => null];
}else{
return ['code' => 301, 'msg' => '用户已被封禁,解封时间:'.date('Y-m-d H:i:s',$block['block_time']), 'data' => null];
}
}
}
$block = db::name('block')->where(['type_text' => $login_device,'type' => 2])->find();
if ($block) {
return ['code' => 0, 'msg' => '设备已被封禁', 'data' => null];
if($block['block_time'] != 0 && $block['block_time'] <= time()){
db('block')->where(['id' => $block['id']])->delete();
}else{
if($block['block_time'] == 0){
return ['code' => 301, 'msg' => '设备已被永久封禁', 'data' => null];
}else{
return ['code' => 301, 'msg' => '设备已被封禁,解封时间:'.date('Y-m-d H:i:s',$block['block_time']), 'data' => null];
}
}
}
$ip = request()->ip();
$block = db::name('block')->where(['type_text' => $ip,'type' => 3])->find();
if ($block) {
return ['code' => 0, 'msg' => 'ip已被封禁', 'data' => null];
if($block['block_time'] != 0 && $block['block_time'] <= time()){
db('block')->where(['id' => $block['id']])->delete();
}else{
if($block['block_time'] == 0){
return ['code' => 301, 'msg' => 'ip已被永久封禁', 'data' => null];
}else{
return ['code' => 301, 'msg' => 'ip已被封禁,解封时间:'.date('Y-m-d H:i:s',$block['block_time']), 'data' => null];
}
}
}
$save_data = [];
@@ -181,6 +209,17 @@ class Login extends Model
}
$return_res[0]['auth'] = $isAuth;
//是否可以发布动态
$user_rechange = db::name('vs_user_recharge')->field('sum(money) as money')->where(['user_id' => $user_info['id'],'pay_status' => 2])->find();
//系统配置
$config_money = get_system_config_value('private_chat_recharge_money');
if(($config_money > 0) && ($user_rechange['money'] < $config_money)){
$return_res[0]['is_can_chat'] = 0;
}else{
$return_res[0]['is_can_chat'] = 1;
}
$return_res[0]['can_chat_money'] = $config_money;
return ['code' => 1, 'msg' => '登录成功', 'data' => $return_res];
}else{
return ['code' => 0, 'msg' => '登录失败,账号失效', 'data' => null];
@@ -254,28 +293,52 @@ class Login extends Model
return ['code' => 0, 'msg' => '密码不能为空', 'data' => null];
}
$user_info = model('User')->where(['mobile' => $user_name,'status'=>1])->find();
$user_info = model('User')->where(['mobile' => $user_name,'status'=>['<>',0]])->find();
if (empty($user_info)) {
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']) {
return ['code' => 0, 'msg' => '密码错误', 'data' => null];
if ($sms_count >= 5) {
$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);
if($login['code'] != 1){
return $login;
}
//登陆成功后 把所有的登录错误删除掉
db::name('sms_error')->where(['mobile' => $user_name])->delete();
return ['code' => 1, 'msg' => '登录成功', 'data' => $login['data']];
}
@@ -300,12 +363,24 @@ class Login extends Model
if($type == 'wx'){
$openid = $userinfo['openid'];
$user_info_data = model('UserData')->where(['wx_openid' => $openid,'deletetime'=>0])->find();
$config_time = get_system_config_value('cancel_to_reset_reg');
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
}
}elseif ($type == 'ali'){
$ali_userid = $userinfo['open_id'];
$user_info_data = model('UserData')->where(['ali_userid' => $ali_userid,'deletetime'=>0])->find();
$config_time = get_system_config_value('cancel_to_reset_reg');
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
}
}elseif ($type == 'ios'){
$apple_id = $userinfo;
$user_info_data = model('UserData')->where(['apple_id' => $userinfo,'deletetime'=>0])->find();
$config_time = get_system_config_value('cancel_to_reset_reg');
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
}
}
else{
return ['code' => 0, 'msg' => '登录类型错误', 'data' => null];
@@ -371,10 +446,23 @@ class Login extends Model
//注销
public function cancel($token){
$user_info = model('UserToken')->where('token', $token)->find();
//用户注册时间
$register_time = db::name('user')->where('id', $user_info['user_id'])->value('createtime');
$config_time = get_system_config_value('reg_to_cancel');
if(time() - $register_time < 86400 * $config_time){
return ['code' => 0, 'msg' => '注册'.$config_time.'天内不能注销!', 'data' => null];
}
if($user_info){
model('UserToken')->where('id', $user_info['id'])->update(['token' => 1]);
$isstatus = model('User')->where('id', $user_info['user_id'])->update(['status' => 0]);
if($isstatus){
//查询用户所在房间
$room_list = db::name('vs_room_visitor')->where('user_id', $user_info['user_id'])->select();
if($room_list){
foreach ($room_list as &$value) {
model('Room')->quit_room($user_info['user_id'], $value['room_id'],$user_info['user_id']);
}
}
//删除用户
// model('Tencent')->account_delete($user_info['user_id']);
model('User')->where('id', $user_info['user_id'])->update(['delete_time' => time()]);
@@ -387,25 +475,16 @@ class Login extends Model
db::name('vs_room')->where('id', $value['id'])->update(['room_status' => 3]);
}
}
//查询用户所在房间
$room_list = db::name('vs_room_visitor')->where('user_id', $user_info['user_id'])->select();
if($room_list){
foreach ($room_list as &$value) {
model('Room')->quit_room($user_info['user_id'], $value['room_id'],$user_info['user_id']);
}
}
}else{
return ['code' => 0, 'msg' => '注销失败', 'data' => null];
}
//查询绑定的手机号
$mob = db::name('user')->where('id', $user_info['user_id'])->value('mobile');
$mobile = db::name('user')->where('mobile', $mob)->select();
$mobile = db::name('user')->where(['mobile' => $mob,'status' => ['<>',0]])->select();
if(isset($mobile) && count($mobile) < 2){
$user_auth = db::name('user_auth')->where('mobile', $mobile[0]['mobile'])->find();
if($user_auth){
db::name('user_auth')->where('id', $user_auth['id'])->delete();
}
db::name('user_auth')->where('mobile', $mob)->delete();
}
return ['code' => 1, 'msg' => '注销成功', 'data' => null];

View File

@@ -55,7 +55,7 @@ class Ranking extends Model
->where($where)
->order('total desc')
->group('a.user_id')
->page($this->page, $this->page_limit)
// ->page($this->page, $this->page_limit)
->select();
if($lists){
@@ -105,7 +105,7 @@ class Ranking extends Model
->where($where)
->order('total desc')
->group('a.gift_user')
->page($this->page, $this->page_limit)
// ->page($this->page, $this->page_limit)
->select();
if($lists){
@@ -149,7 +149,8 @@ class Ranking extends Model
}
}
}
//截取20条
$lists = array_slice($lists,0,20);
$data = [
'my_ranking' => $my_ranking,
'lists' => $lists
@@ -171,7 +172,7 @@ class Ranking extends Model
->join('vs_room b','a.from_id = b.id','left')
->where($where)->field($field)->group('a.from_id')
->order('total desc')
->page($this->page, $this->page_limit)
// ->page($this->page, $this->page_limit)
->select();
$my_ranking = null;
if($lists){
@@ -242,6 +243,8 @@ class Ranking extends Model
$my_ranking['room_name'] = $myRoom['room_name'];
$my_ranking['room_cover'] = $myRoom['room_cover'];
}
//截取20条
$lists = array_slice($lists,0,20);
$data = [
'my_ranking' => $my_ranking,
'lists' => $lists

View File

@@ -28,10 +28,20 @@ class Room extends Model
return ['code' => 0, 'msg' => '请先进行实名认证通过后操作', 'data' => null];
}
//检查房间名称是否包含官方等词
//名称中不能有 系统管理 等关键字
if(!nickname_filter($room_name)){
return ['code' => 0, 'msg' => '名称中不能有 系统、管理、官方等相关敏感字', 'data' => null];
}
if($type <= 0){
$room_info = db::name('vs_room')->where(['user_id' => $uid, 'type_id' => ['<>',6]])->find();
$room_info = db::name('vs_room')->where(['user_id' => $uid, 'type_id' => ['<>',6], 'apply_status' => ['<>',3]])->find();
if (!empty($room_info)) {
if($room_info['apply_status'] == 2){
return ['code' => 0, 'msg' => '已有直播间请勿重复创建', 'data' => null];
}elseif($room_info['apply_status'] == 1){
return ['code' => 0, 'msg' => '房间审核中,请耐心等待', 'data' => null];
}
}else{
//首次建立房间【完成任务】
model('DailyTasks')->tasks_complete($uid,15);
@@ -62,7 +72,8 @@ class Room extends Model
$data['room_name'] = $room_name;
$data['room_cover'] = $room_cover;
$data['room_intro'] = $room_intro;
$data['room_background'] = get_system_config_value('web_site').'/data/default/delfultroombackground.jpg';
$room_bg_img = db::name('vs_room_background')->where(['id' => 2])->value('image_url');
$data['room_background'] = $room_bg_img ?? get_system_config_value('web_site').'/data/default/delfultroombackground.jpg';
$data['is_earnings'] = 1;
$data['createtime'] = time();
@@ -151,7 +162,7 @@ class Room extends Model
if(!empty($data)){
$reslut = $this->where('id', $room_id)->update($data);
if (!$reslut) {
return ['code' => 0, 'msg' => '修改失败', 'data' => null];
return ['code' => 0, 'msg' => '请勿重复提交', 'data' => null];
}
}
//推送消息
@@ -190,24 +201,14 @@ class Room extends Model
}
$list = db::name('vs_room')->field('id as room_id,room_number,user_id,room_name,room_cover,room_password,today_hot_value as hot_value,label_id,is_show_room')
->where($map)->order('hot_value desc')->page($page, $page_limit)->select();
// var_dump($list);
foreach ($list as $k => &$v){
if($v['is_show_room'] == 2){ //是否显示房间 1是2否
//查询当前房间是否有主持在麦上
$room_host_info = db::name('vs_room_pit')->where(['room_id' => $v['room_id'], 'pit_number' => 9])->value('user_id');
if($room_host_info == 0){
unset($list[$k]);
continue;
}
}
// $v['hot_value'] = $v['hot_value'] * 10;
->where($map)->order('hot_value desc, id asc')->page($page, $page_limit)->select();
foreach ($list as &$v){
$v['user_list'] = model('RoomUser')->get_room_user_list($v['room_id']);
$v['label_name'] = db::name('vs_room_label')->where('id', $v['label_id'])->value('label_name');
$v['label_icon'] = db::name('vs_room_label')->where('id', $v['label_id'])->value('label_icon');
}
//$list 不为空 数组重组
$list = array_values((array)$list);
//版本号
$app_version = request()->header('App-Version');
$system = request()->header('system');
@@ -223,32 +224,6 @@ class Room extends Model
return ['code' => 1, 'msg' => '获取成功', 'data' => $list, 'api_version' => $api_version];
}
//关注的用户现在所在房间(废弃)
public function user_follow_in_room_list($uid ,$page, $page_limit)
{
//关注的用户列表
$follow_list = db::name('user_follow')->where('user_id', $uid)->field('follow_user_id')->select();
if(!empty($follow_list)){
$user_room_list = [];
foreach ($follow_list as $k => $v){
//用户是否在房间中
$user_room_info = db::name('vs_room_visitor')->where('user_id', $v['follow_user_id'])->field('room_id')->find();
if(!empty($user_room_info)){
$user_room_list[] = $user_room_info['room_id'];
}
}
}
if(!empty($user_room_list)){
$list = db::name('vs_room')->field('id as room_id,room_number,user_id,room_name,room_cover,room_password,today_hot_value as hot_value')
->where('id', 'in', $user_room_list)->order('hot_value desc')->page($page, $page_limit)->select();
foreach ($list as $k => &$v){
// $v['hot_value'] = $v['hot_value'] * 10;
$v['user_list'] = model('RoomUser')->get_room_user_list($v['id']);
}
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
}
return ['code' => 1, 'msg' => '获取成功', 'data' => []];
}
//首页弹出的房间
public function index_recommend_room()
@@ -297,7 +272,7 @@ class Room extends Model
$roomInfo = db::name('vs_room')
->field('id as room_id,room_number,user_id,room_name,room_cover,apply_status,type_id,room_status,label_id')
->where('user_id' , $uid)
->where(['type_id' => ['<>',6],'room_status' =>1])
->where(['type_id' => ['<>',6],'room_status' =>1,'apply_status' => ['<>',3]])
->page($page, $page_limit)
->select();
}
@@ -367,7 +342,6 @@ class Room extends Model
}
$cp_room[$i]['room_id'] = $v['room_id'];
// $cp_room[$i]['room_name'] = '我 ❤️ '.$room_name.db::name('vs_room')->where('id', $v['room_id'])->value('room_name');
$cp_room[$i]['room_name'] = '我 ❤️ '.$room_name;
$cp_room[$i]['room_number'] = db::name('vs_room')->where('id', $v['room_id'])->value('room_number');
$cp_room[$i]['end_time'] = $v['time_day'];
@@ -487,17 +461,8 @@ class Room extends Model
if(!$room){
return ['code' => 0, 'msg' => '房间不存在', 'data' => null];
}
//获取房间名称
// $room_name = $room['room_name'];
//查询房主是否加入公会
// $guild_id = model('Guild')->user_is_join($room['user_id']);
// //获取房主收益比例
// if($guild_id > 0){
// $room_user_ratio = get_system_config_value('room_author_guild_ratio')/100;
// }else{
$room_user_ratio = get_system_config_value('room_author_ratio')/100;
// }
//根据日期查询房间流水
$field = "b.nickname as sender_nickname,b.avatar as sender_avatar,c.nickname as receive_nickname,c.avatar as receive_avatar,dd.gift_name,a.number,a.total_price,{$group_field} as time";
@@ -513,17 +478,9 @@ class Room extends Model
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
}
// $count = db::name('vs_give_gift')->alias('a')->field($field)
// ->join('user b', 'a.user_id = b.id')
// ->join('user c', 'a.gift_user = c.id')
// ->join('vs_give_gift d', 'a.gift_id = d.id')
// ->where($where)
// ->count();
$list = db::name('vs_give_gift')->alias('a')->field($field)
->join('user b', 'a.user_id = b.id')
->join('user c', 'a.gift_user = c.id')
// ->join('vs_give_gift d', 'a.gift_id = d.id')
->join('vs_gift dd', 'a.gift_id = dd.gid')
->where($where)
->page($page,$page_limit)
@@ -573,10 +530,13 @@ class Room extends Model
//进入房间
public function join_room($user_id, $room_id, $password) {
$room = db::name('vs_room')->where(['id' => $room_id,'apply_status' => 2])->find();
$room = db::name('vs_room')->where(['id' => $room_id,'apply_status' => ['in',[1,2]]])->find();
if (!isset($room)) {
return ['code' => 0, 'msg' => '房间不存在', 'data' => ''];
}
if($room['apply_status'] == 1){
return ['code' => 0, 'msg' => '房间正在审核中……', 'data' => ''];
}
if(isset($room['password']) && $user_id != $room['user_id']){
if (empty($password) || $room['password'] != md5($password)) {
return ['code' => 0, 'msg' => '密码错误', 'data' => ''];
@@ -610,19 +570,18 @@ class Room extends Model
}
//用户是否在其他房间
$room_user = db::name('vs_room_visitor')->where(['user_id' => $user_id])->value('room_id');
if (isset($room_user) && $room_user != $room_id) {
// return ['code' => 0, 'msg' => '您已在其他房间', 'data' => ''];
//根据房间状态判断是否要退出房间并且下麦
$room_user = db::name('vs_room_visitor')->where(['user_id' => $user_id])->order('id desc')->value('room_id');
if (isset($room_user) && $room_user != $room_id && $room_user != 0) {
//根据所在房间状态判断是否要退出房间并且下麦
$roomInfo = db::name('vs_room')->where(['id' => $room_user,'apply_status' => 2])->find();
if(($roomInfo['type_id'] == 1 || $roomInfo['type_id'] == 3 || $roomInfo['type_id'] == 4)&& $roomInfo['label_id'] == 1){
if(($roomInfo['type_id'] == 1 || $roomInfo['type_id'] == 3 || $roomInfo['type_id'] == 4 || $roomInfo['type_id'] == 8)&& $roomInfo['label_id'] == 1){
//退出其他房间
$this->quit_room($user_id, $room_user,$user_id);
}elseif(($roomInfo['type_id'] == 1 || $roomInfo['type_id'] == 3 || $roomInfo['type_id'] == 4)&& $roomInfo['label_id'] == 2){//k歌
}elseif(($roomInfo['type_id'] == 1 || $roomInfo['type_id'] == 3 || $roomInfo['type_id'] == 4 || $roomInfo['type_id'] == 8)&& $roomInfo['label_id'] == 2){//k歌
//他的点歌列表
$song_list = db::name('vs_room_song')->where(['room_id' => $room_user, 'user_id' => $user_id])->select();
if(count($song_list) > 0){
foreach ($song_list as $key => $value){
foreach ($song_list as $value){
if($value['status'] == 2 && $value['times_status'] == 1){
//切歌
model('api/RoomSong')->change_song($room_id,$value['did']);
@@ -634,7 +593,7 @@ class Room extends Model
}
//记录用户退出房
$this->quit_room($user_id, $room_user,$user_id);
}elseif($roomInfo['type_id'] == 3){
}elseif($roomInfo['type_id'] == 2){
//是否在拍卖位
$pitNumber = Cache::get('auction_user_'.$room_user);
if(isset($pitNumber) && $pitNumber == $user_id){
@@ -662,7 +621,7 @@ class Room extends Model
$user_pit = 0;
$pit_list = [];
$cp_users = null;
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7) {//1点唱3男神4女神
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7 || $room['type_id'] == 8) {//1点唱3男神4女神
if($room['label_id'] == 2){//K歌
$song = $this->get_song_info($room_id,$user_id);
$song_list = $song['song_user_info'];
@@ -732,6 +691,7 @@ class Room extends Model
if (!$is_join) {
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]);
$room['is_use_code'] = 0;
$liang = model('api/Decorate')->user_decorate_detail($room['id'],7);
@@ -889,7 +849,17 @@ class Room extends Model
$friend = null;
}
$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,
'msg' => '成功',
'data' => ['room_info' => $room_info,
@@ -902,6 +872,8 @@ class Room extends Model
'pk_info' => $pk_info,
'song_pit_list' => $song_pit_list,
'friend_info' => $friend,
'gift_cycle' => $xlh_info,
'hour_ranking_open' => $hour_open
]
];
}
@@ -1110,9 +1082,9 @@ class Room extends Model
$room_label = $res['data']['label_id'];
$room_type = $res['data']['type_id'];
$apply_type = 0;
if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
$apply_type = 1;
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
$apply_type = 2;
}elseif ($room_type == 7){//交友房 再开始阶段在麦位上不下麦
$apply_type = 3;
@@ -1185,7 +1157,7 @@ class Room extends Model
}else{
$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 .' 踢出房间';
@@ -1227,13 +1199,6 @@ class Room extends Model
$where['a.createtime'] = ['between', [strtotime('this week Monday'), time()]];
}
if($type == 1){//1财富榜2魅力榜
// $list = db::name('vs_room_user_charm')->alias('a')
// ->join('user b', 'a.user_id = b.id')
// ->field('a.user_id,b.nickname,b.avatar,a.total_wealth as total')
// ->where($where)
// ->order('a.total_wealth desc')
// ->page($page, $limit)
// ->select();
$list = db::name('vs_give_gift')->alias('a')
->join('user b', 'a.user_id = b.id')
->field('a.user_id,b.nickname,b.avatar,sum(a.total_price) * 10 as total')
@@ -1243,13 +1208,6 @@ class Room extends Model
->page($page, $limit)
->select();
}else{
// $list = db::name('vs_room_user_charm')->alias('a')
// ->join('user b', 'a.user_id = b.id')
// ->field('a.user_id,b.nickname,b.avatar,a.total_charm as total')
// ->where($where)
// ->order('a.total_charm desc')
// ->page($page, $limit)
// ->select();
$list = db::name('vs_give_gift')->alias('a')
->join('user b', 'a.gift_user = b.id')
->field('a.gift_user as user_id,b.nickname,b.avatar,sum(a.total_price) * 10 as total')
@@ -1289,7 +1247,7 @@ class Room extends Model
//送礼人接收者礼物id礼物数量来源类型来源id房间id麦位
$res = model('GiveGift')->give_gift($uid, $to_uid, $gift_id, $gift_num,2,$type, $room_id,$pit_number,0,$give_gift_ext);
return $res;
}elseif (($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 3 || $label_type['data']['type_id'] == 4) && $label_type['data']['label_id'] == 2)//K歌type_id = 1label_id = 2
}elseif (($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 3 || $label_type['data']['type_id'] == 4 || $label_type['data']['type_id'] == 8) && $label_type['data']['label_id'] == 2)//K歌type_id = 1label_id = 2
{
$res = model('GiveGift')->give_gift($uid, $to_uid, $gift_id, $gift_num,2,$type, $room_id,$pit_number,0,$give_gift_ext);
if($res['code'] == 1){
@@ -1309,8 +1267,7 @@ class Room extends Model
}elseif($label_type['data']['type_id'] == 7){
return model('Friend')->room_give_gift($uid, $to_uid, $gift_id, $gift_num,2,$type, $room_id,$pit_number,$heart_id,$give_gift_ext);
}else{
$res = model('GiveGift')->give_gift($uid, $to_uid, $gift_id, $gift_num,2,$type, $room_id,$pit_number,0,$give_gift_ext);
return $res;
return model('GiveGift')->give_gift($uid, $to_uid, $gift_id, $gift_num,2,$type, $room_id,$pit_number,0,$give_gift_ext);
}
}
@@ -1341,83 +1298,29 @@ class Room extends Model
if ($label_type['code'] != 1) {
return ['code' => 0, 'msg' => '房间不存在', 'data' => null];
}
//查询房间里面的用户
$room_user = db::name('vs_room_visitor')->where(['room_id' => $room_id])->select();
if($room_user){
foreach ($room_user as $vv){
if(($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 8) && $label_type['data']['label_id'] == 1){
//不做处理
}else{
//查询是否有切后台的操作
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $room_id,'user_id' => $vv['user_id']])->find();
// //获取在房间的用户
//// $in_room_users = db::name('vs_room_visitor')->where(['room_id' => $room_id])->field('user_id')->select();
//// if($in_room_users){
//// foreach ($in_room_users as $v){
//// $userss = db::name('user')->where(['id' => $v['user_id']])->field('is_online,is_robot')->find();
//// if($userss['is_online'] == 1 && $userss['is_robot'] == 1){//在线或者机器人都设置为在线
//// db::name('vs_room_visitor')->where(['id' => $v['id']])->update(['on_line' => 1]);
//// }else{
//// db::name('vs_room_visitor')->where(['id' => $v['id']])->update(['on_line' => 0]);
//// }
//// }
//// }
//
// //查找数据库用户
// $dblist = db::name('vs_room_visitor')->where(['room_id' => $room_id])->field('user_id')->select();
// //循环获取在线用户ID 拼接数据
// $user_id_array = [];
// //机器人user_id
// $robot_user_id = [];
// foreach ($dblist as $v) {
// //机器人
// if(db::name('user')->where(['id' => $v['user_id']])->value('is_robot')){
// $robot_user_id[] = $v['user_id'];
// continue;
// }
// $user_id_array[] = 'u'.$v['user_id'];
// }
// //获取腾讯的在线用户
// $online_users = model('Tencent')->query_user_online_status($user_id_array);
// $online_user = [];
// if(isset($online_users['ActionStatus']) && $online_users['ActionStatus'] == 'OK'){
// if($online_users['QueryResult']){
// foreach ($online_users['QueryResult'] as $v){
// if($v['Status'] == "Online"){
// //截取用户ID前面的 u 并获取用户ID
// $user_id = substr($v['To_Account'],1);
// $online_user[] = $user_id;
// }
// }
// }
// }
//
// if($dblist){
// $onpit = db::name('vs_room_pit')->field('user_id')->where(['room_id' => $room_id])->select();
// //合并数组
// $array = array_merge($online_user,$robot_user_id);
//// $array = $online_user;
// $arraypit = array_values((array)$onpit);
// foreach ($dblist as &$v){
//// if(in_array($v['user_id'],$arraypit)){
//// //跳过本次循环
//// continue;
//// }
// if(!in_array($v['user_id'],$array)){
// //修改他的状态
// db::name('vs_room_visitor')->where(['user_id' => $v['user_id'],'room_id'=>$room_id])->update(['on_line' => 0]);
// //查询他是否在其他房间
// $room_id_list = db::name('vs_room_visitor')->where(['user_id' => $v['user_id'],'room_id'=>['neq',$room_id]])->find();
// if($room_id_list){
// db::name('vs_room_visitor')->where(['user_id' => $v['user_id']])->delete();
// }
// }else{
// //修改他的状态
// db::name('vs_room_visitor')->where(['user_id' => $v['user_id'],'room_id'=>$room_id])->update(['on_line' => 1]);
// }
// }
// }else{
// $lists = ['on_pit' => [], 'off_pit' => []];
// return ['code' => 1, 'msg' => '成功', 'data' => $lists];
// }
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);
}
}
}
}
$list = db::name('vs_room_visitor')->alias('a')
->join('user b', 'a.user_id = b.id')
->field('a.user_id,b.nickname,b.avatar')
->where(['a.room_id' => $room_id,'b.is_online' => 1])
->group('a.user_id')
->order('a.id asc')
->page($page, $limit)
->select();
@@ -1439,17 +1342,16 @@ class Room extends Model
});
}
if($label_type['data']['type_id'] == 7 || ($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 3 || $label_type['data']['type_id'] == 4) && $label_type['data']['label_id'] == 1) {//2卡八麦聊天type_id = 1 || 7(交友label_id = 1
foreach ($list as &$val) {
if($label_type['data']['type_id'] == 7 || ($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 3 || $label_type['data']['type_id'] == 4 || $label_type['data']['type_id'] == 8) && $label_type['data']['label_id'] == 1) {//2卡八麦聊天type_id = 1 || 7(交友label_id = 1
foreach ($list as $val) {
if ($val['pit_number'] > 0) {
$lists['on_pit'][] = $val;
} else {
$lists['off_pit'][] = $val;
}
}
}elseif(($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 3 || $label_type['data']['type_id'] == 4) && $label_type['data']['label_id'] == 2){
foreach ($list as &$val) {
// var_dump($val['pit_number']);exit;
}elseif(($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 3 || $label_type['data']['type_id'] == 4 || $label_type['data']['type_id'] == 8) && $label_type['data']['label_id'] == 2){
foreach ($list as $val) {
if (db::name('vs_room_pit_simulate')->where(['room_id' => $room_id,'user_id' => $val['user_id']])->find() || $val['pit_number'] > 0) {
$lists['on_pit'][] = $val;
} else {
@@ -1469,7 +1371,7 @@ class Room extends Model
if($auct){
//获取数组里面的用户ID 组成新的数组
$user_ids = array_column((array)$auct, 'user_id');
foreach ($list as &$val) {
foreach ($list as $val) {
if (in_array($val['user_id'], $user_ids) || $val['pit_number'] > 0) {
$lists['on_pit'][] = $val;
} else {
@@ -1477,7 +1379,7 @@ class Room extends Model
}
}
}else{
foreach ($list as &$val) {
foreach ($list as $val) {
if ($val['pit_number'] > 0) {
$lists['on_pit'][] = $val;
} else {
@@ -1487,8 +1389,7 @@ class Room extends Model
}
}else{
foreach ($list as &$val) {
// $lists['off_pit'][] = $val;
foreach ($list as $val) {
if ($val['pit_number'] > 0) {
$lists['on_pit'][] = $val;
} else {
@@ -1498,6 +1399,7 @@ class Room extends Model
}
}
return ['code' => 1, 'msg' => '成功', 'data' => $lists];
}
@@ -1550,7 +1452,7 @@ class Room extends Model
$user_info['is_in_pit'] = 1;
}
}
}elseif ($room_type['type_id'] == 7 || ($room_type['type_id'] == 1 || $room_type['type_id'] == 3 || $room_type['type_id'] == 4) && $room_type['label_id'] == 1){
}elseif ($room_type['type_id'] == 7 || ($room_type['type_id'] == 1 || $room_type['type_id'] == 3 || $room_type['type_id'] == 4 || $room_type['type_id'] == 8) && $room_type['label_id'] == 1){
$hah = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $user_id])->find();
if($hah){
$user_info['is_in_pit'] = 1;
@@ -1636,6 +1538,7 @@ class Room extends Model
'GiftInfo' => null,
'GiftNum' => null
];
$typee = 0;
if($type == 1){//1-主持,2管理
if($is_add == 1){//1-添加,2-删除
$typee = 1007;
@@ -1711,6 +1614,9 @@ class Room extends Model
if(!$is_host){
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])
->update(['ratio' => $profit]);
if(!$res){
@@ -1722,8 +1628,6 @@ class Room extends Model
//清除房间用户的魅力值
public function clear_user_charm($user_id ,$room_id,$uid='')
{
//判断用户是否在主持麦
// $is_host = db::name('vs_room_pit')->where(['room_id' => $room_id,'user_id' => $user_id,'pit_number' => 9])->find();
$owner = db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
$management = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->find();
if(!$owner && !$management){
@@ -1732,23 +1636,11 @@ class Room extends Model
if($uid <= 0){
db::name('vs_room_user_charm')->where(['room_id' => $room_id])->update(['charm' => 0,'clear_time' => time()]);
//获取房间内所有用户
// $list = db::name('vs_room_visitor')->field('user_id')->where(['room_id' => $room_id])->select();
//
// //循环清除用户魅力值
// if($list){
// foreach ($list as $v){
// //清除有魅力值的用户
// if(db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $v['user_id']])->find()){
// db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $v['user_id']])->update(['charm' => 0,'clear_time' => time()]);
// }
// }
// }
//发送消息
$text['text'] = '清除魅力成功';
model('Chat')->sendMsg(1021,$room_id,$text);
}else{
$dd = db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $uid])->update(['charm' => 0,'clear_time' => time()]);
db::name('vs_room_user_charm')->where(['room_id' => $room_id,'user_id' => $uid])->update(['charm' => 0,'clear_time' => time()]);
//发送消息
$text['text'] = '清除魅力成功';
$text['user_id'] = $uid;
@@ -1792,7 +1684,7 @@ class Room extends Model
//开启事务
db::startTrans();
$data = [];
if($type == 1 || $type == 3 || $type == 4){
if($type == 1 || $type == 3 || $type == 4 || $type == 8){
$data = [
'label_id' => 1,
'type_id' => $type,
@@ -1808,7 +1700,7 @@ class Room extends Model
'is_song' => 1
];
}
//交友房
//交友房(互娱)
if($type == 7){
$data = [
'label_id' => 5,
@@ -1841,12 +1733,8 @@ class Room extends Model
db::name('vs_room_pit_simulate')->where(['room_id' => $room_id])->delete();
//申请上麦的全部下麦
model('RoomPit')->clear_apply_pit_list($uid, $room_id);
//处理之前修改的用户房间信息
if($type == 1 || $type == 3 || $type == 4){
db::name('vs_room_pit')->where(['pit_number' =>['>',10]])->update(['status' => 2]);
}
if($type == 1 || $type == 3 || $type == 4 || $type == 7){
if($type == 1 || $type == 3 || $type == 4 || $type == 7 || $type == 8){
//查询拍卖房的状态
$room_auction = db::name('vs_room_auction')->where(['room_id' => $room_id,'status' => 2])->select();
if($room_auction){
@@ -1854,6 +1742,12 @@ class Room extends Model
model('RoomAuction')->room_auction_end($room_id,$v['auction_id']);
}
}
//拍卖位上是否有人
$an = Cache::get('auction_user_'.$room_id);
if($an){
//拍卖位下麦
model('api/RoomPit')->host_user_pit($uid,$room_id,888,$an,2);
}
}
if($type == 2){
//清除房间此前的魅力值
@@ -1873,6 +1767,15 @@ class Room extends Model
'text' => '房间类型已修改type--'.$type
];
model('Chat')->sendMsg(1012,$room_id,$text);
//查询房间里面的用户
$room_user = db::name('vs_room_visitor')->where(['room_id' => $room_id])->select();
if($room_user){
foreach ($room_user as $v){
if(Db::name('user')->where('id', $v['user_id'])->value('is_online') == 0){
model('Room')->quit_room($v['user_id'], $room_id,$v['user_id'],2);
}
}
}
return ['code' => 1, 'msg' => '修改成功', 'data' => null];
}
@@ -1911,7 +1814,8 @@ class Room extends Model
}
$user_in_room = db::name('vs_room_visitor')->where(['room_id' => $room_id,'user_id' => $user_id])->find();
if(!$user_in_room){
return ['code' => 0, 'msg' => '您已不在此房间', 'data' => null];
// return ['code' => 0, 'msg' => '您已不在此房间', 'data' => null];
return ['code' => 0, 'msg' => '', 'data' => null];
}
$room = db::name('vs_room')->where(['id' => $room_id])->find();
$song_list = null;
@@ -1921,7 +1825,7 @@ class Room extends Model
$pit_list = null;
$roomauction = null;
$cp_users = null;
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7) {
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7 || $room['type_id'] == 8) {
if($room['label_id'] == 1 || $room['label_id'] == 5){
//麦位信息
$pit_list = db::name('vs_room_pit')->alias('a')->join('user b', 'a.user_id = b.id', 'left')
@@ -2119,6 +2023,18 @@ class Room extends Model
$friend = null;
}
$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,
'msg' => '成功',
'data' => ['room_info' => $room_info,
@@ -2131,6 +2047,8 @@ class Room extends Model
'pk_info'=>$pk_info,
'song_pit_list'=>$song_pit_list,
'friend_info' => $friend,
'gift_cycle' => $xlh_info,
'hour_ranking_open' => $hour_open
]
];
}
@@ -2150,11 +2068,7 @@ class Room extends Model
if(!$is_host && !$is_room_owner){
return ['code' => 0, 'msg' => '您没有权限', 'data' => null];
}
//是否在主持麦位上
// $is_pit = db::name('vs_room_pit')->where(['room_id' => $room_id,'pit_number' => 9])->value('user_id');
// if($uid != $is_pit){
// return ['code' => 0, 'msg' => '您没有权限', 'data' => null];
// }
if(!in_array($is_mute, [1,2,3,4])){
return ['code' => 0, 'msg' => '参数错误!', 'data' => null];
}
@@ -2340,7 +2254,7 @@ class Room extends Model
->join('user c','a.user_id2 = c.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')
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0])
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
->order('a.updatetime desc')
->select();
$room_auction2 = db::name('vs_room_auction_relation')->alias('a')
@@ -2348,7 +2262,7 @@ class Room extends Model
->join('user c','a.user_id2 = c.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')
->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')
->select();
@@ -2609,26 +2523,6 @@ class Room extends Model
$friend['friend_id'] = $friend_info['id'];
$friend['end_time'] = $friend_info['end_time'];
$friend['heart_list'] = model('Friend')->pullHeartChange($room_id, $friend_info['id']);
//获取麦上CP心动值列表
// $heart_list = db::name('vs_user_friending_heart')->where(['room_id' => $room_id, 'friend_id' => $friend_info['id'], 'status' => 1])->order('heart_value', 'desc')->limit(3)->select();
// if($heart_list){
// $heart_list_data = [];
//// $heart_list = $heart_list->toArray();
// $pit_number_array_reverse = [0=>[2,5],1=>[1,6],2=>[3,4]];
// foreach($heart_list as $k=>$v){
// $heart_list_data[$k]['heartId'] = $v['id'];
// $pitnum1 = db::name('vs_room_pit')->where(['room_id' =>$room_id, 'user_id' => $v['user1_id']])->value('pit_number');
// $pitnum2 = db::name('vs_room_pit')->where(['room_id' =>$room_id, 'user_id' => $v['user2_id']])->value('pit_number');
// if(in_array($pitnum1,$pit_number_array_reverse[$k]) && in_array($pitnum2,$pit_number_array_reverse[$k])){
// $heart_list_data[$k]['heartNum'] = $v['heart_value'];
// }else{
// $heart_list_data[$k]['heartNum'] = 0;
// }
// }
// $friend['heart_list'] =$heart_list_data;
// }else{
// $friend['heart_list'] = [];
// }
}
return $friend;
}
@@ -2656,4 +2550,85 @@ class Room extends Model
}
return ['code' => 1, 'msg' => '操作成功', 'data' => $list];
}
//用户重连
public function user_reconnect($user_id,$room_id)
{
if(!$room_id){
// $room_id = Db::name('user_data')->where('user_id', $user_id)->value('room_id');
}
if(!$room_id){
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
}
//查询用户在几个房间
$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){
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];
}
}

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){
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){
return ['code' => $ree['code'], 'msg' => $ree['msg'],'data' => null];
}
@@ -167,7 +167,7 @@ class RoomAuction extends Model
->where(['auction_id' => $auction_id])
->group('user_id')
->having('gift_prices >= ' . $auction['gift_price'])
->order('gift_prices DESC')
->order('gift_prices DESC, id ASC')
->limit(6)
->select();
if($list){
@@ -292,10 +292,12 @@ class RoomAuction extends Model
//查询是否有电影房
$cp_movie = $this->movie_room_create_or_add($list['user_id'],$res['user_id'],$res['relation_id'],$res['time_day']);
if($cp_movie['code'] != 1){
return ['code' => 0, 'msg'=>$cp_movie['msg'], 'data'=>$cp_movie['data']];
}
// return ['code' => 0, 'msg'=>$cp_movie['msg'], 'data'=>$cp_movie['data']];
}else{
$cp_room_id = $cp_movie['data']['cp_room_id'];
}
}
$texts = '恭喜'.$auction['nickname'].' 和 '.$recipient['nickname'].',获得'.$auction['relation_name'].' 关系'.$auction['time_day'].'小时';
}else{//拍得无关系
$texts = '恭喜'.$recipient['nickname'].' 拍得 '.$auction['nickname'].'的拍卖关系'.$auction['time_day'].'小时';

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];
}
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){
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();
// if($pit_infos){
// return ['code' => 0, 'msg' => '您已上麦', 'data' => null];
// }
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($pit_number > 0){
if($room_info['label_id'] == 5){//交友
if($room_info['label_id'] == 5){//交友(互娱)
if($pit_number == 7 || $pit_number == 8){
return ['code' => 0, 'msg' => '该麦位已锁定了', 'data' => null];
}
@@ -228,15 +234,6 @@ class RoomPit extends Model
if($pit_info['is_lock'] == 1){
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{
if($room_info['label_id'] == 5){//交友
$pit_number = $this->getRoomNullPitWithout($room_id, [7,8,9,10]);
@@ -248,13 +245,9 @@ class RoomPit extends Model
return ['code' => 0, 'msg' => '当前房间没有空麦位', 'data' => null];
}
}
//换麦使用
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]);
$exchange = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_number])->update([ 'user_id' => $user_id]);
if(!$exchange || !$exchange1){
@@ -278,50 +271,51 @@ class RoomPit extends Model
$text['to_pit_number'] = $pit_number;
model('Chat')->sendMsg(1039,$room_id,$text);
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}
}else{
$ompit = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位
if($ompit['code'] != 1){
return ['code' => 0, 'msg' => '上麦失败', 'data' => null];
}
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}else{
}
}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];
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');
$text['text'] = $FromUserInfo['nickname'].' 换到主持麦 ';
$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,9);//用户上了这个房间的几号麦位
$ont = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位
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];
}
}
}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){
@@ -353,6 +347,7 @@ class RoomPit extends Model
return ['code' => 1, 'msg' => '申请成功,请等待房主审核', 'data' => null];
}
}
}
//申请上麦列表
public function apply_pit_list($userId,$room_id)
@@ -366,15 +361,6 @@ class RoomPit extends Model
'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')
->where($where)->where('a.type',0)->field('a.user_id,a.rank_value,b.nickname,b.avatar')
->order('a.rank_value desc')->select();
@@ -925,7 +911,7 @@ class RoomPit extends Model
if(!$pit_number || $pit_number == 888){
$roomInfo = db::name('vs_room')->where('id',$room_id)->field('label_id,type_id')->find();
if($roomInfo['type_id'] == 2){//拍卖
if($roomInfo['type_id'] == 2 || Cache::get('auction_user_'.$room_id)){//拍卖
//查询当前是否处于拍卖中
$auctioning = db::name('vs_room_auction')
->where(['room_id' => $room_id, 'status' => 2, 'user_id' => $accept_user_id])->find();

View File

@@ -20,6 +20,28 @@ class Sms extends Model
if (!checkMobile($mobile)) {
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();
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_error')->where(['mobile' => $mobile])->delete();
return ['code' =>1, 'msg' =>'验证码正确','data' =>null];
} 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,42 +915,163 @@ class Tencent extends Model
}
//腾讯IM监控在线状态更新
public function tencent_member_status_change($info){
public function tencent_member_status_changeee($info){
$uid = substr($info['To_Account'],1);
$action = $info['Action'];
if($action == 'Disconnect') {
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){
$room_type = db::name('vs_room')->where(['id' => $v['room_id'],'room_status' => 1])->field('step,type_id')->find();
if(($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
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{
}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');
$text['text'] = '重新上线!';
$text['user_id'] = $uid;
$text['type'] = 1;
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;
}
//腾讯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()]);
$room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
$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');
$text['text'] = '重新上线!';
$text['user_id'] = $uid;
$text['type'] = 1;
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;
}

View File

@@ -149,6 +149,17 @@ class User extends Model
$user_info['dress'] = model('Decorate')->user_decorate_detail($user_info['user_id'],1);
$user_info['auth'] = db::name('user_auth')->where(['mobile' => $user_info['mobile'],'is_real' => 1])->find() ? 1 : 0;
//是否可以发布动态
$user_rechange = db::name('vs_user_recharge')->field('sum(money) as money')->where(['user_id' => $uid,'pay_status' => 2])->find();
//系统配置
$config_money = get_system_config_value('private_chat_recharge_money');
if(($config_money > 0) && ($user_rechange['money'] < $config_money)){
$user_info['is_can_chat'] = 0;
}else{
$user_info['is_can_chat'] = 1;
}
$user_info['can_chat_money'] = $config_money;
return ['code' => 1, 'msg' => '获取成功', 'data' => $user_info];
}
@@ -339,10 +350,11 @@ class User extends Model
public function get_user_gift_wall_info($uid)
{
//查询用户礼物墙 以gift_id,send_user_id分组 同一用户送的同一礼物相加
$result = db::name('vs_give_gift')
->where(['gift_user' => $uid])
->field('gift_id,user_id,sum(number) as total')
->group('gift_id,user_id')
$result = db::name('vs_give_gift')->alias('a')
->join('vs_gift g', 'a.gift_id = g.gid')
->where(['a.gift_user' => $uid,'g.label'=>['<>',2]])
->field('a.gift_id,a.user_id,sum(a.number) as total')
->group('a.gift_id,a.user_id')
->order('total desc')
->select();
// var_dump($result);exit;
@@ -391,7 +403,7 @@ class User extends Model
}
$data = array_values($data);
//查询所有的礼物
$gift_list = db::name('vs_gift')->field('gid as gift_id,gift_name,base_image,gift_price')->where(['delete_time' => 0,'is_show' => 1])->select();
$gift_list = db::name('vs_gift')->field('gid as gift_id,gift_name,base_image,gift_price')->where(['delete_time' => 0,'label'=>['<>',2]])->select();
//对比去除$data 里面的礼物
$gift_list = array_filter((array)$gift_list, function ($item) use ($data) {
return !in_array($item['gift_id'], array_column($data, 'gift_id'));
@@ -661,7 +673,13 @@ class User extends Model
if(!empty($nickname)){
//名称中不能有 系统管理 等关键字
if(!nickname_filter($nickname)){
return ['code' => 0, 'msg' => '名称中不能有 系统管理 等相关字', 'data' => null];
return ['code' => 0, 'msg' => '名称中不能有 系统管理、官方 等相关字', 'data' => null];
}
$nick_name_info = db::name('user')->where(['nickname' => $nickname,'status' => ['<>',0]])->find();
if(!empty($nick_name_info)){
if($user_id != $nick_name_info['id']){
return['code' => 0, 'msg' => '该昵称已被占用','data' =>null];
}
}
$data['nickname'] = $nickname;
}
@@ -823,8 +841,41 @@ 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
public function update_user_ip($user_id,$ip){
//判断$ip是否是汉字
if(preg_match('/[\x{4e00}-\x{9fa5}]+/u', $ip)){
$ip = '未知';
}
$data = [
'address_ip' => $ip
];

View File

@@ -49,7 +49,7 @@ class UserData extends Model
$data['id'] = $uid;
if (!empty($nick_name)) {
$data['nickname'] = $nick_name;
$nick_name_info = db::name('user')->where('nickname', $nick_name)->find();
$nick_name_info = db::name('user')->where(['nickname' => $nick_name,'status' => ['<>',0]])->find();
if(!empty($nick_name_info)){
if($uid != $nick_name_info['id']){
return['code' => 0, 'msg' => '该昵称已被占用','data' =>null];
@@ -58,6 +58,10 @@ class UserData extends Model
if(mb_strlen($nick_name) > 24){
return['code' => 0, 'msg' => '昵称长度不能超过24个字符','data' =>null];
}
//名称中不能有 系统管理 等关键字
if(!nickname_filter($nick_name)){
return ['code' => 0, 'msg' => '名称中不能有 系统、管理、官方 等相关字', 'data' => null];
}
}
if (!empty($birthday)) {
@@ -133,8 +137,7 @@ class UserData extends Model
$data['uid'] = $uid;
if (!empty($nick_name)) {
$data['nick_name'] = $nick_name;
$data['base64_nick_name'] = base64_encode($nick_name);
$nick_name_info = db::name('user')->where('base64_nick_name', $data['base64_nick_name'])->find();
$nick_name_info = db::name('user')->where(['nickname' => $nick_name,'status' => ['<>',0]])->find();
if(!empty($nick_name_info)){
if($uid != $nick_name_info['uid']){
return['code' => 0, 'msg' => '该昵称已被占用','data' =>null];
@@ -254,6 +257,11 @@ class UserData extends Model
//修改手机号
public function modify_mobile($new_mobile,$user_id)
{
//查询新手机号绑定的数量
$new_mobile_num = db::name('user')->where(['username' => $new_mobile,'status' => ['neq', 0]])->count();
if ($new_mobile_num >= 3) {
return ['code' => 0, 'msg' => '该手机号已达绑定上限','data' =>null];
}
//查询旧手机号
$mobile = db::name('user')->where(['id' => $user_id])->value('username');
//查询是否实名
@@ -287,11 +295,16 @@ class UserData extends Model
if(empty($user_mobile)){
return ['code' => 0, 'msg' => '请先绑定手机号','data' =>null];
}
//查询是否已经提交过数据了
$is_real = db::name('user_auth')->where(['card_id' => $id_card,'is_real' => 1])->find();
if($is_real){
return ['code' => 0, 'msg' => '已经提交审核了,请等待验证结果!','data' =>null];
$card_id_count = db::name('user_auth')->where(['card_id' => $id_card,'is_real' => 1])->count();
if($card_id_count >= 3){
return ['code' => 0, 'msg' => '该身份证实名已达上限!','data' =>null];
}
//查询是否已经提交过数据了
$is_real = db::name('user_auth')->where(['card_id' => $id_card,'is_real' => 1,'mobile' =>$user_mobile])->find();
if($is_real){
return ['code' => 0, 'msg' => '已经审核通过!请勿重复提交!','data' =>null];
}
$auth = [
'mobile' => $user_mobile,
'real_name' => $real_name,
@@ -347,14 +360,21 @@ class UserData extends Model
public function real_name_result($user_id,$orderNo)
{
$user_mobile = db::name('user')->where(['id' => $user_id,'status'=>1])->value('mobile');
$id = db::name('user_auth')->where(['mobile' => $user_mobile,'is_real' => 3])->value('id');
if($id){
$res = db::name('user_auth')->where(['id' => ['<>',$id],'mobile' => $user_mobile])->select();
if($res){
foreach ($res as $key => $value) {
db::name('user_auth')->where('id' , $value['id'])->delete();
}
}
}
//修改状态
$reslut = db::name('user_auth')->where('mobile' , $user_mobile)->update(['is_real' => 1]);
$reslut = db::name('user_auth')->where('id' , $id)->update(['is_real' => 1]);
if(!$reslut){
return ['code' => 0, 'msg' => '实名失败','data' =>null];
}
//内侧用户充值10W金币
db::name('user_wallet')->where('user_id',$user_id)->update(['coin' => 100000,'updatetime' => time(),'createtime' => time()]);
return ['code' => 1, 'msg' => '实名成功','data' =>null];
}
@@ -567,12 +587,23 @@ class UserData extends Model
//绑定的详情
public function bind_xinxi_detail($user_id,$type)
{
$data = null;
if($type == 2){
$data = db::name('user_data')->where('user_id',$user_id)->field('id,alipay_name,alipay_account')->find();
}
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();
}
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];
}
}

View File

@@ -34,6 +34,10 @@ class UserGiftPack extends Model
const DRAW_GIFT = 7;
//巡乐会抽奖所得
const XLH_DRAW_GIFT_GET = 8;
//小时榜获得
const HOUR_RANK_GET = 9;
//新人充值好礼
const NEW_CHARGE_GIFT = 10;
public static function init()
{
@@ -51,7 +55,9 @@ class UserGiftPack extends Model
self::GIFT_USE => '礼物使用',
self::FIRST_CHARGE => '首充获得',
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::DRAW_GIFT,
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)
@@ -107,7 +114,7 @@ class UserGiftPack extends Model
->page($page, $page_limit)
->select();
if (empty($log_model)) {
return ['code' => 0, 'msg' => '没有数据', 'data' => null];
return ['code' => 0, 'msg' => ' ', 'data' => null];
}
$list = [];
foreach ($log_model as $k => $v){
@@ -134,7 +141,7 @@ class UserGiftPack extends Model
->page($page, $page_limit)
->select();
if (empty($log_model)) {
return ['code' => 0, 'msg' => '没有数据', 'data' => null];
return ['code' => 0, 'msg' => ' ', 'data' => null];
}
$list = [];
foreach ($log_model as $k => $v){

View File

@@ -54,6 +54,7 @@ class UserMessage extends Model
$system_no_read_count = $system_message - $user_read_message;
$system_last_message = db::name('system_message')
->field('id,type,title,content,url')
->where('type', 1)//1系统消息 3公告下的房间推荐4公告下的活动'
->where('FIND_IN_SET(:user_id, receiving_id)', ['user_id' => $uid])
->order('id desc')
@@ -77,6 +78,7 @@ class UserMessage extends Model
$announcement_read_count = count($system_message1) - count($user_read_message1);
unset($map['user_id']);
$announcement_last_message = db::name('system_message')
->field('id,type,title,content,url')
->where($map)
->where('FIND_IN_SET(:user_id, receiving_id)', ['user_id' => $uid])
->order('id desc')

View File

@@ -50,17 +50,18 @@ class UserWallet extends Model
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
// 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($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支出
$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收益钻石
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支出
$in_out_types = [3,14];
$in_out_types = [3,14,29];
}
}

View File

@@ -43,6 +43,13 @@ class UserWithdrawal extends Model
if(!$age){
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();
$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)];
}
if($search_etime){
$where['createtime'] = ['<=',strtotime($search_etime.' 23:59:59')];
$where['createtime'] = ['<=',strtotime($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')
->where($where)
@@ -207,6 +214,26 @@ class UserWithdrawal extends Model
$return_data[$key]['money'] = $value['money'];
$return_data[$key]['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 ['code' => 1, 'msg' => '成功', 'data' => $return_data];

View File

@@ -626,7 +626,7 @@ function nickname_filter($username) {
// 定义敏感词数组(包含常见变体)
$sensitiveWords = [
// 核心敏感词
'系统管理员', '管理员', '系统管理', '系统', '管理',
'系统管理员', '管理员', '系统管理', '系统', '管理','官方',
// 繁体中文
'系統管理員', '管理員', '系統管理', '系統',
@@ -880,7 +880,7 @@ function generateRandom($num = 0)
}
return $str;
}
function generateRandoms($length = 4)
function generateRandoms($length = 6)
{
$min = pow(10, $length - 1);
$max = pow(10, $length) - 1;
@@ -941,12 +941,130 @@ function get_user_constellation($birthday)
}
//数字格式话
function numberFormat($number) {
$num = round($number / 10000, 2);
if ($num > 1) {
$number = $num . 'w';
//function numberFormat($number) {
// $num = round($number / 10000, 2);
// if ($num > 1) {
// $number = $num . 'w';
// }
// return $number;
//}
/**
* 数字格式化方法
* @param int|float $number 需要格式化的数字
* @param string $format 格式类型: 'short'(默认简写), 'thousand'(千分位), 'custom'(自定义)
* @param int $decimals 小数位数
* @param array $options 其他选项
* @return string 格式化后的数字字符串
*/
function numberFormat($number, $format = 'short', $decimals = 2, $options = []) {
// 确保输入是数字
if (!is_numeric($number)) {
return '0';
}
return $number;
switch ($format) {
case 'short':
return formatShortNumber($number, $decimals);
case 'thousand':
return formatThousandNumber($number, $decimals);
case 'custom':
return formatCustomNumber($number, $options);
default:
return formatShortNumber($number, $decimals);
}
}
/**
* 简写格式化数字 (如: 1.23w, 2.56亿)
*/
function formatShortNumber($number, $decimals = 2) {
$units = ['', 'w', '亿', '万亿'];
$unit_index = 0;
// 处理负数
$is_negative = $number < 0;
$number = abs($number);
// 根据数值大小选择合适的单位
while ($number >= 10000 && $unit_index < count($units) - 1) {
$number /= 10000;
$unit_index++;
}
// 格式化数字
$formatted = round($number, $decimals);
// 如果是整数且小数部分为0则不显示小数
if ($decimals > 0 && floor($formatted) == $formatted) {
$formatted = number_format($formatted, 0);
} else {
$formatted = number_format($formatted, $decimals, '.', '');
}
return ($is_negative ? '-' : '') . $formatted . $units[$unit_index];
}
/**
* 千分位格式化数字 (如: 1,234,567.89)
*/
function formatThousandNumber($number, $decimals = 2) {
return number_format($number, $decimals, '.', ',');
}
/**
* 自定义格式化数字
*/
function formatCustomNumber($number, $options = []) {
$defaults = [
'decimals' => 2,
'decimal_point' => '.',
'thousands_sep' => ',',
'suffix' => '',
'prefix' => ''
];
$options = array_merge($defaults, $options);
$formatted = number_format($number, $options['decimals'], $options['decimal_point'], $options['thousands_sep']);
return $options['prefix'] . $formatted . $options['suffix'];
}
/**
* 简化版本的数字格式化 (改进原方法)
* @param int|float $number 需要格式化的数字
* @param int $decimals 小数位数
* @return string 格式化后的数字字符串
*/
function simpleNumberFormat($number, $decimals = 2) {
if (!is_numeric($number)) {
return '0';
}
// 处理负数
$is_negative = $number < 0;
$number = abs($number);
if ($number >= 100000000) { // 1亿以上
$result = round($number / 100000000, $decimals) . '亿';
} elseif ($number >= 10000) { // 1万以上
$result = round($number / 10000, $decimals) . 'w';
} elseif ($number >= 1000) { // 1千以上
$result = round($number / 1000, $decimals) . 'k';
} else {
$result = round($number, $decimals);
// 如果是整数且小数部分为0则不显示小数
if (floor($result) == $result) {
$result = (int)$result;
}
}
return ($is_negative ? '-' : '') . $result;
}
function generateRandomRoomName() {
@@ -1067,14 +1185,6 @@ function handelCharge($where,$data){
db::rollback();
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;
// }
}
//给上级返佣
//获取上级
@@ -1086,9 +1196,23 @@ function handelCharge($where,$data){
return 0;
}
}
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;
} catch (\Exception $e){
db::rollback();
@@ -1163,6 +1287,22 @@ function getMillisecond() {
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');
if($is_maintenance == 2){
return V(203, '系统维护中');
return V(0, '系统维护中');
}
//检测是什么系统
$system = input('system','');

View File

@@ -73,6 +73,10 @@ class Push
//房间盘推送
//巡乐会推送开启进度推送
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;
@@ -279,6 +283,8 @@ class Push
public function giftBanner($gift_list)
{
$topic = 'qx_room_topic';
//数组重组下标从0开始
$gift_list = array_values($gift_list);
$data = ['room_id' => $this->room_id, 'list' => $gift_list];
$this->push(self::PUSH_GIFT_BANNER, $topic, $data);
}
@@ -297,6 +303,17 @@ class Push
$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->check($path)) {
Hook::listen('admin_nopermission', $this);
return V(302,"你没有权限访问", url('index/login', []));
}
// if (!$this->auth->check($path)) {
// Hook::listen('admin_nopermission', $this);
// 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 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 = [
@@ -82,12 +98,14 @@ class UserWallet extends Model
self::OPERATION_GIFT,
self::GUILD_EXIT,
self::HEADLINE_REWARD,
self::TRANSFER_COIN
self::TRANSFER_COIN,
self::RED_PACKET_COIN,
];
//钻石支出类型数组
public $diamond_consumption_type_array = [
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::DELETE_RELATION_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] ?? '';
}

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

@@ -33,7 +33,7 @@ class FriendEnd
$friending_info = db::name('vs_user_friending')->where('room_id', $room['id'])->where('status', 1)->order('id', 'desc')->find();
if($friending_info){
//判断结束时间是否到期
if($friending_info['end_time'] <= time()){
if($friending_info['end_time'] <= time() || $room['step'] == 3){
model('Friend')->end_friend(0,$room['id'],$friending_info['id'],1);
}
}

View File

@@ -2,6 +2,9 @@
namespace app\cron\controller;
use app\common\model\Redpacket;
use app\common\model\UserWallet;
use think\Cache;
use think\Db;
use Yzh\YunPay;
@@ -30,8 +33,14 @@ class PerformPerSecond
echo "pk发起10秒后无应答拒绝\n";
$this->pk_start_refuse();
echo "\n";
echo "房间红包清退:\n";
$this->processExpiredRedpackets();
echo "\n";
// echo "房间火热值更新:\n";
// $this->room_hot_update();
// echo "\n";
// echo "提现云账号订单状态查询:\n";
// $this->withdraw_order_status();
// echo "\n";
}
@@ -136,6 +145,9 @@ class PerformPerSecond
continue;
}
}
if($value['yun_order_status'] == 5077){
continue;
}
echo "提现订单查询:".$value['order_sn']."\n";
$yun_pay = new YunPay($value['order_sn'], "", "", "", "","");
$result = $yun_pay->queryOrder($value['type']);
@@ -145,15 +157,32 @@ class PerformPerSecond
'status' => 6,
'pay_time' => time(),
'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{
db::name('vs_user_withdrawal')->where('order_sn',$value['order_sn'])->update([
'status' => 5,
'pay_time' => time(),
'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";
@@ -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;
use app\common\controller\Push;
use think\Cache;
use think\Db;
@@ -43,17 +44,18 @@ class RoomPan
$room_id = $v['room_id'];
$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['user_id'] = $FromUserInfo['id'];
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标
$user_nickname = $FromUserInfo['nickname'];
$textMessage = $user_nickname;
$text_message = $user_nickname;
foreach ($blind_box_turntable_results_log as $key => $value) {
$ToUserInfo = Db::name('user')->where(['id' => $value['gift_user_id']])->field('id as user_id,nickname,avatar,sex')->find();
$ToUserInfo['icon'][0] = model('UserData')->user_wealth_icon($value['gift_user_id']);//财富图标
$ToUserInfo['icon'][1] = model('UserData')->user_charm_icon($value['gift_user_id']);//魅力图标
$ToUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $value['gift_user_id'],'room_id' => $room_id])->value('charm');//魅力
$draw_gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find();
$textMessage = $textMessage . ' 送给 ' . $ToUserInfo['nickname']. ' 盲盒转盘礼物 ' . $draw_gift['gift_name'].' x ' .$value['count']."\n";
$play_image[] = $draw_gift['play_image'];
$gift_names[] = $draw_gift['gift_name'];
$text_message = $text_message . '在' . $room_name . '房间送给了' . $ToUserInfo['nickname'] . $draw_gift['gift_name'] . 'X' . $value['count']."\n";
if($draw_gift['is_public_server'] == 1) {
@@ -70,7 +72,10 @@ class RoomPan
}
$ToUserInfosList[$value['gift_user_id']] = $ToUserInfo;
}
foreach($ToUserInfosList as $userInfo) {
foreach($ToUserInfosList as &$userInfo) {
$userInfo['icon'][0] = model('UserData')->user_wealth_icon($userInfo['user_id']);//财富图标
$userInfo['icon'][1] = model('UserData')->user_charm_icon($userInfo['user_id']);//魅力图标
$userInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $userInfo['user_id'],'room_id' => $room_id])->value('charm');//魅力
$ToUserInfos[] = $userInfo;
}
$text = [
@@ -78,8 +83,9 @@ class RoomPan
'ToUserInfos' => $ToUserInfos,
'GiftInfo' => [
'play_image' => implode(',',$play_image),
'gift_name' => implode(',',$gift_names),
],
'text' => $textMessage
'text' => rtrim($textMessage, "\n")
];
//聊天室推送系统消息
model('Chat')->sendMsg(1005,$room_id,$text);
@@ -110,7 +116,7 @@ class RoomPan
* 巡乐会结束 礼物发放 【定时脚本】
*/
public function xlh_gift_send(){
$xlh_list = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['<',time()]])->select();
$xlh_list = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['<=',time()]])->select();
if(empty($xlh_list)){
echo "没有需要发放的礼物 \n";
}
@@ -121,16 +127,17 @@ class RoomPan
$res = db::name('vs_room_pan_xlh')->where('id',$value['id'])->update([
'send_time' => time()
]);
db::name("vs_room")->where('id',$value['room_id'])->update([
'xlh_periods_num' => 0
]);
// db::name("vs_room")->where('id',$value['room_id'])->update([
// 'xlh_periods_num' => 0
// ]);
Cache::set("xlh_periods_num", 0, 0);
//推送礼物横幅
$text = "本轮巡乐会已结束,请大家重新开始下一轮巡乐会";
$push = new Push(0, $value['room_id']);
$text_list_new = [
'text' => $text,
'room_id' => $value['room_id'],
'from_type' => 3
'from_type' => 104
];
$push->xunlehui($text_list_new);
continue;
@@ -167,20 +174,17 @@ class RoomPan
echo "处理发放记录失败 \n";
continue;
}
db::name("vs_room")->where('id',$value['room_id'])->update([
'xlh_periods_num' => 0
]);
Cache::set("xlh_periods_num", 0, 0);
//推送
$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');
$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']);
$text_list_new = [
'text' => $text,
'room_id' => $value['room_id'],
'from_type' => 3
'from_type' => 104
];
$push->xunlehui($text_list_new);
}catch (\Exception $e){

View File

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

View File

@@ -18,9 +18,14 @@ class TenSeconds
echo "房间在线人数:\n";
$this->auction_end_notice();//拍卖房结束提醒
echo "\n";
//清理切后台超过5分钟的用户
echo "清理切后台超过5分钟的用户\n";
$this->clear_offline_user();
echo "\n";
}
//在线人数
protected function auction_end_notice()
{
$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++;
}
}
// 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++;
}
}
@@ -58,4 +52,18 @@ class TenSeconds
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
{
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_SANDBOX = "yzh_env_sandbox";
@@ -44,6 +44,8 @@ class BaseClient
'bizlicxjjh5service' => 'https://api-aic.yunzhanghu.com', // 个体工商户注册服务(云账户新经济 H5接口域名
'ins' => 'https://api-ins.yunzhanghu.com', // 保险服务接口域名
'task' => 'https://api-task.yunzhanghu.com', // 任务库服务接口域名
'usercollectservice' => 'https://api-user.yunzhanghu.com', // 用户信息收集接口域名
'calculatelaborservice' => 'https://api-service.yunzhanghu.com', // 连续劳务税费试算接口域名
),
self::ENV_SANDBOX => array( // 沙箱环境
@@ -51,8 +53,10 @@ class BaseClient
'authentication' => 'https://api-service.yunzhanghu.com/sandbox', // 用户信息验证接口域名
'apiusersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // API 签约接口域名
'h5usersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // H5 签约接口域名
'calculatelaborservice' => 'https://api-service.yunzhanghu.com/sandbox', // 连续劳务税费试算接口域名
'realnameservice' => 'https://api-service.yunzhanghu.com/sandbox', // 连续劳务税费试算接口域名
'ins' => '', // 保险服务接口域名
'aic' => '', // 个体工商户注册服务接口域名
'aic' => 'https://api-aic.yunzhanghu.com/sandbox', // 个体工商户注册服务接口域名
'task' => '', // 任务库服务接口域名
'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
*/
public $ref;
/**
* 证件照片 URL 地址
* @var string[]
*/
public $image_urls;
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;
/**
* 加成服务费金额
* 应收综合服务主体加成服务费金额
* @var string
*/
protected $broker_fee;
/**
* 加成服务费实收金额
* 应收余额账户支出加成服务费金额
* @var string
*/
protected $broker_real_fee;
/**
* 已抵扣加成服务费金额
* 应收加成服务费抵扣金额
* @var string
*/
protected $broker_rebate_fee;
/**
* 用户加成服务费金额
* 应收用户加成服务费金额
* @var string
*/
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
*/
public function setBrokerFee($broker_fee)
@@ -87,7 +207,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 加成服务费金额
* 应收综合服务主体加成服务费金额
* @return string
*/
public function getBrokerFee()
@@ -96,7 +216,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 加成服务费实收金额
* 应收余额账户支出加成服务费金额
* @var string $broker_real_fee
*/
public function setBrokerRealFee($broker_real_fee)
@@ -105,7 +225,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 加成服务费实收金额
* 应收余额账户支出加成服务费金额
* @return string
*/
public function getBrokerRealFee()
@@ -114,7 +234,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 已抵扣加成服务费金额
* 应收加成服务费抵扣金额
* @var string $broker_rebate_fee
*/
public function setBrokerRebateFee($broker_rebate_fee)
@@ -123,7 +243,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 已抵扣加成服务费金额
* 应收加成服务费抵扣金额
* @return string
*/
public function getBrokerRebateFee()
@@ -132,7 +252,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 用户加成服务费金额
* 应收用户加成服务费金额
* @var string $user_fee
*/
public function setUserFee($user_fee)
@@ -141,11 +261,443 @@ class DailyOrderSummary extends BaseModel
}
/**
* 用户加成服务费金额
* 应收用户加成服务费金额
* @return string
*/
public function getUserFee()
{
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;
/**
* 综合服务主体加成服务费
* 应收综合服务主体加成服务费金额
* @var string
*/
protected $broker_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/**
* 支付路径流水号
* @var string
@@ -115,6 +120,21 @@ class DealerOrderInfo extends BaseModel
* @var string
*/
protected $finished_time;
/**
* 预扣税费总额
* @var string
*/
protected $tax_amount;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 缴税明细
* @var OrderTaxDetail
*/
protected $tax_detail;
/**
* 综合服务主体 ID
@@ -261,7 +281,7 @@ class DealerOrderInfo extends BaseModel
}
/**
* 综合服务主体加成服务费
* 应收综合服务主体加成服务费金额
* @var string $broker_fee
*/
public function setBrokerFee($broker_fee)
@@ -270,7 +290,7 @@ class DealerOrderInfo extends BaseModel
}
/**
* 综合服务主体加成服务费
* 应收综合服务主体加成服务费金额
* @return string
*/
public function getBrokerFee()
@@ -278,6 +298,24 @@ class DealerOrderInfo extends BaseModel
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
@@ -493,4 +531,58 @@ class DealerOrderInfo extends BaseModel
{
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;
}
}

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