模版提交修改
This commit is contained in:
parent
0013181359
commit
9e90e73bb9
|
|
@ -36,45 +36,46 @@ class QuerySmsStatus extends Command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$push_resp = '';
|
||||
// 生日有礼
|
||||
$bir_list = Db::table('mk_birthday_gift_record')->where(['push_status' => 'await_push'])->select()->toArray();
|
||||
if($bir_list) {
|
||||
Log::info('生日有礼短信发送状态查询开始->' . json_encode($bir_list));
|
||||
foreach ($bir_list as $k => $value) {
|
||||
$data = [
|
||||
'PhoneNumber' => $value['phone'],
|
||||
'BizId' => $value['biz_id'],
|
||||
'SendDate' => date('Ymd'),
|
||||
'PageSize' => 1,
|
||||
'CurrentPage' => 20,
|
||||
'phoneNumber' => $value['phone'],
|
||||
'bizId' => $value['biz_id'],
|
||||
'sendDate' => date('Ymd'),
|
||||
'pageSize' => 10,
|
||||
'currentPage' => 1,
|
||||
];
|
||||
$res = AlibabaSms::QuerySendDetails($data);
|
||||
try {
|
||||
Db::startTrans();
|
||||
if($res['Code'] == 'OK') {
|
||||
$push_resp = $res['ErrCode'];
|
||||
if($res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['SendStatus'] == 3) {
|
||||
$push_status = 'success';
|
||||
// 扣掉余额
|
||||
ShopInfo::moeny(config('cons.sms_price'), $value['main_shop_id'], 2, );
|
||||
ShopInfo::moeny(config('cons.sms_price'), $value['main_shop_id'], '生日有礼短信发送,任务ID:' . $value['id'], 2);
|
||||
}elseif ($res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['SendStatus'] == 2) {
|
||||
$push_resp = $res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['ErrCode'];
|
||||
$push_status = 'failed';
|
||||
}elseif ($res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['SendStatus'] == 1) {
|
||||
$push_status = 'await_push';
|
||||
}
|
||||
$update_data = [
|
||||
'status' => $push_status,
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
'push_status' => $push_status,
|
||||
'push_resp' => $push_resp,
|
||||
];
|
||||
$update_status = Db::table('mk_birthday_gift_record')->where(['id' => $value['id']])->update($update_data);
|
||||
Db::commit();
|
||||
Log::info('短信查询完毕数据库更新结果---》[ID]' . $value['id'] . '更新结果-->' . $update_status . '-->更新数据 . ' . json_encode($update_data));
|
||||
Log::info('生日有礼短信查询完毕数据库更新结果---》[ID]' . $value['id'] . '更新结果-->' . $update_status . '-->更新数据 . ' . json_encode($update_data));
|
||||
}
|
||||
}catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::info('短信查询错误---》[ID]' . $e->getMessage());
|
||||
Log::info('生日有礼短信查询错误---》[ID]' . $e->getMessage());
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -97,12 +98,12 @@ class QuerySmsStatus extends Command
|
|||
try {
|
||||
Db::startTrans();
|
||||
if($res['Code'] == 'OK') {
|
||||
$push_resp = $res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['ErrCode'];
|
||||
if($res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['SendStatus'] == 3) {
|
||||
$push_status = 2;
|
||||
// 扣掉余额
|
||||
ShopInfo::moeny(config('cons.sms_price'), $value['main_shop_id'], 2);
|
||||
ShopInfo::moeny(config('cons.sms_price'), $value['main_shop_id'], '营销短信发送,任务ID:' . $value['event_id'], 2);
|
||||
}elseif ($res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['SendStatus'] == 2) {
|
||||
$push_resp = $res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['ErrCode'];
|
||||
$push_status = -1;
|
||||
}elseif ($res['SmsSendDetailDTOs']['SmsSendDetailDTO'][0]['SendStatus'] == 1) {
|
||||
$push_status = 1;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use support\think\Db;
|
|||
class ShopInfo
|
||||
{
|
||||
|
||||
public static function moeny($money, $shop_id, $type = 1)
|
||||
public static function moeny($money, $shop_id, $reason, $type = 1)
|
||||
{
|
||||
$shop_money = Db::table('sms_shop_money')->where(['shop_id' => $shop_id])->find();
|
||||
if($shop_money) {
|
||||
|
|
@ -26,6 +26,7 @@ class ShopInfo
|
|||
'shop_id' => $shop_id,
|
||||
'type' => $type,
|
||||
'expense' => $money,
|
||||
'reason' => $reason,
|
||||
'balance' => $befor_money,
|
||||
]);
|
||||
}
|
||||
|
|
@ -64,7 +65,7 @@ class ShopInfo
|
|||
{
|
||||
$data_arr = self::javaGetUserList($k_user_params, $page, $size);
|
||||
$for_user_list = [];
|
||||
if($data_arr['code'] == 0) {
|
||||
if($data_arr['code'] == 200) {
|
||||
$user_list = self::evnuserlist($data_arr['data']['records']);
|
||||
if($data_arr['data']['totalPage'] > 1) {
|
||||
for ($i = 2; $i <= $data_arr['data']['totalPage']; $i++) {
|
||||
|
|
@ -92,7 +93,7 @@ class ShopInfo
|
|||
$push_user[] = [
|
||||
'user_id' => $user['id'],
|
||||
'phone' => $user['phone'],
|
||||
'nick_name' => $user['nick_name'],
|
||||
'nick_name' => isset($user['nick_name'])?$user['nick_name']:$user['nickName'],
|
||||
];
|
||||
}
|
||||
return $push_user;
|
||||
|
|
|
|||
|
|
@ -22,10 +22,9 @@ class BirthdayGiftSms implements Consumer
|
|||
if($record) {
|
||||
// 待发送
|
||||
if($record['push_status'] == 'wait_push') {
|
||||
$user = Db::table('tb_shop_user')->where(['id' => $record['user_id']])->find();
|
||||
// 张松 需要加主模版ID
|
||||
$y_temp = Db::table('sms_shop_template')->where(['id' => $record['push_event_id']])->find();
|
||||
if($user && !empty($user['phone'])) {
|
||||
$user = Db::table('tb_shop_user')->where(['id' => $record['shop_user_id']])->find();
|
||||
$y_temp = Db::table('sms_shop_template')->where(['id' => $record['template_id']])->find();
|
||||
if($user) {
|
||||
// 检测余额
|
||||
$shop_money = Db::table('sms_shop_money')->where(['shop_id' => $record['main_shop_id']])->find();
|
||||
if($shop_money) {
|
||||
|
|
@ -61,7 +60,6 @@ class BirthdayGiftSms implements Consumer
|
|||
Log::info('商户【' . $record['main_shop_id'] . '】余额为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
}else {
|
||||
Log::info('【生日有礼】时查询用户不存在---》' . $record['user_id']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,12 @@ class SendMarkSms implements Consumer
|
|||
// $record = Db::table('sms_push_event')->where(['id' => $sms_push_event_id, 'push_type' => 2])->find();
|
||||
$record = Db::table('sms_push_event')->where(['id' => $sms_push_event_id])->find();
|
||||
if($record) {
|
||||
Log::info('$record');
|
||||
|
||||
// 查询是否是定时发送
|
||||
if($record['send_type'] == 2) {
|
||||
|
||||
}
|
||||
|
||||
// 待发送
|
||||
if($record['status'] == 0) {
|
||||
Log::info('待发送');
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ return [
|
|||
]
|
||||
]
|
||||
],
|
||||
'MessagePushTask' => [
|
||||
'handler' => MessagePushTask::class,
|
||||
]
|
||||
// 'MessagePushTask' => [
|
||||
// 'handler' => MessagePushTask::class,
|
||||
// ]
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue