You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.3 KiB
PHP

<?php
/**
* 后台首页
*/
namespace Admin\Controller;
class CpJuheCompanyController extends ThinkController {
//聚合公司
public function index($p = 0) {
// dump(getCpCompanySelect(1));die();
$p = I('p');
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage = $page;
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
$request = [];
$request['p'] = $p;
$request['row'] = $row;
$request['remote'] = 1;
if($_REQUEST['export']) {
$request['export'] = 1;
}
$_REQUEST['origin_game_name']?($request['origin_game_name'] = $_REQUEST['origin_game_name']):'';
$_REQUEST['game_id'] ? ($request['game.id'] = $_REQUEST['game_id']):'';
$_REQUEST['channel_id'] ? ($request['channel_id'] = $_REQUEST['channel_id']):'';
($_REQUEST['company_properties']||$_REQUEST['company_properties']=='0') ? ($request['company_properties'] = $_REQUEST['company_properties']):'';
$url = M("kv")->field("value")->where(['key'=>"cp_company_api"])->find();
$data = json_decode(curl_post($url['value'],$request),true);
// dump($request);die();
if($_REQUEST['export']) {
$list_data = $data['data'];
foreach ($list_data as $key => $value) {
if ($list_data[$key]['bank_card']){
$list_data[$key]['bank_card'] = '`'.$list_data[$key]['bank_card'];
}
if ($list_data[$key]['alipay_user']) {
$list_data[$key]['alipay_user'] = '`'.$list_data[$key]['alipay_user'];
}
$list_data[$key]['agreement_time'] = json_decode($list_data[$key]['agreement_time'],true);
$list_data[$key]['balance_time'] = json_decode($list_data[$key]['balance_time'],true);
$list_data[$key]['agreement_time']['start_time'] = date("Y-m-d H:i:s",$list_data[$key]['agreement_time']['start_time']);
($list_data[$key]['agreement_time']['end_time']!=1)?($list_data[$key]['agreement_time']['end_time'] = date("Y-m-d H:i:s",$list_data[$key]['agreement_time']['end_time'])):($list_data[$key]['agreement_time']['end_time'] = "");
$list_data[$key]['balance_time']['start_time'] = date("Y-m-d H:i:s",$list_data[$key]['balance_time']['start_time']);
($list_data[$key]['balance_time']['end_time']!=1)?($list_data[$key]['balance_time']['end_time'] = date("Y-m-d H:i:s",$list_data[$key]['balance_time']['end_time'])):($list_data[$key]['balance_time']['end_time'] = "");
}
$this->assign("listdata",$list_data);
$this->display("export");die();
} else {
$page = set_pagination($data['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign("listdata",$data['data']);
$this->display();
}
}
public function detail() {
$_REQUEST['id']?($request['id'] = $_REQUEST['id']):'';
$url = M("kv")->field("value")->where(['key'=>"cp_company_api"])->find();
$data = json_decode(curl_post($url['value'],$request),true);
$this->assign("data",$data);
$this->display();
}
}