添加信用购订单逾期定时通知
This commit is contained in:
parent
5ac9ce5b1d
commit
32904dd6dd
@ -2505,10 +2505,11 @@ class StoreOrderRepository extends BaseRepository
|
||||
* 确认接单
|
||||
* @param $user
|
||||
* @param $id
|
||||
* @param $type
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function confirm($user, $id)
|
||||
public function confirm($user, $id, $type)
|
||||
{
|
||||
/** @var StoreGroupOrderRepository $groupOrderRepository */
|
||||
$groupOrderRepository = app()->make(StoreGroupOrderRepository::class);
|
||||
@ -2523,7 +2524,11 @@ class StoreOrderRepository extends BaseRepository
|
||||
if ($order->status != StoreOrder::STATUS_WAIT_CONFIRM) {
|
||||
throw new Exception('订单状态错误');
|
||||
}
|
||||
$order->status = StoreOrder::STATUS_WAIT_PAY;
|
||||
if ($type == 2) {
|
||||
$order->is_del = 1;
|
||||
} else {
|
||||
$order->status = StoreOrder::STATUS_WAIT_PAY;
|
||||
}
|
||||
$order->save();
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
|
@ -55,6 +55,18 @@ class JgPush
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'MERCHANT_CREDIT_BUY_NOTICE':
|
||||
$route = "/pages/admin/orderDetail/index?id={$data['orderId']}&mer_id={$data['id']}";
|
||||
$merUserId = Merchant::where('mer_id', $data['id'])->value('uid');
|
||||
$jgRegisterId = User::where('uid', $merUserId)->value('jg_register_id');
|
||||
if (empty($jgRegisterId)) {
|
||||
break;
|
||||
}
|
||||
$this->addRegistrationId($jgRegisterId);
|
||||
$this->androidNotification('您的先货后款订单即将逾期,请尽快处理!', ['extras' => ['route' => $route]]);
|
||||
$this->iosNotification('您的先货后款订单即将逾期,请尽快处理!', ['extras' => ['route' => $route]]);
|
||||
$this->push->send();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -326,8 +326,9 @@ class StoreOrder extends BaseController
|
||||
public function confirm()
|
||||
{
|
||||
$id = $this->request->param('id/d');
|
||||
$type = $this->request->param('type/d');
|
||||
try {
|
||||
$this->repository->confirm($this->request->userInfo(), $id);
|
||||
$this->repository->confirm($this->request->userInfo(), $id, $type);
|
||||
return app('json')->success('success');
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
|
26
crmeb/listens/AutoCheckCreditBuyListen.php
Normal file
26
crmeb/listens/AutoCheckCreditBuyListen.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace crmeb\listens;
|
||||
|
||||
use app\common\model\store\order\StoreOrderInterest;
|
||||
use crmeb\interfaces\ListenerInterface;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
use crmeb\services\TimerService;
|
||||
use think\facade\Queue;
|
||||
|
||||
class AutoCheckCreditBuyListen extends TimerService implements ListenerInterface
|
||||
{
|
||||
public function handle($event): void
|
||||
{
|
||||
$tomorrow = strtotime('tomorrow 10:00:00');
|
||||
$time = ($tomorrow - time()) * 1000;
|
||||
$this->tick($time, function () {
|
||||
request()->clearCache();
|
||||
$time = strtotime('+3 days');
|
||||
$unSettle = StoreOrderInterest::whereBetweenTime('start_time', time(), $time)->where('status', 0)->group('mer_id')->column('order_id,mer_id');
|
||||
foreach ($unSettle as $item) {
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'MERCHANT_CREDIT_BUY_NOTICE', 'id' => $item['mer_id'], 'orderId' => $item['order_id']]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -282,6 +282,9 @@ class SmsService
|
||||
case 'SVIP_PAY_SUCCESS':
|
||||
self::create()->send($id['phone'], $tempId, ['store_name' => systemConfig('site_name'),'date' => $id['date']]);
|
||||
break;
|
||||
case 'MERCHANT_CREDIT_BUY_NOTICE':
|
||||
self::sendMerMessage($id, $tempId, ['order_id' => $data['orderId']]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user