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