多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# **listens定时监听类** 目录结构 ``` ├─services │ └─pay //支付回调相关监听 │ │ │ MealSuccessListen.php //一号通扫码支付回调 │ │ │ OrderPaySuccessListen.php //订单支付回调 │ │ │ PresellPaySuccessListen.php //预售订单尾款回调 │ │ └─ UserRechargeSuccessListen.php //用户充值回调 │ │ │ │ AuthCancelPresellOrderListen.php //自动关闭尾款订单 │ │ AuthTakeOrderListen.php //自动收货 │ │ AutoCancelGroupOrderListen.php //自动关闭订单 │ │ AutoClearIntegralListen.php //清楚到期积分 │ │ AutoOrderProfitsharingListen.php //自动分账 │ │ AutoOrderReplyListen.php //系统默认好评 │ │ AutoSendPayOrderSmsListen.php //待支付订单短信通知 │ │ AutoUnLockBrokerageListen.php //解冻佣金 │ │ AutoUnLockIntegralListen.php //冻结积分 │ │ AutoUnlockMerchantMoneyListen.php //冻结商户余额 │ │ CreateTimerListen.php //执行定时任务 │ │ ExcelFileDelListen.php //自动删除导出文件 │ │ GuaranteeCountListen.php //自动更新服务保障统计数据 │ │ InitSwooleLockListen.php //订单锁 │ │ MerchantApplyMentsCheckListen.php //申请分账子商户结果查询 │ │ ProductGroupStatusCheckListen.php //自动检测拼团结果 │ │ ProductPresellStatusListen.php //检测预售商品状态 │ │ RefundOrderAgreeListen.php //自动退款 │ │ SeckillTImeCheckListen.php //检测秒杀商品状态 │ │ SwooleTaskListen.php //客服消息 │ │ SwooleWorkerExitListen.php //清除所有定时任务 │ │ SyncBroadcastStatusListen.php //同步直播商品 │ │ SyncSmsResultCodeListen.php //更新短信记录 │ │ SyncSpreadStatusListen.php //分销员绑定关系到期状态 ``` ### 使用方法 * 除了支付回调以外的所有定时任务,都要在`app\event.php`文件中加入`create_timer`变量中实现监听; * 支付的回调则需要单独添加一个键名,键名需要以`pay_success_`拼接生成订单的时候的`attach `值,例如: 生成订单信息: ``` $params = [ 'order_sn' => $this->group_order_sn, 'sub_orders' => [], 'attach' => 'order', 'body' => '订单支付', ]; ``` 订单回调监听 ``` 'pay_success_order' => [\crmeb\listens\pay\OrderPaySuccessListen::class], ``` 完整event文件 ``` <?php // 事件定义文件 return [ 'bind' => [ ], 'listen' => [ 'AppInit' => [], 'HttpRun' => [], 'HttpEnd' => [], 'LogLevel' => [], 'LogWrite' => [], 'swoole.task' => [\crmeb\listens\SwooleTaskListen::class], 'swoole.init' => [ \crmeb\listens\InitSwooleLockListen::class, \crmeb\listens\CreateTimerListen::class, ], 'swoole.workerStart' => [\app\webscoket\SwooleWorkerStart::class], 'swoole.workerExit' => [\crmeb\listens\SwooleWorkerExitListen::class], 'swoole.workerError' => [\crmeb\listens\SwooleWorkerExitListen::class], 'swoole.workerStop' => [\crmeb\listens\SwooleWorkerExitListen::class], 'create_timer' => env('INSTALLED', false) ? [ \crmeb\listens\AutoOrderProfitsharingListen::class, \crmeb\listens\AuthTakeOrderListen::class, \crmeb\listens\AutoCancelGroupOrderListen::class, \crmeb\listens\AuthCancelPresellOrderListen::class, \crmeb\listens\AutoUnLockBrokerageListen::class, \crmeb\listens\AutoSendPayOrderSmsListen::class, \crmeb\listens\SyncSmsResultCodeListen::class, \crmeb\listens\SyncBroadcastStatusListen::class, \crmeb\listens\ExcelFileDelListen::class, \crmeb\listens\RefundOrderAgreeListen::class, \crmeb\listens\SeckillTImeCheckListen::class, \crmeb\listens\AutoOrderReplyListen::class, \crmeb\listens\ProductPresellStatusListen::class, \crmeb\listens\ProductGroupStatusCheckListen::class, \crmeb\listens\SyncSpreadStatusListen::class, \crmeb\listens\GuaranteeCountListen::class, \crmeb\listens\AutoUnLockIntegralListen::class, \crmeb\listens\AutoClearIntegralListen::class, \crmeb\listens\MerchantApplyMentsCheckListen::class, \crmeb\listens\AutoUnlockMerchantMoneyListen::class, ] : [], 'pay_success_user_recharge' => [\crmeb\listens\pay\UserRechargeSuccessListen::class], 'pay_success_order' => [\crmeb\listens\pay\OrderPaySuccessListen::class], 'pay_success_presell' => [\crmeb\listens\pay\PresellPaySuccessListen::class], 'pay_success_meal' => [\crmeb\listens\pay\MealSuccessListen::class], ], 'subscribe' => [ ], ]; ```