更新代码

This commit is contained in:
wangxiaowei 2024-07-29 17:41:56 +08:00
parent 3221603527
commit c95f8cca8a
4 changed files with 27 additions and 7 deletions

@ -50,11 +50,19 @@ class Login extends AdminBase
// 'mobile' => 15005837859, // 'mobile' => 15005837859,
// 'params' => [ // 'params' => [
// 'user_id' => 979, // 'user_id' => 979,
// 'after_sale_sn' => '测试单号' // 'after_sale_sn' => '202306071624224802'
// ] // ]
// ]); // ]);
// dump(123); event('Notice', [
// die; 'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP_REFUND,
'mobile' => 15005837859,
'params' => [
'user_id' => 979,
'after_sale_sn' => '202306071624224802'
]
]);
dump(123);
die;
if ($this->request->isAjax()) { if ($this->request->isAjax()) {
$post = request()->post(); $post = request()->post();
(new LoginValidate())->goCheck(); (new LoginValidate())->goCheck();

@ -43,7 +43,7 @@ class AfterSale extends Api
$post = $this->request->post(); $post = $this->request->post();
$post['user_id'] = $this->user_id; $post['user_id'] = $this->user_id;
$post['reason'] = ""; $post['reason'] = "";
(new AfterSaleValidate())->goCheck('add', $post); // (new AfterSaleValidate())->goCheck('add', $post);
$result = AfterSaleLogic::add($post, $this->user_id); $result = AfterSaleLogic::add($post, $this->user_id);
if (false === $result) { if (false === $result) {
return JsonServer::error('该订单已超过售后时间'); return JsonServer::error('该订单已超过售后时间');

@ -277,7 +277,7 @@ class AfterSaleLogic extends Logic
if (!empty($order['shop']['mobile'])) { if (!empty($order['shop']['mobile'])) {
//通知商家 //通知商家
event('Notice', [ event('Notice', [
'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP, 'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP_REFUND,
'mobile' => $order['shop']['mobile'], 'mobile' => $order['shop']['mobile'],
'params' => [ 'params' => [
'user_id' => $user_id, 'user_id' => $user_id,
@ -500,6 +500,19 @@ class AfterSaleLogic extends Logic
$user_id, $user_id,
AfterSaleLog::USER_AGAIN_REFUND AfterSaleLog::USER_AGAIN_REFUND
); );
$order = Order::with('shop')->where(['id' => $after_sale['order_id']])->find();
if (!empty($order['shop']['mobile'])) {
//通知商家
event('Notice', [
'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP,
'mobile' => $order['shop']['mobile'],
'params' => [
'user_id' => $user_id,
'after_sale_sn' => $after_sale['sn']
]
]);
}
Db::commit(); Db::commit();
return ['after_sale_id' => $id]; return ['after_sale_id' => $id];
} catch (Exception $e) { } catch (Exception $e) {

@ -38,7 +38,6 @@ class SmsMessageServer
try{ try{
//场景对应短信模板信息 //场景对应短信模板信息
$scene_config = NoticeSetting::where(['scene' => $params['scene']])->findOrEmpty(); $scene_config = NoticeSetting::where(['scene' => $params['scene']])->findOrEmpty();
//增加短信记录 //增加短信记录
$content = $this->getContentInfo($scene_config, $params); $content = $this->getContentInfo($scene_config, $params);
$code = $this->getCodeInfo($params['scene'], $scene_config, $params['params']); $code = $this->getCodeInfo($params['scene'], $scene_config, $params['params']);
@ -46,13 +45,13 @@ class SmsMessageServer
//增加通知记录 //增加通知记录
$this->notice = MessageNoticeLogic::addNoticeLog($params, $scene_config['sms_notice'], NoticeEnum::SMS_NOTICE, $content); $this->notice = MessageNoticeLogic::addNoticeLog($params, $scene_config['sms_notice'], NoticeEnum::SMS_NOTICE, $content);
//发送短信 //发送短信
$SmsDriver = new Driver(); $SmsDriver = new Driver();
$res = $SmsDriver->send($params['mobile'], [ $res = $SmsDriver->send($params['mobile'], [
'template_id' => $scene_config['sms_notice']['template_code'], 'template_id' => $scene_config['sms_notice']['template_code'],
'param' => $this->setSmsParams($scene_config, $params), 'param' => $this->setSmsParams($scene_config, $params),
]); ]);
if (false === $res) { if (false === $res) {
$this->updateSmsLog($this->sms_log['id'], SmsEnum::SEND_FAIL, $SmsDriver->getError()); $this->updateSmsLog($this->sms_log['id'], SmsEnum::SEND_FAIL, $SmsDriver->getError());
throw new \Exception($SmsDriver->getError()); throw new \Exception($SmsDriver->getError());