mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改支付事件
This commit is contained in:
parent
4aca36f285
commit
8892a6fa2b
@ -290,7 +290,7 @@ abstract class PaymentService
|
||||
if (empty($data['payment_type'])) unset($data['payment_type']);
|
||||
$this->app->db->name('ShopOrder')->where($map)->update($data);
|
||||
// 触发订单更新事件
|
||||
if (in_array($status, [4, 5])) {
|
||||
if ($status >= 4) {
|
||||
$this->app->event->trigger('ShopOrderPayment', $orderNo);
|
||||
}
|
||||
return true;
|
||||
|
@ -10,7 +10,9 @@ use app\data\service\UserBalanceService;
|
||||
use app\data\service\UserRebateService;
|
||||
use think\Console;
|
||||
|
||||
if (app()->request->isCli()) {
|
||||
$app = app();
|
||||
|
||||
if ($app->request->isCli()) {
|
||||
Console::starting(function (Console $console) {
|
||||
$console->addCommand(OrderClean::class);
|
||||
$console->addCommand(UserAmount::class);
|
||||
@ -19,19 +21,20 @@ if (app()->request->isCli()) {
|
||||
});
|
||||
} else {
|
||||
// 注册订单支付处理事件
|
||||
app()->event->listen('ShopOrderPayment', function ($orderNo) {
|
||||
app()->log->notice("订单 {$orderNo} 支付事件,执行用户升级行为");
|
||||
$app->event->listen('ShopOrderPayment', function ($orderNo) use ($app) {
|
||||
$app->log->notice("订单 {$orderNo} 支付事件,执行用户升级行为");
|
||||
OrderService::instance()->upgrade($orderNo);
|
||||
|
||||
app()->log->notice("订单 {$orderNo} 支付事件,执行用户返利行为");
|
||||
$app->log->notice("订单 {$orderNo} 支付事件,执行用户返利行为");
|
||||
RebateService::instance()->execute($orderNo);
|
||||
|
||||
app()->log->notice("订单 {$orderNo} 支付事件,执行发放余额行为");
|
||||
$app->log->notice("订单 {$orderNo} 支付事件,执行发放余额行为");
|
||||
UserBalanceService::instance()->confirm($orderNo);
|
||||
});
|
||||
|
||||
// 注册订单确认支付事件
|
||||
app()->event->listen('ShopOrderConfirm', function ($orderNo) {
|
||||
app()->log->notice("订单 {$orderNo} 确认事件,执行返利确认行为");
|
||||
$app->event->listen('ShopOrderConfirm', function ($orderNo) use ($app) {
|
||||
$app->log->notice("订单 {$orderNo} 确认事件,执行返利确认行为");
|
||||
UserRebateService::instance()->confirm($orderNo);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user