diff --git a/Application/Admin/Controller/AutoPackController.class.php b/Application/Admin/Controller/AutoPackController.class.php index 3971fc44e..6d3ad0dbe 100644 --- a/Application/Admin/Controller/AutoPackController.class.php +++ b/Application/Admin/Controller/AutoPackController.class.php @@ -40,27 +40,33 @@ class AutoPackController extends Think public function package() { - $find_web_stie = M('config') - -> field('value') - -> where(['name' => 'WEB_SITE']) - -> find(); + $find_web_stie = M('config')->field('value')->where(['name' => 'WEB_SITE'])->find(); if (null == $find_web_stie) { \Think\Log ::record('请先到站点->网站设置->网站域名处设置官网域名'); exit; } - if (Redis::get('console_packing') == 1) { - Printer::export('正在打包', true); + $progressLimit = C('PACK_PROGRESS_LIMIT', null, 1); + $currentProgress = Redis::incr('console_packing'); + if ($currentProgress > $progressLimit) { + Redis::decr('console_packing'); + Printer::export('打包进程已满,进程数量限制[' . $progressLimit . ']', true); } - Redis::set('console_packing', 1); + Printer::export('打包进程[' . $currentProgress . ']开始'); + $this->checkPackageStatus(); // $this->app_package();//app渠道自动打包 - $this->channel(); + $result = $this->channel(); // $this->launch_package(false); // $this->leak_detection(); - Redis::delete('console_packing'); + Redis::decr('console_packing'); + $message = '打包进程[' . $currentProgress . ']结束。' + . '处理数量[' . $result['total'] . '],' + . '成功数量[' . $result['success'] . '],' + . '失败数量[' . $result['error'] . ']'; + Printer::export($message); } /** @@ -311,9 +317,13 @@ class AutoPackController extends Think ->limit(15) ->select(); + $packResult = [ + 'total' => 0, + 'success' => 0, + 'error' => 0, + ]; if (count($applys) == 0) { - Redis::delete('console_packing'); - Printer::export('无等待队列', true); + return $packResult; } $applyIds = array_column($applys, 'id'); @@ -338,14 +348,18 @@ class AutoPackController extends Think $launchCount = $launchCountList[$apply['id']] ?? 0; $result = $gameSourceService->channelPack($gameSource, $game, $apply, $launchCount); $message = '游戏['. $apply['game_id'] . '],渠道['. $apply['promote_id'] . ']打包,'; + $packResult['total'] += 1; if ($result['status']) { $message = 'SUCCESS ----- ' . $message . $result['message']; + $packResult['success'] += 1; } else { $message = 'ERROR ----- ' . $message . $result['message']; + $packResult['error'] += 1; } Printer::export($message); } } + return $packResult; }