|
@@ -193,46 +193,34 @@ class Card extends MY_Controller{
|
|
|
$posts['mod'] = 'card';
|
|
|
$posts['act'] = 'actionProcess';
|
|
|
$posts['data'] = $postData['data'];
|
|
|
- $url = $this->config->item('officialUrl');
|
|
|
- $retData = $this->curl->req($url, $posts);
|
|
|
- $retData = json_decode($retData,1);
|
|
|
+ $retData = $this->httpPost($posts);
|
|
|
+
|
|
|
if($retData == 0){
|
|
|
return $this->response(1, '操作失败');
|
|
|
}else{
|
|
|
- $this->actionSyncJson('CardCollect'.time().'.json');
|
|
|
+ $this->actionSyncJson();
|
|
|
return $this->response(0, '操作成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function group($type){
|
|
|
- $title = $group_type = [
|
|
|
- '卡组ID'
|
|
|
- ];
|
|
|
+ public function group($type)
|
|
|
+ {
|
|
|
+ $title = ['卡组ID'];
|
|
|
|
|
|
$_langList = oo::cfg('lang')['lang_card_group'];
|
|
|
-
|
|
|
- foreach ($_langList as $text){
|
|
|
- $text = strtr($text, ['卡组名称' => '','('=>'',')'=>'']);
|
|
|
- $title[] = $text;
|
|
|
+ foreach ($_langList as $text) {
|
|
|
+ $text = strtr($text, ['卡组名称' => '', '(' => '', ')' => '']);
|
|
|
+ $title[] = $text;
|
|
|
}
|
|
|
- $title[] = $group_type[] = '金币奖励';
|
|
|
- $title[] = $group_type[] = '体力奖励';
|
|
|
- $title[] = $group_type[] = '解锁等级';
|
|
|
- $title[] = $group_type[] = "粮食奖励";
|
|
|
- $title[] = $group_type[] = "经验奖励";
|
|
|
- $title[] = $group_type[] = "标题颜色";
|
|
|
- $title[] = $group_type[] = '操作';
|
|
|
+ $title = array_merge($title, ['金币奖励', '体力奖励', '解锁等级', '粮食奖励', '经验奖励', '标题颜色', '操作']);
|
|
|
+
|
|
|
$posts = $this->postData;
|
|
|
$posts['type'] = $type;
|
|
|
$posts['mod'] = 'card';
|
|
|
$posts['act'] = 'getGroup';
|
|
|
+ $retData = $this->httpPost($posts);
|
|
|
|
|
|
- $url = $this->config->item('officialUrl');
|
|
|
- $retData = $this->curl->req($url, $posts);
|
|
|
-
|
|
|
- $retData = json_decode($retData,1);
|
|
|
-
|
|
|
- if(!empty($list)){
|
|
|
+ if (!empty($list)) {
|
|
|
$list = [];
|
|
|
}else{
|
|
|
$list = $retData['data'];
|
|
@@ -243,12 +231,10 @@ class Card extends MY_Controller{
|
|
|
$data['title'] = $title;
|
|
|
$data['list'] = $list;
|
|
|
$data['_langList'] = $_langList;
|
|
|
-// echo json_encode($list);die;
|
|
|
$data['tableColumnMapping'] = array_merge(['cgid'], (array)array_keys($_langList), ['cg_coin_reward','cg_spin_reward','cg_lock_rank','cg_petFeed_reward','cg_petExp_reward','cg_title_img_id']);
|
|
|
$this->load->view('card/group', $data);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//限时卡组主题配置
|
|
|
public function limitGroupTheme()
|
|
|
{
|
|
@@ -324,12 +310,11 @@ class Card extends MY_Controller{
|
|
|
oo::commonOprModel("json")->SaveJson($postData, $filename);
|
|
|
oo::commonOprModel("json")->setStaticConfig("LimitGroupTheme", $filename);
|
|
|
|
|
|
- $this->actionSyncJson('CardCollect' . time() . '.json');
|
|
|
+ $this->actionSyncJson();
|
|
|
|
|
|
return $this->response(0, '操作成功');
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public function exclusivegroup(){
|
|
|
$title = [
|
|
|
'卡组ID'
|
|
@@ -383,7 +368,7 @@ class Card extends MY_Controller{
|
|
|
}
|
|
|
oo::commonOprRedis('games')->delete(okeys::CardGroupConfig());
|
|
|
|
|
|
- $this->actionSyncJson('CardCollect' . time() . '.json');
|
|
|
+ $this->actionSyncJson();
|
|
|
return $this->response(0, '操作成功');
|
|
|
}
|
|
|
|
|
@@ -393,13 +378,11 @@ class Card extends MY_Controller{
|
|
|
$posts['mod'] = 'card';
|
|
|
$posts['act'] = 'actionExclusiveGroup';
|
|
|
$posts['data'] = $postData['data'];
|
|
|
- $url = $this->config->item('officialUrl');
|
|
|
- $retData = $this->curl->req($url, $posts);
|
|
|
- $retData = json_decode($retData,1);
|
|
|
+ $retData = $this->httpPost($posts);
|
|
|
if($retData == 0){
|
|
|
return $this->response(1, '操作失败');
|
|
|
}else{
|
|
|
- $this->actionSyncJson('CardCollect'.time().'.json');
|
|
|
+ $this->actionSyncJson();
|
|
|
return $this->response(0, '操作成功');
|
|
|
}
|
|
|
}
|
|
@@ -428,9 +411,7 @@ class Card extends MY_Controller{
|
|
|
$posts['mod'] = 'card';
|
|
|
$posts['act'] = 'getCard';
|
|
|
$posts['cgid'] = $cgid;
|
|
|
- $url = $this->config->item('officialUrl');
|
|
|
- $retData = $this->curl->req($url, $posts);
|
|
|
- $retData = json_decode($retData,1);
|
|
|
+ $retData = $this->httpPost($posts);
|
|
|
|
|
|
if(!empty($list)){
|
|
|
$list = [];
|
|
@@ -504,7 +485,7 @@ class Card extends MY_Controller{
|
|
|
}
|
|
|
|
|
|
self::updateCardCache();
|
|
|
- $this->actionSyncJson('CardCollect' . time() . '.json');
|
|
|
+ $this->actionSyncJson();
|
|
|
return $this->response(0, "操作成功");
|
|
|
}
|
|
|
|
|
@@ -540,39 +521,36 @@ class Card extends MY_Controller{
|
|
|
$posts['mod'] = 'card';
|
|
|
$posts['act'] = 'actionExclusiveCard';
|
|
|
$posts['data'] = $postData['data'];
|
|
|
- $url = $this->config->item('officialUrl');
|
|
|
- $retData = $this->curl->req($url, $posts);
|
|
|
- $retData = json_decode($retData,1);
|
|
|
+ $retData = $this->httpPost($posts);
|
|
|
+
|
|
|
if($retData == 0){
|
|
|
return $this->response(1, '操作失败');
|
|
|
}else{
|
|
|
- $this->actionSyncJson('CardCollect'.time().'.json');
|
|
|
+ $this->actionSyncJson();
|
|
|
return $this->response(0, '操作成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function actionSyncJson($filename = "CardCollect.json"){
|
|
|
+ public function actionSyncJson()
|
|
|
+ {
|
|
|
+ $configName = "CardCollect";
|
|
|
+
|
|
|
$posts = $this->postData;
|
|
|
$posts['mod'] = 'card';
|
|
|
$posts['act'] = 'makeCardJson';
|
|
|
- $posts['filename'] = $filename;
|
|
|
- $url = $this->config->item('officialUrl');
|
|
|
- $retData = $this->curl->req($url, $posts);
|
|
|
- $retData = json_decode($retData,1);
|
|
|
- if($retData['code'] == 1){
|
|
|
- $data = $retData['data'];
|
|
|
-
|
|
|
- $dir = $this->staticPath;
|
|
|
- if (!is_dir($dir))
|
|
|
- {
|
|
|
- $old = umask(0);
|
|
|
- //mkdir($dir, PRODUCTION_SERVER ? 0775 : 0777, true);
|
|
|
- mkdir($dir,0775 , true);
|
|
|
- umask($old);
|
|
|
- }
|
|
|
- $filepath = "{$dir}{$filename}";
|
|
|
- file_put_contents($filepath, json_encode($data));
|
|
|
+
|
|
|
+ $retData = $this->httpPost($posts);
|
|
|
+ if ($retData['code'] != 1) {
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
+ $data = $retData['data'];
|
|
|
+ unset($data['incrementData']);
|
|
|
+
|
|
|
+ $filename = $configName . time() . '.json';
|
|
|
+
|
|
|
+ oo::commonOprModel("json")->SaveJson($data, $filename);
|
|
|
+ oo::commonOprModel("json")->setStaticConfig($configName, $filename);
|
|
|
}
|
|
|
|
|
|
public function refreshCardMd5(){
|