Merge branch 'hotfix/pack_package' of wmtx/platform into release

优化打包
master
廖金灵 5 years ago committed by Gogs
commit 154a0115dc

@ -40,27 +40,33 @@ class AutoPackController extends Think
public function package() public function package()
{ {
$find_web_stie = M('config') $find_web_stie = M('config')->field('value')->where(['name' => 'WEB_SITE'])->find();
-> field('value')
-> where(['name' => 'WEB_SITE'])
-> find();
if (null == $find_web_stie) { if (null == $find_web_stie) {
\Think\Log ::record('请先到站点->网站设置->网站域名处设置官网域名'); \Think\Log ::record('请先到站点->网站设置->网站域名处设置官网域名');
exit; exit;
} }
if (Redis::get('console_packing') == 1) { $progressLimit = C('PACK_PROGRESS_LIMIT', null, 1);
Printer::export('正在打包', true); $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->checkPackageStatus();
// $this->app_package();//app渠道自动打包 // $this->app_package();//app渠道自动打包
$this->channel(); $result = $this->channel();
// $this->launch_package(false); // $this->launch_package(false);
// $this->leak_detection(); // $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) ->limit(15)
->select(); ->select();
$packResult = [
'total' => 0,
'success' => 0,
'error' => 0,
];
if (count($applys) == 0) { if (count($applys) == 0) {
Redis::delete('console_packing'); return $packResult;
Printer::export('无等待队列', true);
} }
$applyIds = array_column($applys, 'id'); $applyIds = array_column($applys, 'id');
@ -338,14 +348,18 @@ class AutoPackController extends Think
$launchCount = $launchCountList[$apply['id']] ?? 0; $launchCount = $launchCountList[$apply['id']] ?? 0;
$result = $gameSourceService->channelPack($gameSource, $game, $apply, $launchCount); $result = $gameSourceService->channelPack($gameSource, $game, $apply, $launchCount);
$message = '游戏['. $apply['game_id'] . '],渠道['. $apply['promote_id'] . ']打包,'; $message = '游戏['. $apply['game_id'] . '],渠道['. $apply['promote_id'] . ']打包,';
$packResult['total'] += 1;
if ($result['status']) { if ($result['status']) {
$message = 'SUCCESS ----- ' . $message . $result['message']; $message = 'SUCCESS ----- ' . $message . $result['message'];
$packResult['success'] += 1;
} else { } else {
$message = 'ERROR ----- ' . $message . $result['message']; $message = 'ERROR ----- ' . $message . $result['message'];
$packResult['error'] += 1;
} }
Printer::export($message); Printer::export($message);
} }
} }
return $packResult;
} }

Loading…
Cancel
Save