user_id 保存
This commit is contained in:
parent
5542963183
commit
1ddef4432a
|
|
@ -100,7 +100,7 @@ class SendMarkSms implements Consumer
|
||||||
Db::table('sms_push_event_record')->insert([
|
Db::table('sms_push_event_record')->insert([
|
||||||
'shop_id' => $record['shop_id'],
|
'shop_id' => $record['shop_id'],
|
||||||
'event_id' => $record['id'],
|
'event_id' => $record['id'],
|
||||||
'user_id' => $v['user_id'],
|
'user_id' => $v['u_user_id'],
|
||||||
'type' => 'sms',
|
'type' => 'sms',
|
||||||
'user_phone' => $v['phone'],
|
'user_phone' => $v['phone'],
|
||||||
'biz_id' => $res['BizId'],
|
'biz_id' => $res['BizId'],
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ class SendWechatTemp implements Consumer
|
||||||
if($k_user_params) {
|
if($k_user_params) {
|
||||||
$user_list = ShopInfo::getUserList($k_user_params);
|
$user_list = ShopInfo::getUserList($k_user_params);
|
||||||
if(!$user_list) {
|
if(!$user_list) {
|
||||||
|
Log::info('范围用户列表为空');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
foreach ($user_list as $k => &$v) {
|
foreach ($user_list as $k => &$v) {
|
||||||
|
|
@ -89,56 +90,60 @@ class SendWechatTemp implements Consumer
|
||||||
Log::info('模版消息用户列表' . json_encode($user_list));
|
Log::info('模版消息用户列表' . json_encode($user_list));
|
||||||
if($user_list) {
|
if($user_list) {
|
||||||
foreach ($user_list as $k => $user) {
|
foreach ($user_list as $k => $user) {
|
||||||
$config = [
|
if(!empty($user['wechat_ac_open_id'])) {
|
||||||
'app_id' => config('cons.app_id'),
|
$config = [
|
||||||
'secret' => config('cons.secret'),
|
'app_id' => config('cons.app_id'),
|
||||||
'response_type' => 'array',
|
'secret' => config('cons.secret'),
|
||||||
];
|
'response_type' => 'array',
|
||||||
$app = Factory::officialAccount($config);
|
];
|
||||||
$acc_token = Redis::get('wx:ac:AccessToken');
|
$app = Factory::officialAccount($config);
|
||||||
if($acc_token) {
|
$acc_token = Redis::get('wx:ac:AccessToken');
|
||||||
$app['access_token']->setToken($acc_token);
|
if($acc_token) {
|
||||||
}
|
$app['access_token']->setToken($acc_token);
|
||||||
$wechat_res = $app->template_message->send([
|
}
|
||||||
'touser' => $user['wechat_ac_open_id'],
|
$wechat_res = $app->template_message->send([
|
||||||
'template_id' => 'hGsUGZlWqWC9TMm4ZGZuz0OwE4gwSmvgbr5ecmTDvq4',
|
'touser' => $user['wechat_ac_open_id'],
|
||||||
'miniprogram' => [
|
'template_id' => 'hGsUGZlWqWC9TMm4ZGZuz0OwE4gwSmvgbr5ecmTDvq4',
|
||||||
'appid' => 'wxd88fffa983758a30', // 零点八零
|
'miniprogram' => [
|
||||||
],
|
'appid' => 'wxd88fffa983758a30', // 零点八零
|
||||||
'data' => [
|
],
|
||||||
'thing7' => $record['shop_name'],
|
'data' => [
|
||||||
'thing14' => $record['activity_detail'],
|
'thing7' => $record['shop_name'],
|
||||||
'time3' => $record['activity_time'],
|
'thing14' => $record['activity_detail'],
|
||||||
'thing16' => $record['address'],
|
'time3' => $record['activity_time'],
|
||||||
],
|
'thing16' => $record['address'],
|
||||||
]);
|
],
|
||||||
|
|
||||||
Db::startTrans();
|
|
||||||
Db::table('ac_push_event')->where(['id' => $record['id']])->update([
|
|
||||||
'status' => 1,
|
|
||||||
'update_time' => date('Y-m-d H:i:s'),
|
|
||||||
'send_time' => date('Y-m-d H:i:s'),
|
|
||||||
]);
|
|
||||||
Log::info('模版发送结果' . json_encode($wechat_res));
|
|
||||||
if($wechat_res['errcode'] == 0 && $wechat_res['errmsg'] == 'ok') {
|
|
||||||
Log::info('OKKKKK了');
|
|
||||||
Db::table('sms_push_event_record')->insert([
|
|
||||||
'shop_id' => $record['shop_id'],
|
|
||||||
'event_id' => $record['id'],
|
|
||||||
'user_id' => $user['id'],
|
|
||||||
'user_phone' => $user['phone'],
|
|
||||||
'biz_id' => '',
|
|
||||||
'send_time' => date('Y-m-d H:i:s'),
|
|
||||||
'create_time' => date('Y-m-d H:i:s'),
|
|
||||||
'status' => 2,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Db::startTrans();
|
||||||
Db::table('ac_push_event')->where(['id' => $record['id']])->update([
|
Db::table('ac_push_event')->where(['id' => $record['id']])->update([
|
||||||
'status' => 2,
|
'status' => 1,
|
||||||
'update_time' => date('Y-m-d H:i:s'),
|
'update_time' => date('Y-m-d H:i:s'),
|
||||||
'send_time' => date('Y-m-d H:i:s'),
|
'send_time' => date('Y-m-d H:i:s'),
|
||||||
]);
|
]);
|
||||||
|
Log::info('模版发送结果' . json_encode($wechat_res));
|
||||||
|
if($wechat_res['errcode'] == 0 && $wechat_res['errmsg'] == 'ok') {
|
||||||
|
Log::info('OKKKKK了');
|
||||||
|
Db::table('sms_push_event_record')->insert([
|
||||||
|
'shop_id' => $record['shop_id'],
|
||||||
|
'event_id' => $record['id'],
|
||||||
|
'user_id' => $user['u_user_id'],
|
||||||
|
'user_phone' => $user['phone'],
|
||||||
|
'biz_id' => '',
|
||||||
|
'send_time' => date('Y-m-d H:i:s'),
|
||||||
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
|
'status' => 2,
|
||||||
|
]);
|
||||||
|
Db::table('ac_push_event')->where(['id' => $record['id']])->update([
|
||||||
|
'status' => 2,
|
||||||
|
'update_time' => date('Y-m-d H:i:s'),
|
||||||
|
'send_time' => date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
}else {
|
||||||
|
Log::info('用户' . $user['u_user_id'] . 'open_id 为空。不发送');
|
||||||
}
|
}
|
||||||
Db::commit();
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue