From 4590988f95143faa929f76b954f0b9241bd286f3 Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Mon, 25 Nov 2019 21:32:59 +0800 Subject: [PATCH 1/4] oa --- Application/Admin/Controller/PromoteController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 6313e3da0..6e434ba90 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -70,7 +70,7 @@ unset($_REQUEST['parent_id']); $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(!empty(I('oa_associated')) || !is_null(I('oa_associated'))) { + if(I('oa_associated',-1) != -1) { $map['oa_associated'] = I('oa_associated'); $oa_data = []; for($i = 1; $i > 0; $i++) { From 8d6c54746812d84250e34985dc9d3ed4e59b4da0 Mon Sep 17 00:00:00 2001 From: "elf@home" <360197197@qq.com> Date: Mon, 25 Nov 2019 23:31:29 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=88=86=E7=89=87?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Service/GameSourceService.class.php | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/Application/Base/Service/GameSourceService.class.php b/Application/Base/Service/GameSourceService.class.php index 007c8793f..eb9ade9aa 100644 --- a/Application/Base/Service/GameSourceService.class.php +++ b/Application/Base/Service/GameSourceService.class.php @@ -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) { - $ossService = new OssService(); - $result = $ossService->upload($localFilePath, $distFilePath); - if ($isDeleteLocal && file_exists($localFilePath)) { - @unlink($localFilePath); + if ($isChunk) { + return $this->uploadPackageChunk($localFilePath, $distFilePath, $isDeleteLocal); + } else { + return $this->uploadPackageOnce($localFilePath, $distFilePath, $isDeleteLocal); } - return $result; } else { // 不上传OSS等第三方服务器 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文件 public function createPlist($params) From 0a9efe02caf5d7a05519e1b23153c59a1c56243e Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Tue, 26 Nov 2019 09:45:14 +0800 Subject: [PATCH 3/4] =?UTF-8?q?oa=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/PromoteController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 68a8ff7a3..091cec58a 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -124,7 +124,7 @@ unset($_REQUEST['parent_id']); $re_data = json_decode($re_data,true)['data']; 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']]; M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]); From e9e66fa8a0388a732d6cda743360daf6aa6ccaaa Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Tue, 26 Nov 2019 09:53:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?oa=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 091cec58a..af1f3e999 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -106,32 +106,34 @@ unset($_REQUEST['parent_id']); } $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p,$row)->select(); $oa_data = []; - foreach($list_data as $k => $v) - { - if($v['oa_associated'] != 1) { - $oa_data[] = $v['account']; - } - } - if(!empty($oa_data)) - { - $arr['time'] = time(); - $arr['account'] = implode(",", $oa_data); - ksort($arr); - reset($arr); - $sign = md5(http_build_query($arr) . 'wmkjtx_kj213'); - $arr['sign'] = $sign; - $re_data = curl_post('http://oa.76ba.com/api/wanmeng/verifyBind',$arr); - $re_data = json_decode($re_data,true)['data']; + if(I('oa_associated',-1) == -1) { foreach($list_data as $k => $v) { - if(array_key_exists($v['account'], $re_data)) + if($v['oa_associated'] != 1) { + $oa_data[] = $v['account']; + } + } + if(!empty($oa_data)) + { + $arr['time'] = time(); + $arr['account'] = implode(",", $oa_data); + ksort($arr); + reset($arr); + $sign = md5(http_build_query($arr) . 'wmkjtx_kj213'); + $arr['sign'] = $sign; + $re_data = curl_post('http://oa.76ba.com/api/wanmeng/verifyBind',$arr); + $re_data = json_decode($re_data,true)['data']; + foreach($list_data as $k => $v) { - $list_data[$k]['oa_associated'] = $re_data[$v['account']]; - M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]); + if(array_key_exists($v['account'], $re_data)) + { + $list_data[$k]['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); if($page) {$this->assign('_page', $page);} $this->assign('list_data', $list_data);