优化个人补点

master
chenzhi 4 years ago
parent ad73fe03b3
commit 8ef35174dc

@ -35,7 +35,7 @@ class CompanyStatementController extends ThinkController
public function _initialize()
{
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
$this->DBModel = M("CompanyStatement","tab_");
$this->DBModel = SM("CompanyStatement","tab_");
parent::_initialize();
}
public function lists() {
@ -147,7 +147,7 @@ class CompanyStatementController extends ThinkController
// dd($map);
// $this->checkListOrCountAuthRestMap($map);//导出权限
//条件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")
->where($map)
->order("statement_begin_time desc,id desc")->page($page,$row)->select();
@ -210,7 +210,7 @@ class CompanyStatementController extends ThinkController
}
$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);
$params['p'] = $page;
$params['row'] = $row;
@ -236,7 +236,7 @@ class CompanyStatementController extends ThinkController
}
$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);
$second_party_info = json_decode($dbres['second_party_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['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']){
$params['verify_status'] = 0;
$params['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]);
$params['op_time'] = time();
M("CompanyStatement","tab_")->save($params);
$this->DBModel->save($params);
}
$this->ajaxReturn(["code"=>0,"msg"=>"ok"]);
}else{
@ -342,7 +342,7 @@ class CompanyStatementController extends ThinkController
}
$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['second_party_info']= json_decode($dbres['second_party_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("参数错误");
$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['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) {
$dbres = M("CompanyStatement","tab_")->where(['id' => $id])->find();
$dbres = $this->DBModel->where(['id' => $id])->find();
if($dbres['pay_type'] == 2){
//乙方收款
$dbres['company_info'] = $dbres['second_party_info'];
@ -766,8 +766,8 @@ class CompanyStatementController extends ThinkController
}
}
$Pool = M("company_statement_pool","tab_");
$Statemen = M("company_statement","tab_");
$Pool = SM("company_statement_pool","tab_");
$Statemen = $this->DBModel;
foreach ($datas as $k => $v) {
if(count($v['company_list']) <= 0){continue;}
$v['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
@ -807,10 +807,10 @@ class CompanyStatementController extends ThinkController
}
if(!empty($info)){
$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'])){
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']);
@ -837,10 +837,10 @@ class CompanyStatementController extends ThinkController
}
//保存
protected function addStatementInfo($va,$k,&$v){
$StatementInfo = M("company_statement_info","tab_");
$StatementInfo = SM("company_statement_info","tab_");
$company_info = $va['company_info'];
$LackStatement = M("company_lack_statement_info","tab_");
$LackStatement = SM("company_lack_statement_info","tab_");
$no_pool_money = 300;
//统一比例字段
if($k == "up" || $k=="ups"){
@ -1044,7 +1044,7 @@ class CompanyStatementController extends ThinkController
"up_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 = [];
$dowm_company_id= [];
foreach( $statement as $k=>$v){
@ -1159,7 +1159,7 @@ class CompanyStatementController extends ThinkController
if ($_REQUEST['relation_game_id']) {
$relation_game_id = implode(',',$_REQUEST['relation_game_id']);
// dd($relation_game_id);
$map['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']);
$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) {

@ -256,7 +256,7 @@ class CompanyStatementSetController extends Controller {
$verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]);
$GameDb = M("Game","tab_");
$StatementDb = SM("CompanyStatement","tab_");
dump($cpList);
$statement_begin_time = date("Y.m.d",$begintime);
$statement_end_time = date("Y.m.d",$endtime);
foreach($cpList as $k=>$v){
@ -425,6 +425,7 @@ class CompanyStatementSetController extends Controller {
//非重算
return $add_data;
}
dump($add_data);
$StatementDb->add($add_data);
}

Loading…
Cancel
Save