@ -2,6 +2,7 @@
namespace Admin\Controller;
use Base\Tool\AggregateClient;
use mysql_xdevapi\Exception;
use User\Api\UserApi as UserApi;
use OSS\OssClient;
@ -17,6 +18,8 @@ class PromoteCompanyController extends ThinkController
{
private $modelName = 'PromoteCompany';
public $ratio = [];
public $aggregatePackageName = [];
public function _initialize()
{
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
@ -29,6 +32,7 @@ class PromoteCompanyController extends ThinkController
$is_export= false;
if (isset($_REQUEST['export']) & & $_REQUEST['export']==1){
$is_export = true;
$this->getAggregatePackage();
}
$map = [];
$promotemap=[];
@ -41,6 +45,7 @@ class PromoteCompanyController extends ThinkController
$c_id = throwPromoteIdToCompanyId($pro_id);
$map["_string"]="id in ({$c_id})";
}
//市场部权限end
if($company_name) $map['tab_promote_company.company_name'] = array('like',"%{$company_name}%");
@ -112,10 +117,22 @@ class PromoteCompanyController extends ThinkController
if(!empty($companyres)){
foreach($companyres as $k=>& $v){
$tmpr = D("CompanyRelation")->getCompanyRelation(2,$v['id']);
$v["settlement_type"] = $tmpr['settlement_type'];
$v["collection"] = $tmpr['collection'];
$v["invoice_type"] = $tmpr['invoice_type'];
$v["invoice_content"] = $tmpr['invoice_content'];
if ($tmpr['is_payment']==1) {
$v['bank_address'] = $v['ali_user'];
$v['bank_card'] = $v['ali_account'];
$v['bank_name'] = '--';
}
$v['is_payment'] = ($tmpr['is_payment']==1) ? '是' : '否';
$v["company_belong"] = getCompanyBlong($v["company_belong"]);
$v["develop_type"] = getCompanyRelation($v["develop_type"]);
@ -163,7 +180,7 @@ class PromoteCompanyController extends ThinkController
$promotemap['p.company_id']=["in",$companyallids];
$promotemap['p.level']=1;
$promotecount = M("Promote","tab_")->alias('p')->where($promotemap)->count();
// dd($companyres);
// dd($companyres);
$this->assign('listData', $companyres);
$this->assign('count', $count);
$this->assign('promotecount', $promotecount);
@ -1335,10 +1352,12 @@ class PromoteCompanyController extends ThinkController
}
//获取游戏基础信息
protected function getGameInfo($game_ids){
$gameinfo = [];
$dbres = M("Game","tab_")->where("relation_game_id in ($game_ids)")->field("relation_game_id,relation_game_name,game_type_name,original_package_name")->group("relation_game_id")->select();
$dbres = M("Game","tab_")->where("relation_game_id in ($game_ids)")->field("relation_game_id,relation_game_name,game_type_name,original_package_name,unique_code ")->group("relation_game_id")->select();
foreach($dbres as $k=>$v){
$v['aggregate_gamename'] = $this->aggregatePackageName[$v['unique_code']];
$gameinfo[$v['relation_game_id']] = $v;
}
return $gameinfo;
@ -1373,6 +1392,16 @@ class PromoteCompanyController extends ThinkController
}
}
protected function getAggregatePackage() {
$client = new AggregateClient();
$result = $client->api('aggregate-gamename', []);
$this->aggregatePackageName = $result['data'];
}