Merge branch 'dev' of 47.111.118.107:/srv/git/platform into dev

master
yulingwei 5 years ago
commit 079417b576

@ -78,7 +78,7 @@ unset($_REQUEST['parent_id']);
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find()); $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find());
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if(!empty(I('oa_associated')) || !is_null(I('oa_associated'))) { if(I('oa_associated',-1) != -1) {
$map['oa_associated'] = I('oa_associated'); $map['oa_associated'] = I('oa_associated');
$oa_data = []; $oa_data = [];
for($i = 1; $i > 0; $i++) { for($i = 1; $i > 0; $i++) {
@ -111,6 +111,7 @@ unset($_REQUEST['parent_id']);
} }
$list_data = D(self::model_name)->where($map)->order('id DESC')->page($p,$row)->select(); $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p,$row)->select();
$oa_data = []; $oa_data = [];
if(I('oa_associated',-1) == -1) {
foreach($list_data as $k => $v) foreach($list_data as $k => $v)
{ {
if($v['oa_associated'] != 1) { if($v['oa_associated'] != 1) {
@ -129,14 +130,15 @@ unset($_REQUEST['parent_id']);
$re_data = json_decode($re_data,true)['data']; $re_data = json_decode($re_data,true)['data'];
foreach($list_data as $k => $v) foreach($list_data as $k => $v)
{ {
if(in_array($v['account'], $re_data)) if(array_key_exists($v['account'], $re_data))
{ {
$list_data[$k]['oa_associated'] = $re_data[$v['account']]; $list_data[$k]['oa_associated'] = $re_data[$v['account']];
M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]); M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]);
} }
} }
} }
$count = (I('oa_associated') || !is_null(I('oa_associated') )) ? D(self::model_name)->where($map)->count() : D(self::model_name)->count(); }
$count = (I('oa_associated',-1) != -1) ? D(self::model_name)->where($map)->count() : D(self::model_name)->count();
$page = set_pagination($count,$row); $page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);} if($page) {$this->assign('_page', $page);}
$this->assign('list_data', $list_data); $this->assign('list_data', $list_data);

@ -322,15 +322,14 @@ class GameSourceService {
]; ];
} }
public function uploadPackage($localFilePath, $distFilePath, $isDeleteLocal = false) public function uploadPackage($localFilePath, $distFilePath, $isDeleteLocal = false, $isChunk = false)
{ {
if (get_tool_status('oss_storage') == 1) { if (get_tool_status('oss_storage') == 1) {
$ossService = new OssService(); if ($isChunk) {
$result = $ossService->upload($localFilePath, $distFilePath); return $this->uploadPackageChunk($localFilePath, $distFilePath, $isDeleteLocal);
if ($isDeleteLocal && file_exists($localFilePath)) { } else {
@unlink($localFilePath); return $this->uploadPackageOnce($localFilePath, $distFilePath, $isDeleteLocal);
} }
return $result;
} else { } else {
// 不上传OSS等第三方服务器 // 不上传OSS等第三方服务器
return [ return [
@ -342,6 +341,40 @@ class GameSourceService {
]; ];
} }
} }
public function uploadPackageChunk($localFilePath, $distFilePath, $isDeleteLocal = false)
{
$client = new Client([
'base_uri' => C('UPLOAD_SERVER_URL'),
'timeout' => 10.0,
]);
$response = $client->post('/upload', [
'verify' => false,
'form_params' => [
'file' => $gameId,
'dist' => $distFilePath,
'is_delete_local' => 0,
]
]);
$result = (string)$response->getBody();
$result = json_decode($result, true);
if (!$result) {
return [
'status' => false,
'message' => '请求打包失败',
];
}
return $result;
}
public function uploadPackageOnce($localFilePath, $distFilePath, $isDeleteLocal = false)
{
$ossService = new OssService();
$result = $ossService->upload($localFilePath, $distFilePath);
if ($isDeleteLocal && file_exists($localFilePath)) {
@unlink($localFilePath);
}
return $result;
}
//生成游戏渠道plist文件 //生成游戏渠道plist文件
public function createPlist($params) public function createPlist($params)

Loading…
Cancel
Save