|
|
@ -35,7 +35,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
public function _initialize()
|
|
|
|
public function _initialize()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
|
|
|
|
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
|
|
|
|
$this->DBModel = M("CompanyStatement","tab_");
|
|
|
|
$this->DBModel = SM("CompanyStatement","tab_");
|
|
|
|
parent::_initialize();
|
|
|
|
parent::_initialize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function lists() {
|
|
|
|
public function lists() {
|
|
|
@ -147,7 +147,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
// dd($map);
|
|
|
|
// dd($map);
|
|
|
|
// $this->checkListOrCountAuthRestMap($map);//导出权限
|
|
|
|
// $this->checkListOrCountAuthRestMap($map);//导出权限
|
|
|
|
//条件end
|
|
|
|
//条件end
|
|
|
|
$data = M("company_statement","tab_")
|
|
|
|
$data = $this->DBModel
|
|
|
|
->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,confirm_status,confirm_log,op_time,remark")
|
|
|
|
->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,confirm_status,confirm_log,op_time,remark")
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->order("statement_begin_time desc,id desc")->page($page,$row)->select();
|
|
|
|
->order("statement_begin_time desc,id desc")->page($page,$row)->select();
|
|
|
@ -210,7 +210,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$v['oplist'] = $this->OpAuth($v);
|
|
|
|
$v['oplist'] = $this->OpAuth($v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$count = M("company_statement","tab_")->field("count(id) count,IFNULL(SUM(CASE WHEN withdraw_type < 2 THEN platform_amount ELSE 0 END),0) as platform_amount,SUM(statement_money) as statement_money")->where($map)->find();
|
|
|
|
$count = $this->DBModel->field("count(id) count,IFNULL(SUM(CASE WHEN withdraw_type < 2 THEN platform_amount ELSE 0 END),0) as platform_amount,SUM(statement_money) as statement_money")->where($map)->find();
|
|
|
|
// dd($count);
|
|
|
|
// dd($count);
|
|
|
|
$params['p'] = $page;
|
|
|
|
$params['p'] = $page;
|
|
|
|
$params['row'] = $row;
|
|
|
|
$params['row'] = $row;
|
|
|
@ -236,7 +236,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
//获取基本信息
|
|
|
|
//获取基本信息
|
|
|
|
$dbres = M("CompanyStatement","tab_")->where("id='{$id}'")->find();
|
|
|
|
$dbres = $this->DBModel->where("id='{$id}'")->find();
|
|
|
|
$first_party_info = json_decode($dbres['first_party_info'],true);
|
|
|
|
$first_party_info = json_decode($dbres['first_party_info'],true);
|
|
|
|
$second_party_info = json_decode($dbres['second_party_info'],true);
|
|
|
|
$second_party_info = json_decode($dbres['second_party_info'],true);
|
|
|
|
$statement_info = json_decode($dbres['statement_info'],true);
|
|
|
|
$statement_info = json_decode($dbres['statement_info'],true);
|
|
|
@ -328,12 +328,12 @@ class CompanyStatementController extends ThinkController
|
|
|
|
$params['second_party_info'] = json_encode($params['second_party_info'],JSON_UNESCAPED_UNICODE);
|
|
|
|
$params['second_party_info'] = json_encode($params['second_party_info'],JSON_UNESCAPED_UNICODE);
|
|
|
|
$params['statement_info'] = json_encode($params['statement_info'],JSON_UNESCAPED_UNICODE);
|
|
|
|
$params['statement_info'] = json_encode($params['statement_info'],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
|
|
|
|
$y = M("CompanyStatement", "tab_")->where("id='{$params['id']}'")->find();
|
|
|
|
$y = $this->DBModel->where("id='{$params['id']}'")->find();
|
|
|
|
if($y['first_party_info'] != $params['first_party_info'] || $y['second_party_info'] != $params['second_party_info'] || $y['statement_info'] != $params['statement_info']){
|
|
|
|
if($y['first_party_info'] != $params['first_party_info'] || $y['second_party_info'] != $params['second_party_info'] || $y['statement_info'] != $params['statement_info']){
|
|
|
|
$params['verify_status'] = 0;
|
|
|
|
$params['verify_status'] = 0;
|
|
|
|
$params['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]);
|
|
|
|
$params['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]);
|
|
|
|
$params['op_time'] = time();
|
|
|
|
$params['op_time'] = time();
|
|
|
|
M("CompanyStatement","tab_")->save($params);
|
|
|
|
$this->DBModel->save($params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->ajaxReturn(["code"=>0,"msg"=>"ok"]);
|
|
|
|
$this->ajaxReturn(["code"=>0,"msg"=>"ok"]);
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
@ -342,7 +342,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
//获取基本信息
|
|
|
|
//获取基本信息
|
|
|
|
$dbres = M("CompanyStatement", "tab_")->where("id='{$id}'")->find();
|
|
|
|
$dbres = $this->DBModel->where("id='{$id}'")->find();
|
|
|
|
$dbres['first_party_info'] = json_decode($dbres['first_party_info'], true);
|
|
|
|
$dbres['first_party_info'] = json_decode($dbres['first_party_info'], true);
|
|
|
|
$dbres['second_party_info']= json_decode($dbres['second_party_info'], true);
|
|
|
|
$dbres['second_party_info']= json_decode($dbres['second_party_info'], true);
|
|
|
|
$dbres['statement_info'] = json_decode($dbres['statement_info'], true);
|
|
|
|
$dbres['statement_info'] = json_decode($dbres['statement_info'], true);
|
|
|
@ -504,7 +504,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
if(!isset($_REQUEST['id'])) $this->error("参数错误");
|
|
|
|
if(!isset($_REQUEST['id'])) $this->error("参数错误");
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
|
|
|
|
|
|
|
$data = M("CompanyStatement","tab_")->where(['id' => $id])->find();
|
|
|
|
$data = $this->DBModel->where(['id' => $id])->find();
|
|
|
|
|
|
|
|
|
|
|
|
$data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方
|
|
|
|
$data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方
|
|
|
|
$data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方
|
|
|
|
$data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方
|
|
|
@ -552,7 +552,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
|
|
|
|
|
|
|
if ($data['withdraw_type'] == 3 && $data['company_type'] == 2) {
|
|
|
|
if ($data['withdraw_type'] == 3 && $data['company_type'] == 2) {
|
|
|
|
|
|
|
|
|
|
|
|
$dbres = M("CompanyStatement","tab_")->where(['id' => $id])->find();
|
|
|
|
$dbres = $this->DBModel->where(['id' => $id])->find();
|
|
|
|
if($dbres['pay_type'] == 2){
|
|
|
|
if($dbres['pay_type'] == 2){
|
|
|
|
//乙方收款
|
|
|
|
//乙方收款
|
|
|
|
$dbres['company_info'] = $dbres['second_party_info'];
|
|
|
|
$dbres['company_info'] = $dbres['second_party_info'];
|
|
|
@ -766,8 +766,8 @@ class CompanyStatementController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$Pool = M("company_statement_pool","tab_");
|
|
|
|
$Pool = SM("company_statement_pool","tab_");
|
|
|
|
$Statemen = M("company_statement","tab_");
|
|
|
|
$Statemen = $this->DBModel;
|
|
|
|
foreach ($datas as $k => $v) {
|
|
|
|
foreach ($datas as $k => $v) {
|
|
|
|
if(count($v['company_list']) <= 0){continue;}
|
|
|
|
if(count($v['company_list']) <= 0){continue;}
|
|
|
|
$v['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
|
|
|
|
$v['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
|
|
|
@ -807,10 +807,10 @@ class CompanyStatementController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!empty($info)){
|
|
|
|
if(!empty($info)){
|
|
|
|
$save["pool_id"]=$pool_id;
|
|
|
|
$save["pool_id"]=$pool_id;
|
|
|
|
M("company_statement_info","tab_")->where("id in ({$info})")->save($save);
|
|
|
|
SM("company_statement_info","tab_")->where("id in ({$info})")->save($save);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!empty($v['del_lack_ids'])){
|
|
|
|
if(!empty($v['del_lack_ids'])){
|
|
|
|
M("company_lack_statement_info","tab_")->where("id in ({$v['del_lack_ids']})")->save(["is_pool"=>1]);
|
|
|
|
SM("company_lack_statement_info","tab_")->where("id in ({$v['del_lack_ids']})")->save(["is_pool"=>1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//修改结算单规则
|
|
|
|
//修改结算单规则
|
|
|
|
$this->updatePoolVerifyStatus($v['statement_ids'],2,"pool",$v['statement_num']);
|
|
|
|
$this->updatePoolVerifyStatus($v['statement_ids'],2,"pool",$v['statement_num']);
|
|
|
@ -837,10 +837,10 @@ class CompanyStatementController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//保存
|
|
|
|
//保存
|
|
|
|
protected function addStatementInfo($va,$k,&$v){
|
|
|
|
protected function addStatementInfo($va,$k,&$v){
|
|
|
|
$StatementInfo = M("company_statement_info","tab_");
|
|
|
|
$StatementInfo = SM("company_statement_info","tab_");
|
|
|
|
$company_info = $va['company_info'];
|
|
|
|
$company_info = $va['company_info'];
|
|
|
|
|
|
|
|
|
|
|
|
$LackStatement = M("company_lack_statement_info","tab_");
|
|
|
|
$LackStatement = SM("company_lack_statement_info","tab_");
|
|
|
|
$no_pool_money = 300;
|
|
|
|
$no_pool_money = 300;
|
|
|
|
//统一比例字段
|
|
|
|
//统一比例字段
|
|
|
|
if($k == "up" || $k=="ups"){
|
|
|
|
if($k == "up" || $k=="ups"){
|
|
|
@ -1044,7 +1044,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
"up_company_id"=>[],
|
|
|
|
"up_company_id"=>[],
|
|
|
|
"dowm_company_id"=>[],
|
|
|
|
"dowm_company_id"=>[],
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$statement = M("company_statement","tab_")->field("count(id) count,company_id,company_belong")->group("company_id,company_belong")->select();
|
|
|
|
$statement = $this->DBModel->field("count(id) count,company_id,company_belong")->group("company_id,company_belong")->select();
|
|
|
|
$up_company_id = [];
|
|
|
|
$up_company_id = [];
|
|
|
|
$dowm_company_id= [];
|
|
|
|
$dowm_company_id= [];
|
|
|
|
foreach( $statement as $k=>$v){
|
|
|
|
foreach( $statement as $k=>$v){
|
|
|
@ -1159,7 +1159,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
if ($_REQUEST['relation_game_id']) {
|
|
|
|
if ($_REQUEST['relation_game_id']) {
|
|
|
|
|
|
|
|
|
|
|
|
$relation_game_id = implode(',',$_REQUEST['relation_game_id']);
|
|
|
|
$relation_game_id = implode(',',$_REQUEST['relation_game_id']);
|
|
|
|
|
|
|
|
// dd($relation_game_id);
|
|
|
|
$map['relation_game_id'] = ['in',$relation_game_id];
|
|
|
|
$map['relation_game_id'] = ['in',$relation_game_id];
|
|
|
|
$radioMap['tab_company_game_ratio.relation_game_id'] = ['in',$relation_game_id];
|
|
|
|
$radioMap['tab_company_game_ratio.relation_game_id'] = ['in',$relation_game_id];
|
|
|
|
|
|
|
|
|
|
|
@ -1182,7 +1182,7 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
|
|
|
|
|
|
|
$start_time = strtotime($_REQUEST['time_start']);
|
|
|
|
$start_time = strtotime($_REQUEST['time_start']);
|
|
|
|
$end_time = strtotime($_REQUEST['time_end']) + 86399;
|
|
|
|
$end_time = strtotime($_REQUEST['time_end']) + 86399;
|
|
|
|
$check_add = M("company_statement","tab_")->field("statement_begin_time,statement_end_time,statement_info,company_type")->where(['company_id'=>$_REQUEST['company_id'],'withdraw_type'=>3])->select();
|
|
|
|
$check_add = $this->DBModel->field("statement_begin_time,statement_end_time,statement_info,company_type")->where(['company_id'=>$_REQUEST['company_id'],'withdraw_type'=>3])->select();
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($check_add as $key => $value) {
|
|
|
|
foreach ($check_add as $key => $value) {
|
|
|
|
|
|
|
|
|
|
|
|