|
|
|
@ -6,34 +6,22 @@ namespace Admin\Controller;
|
|
|
|
|
*/
|
|
|
|
|
class StatementController extends ThinkController
|
|
|
|
|
{
|
|
|
|
|
public $mycompany = array(
|
|
|
|
|
"id" => 0,
|
|
|
|
|
"partner" => "海南万盟天下科技有限公司",
|
|
|
|
|
"link_man" => "雷丽华",
|
|
|
|
|
"link_phone" => "13067391751",
|
|
|
|
|
"address" => "福建省福州市鼓楼区福大怡山创业园区11号103",
|
|
|
|
|
"company_tax_no" => "1243245",
|
|
|
|
|
"payee_name" => "雷丽华",
|
|
|
|
|
"bank_account" => "1654654564364635456",
|
|
|
|
|
"opening_bank" => "福州市福大分行"
|
|
|
|
|
);
|
|
|
|
|
//创建
|
|
|
|
|
public function createCpStatement()
|
|
|
|
|
{
|
|
|
|
|
$this->display();
|
|
|
|
|
//获取cp推广公司
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//获取推广公司基础信息
|
|
|
|
|
public function getCpCompanyInfo()
|
|
|
|
|
{
|
|
|
|
|
$CompanyId = $_REQUEST['company_id'];
|
|
|
|
|
if($CompanyId == 0){
|
|
|
|
|
$info = $this->mycompany;
|
|
|
|
|
$mycompany = M("tool","tab_")->field("config")->where("name='company_info'")->find();
|
|
|
|
|
$info = json_decode($mycompany['config'],true);
|
|
|
|
|
$info['id'] = 0;
|
|
|
|
|
}else{
|
|
|
|
|
$info = M("partner","tab_")->where("id = '{$CompanyId}'")->find();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(empty($info)){
|
|
|
|
|
$this->ajaxReturn(array("error"=>"no find","code"=>2000));
|
|
|
|
|
}else{
|
|
|
|
@ -60,6 +48,45 @@ class StatementController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
$map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
|
|
|
|
|
}
|
|
|
|
|
//判断是否有重叠时间
|
|
|
|
|
$Statement = M("statement","tab_");
|
|
|
|
|
$repart =false;
|
|
|
|
|
$errorstr = '';
|
|
|
|
|
//开始时间被重叠部分
|
|
|
|
|
$checkmap = array(
|
|
|
|
|
"statement_begin_time"=>array("ELT",strtotime($_REQUEST['time_start'])),
|
|
|
|
|
"statement_end_time"=>array("EGT",strtotime($_REQUEST['time_start'])),
|
|
|
|
|
"company_id"=>$CompanyId
|
|
|
|
|
);
|
|
|
|
|
$bres = $Statement->field("statement_begin_time,statement_end_time")->where($checkmap)->find();
|
|
|
|
|
if($bres){
|
|
|
|
|
$repart=true;
|
|
|
|
|
$begin = $_REQUEST['time_start'];
|
|
|
|
|
//统计相交时间
|
|
|
|
|
if(strtotime($_REQUEST['time_end']) > $bres["statement_end_time"]){
|
|
|
|
|
$end = date("Y-m-d",$bres["statement_end_time"]);
|
|
|
|
|
}else{
|
|
|
|
|
$end = $_REQUEST['time_end'];
|
|
|
|
|
}
|
|
|
|
|
$errorstr .= ($begin."到".$end."期间的数据已经结算过<br/>");
|
|
|
|
|
}
|
|
|
|
|
//结束被重复的部分
|
|
|
|
|
$checkmap = array(
|
|
|
|
|
"statement_begin_time"=>array("ELT",strtotime($_REQUEST['time_end'])),
|
|
|
|
|
"statement_end_time"=>array("EGT",strtotime($_REQUEST['time_end'])),
|
|
|
|
|
"company_id"=>$CompanyId
|
|
|
|
|
);
|
|
|
|
|
$bres = $Statement->field("statement_begin_time,statement_end_time")->where($checkmap)->find();
|
|
|
|
|
if($bres){
|
|
|
|
|
$repart=true;
|
|
|
|
|
$begin = date("Y-m-d",$bres["statement_begin_time"]);
|
|
|
|
|
//统计相交时间
|
|
|
|
|
$end = $_REQUEST['time_end'];
|
|
|
|
|
$errorstr .= ($begin."到".$end."期间的数据已经结算过<br/>");
|
|
|
|
|
}
|
|
|
|
|
if($repart){
|
|
|
|
|
$this->ajaxReturn(array("error"=>$errorstr,"code"=>2001));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取对应cp公司的游戏
|
|
|
|
|
$game_list = M("game","tab_")->field("id")->where("partner_id = '{$CompanyId}'")->select();
|
|
|
|
|