RedRemindController.class.php
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* 【销售活动-后台】红包提醒接口
*
* author daijun
*/
namespace Apicp\Controller\Red;
use Common\Service\ActivityService;
use Common\Service\PacketrecordService;
class RedRemindController extends \Apicp\Controller\AbstractController
{
public function Index_post()
{
$red_ids = I('post.red_ids');
if (empty($red_ids)) {
// 红包id不能为空
E('_EMPTY_RED_IDS');
}
$records_serv = new PacketrecordService();
$records_list = $records_serv->list_by_conds([
'rid' => $red_ids, // 红包id
'packet_status' => PacketrecordService::PACKET_STATUS_WAIT, // 待领取
]);
$activity = [];
if ($records_list) {
$activity_serv = new ActivityService();
$activity = $activity_serv->get($records_list[0]['ac_id']);
}
foreach ($records_list as $v) {
if (PacketrecordService::RED_PACKET_RAND == $v['p_type']) {
// 提醒领取随机红包
$msg_type = PacketrecordService::MSG_REMAIND_RECEIVE_RANDOM_REDPACKET;
} elseif ($v['p_type'] == PacketrecordService::RED_PACKET_VIP) {
// 提醒领取定向红包
$msg_type = PacketrecordService::MSG_REMAIND_RECEIVE_VIP_REDPACKET;
} else {
continue;
}
$params = [
'uids' => $v['uid'],
'ac_id' => $v['ac_id'],
'rid' => $v['rid'],
'comment_id' => $v['comment_id'],
'subject' => $activity['subject'],
'rand_money' => $v['rand_money'],
'give_time' => $v['give_time']
];
$records_serv->send_msg($params, $msg_type);
}
return true;
}
}