|
@@ -22,10 +22,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
{
|
|
{
|
|
|
public function handle($event): void
|
|
public function handle($event): void
|
|
|
{
|
|
{
|
|
|
|
|
+ //自动写入文件方便检测是否启动定时任务命令
|
|
|
$time = time();
|
|
$time = time();
|
|
|
- $date = date('Y-m-d H:i:s', time());
|
|
|
|
|
- $timer_log_open = config("log.timer_log", false);
|
|
|
|
|
-
|
|
|
|
|
new Crontab('*/6 * * * * *', function () use ($time) {
|
|
new Crontab('*/6 * * * * *', function () use ($time) {
|
|
|
file_put_contents(root_path() . 'runtime/.timer', $time);
|
|
file_put_contents(root_path() . 'runtime/.timer', $time);
|
|
|
});
|
|
});
|
|
@@ -38,7 +36,7 @@ class SystemCrontab implements ListenerInterface
|
|
|
$timeStr = $this->getTimerStr($item);
|
|
$timeStr = $this->getTimerStr($item);
|
|
|
//未支付自动取消订单
|
|
//未支付自动取消订单
|
|
|
if ($item['mark'] == 'order_cancel') {
|
|
if ($item['mark'] == 'order_cancel') {
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var StoreOrderServices $orderServices */
|
|
/** @var StoreOrderServices $orderServices */
|
|
|
$orderServices = app()->make(StoreOrderServices::class);
|
|
$orderServices = app()->make(StoreOrderServices::class);
|
|
@@ -50,8 +48,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//拼团到期订单处理
|
|
//拼团到期订单处理
|
|
|
- if ($item['mark'] == 'pink_expiration') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'pink_expiration') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var StorePinkServices $storePinkServices */
|
|
/** @var StorePinkServices $storePinkServices */
|
|
|
$storePinkServices = app()->make(StorePinkServices::class);
|
|
$storePinkServices = app()->make(StorePinkServices::class);
|
|
@@ -63,8 +61,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//自动解绑上级绑定
|
|
//自动解绑上级绑定
|
|
|
- if ($item['mark'] == 'agent_unbind') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'agent_unbind') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var AgentManageServices $agentManage */
|
|
/** @var AgentManageServices $agentManage */
|
|
|
$agentManage = app()->make(AgentManageServices::class);
|
|
$agentManage = app()->make(AgentManageServices::class);
|
|
@@ -76,8 +74,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//更新直播商品状态
|
|
//更新直播商品状态
|
|
|
- if ($item['mark'] == 'live_product_status') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'live_product_status') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var LiveGoodsServices $liveGoods */
|
|
/** @var LiveGoodsServices $liveGoods */
|
|
|
$liveGoods = app()->make(LiveGoodsServices::class);
|
|
$liveGoods = app()->make(LiveGoodsServices::class);
|
|
@@ -89,8 +87,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//更新直播间状态
|
|
//更新直播间状态
|
|
|
- if ($item['mark'] == 'live_room_status') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'live_room_status') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var LiveRoomServices $liveRoom */
|
|
/** @var LiveRoomServices $liveRoom */
|
|
|
$liveRoom = app()->make(LiveRoomServices::class);
|
|
$liveRoom = app()->make(LiveRoomServices::class);
|
|
@@ -103,8 +101,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//自动收货
|
|
//自动收货
|
|
|
- if ($item['mark'] == 'take_delivery') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'take_delivery') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var StoreOrderTakeServices $services */
|
|
/** @var StoreOrderTakeServices $services */
|
|
|
$services = app()->make(StoreOrderTakeServices::class);
|
|
$services = app()->make(StoreOrderTakeServices::class);
|
|
@@ -116,8 +114,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//查询预售到期商品自动下架
|
|
//查询预售到期商品自动下架
|
|
|
- if ($item['mark'] == 'advance_off') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'advance_off') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var StoreProductServices $product */
|
|
/** @var StoreProductServices $product */
|
|
|
$product = app()->make(StoreProductServices::class);
|
|
$product = app()->make(StoreProductServices::class);
|
|
@@ -129,8 +127,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//自动好评
|
|
//自动好评
|
|
|
- if ($item['mark'] == 'product_replay') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'product_replay') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var StoreOrderServices $orderServices */
|
|
/** @var StoreOrderServices $orderServices */
|
|
|
$orderServices = app()->make(StoreOrderServices::class);
|
|
$orderServices = app()->make(StoreOrderServices::class);
|
|
@@ -142,8 +140,8 @@ class SystemCrontab implements ListenerInterface
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
//清除昨日海报
|
|
//清除昨日海报
|
|
|
- if ($item['mark'] == 'clear_poster') {
|
|
|
|
|
- new Crontab($timeStr, function () use ($date, $timer_log_open) {
|
|
|
|
|
|
|
+ elseif ($item['mark'] == 'clear_poster') {
|
|
|
|
|
+ new Crontab($timeStr, function () {
|
|
|
try {
|
|
try {
|
|
|
/** @var SystemAttachmentServices $attach */
|
|
/** @var SystemAttachmentServices $attach */
|
|
|
$attach = app()->make(SystemAttachmentServices::class);
|
|
$attach = app()->make(SystemAttachmentServices::class);
|
|
@@ -154,6 +152,10 @@ class SystemCrontab implements ListenerInterface
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ //
|
|
|
|
|
+ else {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -165,7 +167,7 @@ class SystemCrontab implements ListenerInterface
|
|
|
$timer_log_open = config("log.timer_log", false);
|
|
$timer_log_open = config("log.timer_log", false);
|
|
|
if ($timer_log_open){
|
|
if ($timer_log_open){
|
|
|
$date = date('Y-m-d H:i:s', time());
|
|
$date = date('Y-m-d H:i:s', time());
|
|
|
- Log::notice($date . ' 执行清除昨日海报');
|
|
|
|
|
|
|
+ Log::notice($date . $msg);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|