diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php
index 6cda8d817..39aa08532 100644
--- a/Application/Admin/Common/extend.php
+++ b/Application/Admin/Common/extend.php
@@ -1892,7 +1892,7 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
$objPHPExcel->getActiveSheet()->setCellValue('J3', $data['second_party_info']['link_man']);
$objPHPExcel->getActiveSheet()->setCellValue('J4', $data['second_party_info']['link_phone']."\t");
$objPHPExcel->getActiveSheet()->setCellValue('J5', $data['second_party_info']['address']);
- $objPHPExcel->getActiveSheet()->setCellValue('J6', $data['second_party_info']['company_tax_no']);
+ $objPHPExcel->getActiveSheet()->setCellValue('J6', $data['second_party_info']['company_tax_no']." ");
$objPHPExcel->getActiveSheet()->setCellValue('C7', "支付给:".$data['receive_company']['partner']); //增加支付给对应公司
$line = 10;
@@ -1986,6 +1986,139 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
}
+//下游工会对账单导出
+function excelSpecialComplementEmplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money) {
+
+ header("Content-type: text/html; charset=utf-8");
+ error_reporting(E_ALL);
+ ini_set('display_errors', TRUE);
+ ini_set('display_startup_errors', TRUE);
+
+ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
');
+
+ Vendor("PHPExcel.PHPExcel");
+ $objPHPExcel = new \PHPExcel();
+ $objReader = \PHPExcel_IOFactory::createReader('Excel5');
+
+ //设置模板文件
+ $objPHPExcel = $objReader->load("Public/Admin/excel/down_stream.xls");
+
+ $statement_begin_time = date('Y.m.d', $data['statement_begin_time']);//对账开始时间
+ $statement_end_time = date('Y.m.d',$data['statement_end_time']);//对账截止时间
+
+ $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单\n({$statement_begin_time}-{$statement_end_time})");
+ if ($data['withdraw_type'] == '2') {
+ $objPHPExcel->getActiveSheet()->setCellValue('D2','补点比例');
+ }
+ if ($data['withdraw_type'] == 3) {
+ $objPHPExcel->getActiveSheet()->setCellValue('E2','特殊补点比例');
+ }
+
+ $line = 3;
+ $pay_amount_str = "=SUM(F3:";
+ $plat_amount_str = "=SUM(C3:";
+ foreach ($data['statement_info'] as $key => $value) {
+ $objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1);
+ $objPHPExcel->getActiveSheet()->removeConditionalStyles();
+
+ $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['statement_begin_time'].'-'.$value['statement_end_time']);
+ if ($value['statement_type'] > 0) {//罚款
+ $product_name = $value['game_name'];
+ $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, '-');
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, '-');
+ if ($value['statement_type'] == 1) {
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, "-".$value['pay_amount']);
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, "-".$value['sum_money']);
+ }else{
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['pay_amount']);
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, $value['sum_money']);
+ }
+ } else {//游戏
+ $product_name = $value['game_name'];
+
+ $objPHPExcel->getActiveSheet()->getStyle('D'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
+ $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
+ $objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
+ $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
+ if($data['withdraw_type'] != 3) {
+
+
+ if($value['increment_ratio'] == 0){
+ $value['increment_ratio'] = 0;
+ }else{
+ $value['increment_ratio'] = number_format($value['first_ratio']);
+ }
+ }
+ if($value['ratio'] == 0) {
+ $value['ratio'] = 0;
+ }else{
+ $value['ratio'] = number_format($value['ratio']);
+ }
+ if($value['fax_ratio'] == 0) $value['fax_ratio'] = 0;
+
+
+ if ($data['withdraw_type'] == 2) {
+ $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['increment_ratio'] . '%');
+ }else{
+ $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['ratio'] . '%');
+ }
+
+
+ if ($data['withdraw_type'] != 3) {
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, $value['fax_ratio'] . '%');
+ } else {
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, $value['increment_ratio'] . '%');
+ }
+
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['pay_amount']);
+ // $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, $value['sum_money']);
+
+ if ($data['withdraw_type'] != 3) {
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$line,"=C{$line}*D{$line}*(1-E{$line})");
+ } else {
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$line,"=C{$line}*E{$line}");
+ }
+ }
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.$line, $product_name);
+ $line++;
+ }
+
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $plat_amount_str."C".($line-1).")");//合计-平台总额
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.($line), $pay_amount_str."F".($line-1).")");//合计-结算金额
+
+
+ // $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+1), $big_all_sum_money);//大写支付结算金额
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+1), "=F{$line}");//大写支付结算金额
+ //甲方信息
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+3), $data['pay_company']['partner']);//甲方
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+4), $data['pay_company']['link_man']);//联系人
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+5), $data['pay_company']['link_phone']."\t");//联系电话
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+6), $data['receive_company']['invoice_content']);//开票项目
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $data['receive_company']['invoice_type']);//发票类型
+
+ //乙方信息
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+3), $data['receive_company']['partner']);//乙方
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+4), $data['receive_company']['link_man']);//联系人
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['receive_company']['link_phone']."\t");//联系电话
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['receive_company']['address']);//邮寄地址
+// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $value['pay_amount']);//请汇入此账号
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['receive_company']['payee_name']);//户名
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['receive_company']['bank_account']."\t");//银行账号
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['receive_company']['opening_bank']);//开户行
+
+ $fileName = "{$data['company_name']}&{$data['my_company']}-对账单{$statement_begin_time}-{$statement_end_time}";
+// dd($fileName);
+ ob_end_clean();//清除缓冲区,避免乱码
+ header('pragma:public');
+ header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
+ header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
+ $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+ $objWriter->save('php://output');
+ exit;
+
+}
+
+
//下游工会对账单导出
function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money) {
@@ -2034,9 +2167,10 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
} else {//游戏
$product_name = $value['game_name'];
- $objPHPExcel->getActiveSheet()->getStyle('D'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);
- $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_000);
+ $objPHPExcel->getActiveSheet()->getStyle('D'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
+ $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
$objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
+ $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
if($value['increment_ratio'] == 0){
$value['increment_ratio'] = 0;
@@ -2575,7 +2709,7 @@ function getMarketAdminsByPromoteIds($promoteIds)
foreach ($topPromotes as $topPromote) {
$topAdminMap[$topPromote['id']] = $topPromote['admin_id'];
}
- $admins = M('ucenter_member', 'sys_')->field(['id', 'username'])->where(['id' => ['in', array_column($topPromotes, 'admin_id')]])->select();
+ $admins = M('member', 'sys_')->field(['uid id', 'nickname username', 'real_name'])->where(['id' => ['in', array_column($topPromotes, 'admin_id')]])->select();
$admins = index_by_column('id', $admins);
foreach ($resultMap as &$row) {
$adminId = $topAdminMap[$row['top_id']] ?? 0;
@@ -2947,3 +3081,10 @@ function getMerchantName($id = 1){
return $data['name']?$data['name']:'无';
}
+
+
+function dateFormat($date) {
+
+ return date("Y.m.d",strtotime($date));
+
+}
diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php
index a473d930b..88e6404ce 100644
--- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php
+++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php
@@ -9,7 +9,7 @@ class AggregateFinanceStatementController extends ThinkController
{
public $verify_status = [
"-3"=>"撤销汇总",
- "-1"=>"审批拒绝",
+ "-1"=>"审批拒绝",
"0"=>"未申请开票",
"1"=>"申请开票",
"2"=>"审批同意",
@@ -617,6 +617,96 @@ class AggregateFinanceStatementController extends ThinkController
$objPHPExcel->getActiveSheet()->setCellValue('B'.($line+8), $first_data);//户名
// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['pay_company']['payee_name']);//户名
// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['pay_company']['bank_account']);//银行账号
+// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['pay_company']['opening_bank']);//开户行
+ if($data['withdraw_type'] == 1){
+ $m = date('Y.m', $data['begintime']);
+ $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$m}";
+ }else{
+ $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$statement_begin_time}-{$statement_end_time}";
+ }
+ ob_end_clean();//清除缓冲区,避免乱码
+ header('pragma:public');
+ header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
+ header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
+ $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+ $objWriter->save('php://output');
+ }
+ public function excelDownStreamPersonTemplate($data,$big_all_sum_money) {
+
+ header("Content-type: text/html; charset=utf-8");
+ error_reporting(E_ALL);
+ ini_set('display_errors', TRUE);
+ ini_set('display_startup_errors', TRUE);
+
+ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
');
+
+ date_default_timezone_set('Asia/Shanghai');
+ Vendor("PHPExcel.PHPExcel");
+ $objPHPExcel = new \PHPExcel();
+ $objReader = \PHPExcel_IOFactory::createReader('Excel5');
+ //设置模板文件
+ $objPHPExcel = $objReader->load("Public/Admin/excel/aggregate_stream.xls");
+ $statement_begin_time = date('Y.m.d', $data['begintime']);//对账开始时间
+ $statement_end_time = date('Y.m.d',$data['endtime']);//对账截止时间
+
+ $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
+ $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['channel_name']} 》结算单\n({$statement_begin_time}-{$statement_end_time})");
+ if ($data['withdraw_type'] == '2') {
+ $objPHPExcel->getActiveSheet()->setCellValue('D2','补点比例');
+ }
+ $line = 3;
+ foreach ($data['statement_info'] as $key => $value) {
+ $objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1);
+ $objPHPExcel->getActiveSheet()->removeConditionalStyles();
+ $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['begintime'] . '-' . $value['endtime']);
+ $product_name = $value['game_name'];
+ $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['ratio'] . '%');
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, $value['fax_ratio'] . '%');
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['money']);
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.$line, $product_name);
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, $value['ratio_money']);
+
+ $objPHPExcel->getActiveSheet()->getStyle('A'.$line)->getFont()->setBold(false);
+ $objPHPExcel->getActiveSheet()->getStyle('B'.$line)->getFont()->setBold(false);
+ $objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getFont()->setBold(false);
+ $objPHPExcel->getActiveSheet()->getStyle('D'.$line)->getFont()->setBold(false);
+ $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getFont()->setBold(false);
+ $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getFont()->setBold(false);
+ $line++;
+ }
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $data['pay_money']);//合计-平台总额
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.($line), $data['ratio_money']);//合计-结算金额
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+1), $big_all_sum_money);//大写支付结算金额
+ //甲方信息
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+3), $data['first_party_info']['partner']);//甲方
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+4), $data['first_party_info']['link_man']);//联系人
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+5), $data['first_party_info']['link_phone']);//联系电话
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+6), $data['first_party_info']['address']);//邮寄地址
+// $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $data['second_party_info']['invoice_type']);//发票类型
+ //乙方信息
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+3), $data['second_party_info']['partner']);//乙方
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+4), $data['second_party_info']['link_man']);//联系人
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['second_party_info']['link_phone']);//联系电话
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['second_party_info']['address']);//邮寄地址
+
+ //开票信息
+// $invoice_data = "发票类型:".$data['second_party_info']['invoice_type'];
+// $invoice_data .= "\n发票抬头:".$data['second_party_info']['partner'];
+// $invoice_data .= "\n纳税人识别号:".$data['second_party_info']['company_tax_no'];
+//
+// $invoice_data .= "\n开户银行:".$data['second_party_info']['opening_bank'];
+// $invoice_data .= "\n开户账号:".$data['second_party_info']['payee_name'];
+// $invoice_data .= "\n开票内容:".$data['second_party_info']['invoice_item'];
+// $invoice_data .= "\n注册地址及电话:".$data['second_party_info']['register_address'].",".$data['second_party_info']['register_phone'];
+//
+// $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $invoice_data);//乙方
+
+ $first_data = "户名:{$data['pay_company']['payee_name']}";
+ $first_data .= "\n账号:{$data['pay_company']['bank_account']}";
+ $first_data .= "\n开户行:{$data['pay_company']['opening_bank']}";
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $first_data);//户名
+// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['pay_company']['payee_name']);//户名
+// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['pay_company']['bank_account']);//银行账号
// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['pay_company']['opening_bank']);//开户行
if($data['withdraw_type'] == 1){
$m = date('Y.m', $data['begintime']);
diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php
index ea80320e6..459fcb2c6 100644
--- a/Application/Admin/Controller/AjaxController.class.php
+++ b/Application/Admin/Controller/AjaxController.class.php
@@ -567,14 +567,26 @@ class AjaxController extends ThinkController{
*/
public function getPromoteGameList() {
- $game_ids = I('game_ids');
+ $company_id = $_REQUEST['company_id'];
+
+ $spendData = M("spend use index(user_id)","tab_")
+ ->field("game_id")
+ ->join("left join tab_promote on tab_spend.promote_id=tab_promote.id")
+ ->where([
+ 'company_id'=>$company_id,
+ 'pay_status'=>1,
+ 'pay_way'=>['egt',0]
+ ])
+ ->group("game_id")
+ ->select();
- if ($game_ids) {
- $map['relation_game_id'] = ['in',$game_ids];
+ if ($spendData) {
+ $map['id'] = ['in',array_column($spendData,"game_id")];
} else {
$this->ajaxReturn([]);
}
+
$data = M("game","tab_")
->field("relation_game_id,relation_game_name")
->where($map)
diff --git a/Application/Admin/Controller/CompanyGameRatioController.class.php b/Application/Admin/Controller/CompanyGameRatioController.class.php
index 77d6d837d..79c2fe3ec 100644
--- a/Application/Admin/Controller/CompanyGameRatioController.class.php
+++ b/Application/Admin/Controller/CompanyGameRatioController.class.php
@@ -966,11 +966,11 @@ class CompanyGameRatioController extends AdminController
$turnoverratio = json_decode($turnover_ratio[$key],true);
$v['turnover_ratios'][$key] = array(
- array("ratio"=>$value."%","name"=>"默认比例")
+ array("ratio"=>floatval($value)."%","name"=>"默认比例")
);
foreach($turnoverratio as $ke=>$va){
- $t=array("ratio"=>$va["ratio"]."%");
+ $t=array("ratio"=>floatval($va["ratio"])."%");
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){
diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php
index f514801e9..d5e0be037 100644
--- a/Application/Admin/Controller/CompanyStatementController.class.php
+++ b/Application/Admin/Controller/CompanyStatementController.class.php
@@ -54,13 +54,13 @@ class CompanyStatementController extends ThinkController
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
- $map["_string"] = "(statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (statement_end_time BETWEEN {$time_start} AND {$time_end})";
+ $map["_string"] = "( (statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (statement_end_time BETWEEN {$time_start} AND {$time_end}) )";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
- $map["_string"] = "(statement_begin_time >= {$time_start} ) OR (statement_end_time >= {$time_start})";
+ $map["_string"] = "( (statement_begin_time >= {$time_start} ) OR (statement_end_time >= {$time_start}) )";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
- $map["_string"] = "(statement_begin_time <= {$time_end} ) OR (statement_end_time <= {$time_end})";
+ $map["_string"] = "( (statement_begin_time <= {$time_end} ) OR (statement_end_time <= {$time_end}) )";
}
if (isset($_REQUEST['time_start2']) && isset($_REQUEST['time_end2'])) {
@@ -80,6 +80,12 @@ class CompanyStatementController extends ThinkController
$typeflag = 2;//周结
$map["withdraw_type"] = ["in",[0,2]];
}
+
+ if($_REQUEST['withdraw_type'] == 3){
+ $typeflag = 3;//特殊补点
+ $map["withdraw_type"] = 3;
+ }
+
}
if (isset($_REQUEST['withdraw_type2'])) {
if($_REQUEST['withdraw_type2'] == 2){
@@ -97,6 +103,22 @@ class CompanyStatementController extends ThinkController
$map['withdraw_type'] = ["in",[0,1]];
}
}
+
+ if($_REQUEST['withdraw_type2'] == 3){
+ if ($typeflag == 3 || !$typeflag) {
+ $map["withdraw_type"] = 3;
+ } else {
+ $map["withdraw_type"] = 999; //两者不一搜索为空
+ }
+
+ } else {
+
+ if($typeflag == 3) {
+ $map["withdraw_type"] = 999; //两者不一搜索为空
+ }
+ }
+
+
}
//其他
if(isset($_REQUEST['company_type'])){
@@ -122,12 +144,14 @@ class CompanyStatementController extends ThinkController
if(isset($_REQUEST['confirm_status'])){
$map['confirm_status'] = $_REQUEST['confirm_status'];
}
+ // dd($map);
// $this->checkListOrCountAuthRestMap($map);//导出权限
//条件end
$data = M("company_statement","tab_")
->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("FIELD(verify_status,0,1,-1,2,3,-2,-3),id desc")->page($page,$row)->select();
+ ->order("statement_begin_time desc,id desc")->page($page,$row)->select();
+
foreach($data as $k => &$v) {
$v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
@@ -138,8 +162,8 @@ class CompanyStatementController extends ThinkController
$v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
- $v['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" : ($v['withdraw_type'] == 3 ?"特殊补点" : "周结"));
- $v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" :"正常结算");
+ $v['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" : ($v['withdraw_type'] == 3 ?"其他" : "周结"));
+ $v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" : ($v['withdraw_type'] == 3 ?"特殊补点" : "正常结算"));
$v['verify_log'] = json_decode($v['verify_log'], true);
$v['confirm_log'] = json_decode($v['confirm_log'], true);
@@ -348,7 +372,16 @@ class CompanyStatementController extends ThinkController
public function delStatement(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
- $dbres = $this->DBModel->where("id in ({$ids}) and verify_status = 0")->delete();
+// $dbres = $this->DBModel->where("id in ({$ids}) and verify_status = 0")->delete();
+ $dbres = $this->DBModel->where("id in ({$ids})")->select();
+ foreach ($dbres as $key=>$value) {
+ if($value['withdraw_type'] !=3) {
+ $this->DBModel->where("id = {$value['id']} and verify_status = 0")->delete();
+ } else {
+ $this->DBModel->where("id = {$value['id']} and verify_status != 2")->delete();
+ }
+
+ }
addOperationLog(['op_type'=>2,'key'=>$ids,"op_name"=>"删除结算单",'url'=>U('lists')]);
$this->ajaxReturn(array(
'status' => 1,
@@ -423,7 +456,8 @@ class CompanyStatementController extends ThinkController
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
- $dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$ids})")->select();
+ $dbres = $this->DBModel->field("id,verify_status,verify_log,withdraw_type")->where("id in ({$ids})")->select();
+
foreach($dbres as $k=>&$v){
// if(in_array($v['verify_status'],[3,4])) continue; //合作方确认后不进行重算
//重算
@@ -443,10 +477,12 @@ class CompanyStatementController extends ThinkController
//导出
public function export()
{
+
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$data = M("CompanyStatement","tab_")->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);//乙方
$data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录
@@ -481,7 +517,33 @@ class CompanyStatementController extends ThinkController
} else {
//下游
// if($dbres["company_type"] == 1){
+
+ if ($data['withdraw_type'] == 3 && $data['company_type'] == 2) {
+
+ $dbres = M("CompanyStatement","tab_")->where(['id' => $id])->find();
+ if($dbres['pay_type'] == 2){
+ //乙方收款
+ $dbres['company_info'] = $dbres['second_party_info'];
+ }else{
+ $dbres['company_info'] = $dbres['first_party_info'];
+ }
+ unset($dbres['second_party_info']);
+ unset($dbres['first_party_info']);
+
+ $dbres=[$dbres];
+
+ $this->assign("title","下游个人特殊补点");
+ $this->exportSpecialComplement($dbres,1);
+
+ } else if ($data['withdraw_type'] == 3 && $data['company_type'] != 2){
+ excelSpecialComplementEmplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
+ }
+ else {
+
excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
+
+ }
+
// }else{
// $data['statement_begin_time'] = date('Ymd',$data['statement_begin_time']);
// $data['statement_end_time'] = date('Ymd',$data['statement_end_time']);
@@ -492,6 +554,105 @@ class CompanyStatementController extends ThinkController
// }
}
}
+
+ public function exportSpecialComplement(&$infolist,$is_export) {
+
+ $line = 1;
+ $count = [];
+ //获取对接人
+ foreach($infolist as $k=>&$v){
+ $infolist[$k]['reward'] = 0;
+ $infolist[$k]['fine'] = 0;
+ $v['statement_info'] = json_decode($v['statement_info'],true);
+ $v['company_info'] = json_decode($v['company_info'],true);
+ $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
+ $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']);
+ $v['company_info']['nickname'] = $v['statement_info'][0]['real_name'];
+
+ if (isset($v['company_info']['company_type'])) {
+ if($v['company_info']['company_type'] == 1) {
+ $v['company_info']['company_type_str'] = '公司';
+ } elseif($v['company_info']['company_type'] == 2){
+ $v['company_info']['company_type_str'] = '个人';
+ }
+ }
+
+ if (isset($v['company_info']['company_belong'])) {
+ $v['company_info']['company_belong_str'] = getCompanyBlong($v['company_info']['company_belong']);
+ }
+
+ if (isset($v['company_info']['develop_type'])) {
+ $v['company_info']['company_relation_str'] = getCompanyRelation($v['company_info']['develop_type']);
+ }
+
+ $cline = $line+1;
+ if($is_export){
+ $v['statement_money'] = "=ROUND(";
+ }
+
+ $row = 0;
+ foreach($v['statement_info'] as $ke=>&$va){
+ $va['row'] = count($va['game_list']);
+ $row += count($va['game_list']);
+
+ foreach($va['game_list'] as $key=>&$val){
+ $line ++;
+ if($v['withdraw_type'] != 3) {
+ if(isset($val['ratio'])){
+ $val['increment_ratio'] = 0;
+ }else{
+ $val['ratio'] = 0;
+ }
+ }
+
+ if($is_export){
+ if($v['withdraw_type'] != 3) {
+ $val['sum_money'] = "=ROUND(K{$line}*(L{$line}+M{$line}),2)";
+ } else {
+ $val['sum_money'] = "=ROUND(K{$line}*(M{$line}),2)";
+ }
+// $val['sum_money'] = "=J{$line}*(K{$line}+L{$line})";
+ $v['statement_money'] .= "N{$line}+";
+ }else{
+ $count['platform_amount'] += $val['pay_amount'];
+ $count['sum_money'] += $val['sum_money'];
+ }
+ }
+ // if($is_export){
+ // //J3*(K3+L3)+M3-N3
+ // if($va['statement_type'] > 0){ //罚款服务器费用
+ // $va['sum_money'] = "=J{$line}";
+ // }else{
+ // $va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
+ // }
+ // }else{
+ // $count['platform_amount'] += $va['pay_amount'];
+ // $count['sum_money'] += $va['sum_money'];
+ // }
+ }
+ $v['row'] = $row;
+ if($is_export){
+
+ if($v['withdraw_type'] != 3) {
+ $v['statement_money'] .="N{$cline}-O{$cline},2)";
+ } else {
+ $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)";
+ }
+// dump($v['statement_money']);die();
+ }
+ }
+
+ if($is_export){
+ $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)";
+ $count["sum_money"] = "=ROUND(SUM(Q2:Q".$line."),2)";
+ }
+ $this->assign("data",$infolist);
+ $this->assign("count",$count);
+ $this->assign("is_export",$is_export);
+ $this->display("CompanyStatementPool/viewPuPool");
+
+ }
+
//汇总
public function pool()
{
@@ -559,16 +720,17 @@ class CompanyStatementController extends ThinkController
}
foreach ($dbres as $k=>$v) {
- if($v['verify_status'] != 1) continue;
- if($v['company_belong'] == 9){
- //上游
- $this->setDf($datas['up'],$v);
- } elseif($v['withdraw_type'] == 3&&$v['company_type']==1){
- $this->setDf($datas['complement_down'],$v);
- } elseif($v['withdraw_type'] == 3&&$v['company_type']==2){
- $this->setDf($datas['complement_user'],$v);
- } else {
- $this->setDf($datas['down'],$v);
+ if($v['verify_status'] == 1 || $v['verify_status'] == -2){
+ if($v['company_belong'] == 9){
+ //上游
+ $this->setDf($datas['up'],$v);
+ } elseif($v['withdraw_type'] == 3&&$v['company_type']==1){
+ $this->setDf($datas['complement_down'],$v);
+ } elseif($v['withdraw_type'] == 3&&$v['company_type']==2){
+ $this->setDf($datas['complement_user'],$v);
+ } else {
+ $this->setDf($datas['down'],$v);
+ }
}
}
@@ -619,7 +781,7 @@ class CompanyStatementController extends ThinkController
M("company_lack_statement_info","tab_")->where("id in ({$v['del_lack_ids']})")->save(["is_pool"=>1]);
}
//修改结算单规则
- $this->updatePoolVerifyStatus($v['statement_ids'],1,2,"pool",$v['statement_num']);
+ $this->updatePoolVerifyStatus($v['statement_ids'],2,"pool",$v['statement_num']);
}
$this->ajaxReturn(array(
'status' => 1,
@@ -627,10 +789,10 @@ class CompanyStatementController extends ThinkController
));
}
//结算单规则
- protected function updatePoolVerifyStatus($ids,$old_status,$change_status,$op_pre,$num){
+ protected function updatePoolVerifyStatus($ids,$change_status,$op_pre,$num){
$dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$ids})")->select();
foreach($dbres as $k=>&$v){
- if($v['verify_status'] != $old_status) continue;
+ // if($v['verify_status'] != $old_status) continue;
$v['verify_log'] = json_decode($v['verify_log'],true);
$v['verify_log'][$op_pre.'_user']=$this->admininfo["username"];
$v['verify_log'][$op_pre.'_time']=date("Y.m.d H:i:s");
@@ -993,24 +1155,41 @@ class CompanyStatementController extends ThinkController
foreach ($check_add as $key => $value) {
- if ($value['statement_end_time'] >= $start_time && $value['statement_end_time']<=$end_time
- ||$value['statement_begin_time']>=$start_time && $value['statement_begin_time']<=$end_time
- ||$value['statement_begin_time']>=$start_time && $value['statement_end_time'] <= $end_time)
- {
-
- $statementInfo = json_decode($value['statement_info'],true);;
- if ($value['company_type'] == 2) {
- $statementInfo = $statementInfo['game_list'];
+// if ($value['statement_end_time'] >= $start_time && $value['statement_end_time']<=$end_time
+// ||$value['statement_begin_time']>=$start_time && $value['statement_begin_time']<=$end_time
+// ||$value['statement_begin_time']<=$start_time && $value['statement_end_time'] >= $end_time)
+// {
+
+ $statementInfo = json_decode($value['statement_info'],true);;
+ if ($value['company_type'] == 2) {
+
+ foreach ($statementInfo as $sk => $sv) {
+ $statementInfos = $sv['game_list'];
+ foreach ($statementInfos as $k => $v) {
+ if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time
+ ||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time
+ ||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) {
+ if (in_array($v['relation_game_id'], $relation_game_data)) {
+ $this->ajaxReturn(['status' => 0, 'data' => [], 'msg' => "《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]);
+ }
+ }
+ }
}
-
+ } else {
foreach ($statementInfo as $k => $v) {
- if (in_array($v['relation_game_id'],$relation_game_data)) {
- $this->ajaxReturn(['status'=>0,'data'=>[],'msg'=>"《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]);
+ if (strtotime(str_replace('.','-',$v['statement_end_time'])) >= $start_time && strtotime(str_replace('.','-',$v['statement_end_time']))<=$end_time
+ ||strtotime(str_replace('.','-',$v['statement_begin_time']))>=$start_time && strtotime(str_replace('.','-',$v['statement_begin_time']))<=$end_time
+ ||strtotime(str_replace('.','-',$v['statement_begin_time']))<=$start_time && strtotime(str_replace('.','-',$v['statement_end_time'])) >= $end_time) {
+ if (in_array($v['relation_game_id'], $relation_game_data)) {
+ $this->ajaxReturn(['status' => 0, 'data' => [], 'msg' => "《{$v['game_name']}》在日期:{$_REQUEST['time_start']}-{$_REQUEST['time_end']}有结算过的部分,请重新选择"]);
+ }
}
}
-
}
+
+// }
+
}
@@ -1029,7 +1208,7 @@ class CompanyStatementController extends ThinkController
$radioMap['_string'] = "start_time < {$end_time}";
}
$map['tab_spend.pay_status'] = 1;
- $map['pay_way'] = ['egt',1];
+// $map['pay_way'] = ['egt',0];
$data = M("spend","tab_")
->field("pay_amount,relation_game_id,relation_game_name,payed_time")
@@ -1079,81 +1258,92 @@ class CompanyStatementController extends ThinkController
->where(['relation_game_id'=>['in',$rvalue]])
->find();
- $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
- $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
- $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
- $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
- $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $rvalue;
- $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $game_name['relation_game_name'];
- $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$rvalue]['ratio']?$handleRadioMould[$rvalue]['ratio']:0;
- $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$rvalue]['turnover_ratio'];
+ $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
+ $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
+ $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
+ $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
+ $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $rvalue;
+ $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $game_name['relation_game_name'];
+ $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$rvalue]['ratio']?$handleRadioMould[$rvalue]['ratio']:0;
+ $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$rvalue]['turnover_ratio'];
}
}
- foreach ($radioData as $key => $value) {
+ foreach ($relation_game_data as $rk => $rv) {
+ unset($radioMap['tab_company_game_ratio.relation_game_id']);
+ $radioMap['tab_company_game_ratio.relation_game_id'] = $rv;
+ $radioGameRatios = M("company_game_ratio","tab_")
+ ->field("tab_company_game_ratio.*,game.relation_game_name")
+ ->join("left join ({$game_data}) game on tab_company_game_ratio.relation_game_id=game.relation_game_id")
+ ->where($radioMap)
+ ->order("begin_time ASC")
+ ->select();
- if (strtotime(I('time_start')) <= $value['begin_time']) {
- $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['begin_time'];
- } else {
- $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
- }
- if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
- $handleData[$_REQUEST['company_id']]['end_time'][] = $value['end_time'];
- } else {
- $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
- }
- $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
- $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
- $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
- $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
- $handleData[$_REQUEST['company_id']]['ratio'][] = $value['ratio'];
- $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $value['turnover_ratio'];
- $num++;
-
- //如果结算时间小于比例开始时间
- if ($key == 0) {
- if (strtotime(I('time_start')) < $value['begin_time']) {
- $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
- $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
- $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
- $handleData[$_REQUEST['company_id']]['end_time'][] = $value['begin_time']-1;
- $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
- $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
- $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
- $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
+ foreach ($radioGameRatios as $key => $value) {
+ if (strtotime(I('time_start')) <= $value['begin_time']) {
+ $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['begin_time'];
+ } else {
+ $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
}
- }
+ if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
+ $handleData[$_REQUEST['company_id']]['end_time'][] = $value['end_time'];
+ } else {
+ $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399;
+ }
+ $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
+ $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
+ $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
+ $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
+ $handleData[$_REQUEST['company_id']]['ratio'][] = $value['ratio'];
+ $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $value['turnover_ratio'];
+ $num++;
+
+ //如果结算时间小于比例开始时间
+ if ($key == 0) {
+ if (strtotime(I('time_start')) < $value['begin_time']) {
+ $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
+ $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
+ $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start'));
+ $handleData[$_REQUEST['company_id']]['end_time'][] = $value['begin_time']-1;
+ $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
+ $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
+ $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
+ $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
- if(!$radioData[$key+1]) {
+ }
+ }
- if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
- $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
- $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
- $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
- $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end'))-86399;
- $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
- $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
- $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
- $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
+ if(!$radioData[$key+1]) {
+
+ if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) {
+ $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
+ $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
+ $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
+ $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end'))-86399;
+ $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
+ $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
+ $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0;
+ $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
+ }
}
- }
- //如果结算时间中有时间段间隔
- if ($radioData[$key+1]) {
- if ($radioData[$key+1]['begin_time'] != ($value['end_time']+1)) {
- $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
- $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
- $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
- $handleData[$_REQUEST['company_id']]['end_time'][] = $radioData[$key+1]['begin_time'] - 1;
- $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
- $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
- $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$gameRatioMould['ratio']:0;
- $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
+ //如果结算时间中有时间段间隔
+ if ($radioData[$key+1]) {
+ if ($radioData[$key+1]['begin_time'] != ($value['end_time']+1)&&$value['end_time']!=0) {
+ $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id'];
+ $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name'];
+ $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1;
+ $handleData[$_REQUEST['company_id']]['end_time'][] = $radioData[$key+1]['begin_time'] - 1;
+ $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id'];
+ $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name'];
+ $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$gameRatioMould['ratio']:0;
+ $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio'];
+ }
}
}
}
-// dump($handleData);die();
+
foreach ($handleData as $key => $value) {
$handleData[$key]['row'] = 0;
$timeArr = $value['begin_time'];
@@ -1216,14 +1406,16 @@ class CompanyStatementController extends ThinkController
$statement_data = [];
M()->startTrans();
foreach ($data as $key => $value) {
-
+ $begin_time = 99999999999;
+ $end_time = 0;
+ $statement_data = [];
$company_data = M("promote_company","tab_")->where(['id'=>$value['company_id']])->find();
$company_type = M("company_relation","tab_")->where("first_company_id={$value['company_id']} or second_company_id={$value['company_id']}")->find();
$insert['is_payment'] = $company_type['is_payment'];
- $insert['statement_begin_time'] = strtotime($value['statement_begin_time']);
- $insert['statement_end_time'] = strtotime($value['statement_end_time']);
+// $insert['statement_begin_time'] = strtotime($value['statement_begin_time']);
+// $insert['statement_end_time'] = strtotime($value['statement_end_time']);
$insert['withdraw_type'] = $withdraw_type;
$insert['company_belong'] = $company_data['company_belong'];
$insert['company_name'] = $company_data['company_name'];
@@ -1296,8 +1488,10 @@ class CompanyStatementController extends ThinkController
$statement_info[$k]['statement_type'] = 0;
$statement_info[$k]['fax_ratio'] = $company_data['fax_ratio'];
- }
+ $statement_info[$k]['statement_begin_time'] = dateFormat($v['statement_begin_time']);
+ $statement_info[$k]['statement_end_time'] = dateFormat($v['statement_end_time']);
+ }
if ($company_data['company_type'] == 2) {
@@ -1313,15 +1507,26 @@ class CompanyStatementController extends ThinkController
$amount_time['promote_id'] = '-1';
}
$amount_time['tab_spend.pay_status'] = 1;
- $amount_time['pay_way'] = ['egt',0];
+// $amount_time['pay_way'] = ['egt',0];
foreach ($statement_info as $k => $v) {
- $statement_begin_time = strtotime($v['statement_begin_time']);
- $statement_end_time = strtotime($v['statement_end_time'])+86399;
+
+ $statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time']));
+ $statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399;
+ if ($statement_begin_time<$begin_time) {
+ $begin_time = $statement_begin_time;
+ }
+
+ if ($statement_end_time>$end_time) {
+ $end_time = $statement_end_time;
+ }
+
+
$amount_time['_string'] = "payed_time between {$statement_begin_time} and {$statement_end_time} and relation_game_id={$v['relation_game_id']}";
$dataAmount = M("spend","tab_")
- ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name,substring_index(substring_index(promote.`chain`,'/',2),'/',-1) promote_id,chain,admin_id")
+ ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name,
+ CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,chain,admin_id")
->join("left join tab_promote promote on tab_spend.promote_id=promote.id")
->join("left join tab_game game on tab_spend.game_id=game.id")
->where($amount_time)
@@ -1343,8 +1548,8 @@ class CompanyStatementController extends ThinkController
$game_list['ratio'] = $v['ratio'];
$game_list['fax_ratio'] = $company_data['fax_ratio'];
- $game_list['sum_money'] = number_format(($aval['pay_amount']*($v['increment_ratio']))/100,2,'.','');
- $game_list['increment_ratio'] = number_format($v['increment_ratio'],2,'.','');
+ $game_list['sum_money'] = ($aval['pay_amount']*($v['increment_ratio']))/100;
+ $game_list['increment_ratio'] = $v['increment_ratio'];
$game_list['statement_begin_time'] = $v['statement_begin_time'];
$game_list['statement_end_time'] = $v['statement_end_time'];
$game_list['statement_type'] = '0';
@@ -1371,9 +1576,25 @@ class CompanyStatementController extends ThinkController
$insert['statement_info'] = json_encode($statement_insert);
} else {
+
$insert['statement_info'] = json_encode($statement_info);
+ foreach ($statement_info as $k => $v) {
+ $statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time']));
+ $statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399;
+
+ if ($statement_begin_time<$begin_time) {
+ $begin_time = $statement_begin_time;
+ }
+
+ if ($statement_end_time>$end_time) {
+ $end_time = $statement_end_time;
+ }
+ }
}
+ $insert['statement_begin_time'] = $begin_time;
+ $insert['statement_end_time'] = $end_time;
+
if ($company_type['first_company_id'] == $value['company_id']) {
$insert['first_party_info'] = json_encode($proCompany_info);
$insert['second_party_info'] = json_encode($secord_info);
@@ -1458,7 +1679,7 @@ class CompanyStatementController extends ThinkController
"export"=>"批量导出",
"updateNewStatement"=>"新增结算",
"launch"=>"对外发起",
- "specialComplement"=>"特殊补点",
+ "viewSpecialComplement"=>"特殊补点",
"delStatement"=>"批量删除"
];
$resarr = [];
diff --git a/Application/Admin/Controller/CompanyStatementLackController.class.php b/Application/Admin/Controller/CompanyStatementLackController.class.php
index d28c960f0..4fef420fd 100644
--- a/Application/Admin/Controller/CompanyStatementLackController.class.php
+++ b/Application/Admin/Controller/CompanyStatementLackController.class.php
@@ -82,6 +82,7 @@ class CompanyStatementLackController extends ThinkController
$v['company_type_str'] = $this->CompanyType[$v['company_type']];
$v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
$v['oplist'] = $this->OpAuth($v);
+ $v['withdraw_type_str'] = ($v['withdraw_type']==3?"特殊补点":"正常结算");;
}
$count = $this->DBModel->field("count(id) count,sum(statement_money) statement_money")->where($map)->find();
@@ -136,6 +137,21 @@ class CompanyStatementLackController extends ThinkController
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = $this->DBModel->field("*")->where("id in ({$ids})")->select();
+
+ $hav_special = 0;
+ $hav_common = 0;
+ foreach ($dbres as $key => $value) {
+ if ($value['withdraw_type'] == 3) {
+ $hav_special = 1;
+ } else {
+ $hav_common = 1;
+ }
+ }
+
+ if ($hav_special && $hav_common) {
+ $this->error("特殊补点不能与正常结算一起汇总");
+ }
+
//分单
$basedata = [
"pay_amount"=>0,
@@ -152,7 +168,7 @@ class CompanyStatementLackController extends ThinkController
"verify_status"=>0,
"verify_log"=>json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]),
"op_time"=>time(),
- "company_list"=>[]
+ "company_list"=>[],
];
$datas = ["ups","up","downs","down","user","users"];
//初始化数据
@@ -269,6 +285,7 @@ class CompanyStatementLackController extends ThinkController
}
protected function addStatementInfo($va,$ke,&$v,$k){
+
if($k=="ups" || $k=='downs' || $k =="users"){
$verify_status = 0;
}else{
@@ -294,8 +311,10 @@ class CompanyStatementLackController extends ThinkController
"statement_end_time"=>$v['statement_end_time'],
"statement_info"=>json_encode($va['statement_info'],JSON_UNESCAPED_UNICODE),
"statement_num"=>$va['statement_num'],
- "verify_status"=>$verify_status
+ "verify_status"=>$verify_status,
+ "withdraw_type"=>$va['withdraw_type']
];
+
$companyid = $StatementInfo->add($company);
$v['info_ids'][] =$companyid;
$v['statement_money'] +=$va['statement_money'];
@@ -337,7 +356,8 @@ class CompanyStatementLackController extends ThinkController
"fine"=>$fine,
"reward"=>$reward,
"statement_info"=>$v['statement_info'],
- "statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5)
+ "statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5),
+ "withdraw_type"=>$v['withdraw_type'],
];
$savedata['company_list'][$v['company_id']] = $tdata;
}
diff --git a/Application/Admin/Controller/CompanyStatementOfflineController.class.php b/Application/Admin/Controller/CompanyStatementOfflineController.class.php
index c9b44d4f3..bd559b24c 100644
--- a/Application/Admin/Controller/CompanyStatementOfflineController.class.php
+++ b/Application/Admin/Controller/CompanyStatementOfflineController.class.php
@@ -114,11 +114,15 @@ class CompanyStatementOfflineController extends ThinkController
//获取所有的母单id
$companyStatementInfo = M("company_statement_info","tab_");
$statementPool = $companyStatementInfo->where("id in ($ids) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
- $poolInfo = [];
+ $yPoolInfo = [];
foreach ($statementPool as $k => $v) {
- $poolInfo[$v['pool_id']] = $v['count'];
+ $yPoolInfo[$v['pool_id']] = $v['count'];
}
unset($statementPool);
+
+ //获取母单未支付完成订单
+ $poolIds = implode(",",array_keys($yPoolInfo));
+ $poolInfo = $companyStatementInfo->where("pool_id in ($poolIds) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
//修改info
$saveData = [
@@ -127,15 +131,11 @@ class CompanyStatementOfflineController extends ThinkController
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>date("Y-m-d H:i:s")])
];
$ires = $companyStatementInfo->where("id in ($ids)")->save($saveData);
-
- //获取母单未支付完成订单
- $poolIds = implode(",",array_keys($poolInfo));
- $poolInfo = $companyStatementInfo->where("pool_id in ($poolIds) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
//全部就打款成功,否则打款中
$companyStatementPool = M("company_statement_pool","tab_");
foreach ($poolInfo as $k => $v) {
- if($v['count'] == $poolInfo[$v['pool_id']]){
+ if($v['count'] == $yPoolInfo[$v['pool_id']]){
//打款成功
$this->setOneVerifyStatus(4,"payment",$v['pool_id']);
}else{
diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php
index 25d7cecc0..f18a6fbac 100644
--- a/Application/Admin/Controller/CompanyStatementPoolController.class.php
+++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php
@@ -241,7 +241,7 @@ class CompanyStatementPoolController extends ThinkController
}
$cline = $line+1;
if($is_export){
- $v['statement_money'] = "=";
+ $v['statement_money'] = "=ROUND(";
}
$row = 0;
@@ -261,44 +261,30 @@ class CompanyStatementPoolController extends ThinkController
if($is_export){
if($v['withdraw_type'] != 3) {
- $val['sum_money'] = "=K{$line}*(L{$line}+M{$line})";
+ $val['sum_money'] = "=ROUND(K{$line}*(L{$line}+M{$line}),2)";
} else {
- $val['sum_money'] = "=K{$line}*(M{$line})";
+ $val['sum_money'] = "=ROUND(K{$line}*(M{$line}),2)";
}
-// $val['sum_money'] = "=J{$line}*(K{$line}+L{$line})";
$v['statement_money'] .= "N{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['sum_money'] += $val['sum_money'];
}
}
- // if($is_export){
- // //J3*(K3+L3)+M3-N3
- // if($va['statement_type'] > 0){ //罚款服务器费用
- // $va['sum_money'] = "=J{$line}";
- // }else{
- // $va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
- // }
- // }else{
- // $count['platform_amount'] += $va['pay_amount'];
- // $count['sum_money'] += $va['sum_money'];
- // }
}
$v['row'] = $row;
if($is_export){
-
if($v['withdraw_type'] != 3) {
- $v['statement_money'] .="N{$cline}-O{$cline}";
+ $v['statement_money'] .="O{$cline}-P{$cline},2)";
} else {
- $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1);
+ $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)";
}
-// dump($v['statement_money']);die();
}
}
if($is_export){
- $count["platform_amount"] = "=SUM(K2:K".$line.")";
- $count["sum_money"] = "=SUM(Q2:Q".$line.")";
+ $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)";
+ $count["sum_money"] = "=ROUND(SUM(Q2:Q".$line."),2)";
}
$this->assign("data",$infolist);
$this->assign("count",$count);
@@ -346,23 +332,31 @@ class CompanyStatementPoolController extends ThinkController
if($is_export){
if($v['withdraw_type'] != 3) {
- $va['d_statement_money'] = "=D{$line}*(1-G{$line})*(E{$line}+F{$line})";
+ $va['d_statement_money'] = "=ROUND(D{$line}*(1-G{$line})*(E{$line}+F{$line}),2)";
} else {
- $va['d_statement_money'] = "=D{$line}*(F{$line})";
+ $va['d_statement_money'] = "=ROUND(D{$line}*(F{$line}),2)";
}
}else{
- $va['d_statement_money'] = round($va['pay_amount']*($va['ratio']+$va['increment_ratio'])*(100-$va['fax_ratio'])/100/100,2);
+ if ($v['withdraw_type'] != 3) {
+ $va['d_statement_money'] = round($va['pay_amount']*($va['ratio']+$va['increment_ratio'])*(100-$va['fax_ratio'])/100/100,2);
- $count['platform_amount'] += $va['pay_amount'];
+ $count['platform_amount'] += $va['pay_amount'];
- $count['d_statement_money'] += $va['d_statement_money'];
+ $count['d_statement_money'] += $va['d_statement_money'];
+ } else {
+ $va['d_statement_money'] = round(($va['pay_amount']*($va['increment_ratio']))/100,2);
+
+ $count['platform_amount'] += $va['pay_amount'];
+
+ $count['d_statement_money'] += $va['d_statement_money'];
+ }
}
}
$v['settlement_contact'] = $Partner[$v['company_id']];
if($is_export){
if ($v['withdraw_type'] != 3) {
- $v['statement_money'] = "=SUM(H{$cline}:H{$line})+J{$cline}-I{$cline}";
+ $v['statement_money'] = "=ROUND(SUM(H{$cline}:H{$line})+J{$cline}-I{$cline},2)";
}
@@ -375,11 +369,11 @@ class CompanyStatementPoolController extends ThinkController
}
if($is_export){
- $count["platform_amount"] = "=SUM(D2:D".$line.")";
- $count["d_statement_money"] = "=SUM(H2:H".$line.")";
- $count["fine"] = "=SUM(I2:I".$line.")";
- $count["reward"] = "=SUM(J2:J".$line.")";
- $count["statement_money"] = "=SUM(K2:K".$line.")";
+ $count["platform_amount"] = "=ROUND(SUM(D2:D".$line."),2)";
+ $count["d_statement_money"] = "=ROUND(SUM(H2:H".$line."),2)";
+ $count["fine"] = "=ROUND(SUM(I2:I".$line."),2)";
+ $count["reward"] = "=ROUND(SUM(J2:J".$line."),2)";
+ $count["statement_money"] = "=ROUND(SUM(K2:K".$line."),2)";
}
// dd($infolist);
$this->assign("data",$infolist);
@@ -423,7 +417,7 @@ class CompanyStatementPoolController extends ThinkController
$line ++;
$va['company_ratio'] = 100-$va['ratio'];
if($is_export){
- $va['d_statement_money'] = "=F{$line}*G{$line}";
+ $va['d_statement_money'] = "=ROUND(F{$line}*G{$line},2)";
}else{
$va['d_statement_money'] = round($va['pay_amount']*$va['ratio']/100,2);
$count['platform_amount'] += $va['pay_amount'];
@@ -433,7 +427,7 @@ class CompanyStatementPoolController extends ThinkController
}
$v['matche_platform'] = $Partner[$v['company_id']];
if($is_export){
- $v['statement_money'] = "=SUM(K{$cline}:K{$line})+M{$cline}-L{$cline}";
+ $v['statement_money'] = "=ROUND(SUM(K{$cline}:K{$line})+M{$cline}-L{$cline},2)";
}else{
$count['fine'] += $v['fine'];
$count['reward'] += $v['reward'];
@@ -443,12 +437,12 @@ class CompanyStatementPoolController extends ThinkController
}
if($is_export){
- $count["d_statement_money"] = "=SUM(K3:K".$line.")";
- $count["platform_amount"] = "=SUM(E3:E".$line.")";
- $count["platform_amount2"] = "=SUM(F3:F".$line.")";
- $count["fine"] = "=SUM(L3:L".$line.")";
- $count["reward"] = "=SUM(M3:M".$line.")";
- $count["statement_money"] = "=SUM(N3:N".$line.")";
+ $count["d_statement_money"] = "=ROUND(SUM(K3:K".$line."),2)";
+ $count["platform_amount"] = "=ROUND(SUM(E3:E".$line."),2)";
+ $count["platform_amount2"] = "=ROUND(SUM(F3:F".$line."),2)";
+ $count["fine"] = "=ROUND(SUM(L3:L".$line."),2)";
+ $count["reward"] = "=ROUND(SUM(M3:M".$line."),2)";
+ $count["statement_money"] = "=ROUND(SUM(N3:N".$line."),2)";
}
// dd($infolist);
$this->assign("data",$infolist);
@@ -791,7 +785,12 @@ class CompanyStatementPoolController extends ThinkController
if($re_op){
//公司及上游回退
if($db_res['company_type'] == 2){
- $this->retry($db_res); //个人重算
+
+ if($db_res['withdraw_type'] == 3) {
+ $this->cancelCompanyPool($db_res);//公司撤回
+ } else {
+ $this->retry($db_res); //个人重算
+ }
}else{
$this->cancelCompanyPool($db_res);//公司撤回
}
@@ -1055,7 +1054,7 @@ class CompanyStatementPoolController extends ThinkController
$mentBtn = [
"verifyAgree"=>"审批通过",
"verifyRefuse"=>"审核拒绝",
- "export"=>"批量导出"
+ "export"=>"导出"
];
$resarr = [];
foreach ($mentBtn as $k => $v) {
diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php
index 2afc95983..2ff9ad3b9 100644
--- a/Application/Admin/Controller/CompanyStatementSetController.class.php
+++ b/Application/Admin/Controller/CompanyStatementSetController.class.php
@@ -113,7 +113,8 @@ class CompanyStatementSetController extends Controller {
$this->promoteCompanyStatement(1,$stime);
$this->promoteCompanyStatement(2,$stime);
- echo "∟----推广公司月结&补点统计ok".PHP_EOL;
+ $this->officeCompanyStatement($stime); //官方结算
+ echo "∟----官方/推广公司月结&补点统计ok".PHP_EOL;
$this->promoteUserPool(1,$stime);
$this->promoteUserPool(2,$stime);
@@ -127,7 +128,8 @@ class CompanyStatementSetController extends Controller {
if($company == "pc"){
$this->promoteCompanyStatement(1,$stime);
$this->promoteCompanyStatement(2,$stime);
- echo "∟----推广公司月结&补点统计ok".PHP_EOL;
+ $this->officeCompanyStatement($stime); //官方结算
+ echo "∟----官方/推广公司月结&补点统计ok".PHP_EOL;
}
if($company == "pu"){
$this->promoteUserPool(1,$stime);
@@ -297,55 +299,60 @@ class CompanyStatementSetController extends Controller {
$promote_ratio = $cp[$add_data['company_id']]['channel_rate'] ?? 0;
$fax_ratio = $cp[$add_data['company_id']]['taxation_rate'] ?? 0;
//游戏统计
- if(!isset($v['list'])){continue;}
- foreach($v['list'] as $ke=>$va){
- $game =[];
- $game['pay_amount'] =$va['pay_money'];
- $game['game_name'] =$ke;
- //获取游戏id及比例
- $game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find();
- if(empty($game_id) && isset($va['unique_code']) && !empty($va['unique_code'])){
- $unique_code = $va['unique_code'];
- $game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find();
- }
- if(empty($game_id)){
- $game['relation_game_id']=0;
- $tratio = 0;
- }else{
- //获取比例
- $game['relation_game_id']=$game_id['relation_game_id'];
- if($type == 1){
- $tratio = getGameCpRadio($game_id['id'],$va['pay_money'],true);
- }elseif($type == 0){
- $tratio = getGameCpRadio($game_id['id'],$va['pay_money'],false);
- }else{
- //补丁
- $tratio1 = getGameCpRadio($game_id['id'],$va['pay_money'],true);
- $tratio2 = getGameCpRadio($game_id['id'],$va['pay_money'],false);
- $tratio = $tratio1-$tratio2;
- if($tratio <= 0){continue;}
- }
- }
- if($v['first_company_type'] == 1){
- $game['first_ratio']=$tratio-0;
- $game['second_ratio']=100-$tratio;
- }else{
- $game['first_ratio']=100-$tratio;
- $game['second_ratio']=$tratio-0;
- }
- $add_data['pay_amount'] += $va['pay_money'];
-
- $game['sum_money']=round($va['pay_money']*(100-$promote_ratio)*$tratio*(100-$fax_ratio)/(100*100*100),2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率)
-
- $add_data['statement_money'] += $game['sum_money'];
+ if (isset($v['list'])) {
+ foreach ($v['list'] as $ke=>$va) {
+ $game =[];
+ $game['pay_amount'] =$va['pay_money'];
+ $game['game_name'] =$ke;
+ //获取游戏id及比例
+ $game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find();
+ if (empty($game_id) && isset($va['unique_code']) && !empty($va['unique_code'])) {
+ $unique_code = $va['unique_code'];
+ $game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find();
+ }
+ if (empty($game_id)) {
+ $game['relation_game_id']=0;
+ $tratio = 0;
+ } else {
+ //获取比例
+ $game['relation_game_id']=$game_id['relation_game_id'];
+ if ($type == 1) {
+ $tratio = getGameCpRadio($game_id['id'], $va['pay_money'], true);
+ } elseif ($type == 0) {
+ $tratio = getGameCpRadio($game_id['id'], $va['pay_money'], false);
+ } else {
+ //补丁
+ $tratio1 = getGameCpRadio($game_id['id'], $va['pay_money'], true);
+ $tratio2 = getGameCpRadio($game_id['id'], $va['pay_money'], false);
+ $tratio = $tratio1-$tratio2;
+ if ($tratio <= 0) {
+ continue;
+ }
+ }
+ }
+ if ($v['first_company_type'] == 1) {
+ $game['first_ratio']=$tratio-0;
+ $game['second_ratio']=100-$tratio;
+ } else {
+ $game['first_ratio']=100-$tratio;
+ $game['second_ratio']=$tratio-0;
+ }
+ $add_data['pay_amount'] += $va['pay_money'];
+
+ $game['sum_money']=round($va['pay_money']*(100-$promote_ratio)*$tratio*(100-$fax_ratio)/(100*100*100), 2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率)
+
+ $add_data['statement_money'] += $game['sum_money'];
- $game['fax_ratio']=$fax_ratio;
- $game['promote_ratio']=$promote_ratio;
+ $game['fax_ratio']=$fax_ratio;
+ $game['promote_ratio']=$promote_ratio;
- $game['statement_begin_time']=$statement_begin_time;
- $game['statement_end_time']=$statement_end_time;
- $game['statement_type']=0;
- $add_data['statement_info'][] = $game;
+ $game['statement_begin_time']=$statement_begin_time;
+ $game['statement_end_time']=$statement_end_time;
+ $game['statement_type']=0;
+ $add_data['statement_info'][] = $game;
+ }
+ }else{
+ $add_data['statement_info'] = [];
}
$add_data['platform_amount'] = $add_data['pay_amount'];
if($type < 2){
@@ -409,9 +416,9 @@ class CompanyStatementSetController extends Controller {
//金额为0不补点
continue;
}
- if($add_data['platform_amount'] == 0){
+ if($add_data['platform_amount'] == 0 && $add_data['statement_money'] == 0){
//全等于0表示没有流水,小于0依旧要结算
- return;
+ continue;
}
//添加
if($recount && $company_id !== false){
@@ -477,6 +484,84 @@ class CompanyStatementSetController extends Controller {
}
return $cplList;
}
+ //官方结算
+ public function officeCompanyStatement($stime,$recount=false)
+ {
+
+ $t = $this->setBeginAndEndTime(1,$stime);
+ $begintime = $t[0];
+ $endtime = $t[1];
+ //获取官方信息
+ $pc_map = [
+ "id"=>["IN",$pc_id],
+ "_string"=>"(validity_start_time > 0 AND validity_end_time = 0 ) OR validity_end_time >= {$endtime}",
+ "company_type"=>1
+ ];
+ //获取pc公司
+ $company = M("CompanyInfo","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank")->where("partner = '海南万盟天下科技有限公司'")->find();
+ $first_party_info = json_encode($company,JSON_UNESCAPED_UNICODE);
+ $company['partner'] = C("OFFICIEL_CHANNEL");
+ $second_party_info = json_encode($company,JSON_UNESCAPED_UNICODE);
+ $add_data=[
+ "first_party_info"=>$first_party_info,
+ "second_party_info"=>$second_party_info,
+ "pay_type"=>2,
+ "withdraw_type"=>1,
+ "statement_begin_time"=>$begintime,
+ "statement_end_time"=>$endtime,
+ "statement_money"=>0,
+ "pay_amount"=>0,
+ "platform_amount"=>0,
+ "verify_log"=>json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]),
+ "op_time"=>time(),
+ "is_payment"=>2,
+ "statement_info"=>[],
+ "company_belong"=>0,
+ "company_name"=>C("OFFICIEL_CHANNEL"),
+ "company_id"=>0,
+ "company_type"=>1
+ ];
+
+ //获取渠道及发票税率
+ $fax_ratio = 0; //税费费率
+ $company_belong = 0;
+
+
+
+ $Promote = M("Promote","tab_");
+ $Spend = M("Spend","tab_");
+ $spenMap = [
+ "s.pay_status"=>1,
+ "s.payed_time"=>['between', [$begintime,$endtime]],
+ "s.promote_id"=>0
+ ];
+ $list = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,g.relation_game_id,g.relation_game_name game_name')->where($spenMap)->group('relation_game_id')
+ ->join("left join tab_game g on s.game_id = g.id")
+ ->select();
+ if(empty($list)){return;}
+ $statement_begin_time = date("Y.m.d",$begintime);
+ $statement_end_time = date("Y.m.d",$endtime);
+
+ foreach ($list as $k => $v) {
+ $v['fax_ratio'] = 0;
+ $v['statement_begin_time']=$statement_begin_time;
+ $v['statement_end_time']=$statement_end_time;
+ $v['ratio']=0;
+ $v['sum_money'] = 0;
+ $v['statement_type']=0;
+
+ $add_data['platform_amount'] += $v['pay_amount'];
+ $add_data['pay_amount'] += $v['pay_amount'];
+ $add_data['statement_info'][] = $v;
+ }
+ $add_data['statement_info'] = json_encode($add_data['statement_info'],JSON_UNESCAPED_UNICODE);
+ if($recount){
+ //非重算
+ return $add_data;
+ }
+ M("CompanyStatement","tab_")->add($add_data);
+ }
+
/**
* 下游结算
*/
@@ -1196,6 +1281,7 @@ class CompanyStatementSetController extends Controller {
}
//聚合未结算数据
$lsres = $LackStatement->where("company_id='{$k}' and is_pool = 0")->select();
+ // dd($lsres);
$del_lack_ids = [];
if(count($lsres) > 0){
@@ -1213,9 +1299,9 @@ class CompanyStatementSetController extends Controller {
foreach($t_statement_info as $p=>$info){
$statement_info[$info['account']] = $info['game_list'];
}
- foreach($v['statement_info'] as $p=>&$info){
+ foreach($v['statement_info'] as $p=>$info){
if(isset($statement_info[$info['account']])){
- $info['game_list'] = array_merge($statement_info[$info['account']],$info['game_list']);
+ $v['statement_info'][$p]['game_list'] = array_merge($statement_info[$info['account']],$v['statement_info'][$p]['game_list']);
unset($statement_info[$info['account']]);
}
}
@@ -1226,21 +1312,23 @@ class CompanyStatementSetController extends Controller {
}
}
}
-
+ if($v['platform_amount'] == 0 && $v['statement_money'] == 0){
+ continue ;
+ }
if($type == 2 && $v['statement_money'] == 0){
//补点不存
}else{
if($v['platform_amount'] < 300){
//存未满
- if($lackcompany['pay_amount'] != 0){
+ // if($lackcompany['pay_amount'] != 0){
$lask_id = $LackStatement->add($lackcompany);
$countdata['create_lack_ids'][] =$lask_id;
$countdata['lack_statement_money'] +=$lackcompany['statement_money'];
$countdata['lack_platform_amount'] +=$lackcompany['platform_amount'];
- }
+ // }
}else{
- if($v['pay_amount'] != 0){
+ // if($v['pay_amount'] != 0){
//存成功配置单号
$company =[
"pool_id"=>0,
@@ -1271,7 +1359,7 @@ class CompanyStatementSetController extends Controller {
$countdata['platform_amount'] +=$v['platform_amount'];
$countdata['fine'] +=$v['fine'];
$countdata['reward'] +=$v['reward'];
- }
+ // }
}
}
}
@@ -1480,11 +1568,16 @@ class CompanyStatementSetController extends Controller {
//获取时间
$stime = $dbres['statement_end_time']-0+1;
$company_id = $dbres['company_id'];
- if($dbres['company_belong'] == 9){
- //上游
- $savedata = $this->cpStatement($dbres['withdraw_type'],$stime,$company_id);
+
+ if($company_id == 0){
+ $savedata = $this->officeCompanyStatement($stime,true);
}else{
- $savedata = $this->promoteCompanyStatement($dbres['withdraw_type'],$stime,$company_id);
+ if($dbres['company_belong'] == 9){
+ //上游
+ $savedata = $this->cpStatement($dbres['withdraw_type'],$stime,$company_id);
+ }else{
+ $savedata = $this->promoteCompanyStatement($dbres['withdraw_type'],$stime,$company_id);
+ }
}
//重写用户
$savedata['verify_log'] = json_encode(["create_user"=>$admin_user,"create_time"=>date("Y-m-d H:i:s")]);
diff --git a/Application/Admin/Controller/DepositController.class.php b/Application/Admin/Controller/DepositController.class.php
index 8034efa3d..c2824467c 100644
--- a/Application/Admin/Controller/DepositController.class.php
+++ b/Application/Admin/Controller/DepositController.class.php
@@ -44,23 +44,23 @@ class DepositController extends ThinkController {
$map['promote_id']=$_REQUEST['promote_id'];
}
if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){
- $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1));
+ $map['payed_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1));
unset($_REQUEST['time-start']);unset($_REQUEST['time-end']);
}elseif(isset($_REQUEST['time-start'])){
- $map['create_time'] = ['GT',strtotime(I('time-start'))];
+ $map['payed_time'] = ['GT',strtotime(I('time-start'))];
unset($_REQUEST['time-start']);
}elseif(isset($_REQUEST['time-end'])){
- $map['create_time'] = ['LT',strtotime(I('time-end'))+86399];
+ $map['payed_time'] = ['LT',strtotime(I('time-end'))+86399];
unset($_REQUEST['time-end']);
}
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
- $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
+ $map['payed_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
unset($_REQUEST['start']);unset($_REQUEST['end']);
}elseif(isset($_REQUEST['start'])){
- $map['create_time'] = ['GT',strtotime(I('start'))];
+ $map['payed_time'] = ['GT',strtotime(I('start'))];
unset($_REQUEST['start']);
}elseif(isset($_REQUEST['end'])){
- $map['create_time'] = ['LT',strtotime(I('end'))+86399];
+ $map['payed_time'] = ['LT',strtotime(I('end'))+86399];
unset($_REQUEST['end']);
}
if(isset($_REQUEST['pay_way'])) {
@@ -71,7 +71,8 @@ class DepositController extends ThinkController {
}
unset($_REQUEST['pay_way']);
}
- if ($_REQUEST['merchant_id']) {
+
+ if ($_REQUEST['merchant_id'] && $_REQUEST['merchant_id'] != 0) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
@@ -92,49 +93,12 @@ class DepositController extends ThinkController {
$map1=$map;
$map1['pay_status']=1;
-// if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') {
-// $page = intval($p);
-// $page = $page ? $page : 1; //默认显示第一页数据
-// if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
-// $map1['order_status'] = 1;
-// unset($map1['pay_status']);
-// if ($map['pay_status']) {
-// $map['order_status']=$map['pay_status'];
-// }
-//
-// $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount'));
-// $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount'));
-// $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount'));
-// $this->assign('total',$total);
-// $this->assign('ttotal',$ttotal);
-// $this->assign('ytotal',$ytotal);
-//
-// $data = D('coin_pay_order')
-// /* 查询指定字段,不指定则查询所有字段 */
-// ->field('*,order_status as pay_status')
-// // 查询条件
-// ->where($map)
-// /* 默认通过id逆序排列 */
-// ->order("id desc")
-// /* 数据分页 */
-// ->page($page, $row)
-// /* 执行查询 */
-// ->select();
-//
-// /* 查询记录总数 */
-// $count = D('coin_pay_order')->where($map)->count();
-//
-// $page = set_pagination($count,$row);
-// if($page) {$this->assign('_page', $page);}
-//
-// $this->assign('list_data', $data);
-// $this->meta_title = '平台币充值列表';
-// $this->display('lists');die();
-// }
$this->checkListOrCountAuthRestMap($map,[]);
+
+
$total=null_to_0(D(self::model_name)->where($map1)->sum('pay_amount'));
- $ttotal=null_to_0(D(self::model_name)->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount'));
- $ytotal=null_to_0(D(self::model_name)->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount'));
+ $ttotal=null_to_0(D(self::model_name)->where('payed_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount'));
+ $ytotal=null_to_0(D(self::model_name)->where('payed_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount'));
$this->assign('total',$total);
$this->assign('ttotal',$ttotal);
$this->assign('ytotal',$ytotal);
@@ -145,7 +109,7 @@ class DepositController extends ThinkController {
$this->assign("is_admin",is_administrator());
$show_data_power = (is_administrator()|| session('user_auth')['show_data']);
$this->assign('show_data_power', $show_data_power);
- parent::lists(self::model_name,$_GET["p"],$map);
+ parent::lists(self::model_name, $_GET["p"], $map);
}
public function lists_secord() {
diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index aed2f929e..98ec3c257 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -1303,6 +1303,12 @@ class ExportController extends Controller
break;
case 8:
//操作日志
+ if (I('start', '') == '') {
+ $this->error('请选择充值开始时间');
+ }
+ if (I('end', '') == '') {
+ $this->error('请选择充值结束时间');
+ }
$GetData = $_GET;
unset($GetData['xlsname']);
unset($GetData['id']);
@@ -1342,12 +1348,12 @@ class ExportController extends Controller
$map['promote_id'] = $_REQUEST['promote_id'];
}
if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) {
- $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
+ $map['payed_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
unset($_REQUEST['time-start']);
unset($_REQUEST['time-end']);
}
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
- $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
+ $map['payed_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
unset($_REQUEST['start']);
unset($_REQUEST['end']);
}
@@ -1359,7 +1365,7 @@ class ExportController extends Controller
$map['pay_status'] = $_REQUEST['pay_status'];
unset($_REQUEST['pay_status']);
}
- if ($_REQUEST['merchant_id']) {
+ if (isset($_REQUEST['merchant_id']) && $_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
@@ -2468,18 +2474,25 @@ class ExportController extends Controller
array('sdk_version', '设备名称'),
array('order_amount', '订单金额'),
array('pay_amount', '实付金额'),
+ array('platform_type', '所属平台'),
array('pay_way', '充值方式'),
array('merchant_id', '所属商户'),
array('add_time', '录入时间'),
);
$params = I('get.');
- // if(isset($params['timestart']) && isset($params['timeend'])) {
- // $startTime = strtotime($params['timestart']);
- // $endTime = strtotime($params['timeend']) + 86399;
- // $map['tab_test_order.pay_time'] = array('BETWEEN', [$startTime, $endTime]);
- // }
+ $platformType = I('platform_type', 0);
+ $startedAt = I('timestart', '');
+ $endedAt = I('timeend', '');
+ $gameId = I('game_id', 0);
+ $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->select();
+ $gameSets = index_by_column('game_id', $gameSets);
+ $aggGameIds = getAggExceptIds($gameSets);
+
+ $map = [];
+ $map['_string'] = '1=1';
+
if(isset($params['server_type'])) {
$map['t.server_type'] = $params['server_type'];
}
@@ -2499,18 +2512,23 @@ class ExportController extends Controller
if(isset($params['pay_way'])) {
$map['t.pay_way'] = $params['pay_way'];
}
-
- if(!empty($params['timestart']) && !empty($params['timeend'])){
- $timestart = strtotime($params['timestart']);
- $timeend = strtotime($params['timeend'])+86399;
- $map['t.pay_time'] = array("between",array($timestart,$timeend));
- }else if(!empty($params['timestart']) && empty($params['timeend'])) {
- $timestart = strtotime($params['timestart']);
- $map['t.pay_time'] = array("EGT",$timestart);
- }else if (!empty($params['timeend']) && empty($params['timestart'])) {
- $timeend = strtotime($params['timeend'])+86399;
- $map['t.pay_time'] = array("ELT",$timeend);
+
+ if ($startedAt != '') {
+ $map['_string'] .= ' and pay_time>=' . strtotime($startedAt . ' 00:00:00');
+ }
+ if ($endedAt != '') {
+ $map['_string'] .= ' and pay_time<=' . strtotime($endedAt . ' 23:59:59');
+ }
+ if ($platformType == 1) {
+ $map['_string'] .= ' and game_id not in(' . implode(',', $aggGameIds) . ')';
+ }
+ if ($platformType == 2) {
+ $map['_string'] .= ' and game_id in(' . implode(',', $aggGameIds) . ')';
}
+ if ($gameId != 0) {
+ $map['_string'] .= ' and game_id=' . $gameId;
+ }
+
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
@@ -2530,6 +2548,7 @@ class ExportController extends Controller
}else {
$order_list['server_type'] = '测试外网';
}
+ $order_list['platform_type'] = in_array($v['game_id'], $aggGameIds) ? '聚合' : '联运';
$order_list['game_name'] =clearGameNameType($v['game_name']);
$order_list['sdk_version'] =getGameTypeName($v['sdk_version']);
$order_list['order_type'] = get_order_type($v['order_type']);
@@ -4057,20 +4076,23 @@ class ExportController extends Controller
$error = '请选择游戏!';
$status = false;
}
- if ($deviceType == '') {
- $error = '请选择设备类型!';
- $status = false;
- }
$startTime = strtotime($start . ' 00:00:00');
$endTime = strtotime($end . ' 23:59:59') + 1;
if ((($endTime - $startTime)/(24*3600)) > 31) {
$error = '时间间隔不能超过31天';
$status = false;
}
+ $searchGameId = 0;
if ($status) {
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
- $gameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id'];
+ $gameIds = [];
+ if ($deviceType) {
+ $searchGameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id'];
+ $gameIds[] = $searchGameId;
+ } else {
+ $gameIds = [$baseGame['android_game_id'], $baseGame['ios_game_id']];
+ }
$client = new Client([
'base_uri' => C('TASK_URL'),
@@ -4082,7 +4104,7 @@ class ExportController extends Controller
'start_time' => $start,
'end_time' => $end,
'promote_id' => I('promote_id', 0),
- 'game_id' => $gameId,
+ 'game_ids' => $gameIds,
]
]);
@@ -4091,7 +4113,7 @@ class ExportController extends Controller
if (!$result) {
$this->error('数据请求异常!');
}
- $gameName = get_game_name($gameId);
+ $gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name'];
$promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
@@ -8328,8 +8350,8 @@ class ExportController extends Controller
}
return false;
});
-
- $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->where(['game_id' => ['in', $gameIds]])->select();
+
+ $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->select();
$gameSets = index_by_column('game_id', $gameSets);
$searchGameCodes = [];
@@ -8342,6 +8364,7 @@ class ExportController extends Controller
$searchGameCodes = M('game', 'tab_')->where(['id' => ['in', $searchGameIds], 'unique_code' => ['neq', '']])->getField('unique_code', true);
$searchGameCodes = array_unique($searchGameCodes);
$testWhere['game_id'] = ['in', $searchGameIds];
+
$testRows = M('test_order', 'tab_')
->field(['game_id', 'sum(pay_amount) amount'])
->where($testWhere)
@@ -8373,6 +8396,7 @@ class ExportController extends Controller
}
$exceptIds = getAggExceptIds($gameSets);
+
foreach ($xlsData as $key => $value) {
$aggAmount = '0.00';
$aggFailAmount = '0.00';
@@ -8384,7 +8408,6 @@ class ExportController extends Controller
}
$xlsData[$key]['agg_amount'] = $aggAmount;
$xlsData[$key]['agg_failed_amount'] = $aggFailAmount;
- $xlsData[$key]['agg_failed_amount'] = '0.00';
if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) {
$xlsData[$key]['cash_count'] = $value['cash_count'] = 0;
$xlsData[$key]['balance_coin_count'] =$value['balance_coin_count'] = 0;
@@ -8411,6 +8434,7 @@ class ExportController extends Controller
}
$testWhere['_string'] .= ' and game_id in(' . implode(',', $exceptIds) . ')';
+
$testAllAmount = M('test_order', 'tab_')->where($testWhere)->sum('pay_amount');
$totalData = D("spend")->totalGameStatistics($map);
@@ -8420,17 +8444,19 @@ class ExportController extends Controller
$sumInside = $totalData['inside_cash_count'];
$sumNoticeFail = $totalData['notice_fail_count']? $totalData['notice_fail_count']:0;
$sumAll = $sumCash + $sumBalance + $sumInside;
-
- $sumData = [['game_name'=>'总计',
- 'cash_count'=>$sumCash,
- 'balance_coin_count'=>$sumBalance,
- 'inside_cash_count'=>$sumInside,
- 'all_cash_count'=>$sumAll,
- 'notice_fail_count'=>$sumNoticeFail,
- 'agg_amount' => $aggTotal,
- 'testAllAmount' => $testAllAmount,
- 'aggFailTotal' => $aggFailTotal,
- ]];
+ $sumData = [
+ [
+ 'game_name'=>'总计',
+ 'cash_count'=>$sumCash,
+ 'balance_coin_count'=>$sumBalance,
+ 'inside_cash_count'=>$sumInside,
+ 'all_cash_count'=>$sumAll,
+ 'notice_fail_count'=>$sumNoticeFail,
+ 'agg_amount' => $aggTotal,
+ 'test_amount' => round(floatval($testAllAmount), 2),
+ 'agg_failed_amount' => $aggFailTotal,
+ ]
+ ];
$xlsData = array_merge($xlsData,$sumData);
$this->exportAddOperationLog("Finance/gameStatistics","充值-财务管理-游戏统计-导出");
$this->exportExcel($xlsName, $xlsCell, $xlsData);
diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php
index 8c6db5e2e..4ecf1027c 100644
--- a/Application/Admin/Controller/FinanceController.class.php
+++ b/Application/Admin/Controller/FinanceController.class.php
@@ -768,6 +768,7 @@ class FinanceController extends ThinkController
$searchGameCodes = array_unique($searchGameCodes);
$testWhere['game_id'] = ['in', $searchGameIds];
+
$testRows = M('test_order', 'tab_')
->field(['game_id', 'sum(pay_amount) amount'])
->where($testWhere)
@@ -830,7 +831,7 @@ class FinanceController extends ThinkController
}
$this->checkListOrCountAuthRestMap($map,[]);
-
+
$testWhere['_string'] .= ' and game_id in(' . implode(',', $exceptIds) . ')';
$testAllAmount = M('test_order', 'tab_')->where($testWhere)->sum('pay_amount');
@@ -881,7 +882,7 @@ class FinanceController extends ThinkController
$account = I('account', '');
$gameId = I('game_id', 0);
- $game = M('game', 'tab_')->field(['id', 'unique_code', 'game_name'])->where(['game_id' => $gameId])->find();
+ $game = M('game', 'tab_')->field(['id', 'unique_code', 'game_name', 'sdk_version'])->where(['id' => $gameId])->find();
$client = new AggregateClient();
$result = $client->api('game-recharge-detail', [
@@ -891,7 +892,7 @@ class FinanceController extends ThinkController
'account' => $account,
'order_number' => $orderNumber,
'role_name' => $roleName,
- 'device_type' => I("sdk_type", 0),
+ 'device_type' => $game['sdk_version'],
'page' => $p,
'limit' => $limit,
]);
@@ -899,7 +900,7 @@ class FinanceController extends ThinkController
$count = 0;
$total = '0.00';
$records = [];
- if ($result['code'] != '0000') {
+ if ($result['code'] == '0000') {
$count = $result['data']['count'];
$total = $result['data']['total'];
$records = $result['data']['records'];
@@ -907,6 +908,7 @@ class FinanceController extends ThinkController
foreach ($records as $key => $record) {
$records[$key]['game_name'] = $game['game_name'];
+ $records[$key]['rom_platform'] = $record['rom_platform'] == 'android' ? '安卓' : 'IOS';
}
if(isset($_REQUEST['export'])){
@@ -931,6 +933,7 @@ class FinanceController extends ThinkController
$this->assign('_page', $page);
}
+ $this->assign('game', $game);
$this->assign('pagination', $page);
$this->assign('total', $total);
$this->assign('records', $records);
@@ -1385,6 +1388,29 @@ class FinanceController extends ThinkController
$cashStatistics[$value['pay_way']]['balance'] += $value['pay_amount'];//别表的平台币充值
}
+ $testOrderData = M('test_order', 'tab_')
+ ->where([
+ 'pay_way'=>['egt',1],
+ 'pay_time'=>$time
+ ])
+ ->field('pay_way,sum(pay_amount) as pay_amount')
+ ->group("pay_way")
+ ->select();
+ foreach ($testOrderData as $key => $value) {
+
+ if ($value['pay_way'] == NULL&&$value['pay_amount'] == NULL) {
+ continue;
+ }
+
+ if (!array_key_exists($value['pay_way'], $cashStatistics)) {
+ $cashStatistics[$value['pay_way']] = $value;
+ $cashStatistics[$value['pay_way']]['pay_type'] = getPayType($value['pay_way']);//充值方式文字影视
+ $cashStatistics[$value['pay_way']]['pay_amount'] = '0.00';
+ $cashStatistics[$value['pay_way']]['balance'] = 0;//别表的平台币充值
+ }
+ $cashStatistics[$value['pay_way']]['balance'] += $value['pay_amount'];//别表的平台币充值
+ }
+
foreach ($cashStatistics as $key => $value) {
$cashStatistics[$key]['pay_rate'] = '';
$cashStatistics[$key]['total'] = $value['pay_amount'] + $value['balance'];//添加列表合计
diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php
index 4dd97fdc8..5e598b42b 100644
--- a/Application/Admin/Controller/FinancialSummaryController.class.php
+++ b/Application/Admin/Controller/FinancialSummaryController.class.php
@@ -3,7 +3,7 @@ namespace Admin\Controller;
class FinancialSummaryController extends AdminController
{
public $keyname=array(
- "cash_spend"=>"现金充值收入",
+ "cash_spend"=>"游戏现金充值收入",
"balance_coin_spend"=>"平台币消耗",
"balance_coin_income"=>"平台币充值收入",
"game_supersign_income"=>"超级签购买收入",
@@ -165,6 +165,12 @@ class FinancialSummaryController extends AdminController
}
public function menuAuth()
{
+
+ $isCan = D("CmdTasks")->isCanAddTask("FinancialSummary");
+ if(!$isCan){
+ return [];
+ }
+
$mentBtn = [
"updateStatement"=>"重算金额"
];
diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php
index 739dc1299..2720c987e 100644
--- a/Application/Admin/Controller/FinancialSummarySetController.class.php
+++ b/Application/Admin/Controller/FinancialSummarySetController.class.php
@@ -196,38 +196,38 @@ class FinancialSummarySetController extends \Think\Controller
"type"=>1,
"sort"=>5
);
- //获取测试白名单
- $testlist = M("TestWhiteList",'tab_')->field("user_id")->select();
- if($testlist){
- $testlist = implode(",",array_column($testlist, 'user_id'));
- }else{
- $testlist = false;
- }
- //获取现金充值
- $map = array(
- "payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
- "pay_status"=>1,
- "pay_way"=>array("GT",0)
- );
- if($testlist) $map['user_id']=array("in",$testlist);
- $cash_spend = $this->SpendModel
- ->field("IFNULL(SUM(pay_amount),0) as pay_amount")
- ->where($map)
- ->find()['pay_amount'];
- //获取平台币充值
- $map1 = array(
- "payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
- "pay_status"=>1
- );
- if($testlist) $map1['user_id']=array("in",$testlist);
- $deposit = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount'];
+ // //获取测试白名单
+ // $testlist = M("TestWhiteList",'tab_')->field("user_id")->select();
+ // if($testlist){
+ // $testlist = implode(",",array_column($testlist, 'user_id'));
+ // }else{
+ // $testlist = false;
+ // }
+ // //获取现金充值
+ // $map = array(
+ // "payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
+ // "pay_status"=>1,
+ // "pay_way"=>array("GT",0)
+ // );
+ // if($testlist) $map['user_id']=array("in",$testlist);
+ // $cash_spend = $this->SpendModel
+ // ->field("IFNULL(SUM(pay_amount),0) as pay_amount")
+ // ->where($map)
+ // ->find()['pay_amount'];
+ // //获取平台币充值
+ // $map1 = array(
+ // "payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
+ // "pay_status"=>1
+ // );
+ // if($testlist) $map1['user_id']=array("in",$testlist);
+ // $deposit = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount'];
//测试订单录入
$map2 = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
);
$test_pay_amount = $this->TestOrderModel->where($map2)->field("IFNULL(sum(pay_amount),0) pay_amount")->find()['pay_amount'];
- $temparr['sum_money'] = number_format(($cash_spend*100 + $deposit*100 + $test_pay_amount*100 )/100, 2, '.', '');
+ $temparr['sum_money'] = number_format(($test_pay_amount*100 )/100, 2, '.', '');
$this->adddata[]=$temparr;
}
diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php
index dd76ed3a7..29c19144e 100644
--- a/Application/Admin/Controller/GameController.class.php
+++ b/Application/Admin/Controller/GameController.class.php
@@ -238,7 +238,7 @@ class GameController extends ThinkController
$gameService->saveBaseGame($baseData);
M('promote_company', 'tab_')
- ->where('1=1')
+ ->where(['company_belong' => ['not in', [1, 2]]])
->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['relation_game_id'] . '))']]);
$subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['not in', [1, 2]]])->select(false);
diff --git a/Application/Admin/Controller/GameRatioMouldController.class.php b/Application/Admin/Controller/GameRatioMouldController.class.php
index eac5363f7..17ff6fea9 100644
--- a/Application/Admin/Controller/GameRatioMouldController.class.php
+++ b/Application/Admin/Controller/GameRatioMouldController.class.php
@@ -214,11 +214,11 @@ class GameRatioMouldController extends AdminController
protected function readTurnoverRatio(&$v){
$turnover_ratio = json_decode($v['turnover_ratio'],true);
$v['turnover_ratio'] = array(
- array("ratio"=>$v['ratio']."%","name"=>"默认比例")
+ array("ratio"=>floatval($v['ratio'])."%","name"=>"默认比例")
);
foreach($turnover_ratio as $ke=>$va){
- $t=array("ratio"=>$va["ratio"]."%");
+ $t=array("ratio"=>floatval($va["ratio"])."%");
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){
diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php
index 3fb4277f6..bc03dc432 100644
--- a/Application/Admin/Controller/PartnerController.class.php
+++ b/Application/Admin/Controller/PartnerController.class.php
@@ -57,6 +57,14 @@ class PartnerController extends ThinkController
$map["_string"] = "(contract_start_time <= {$time_end} ) OR (contract_end_time <= {$time_end})";
}
+ if($_REQUEST['original_package_name']) {
+ $game_map['original_package_name'] = ['like',"%{$_REQUEST['original_package_name']}%"];
+ }
+
+ if($_REQUEST['relation_game_name']) {
+ $game_map['relation_game_name'] = ['like',"%{$_REQUEST['relation_game_name']}%"];
+ }
+
$page = intval(I('get.p', 0));
$page = $page ? $page : 1; //默认显示第一页数据
$row = intval(I('row', 0));
@@ -80,10 +88,10 @@ class PartnerController extends ThinkController
}else{
$partners = $query
->field("p.*")
- ->page($page,$row)
+// ->page($page,$row)
->select();
}
-
+// dump($partners);die();
//获取公司id
$partner_ids = array_column($partners, 'id');
@@ -125,6 +133,7 @@ class PartnerController extends ThinkController
$val['name']="月流水>".$val['begin_total_amount'];
}
}
+ $val['ratio'] = floatval($val['ratio']);
$parseGameRadiores[$val['game_id']][] = $val;
}
$myGameRadiores = $parseGameRadiores;//我方分成比例
@@ -152,7 +161,6 @@ class PartnerController extends ThinkController
}
-
$parseData = array();
foreach ($partners as $key =>$value) {
$tmpr = D("CompanyRelation")->getCompanyRelation(1,$value['id']);
@@ -194,6 +202,18 @@ class PartnerController extends ThinkController
$value['row'] = empty($row2) ? 1: $row2;
$parseData[] = $value;
}
+
+ if ($_REQUEST['original_package_name'] || $_REQUEST['relation_game_name']) {
+
+ foreach ( $parseData as $key => $value ) {
+
+ if (!$value['game']) {
+ unset($parseData[$key]);
+ }
+
+ }
+ }
+
if($is_export){
$this->assign('listData', $parseData);
$GetData = $_GET;
@@ -202,10 +222,12 @@ class PartnerController extends ThinkController
$this->display("export");
die();
}
+
+ $count = count($parseData);
/* 查询记录总数 */
- $count = $model
- ->where($map)
- ->count();
+// $count = $model
+// ->where($map)
+// ->count();
//分页
$parameter['p'] = $page;
$parameter['row'] = $row;
@@ -213,6 +235,17 @@ class PartnerController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
+
+ $arraypage = $page;
+ $size = $row;//每页显示的记录数
+ $parseData = array_slice($parseData, ($arraypage - 1) * $size, $size);
+// $page = set_pagination($count, $row, $parameter);
+// if ($page) {
+// $this->assign('_page', $page);
+// }
+// dump($arraypage);
+// dump($size);die();
+
$this->checkListOrCountAuthRestMap($map,[]);
$this->assign('listData', $parseData);
$this->assign('count', $count);
diff --git a/Application/Admin/Controller/PresidentDepositController.class.php b/Application/Admin/Controller/PresidentDepositController.class.php
index 4fc4d139d..3f071caaa 100644
--- a/Application/Admin/Controller/PresidentDepositController.class.php
+++ b/Application/Admin/Controller/PresidentDepositController.class.php
@@ -332,9 +332,10 @@ class PresidentDepositController extends ThinkController
public function payConfirm()
{
$ids = I('ids', []);
+ $acceptTime = I('accept_time', date('Y-m-d'));
try {
$service = new PresidentDepositService();
- $service->batchPayConfirm($ids);
+ $service->batchPayConfirm($ids, $acceptTime);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php
index b57537591..b47b7c5af 100644
--- a/Application/Admin/Controller/PromoteCompanyController.class.php
+++ b/Application/Admin/Controller/PromoteCompanyController.class.php
@@ -116,7 +116,7 @@ class PromoteCompanyController extends ThinkController
if(!empty($companyres)){
$companyIds = array_column($companyres, 'id') ;
- $depositList = M('president_deposit', 'tab_')->field(['company_id', 'pay_type'])->where(['company_id' => ['in', $companyIds]])->select();
+ $depositList = M('president_deposit', 'tab_')->field(['company_id', 'pay_type', 'amount', 'status'])->where(['company_id' => ['in', $companyIds]])->select();
$depositList = index_by_column('company_id', $depositList);
foreach($companyres as $k=>&$v){
@@ -125,6 +125,8 @@ class PromoteCompanyController extends ThinkController
$v["settlement_type"] = $tmpr['settlement_type'];
$v["deposit_pay_type"] = $deposit ? $payTypes[$deposit['pay_type']] : '--';
+ $v["deposit_status"] = !$deposit || $deposit['pay_type'] == PresidentDepositService::PAY_TYPE_NONE ? '--' : $statusList[$deposit['status']];
+ $v["deposit_amount"] = $deposit ? $deposit['amount'] : 0;
$v["collection"] = $tmpr['collection'];
$v["invoice_type"] = $tmpr['invoice_type'];
$v["invoice_content"] = $tmpr['invoice_content'];
@@ -186,7 +188,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);
@@ -257,7 +259,7 @@ class PromoteCompanyController extends ThinkController
$map["create_time"] = ['ELT',$time_end];
}
$model = M("promote_company_verify", 'tab_');
- $data = $model->where($map)->page($page,$row)->order("FIELD(verify_status,0,1,-1,-2,2),id desc")->select();
+ $data = $model->where($map)->page($page,$row)->order("create_time desc")->select();
foreach ($data as $k => &$v) {
$v['company_info'] = json_decode($v['company_info'],true);
if($v['company_id'] == 0){
@@ -360,6 +362,7 @@ class PromoteCompanyController extends ThinkController
$v['verify_log']['market_time']=date("Y-m-d H:i:s");
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=-1;
+ $v["create_time"] = time();
M("PromoteCompanyVerify", 'tab_')->save($v);
addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"市场部审核",'url'=>U('index')]);
}
@@ -379,6 +382,7 @@ class PromoteCompanyController extends ThinkController
$v['verify_log']['admin_time']=date("Y-m-d H:i:s");
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=-2;
+ $v["create_time"] = time();
M("PromoteCompanyVerify", 'tab_')->save($v);
addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"管理员审核",'url'=>U('index')]);
}
@@ -621,7 +625,7 @@ class PromoteCompanyController extends ThinkController
$promoteCompanyService = new PromoteCompanyService();
- $oldData = M('promote_company', 'tab_')->field(['id', 'company_belong'])->where(['id' => $save['company_id']])->find();
+ $oldData = M('promote_company', 'tab_')->field(['id', 'company_belong'])->where(['id' => $save['id']])->find();
$isNewDeposit = false;
if (!in_array($oldData['company_belong'], [1, 2]) && in_array($save['company_belong'], [1, 2])) {
$isNewDeposit = true;
@@ -1207,7 +1211,7 @@ class PromoteCompanyController extends ThinkController
}
}
if(count($diff_ids) > 0){
- $diff_ids = D("Game")->changeRelationGameidToGameid($diff_ids,true);
+ $diff_ids = D("Game")->changeRelationGameidToGameid(implode(',',$diff_ids),true);
}
if($is_change_game){
$dbres = $Promote->field("id,game_ids")->where("company_id = '{$company_id}'")->select();
@@ -1298,7 +1302,7 @@ class PromoteCompanyController extends ThinkController
if($is_export){
$CpRadio = $this->getPromoteCompanyCpRadio($game_ids);
}
-
+ // dd($CpRadio);
$endtime = time();
$rwhere = "(end_time = 0 OR end_time >= '{$endtime}') and company_id='{$company_id}' and relation_game_id in ({$game_ids})";
$cgr_res = M("CompanyGameRatio","tab_")->where($rwhere)->select();
@@ -1332,7 +1336,6 @@ class PromoteCompanyController extends ThinkController
}
}
}
-
if(empty($game_arr)){
return $senddata;
}
@@ -1372,10 +1375,10 @@ class PromoteCompanyController extends ThinkController
if(empty($game_arr)){
return $senddata;
}
-
foreach($game_arr as $k=>$v){
+ if(empty($game[$k])) continue;
$senddata[$k]= ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1];
- $senddata[$k]+= $game[$k];;
+ $senddata[$k] += $game[$k];
}
return $senddata;
}
@@ -1396,13 +1399,15 @@ class PromoteCompanyController extends ThinkController
->select();
// dd($promoteres);
$adminList = getMarketAdminsByPromoteIds(array_column($promoteres, 'id'));
+
if(empty($promoteres)){
//无会长
return ["list"=>["account" => "--","list" => ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1,"original_package_name"=>"--","relation_game_name"=>"--","game_type_name"=>"--"]],"row"=>1];
}
foreach ($promoteres as $k => &$v) {
- $v['market_admin_username'] = isset($adminList[$v['id']]) && $adminList[$v['id']]['admin'] ? $adminList[$v['id']]['admin']['username'] : '无';
+ $admin = isset($adminList[$v['id']]) && $adminList[$v['id']]['admin'] ? $adminList[$v['id']]['admin'] : null;
+ $v['market_admin_username'] = $admin ? ($admin['real_name'] ? $admin['real_name'] : $admin['username']) : '无';
if($ratio == false || empty($v['game_ids'])){
$v['row']=1;
@@ -1455,7 +1460,7 @@ class PromoteCompanyController extends ThinkController
$val['name']="月流水>".$val['begin_total_amount'];
}
}
- $parseGameRadiores[$val['game_id']][] =['name'=>$val['name'],"ratio"=>$val['ratio']];
+ $parseGameRadiores[$val['game_id']][] =['name'=>$val['name'],"ratio"=>floatval($val['ratio'])];
}
return $parseGameRadiores;
}
@@ -1463,11 +1468,11 @@ class PromoteCompanyController extends ThinkController
protected function setPromoteRadio(&$v){
$turnover_ratio = json_decode($v['turnover_ratio'],true);
$v['turnover_ratio'] = array(
- array("ratio"=>$v['ratio']."%","name"=>"默认比例")
+ array("ratio"=>floatval($v['ratio'])."%","name"=>"默认比例")
);
foreach($turnover_ratio as $ke=>$va){
- $t=array("ratio"=>$va["ratio"]."%");
+ $t=array("ratio"=>floatval($va["ratio"])."%");
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){
diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php
index 2e9ea118f..58900f04d 100644
--- a/Application/Admin/Controller/PromoteController.class.php
+++ b/Application/Admin/Controller/PromoteController.class.php
@@ -7,6 +7,7 @@ use User\Api\UserApi;
use Org\XiguSDK\Xigu;
use Base\Service\PromoteService;
use Base\Service\ApplyService;
+use Base\Service\PromoteCompanyService;
/**
* 后台首页控制器
@@ -276,6 +277,13 @@ class PromoteController extends ThinkController
if ($this->accountExist($account)) {
$this->error('该账号已存在');
}
+
+ $promoteCompanyService = new PromoteCompanyService();
+ $verifyingPromotes = $promoteCompanyService->getVerifyingPromotes();
+ if ($promoteCompanyService->isExistVerifyingPromoteAccount([$account], $verifyingPromotes)) {
+ $this->error('该账号已存在');
+ }
+
if(!empty($mobile_phone)){
//判断手机格式
if (!preg_match("/^1[3456789]{1}\d{9}$/", $mobile_phone)) {
@@ -407,6 +415,13 @@ class PromoteController extends ThinkController
if ($this->accountExist($data['account'], $_POST['id'])) {
$this->error('该账号已存在');
}
+
+ $promoteCompanyService = new PromoteCompanyService();
+ $verifyingPromotes = $promoteCompanyService->getVerifyingPromotes();
+ if ($promoteCompanyService->isExistVerifyingPromoteAccount([$data['account']], $verifyingPromotes)) {
+ $this->error('该账号已存在');
+ }
+
$company_id = I('company_id');
if ($company_id <0 && $promote['level'] ==1) {
$this->error('请选择推广公司');
diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php
index bb95ec29d..a085d0296 100644
--- a/Application/Admin/Controller/StatController.class.php
+++ b/Application/Admin/Controller/StatController.class.php
@@ -167,20 +167,23 @@ class StatController extends ThinkController
$error = '请选择游戏!';
$status = false;
}
- if ($deviceType == '') {
- $error = '请选择设备类型!';
- $status = false;
- }
$startTime = strtotime($start . ' 00:00:00');
$endTime = strtotime($end . ' 23:59:59') + 1;
if ((($endTime - $startTime)/(24*3600)) > 31) {
$error = '时间间隔不能超过31天';
$status = false;
}
+ $searchGameId = 0;
if ($status) {
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
- $gameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id'];
+ $gameIds = [];
+ if ($deviceType) {
+ $searchGameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id'];
+ $gameIds[] = $searchGameId;
+ } else {
+ $gameIds = [$baseGame['android_game_id'], $baseGame['ios_game_id']];
+ }
$client = new Client([
'base_uri' => C('TASK_URL'),
@@ -192,7 +195,7 @@ class StatController extends ThinkController
'start_time' => $start,
'end_time' => $end,
'promote_id' => I('promote_id', 0),
- 'game_id' => $gameId,
+ 'game_ids' => $gameIds,
]
]);
@@ -203,7 +206,7 @@ class StatController extends ThinkController
}
$data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
- $gameName = get_game_name($gameId);
+ $gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name'];
$promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
diff --git a/Application/Admin/Controller/TestOrderController.class.php b/Application/Admin/Controller/TestOrderController.class.php
index 638f3c3e1..6ac73b078 100644
--- a/Application/Admin/Controller/TestOrderController.class.php
+++ b/Application/Admin/Controller/TestOrderController.class.php
@@ -13,14 +13,22 @@ class TestOrderController extends ThinkController
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage = $page;
-
+ $platformType = I('platform_type', 0);
+ $startedAt = I('timestart', '') == '' ? I('start', '') : I('timestart', '');
+ $endedAt = I('timeend', '') == '' ? I('end', '') : I('timeend', '');
+ $gameId = I('game_id', 0);
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
+ $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->select();
+ $gameSets = index_by_column('game_id', $gameSets);
+ $aggGameIds = getAggExceptIds($gameSets);
+
$map['1'] = "1";
+ $map['_string'] = '1=1';
if (!empty($_REQUEST['server_type'])) {
$map['t.server_type'] = $_REQUEST['server_type'];
}
@@ -36,16 +44,20 @@ class TestOrderController extends ThinkController
if (!empty($_REQUEST['pay_way'])) {
$map['pay_way'] = $_REQUEST['pay_way'];
}
- if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])){
- $timestart = strtotime($_REQUEST['timestart']);
- $timeend = strtotime($_REQUEST['timeend'])+86399;
- $map['pay_time'] = array("between",array($timestart,$timeend));
- }else if(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
- $timestart = strtotime($_REQUEST['timestart']);
- $map['pay_time'] = array("EGT",$timestart);
- }else if (!empty($_REQUEST['timeend']) && empty($_REQUEST['timestart'])) {
- $timeend = strtotime($_REQUEST['timeend'])+86399;
- $map['pay_time'] = array("ELT",$timeend);
+ if ($startedAt != '') {
+ $map['_string'] .= ' and pay_time>=' . strtotime($startedAt . ' 00:00:00');
+ }
+ if ($endedAt != '') {
+ $map['_string'] .= ' and pay_time<=' . strtotime($endedAt . ' 23:59:59');
+ }
+ if ($platformType == 1) {
+ $map['_string'] .= ' and game_id not in(' . implode(',', $aggGameIds) . ')';
+ }
+ if ($platformType == 2) {
+ $map['_string'] .= ' and game_id in(' . implode(',', $aggGameIds) . ')';
+ }
+ if ($gameId != 0) {
+ $map['_string'] .= ' and game_id=' . $gameId;
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
@@ -56,8 +68,9 @@ class TestOrderController extends ThinkController
->join("tab_game g on t.game_id = g.id","left")
->where($map)->page($page,$row)->order('add_time desc')->select();
foreach ($order_list as $k => &$v) {
- $v['game_name'] =clearGameNameType($v['game_name']);
- $v['sdk_version'] =getGameTypeName($v['sdk_version']);
+ $v['game_name'] = clearGameNameType($v['game_name']);
+ $v['sdk_version'] = getGameTypeName($v['sdk_version']);
+ $v['platform_type'] = in_array($v['game_id'], $aggGameIds) ? '聚合' : '联运';
}
$sum_order_amount = M('test_order', 'tab_')->alias("t")->where($map)->field('sum(order_amount) as sum_order_amount,count(1) as count')->find();
$sum_pay_amount = M('test_order', 'tab_')->alias("t")->where($map)->field('sum(pay_amount) as sum_order_amount')->find();
diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php
index 42875bfdc..720765752 100644
--- a/Application/Admin/Controller/TimingController.class.php
+++ b/Application/Admin/Controller/TimingController.class.php
@@ -755,6 +755,226 @@ class TimingController extends AdminController {
}
}
+
+ /**
+ * 获取下游公司的特殊补点金额
+ * @param int $start_time
+ * @param int $end_time
+ * @return array
+ */
+ public function getSpecialComplement($start_time=0,$end_time =0,$promote_id = 0) {
+
+ $data = M("company_statement","tab_")->where("statement_begin_time<={$start_time} and statement_end_time<={$end_time} and withdraw_type=3")->select();
+
+ $return = [];
+ foreach ($data as $key => $value) {
+ $statement_info = json_decode($value['statement_info'],true);
+
+ if ($value['company_type'] == 2) {
+
+ foreach ($statement_info as $skey => $sval) {
+ $info = $sval['game_list'];
+ foreach ($info as $k => $v) {
+ //
+ if (isset($return[$statement_info['promote_id'].$v['relation_game_id']])) {
+ $return[$value['company_id']."-".$sval['promote_id']."-".$v['relation_game_id']] = $v['sum_money'];
+ } else {
+ $return[$value['company_id']."-".$sval['promote_id']."-".$v['relation_game_id']] += $v['sum_money'];
+ }
+
+ }
+
+ }
+ } else {
+ //判断公司比例是不是隶属于这个会长
+ $compamy_info = M("promote","tab_")->where(['id'=>$promote_id,'company_id'=>$value['company_id']])->find();
+ if ($compamy_info) {
+ foreach ($statement_info as $k => $v) {
+ $statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time']));
+ $statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399;
+ $amount_time['tab_spend.pay_status'] = 1;
+ $amount_time['pay_way'] = ['egt',0];
+ $amount_time['_string'] = "payed_time between {$statement_begin_time} and {$statement_end_time} and relation_game_id={$v['relation_game_id']}";
+
+ $dataAmount = M("spend","tab_")
+ ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name,substring_index(substring_index(promote.`chain`,'/',2),'/',-1) promote_id,chain,admin_id")
+ ->join("left join tab_promote promote on tab_spend.promote_id=promote.id")
+ ->join("left join tab_game game on tab_spend.game_id=game.id")
+ ->where($amount_time)
+ ->select(false);
+
+ $dataAmount = M()->table("({$dataAmount})a")
+ ->field("a.*,sum(pay_amount) pay_amount,promote.account,member.real_name")
+ ->join("left join tab_promote promote on promote_id=promote.id")
+ ->join("left join sys_member member on promote.admin_id=member.uid ")
+ ->where(['promote_id'=>$promote_id])
+ ->group("promote_id")
+ ->find();
+
+ $return[$value['company_id']."-".$promote_id."-".$v['relation_game_id']] += ($dataAmount['pay_amount']*$v['increment_ratio'])/100;
+ }
+ }
+
+ }
+
+ }
+
+ return $return;
+
+ }
+
+ public function test() {
+ $this->getSpecialComplement(strtotime(date("Y-m-1",strtotime("2020-07"))),strtotime(date("Y-m-t",strtotime("2020-07")))+86399,2259);
+ }
+
+
+// $admin_id = 0,$promote_id = 0,$company_id=0,$relation_game_id=0,$date ='',$pay_amount = 0
+ public function getCompanyGameRadio($admin_id = 0,$promote_id = 0,$company_id=0,$relation_game_id=0,$date ='',$pay_amount = 0) {
+// $company_id=273;
+// $relation_game_id=213;
+// $pay_amount = 440;
+// $date = "2020-07";
+// $admin_id = 50;
+// $promote_id = 3711;
+ $begintime = strtotime(date("Y-m-1",strtotime($date)));
+ $endtime = strtotime(date("Y-m-t",strtotime($date)))+86399;
+
+ $company_game_ratio = M("company_game_ratio","tab_")
+ ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id])
+ ->where("(end_time>={$begintime} and (end_time<={$endtime} and end_time!=0)) or (begin_time>={$begintime} and begin_time<={$endtime}) or (begin_time<={$begintime} and (end_time>={$endtime} or end_time=0))")
+ ->order("begin_time ASC")
+ ->select();
+
+ $company_data = M('promote_company','tab_')
+ ->field("company_belong")
+ ->where("id=$company_id")
+ ->find();
+
+ $game_ratio_mould = M("game_ratio_mould","tab_")
+ ->where(['relation_game_id'=>$relation_game_id,'company_belong'=>$company_data['company_belong']])
+ ->find();
+
+ $mould = json_decode($game_ratio_mould['turnover_ratio'],true);
+ $amount = 0;
+
+ if (!$company_game_ratio) {
+ $spend = $this->getSpendData($begintime,$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
+ }
+
+ foreach ($company_game_ratio as $key => $value) {
+ $turnover_ratio = json_decode($value['turnover_ratio'],true);
+
+ if($value['begin_time'] > $begintime) {
+
+ if ($key == 0) {
+ $spend = $this->getSpendData($begintime,$value['begin_time']-1,$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
+ }
+
+ if ($value['end_time']<$endtime&&($value['end_time']!=0)) {
+ $spend = $this->getSpendData($value['begin_time'],$value['end_time'],$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
+ } else {
+ $spend = $this->getSpendData($value['begin_time'],$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
+ break;
+ }
+
+
+
+ } elseif ($value['begin_time']<=$begintime) {
+
+ $value['begin_time']=$begintime;
+ if ($value['end_time']<$endtime&&($value['end_time']!=0)) {
+ $spend = $this->getSpendData($value['begin_time'],$value['end_time'],$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
+ } else {
+ $spend = $this->getSpendData($value['begin_time'],$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
+ break;
+ }
+
+ }
+
+ //缺片段的情况下用模板比例补充
+ if ($company_game_ratio[$key+1]['begin_time'] != $value['end_time']+1 && $company_game_ratio[$key+1]) {
+ $spend = $this->getSpendData($value['end_time']+1,$company_game_ratio[$key+1]['begin_time']-1,$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
+ }
+
+ //如果最后还有缺失的片段再用模板补齐
+ if(!$company_game_ratio[$key+1]&&$endtime>$value['end_time']) {
+ $spend = $this->getSpendData($value['end_time']+1,$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
+ $amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
+ }
+
+ }
+
+ return $amount?$amount:0;
+
+
+ }
+
+
+ public function setSpendData($spend=[],$turnover_ratio=[],$radio=0,$pay_amount=0) {
+
+ $turnover = 0;
+ $amount= 0;
+ foreach ($spend as $k => $v) {
+ //获取的金额
+
+ $amount = ($v['pay_amount'] * ($radio?$radio:0))/100;
+
+ foreach ( $turnover_ratio as $tk => $tv ) {
+ //判断大于的流水是否比前一个要小
+ if ($turnover >= $tv['turnover']) {
+ continue;
+ }
+
+ if ($tv['instanceof']==1) {
+ if ($pay_amount >= $tv['turnover']) {
+ $amount = ($v['pay_amount'] * ($tv['ratio']?$tv['ratio']:0))/100;
+ $turnover = $tv['turnover'];
+ }
+ } else {
+ if ($pay_amount > $tv['turnover']) {
+ $amount = ($v['pay_amount'] * ($tv['ratio']?$tv['ratio']:0))/100;
+ $turnover = $tv['turnover'];
+ }
+ }
+
+ }
+
+ }
+
+ return $amount;
+ }
+
+ public function getSpendData($begintime = 0,$endtime = 0,$company_id=0,$relation_game_id=0,$admin_id=0,$promote_id=0) {
+ $map['tab_spend.pay_status'] = 1;
+ $map['pay_way'] = ['egt',0];
+
+ $spend = M("spend","tab_")
+ ->field("sum(pay_amount) pay_amount,
+ CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,game.relation_game_id,company_id")
+ ->join("left join tab_game game on tab_spend.game_id = game.id")
+ ->join("left join tab_promote promote on tab_spend.promote_id = promote.id")
+ ->where($map)
+ ->where(['payed_time'=>['between',[$begintime,$endtime]],'company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'market_admin_id'=>$admin_id])
+ ->group("tab_spend.id")
+ ->select(false);
+
+ $spend = M()->table("({$spend})a")
+ ->field("*,sum(pay_amount) pay_amount")
+ ->where(['promote_id'=>$promote_id])
+ ->group("promote_id")
+ ->select();
+
+ return $spend;
+ }
+
+
//计算市场专员业绩公式 参数 time 2020-10
public function caculateMarketStream () {
echo date("Y-m-d H:i:s")."----------------------市场结算管理计算----------------------\n";
@@ -886,10 +1106,10 @@ class TimingController extends AdminController {
->join("left join ({$data}) auth on auth.uid=market_admin_id")
->where(['develop_type'=>['egt',1],'group_id'=>['in',['11','12','21']]])
->select();
-// dump($spend);die();
//
// dump($tax_radio);die();
+ $specialPayAmount = [];
foreach ($promote_data as $key => $value) {
@@ -900,12 +1120,24 @@ class TimingController extends AdminController {
//上游流水
$promote_data[$key]['cp_amount'] = $value['pay_amount'] * ($cp_radio * 0.01);
//下游
- $promote_radio = getGamePromoteCompanyRadio($value['company_id'],$value['relation_game_id'],time(),$value['pay_amount'],true,$value['company_belong']);
- if (!$promote_radio) {
- $promote_radio = getGamePromoteCompanyRadio($value['company_id'],$value['relation_game_id'],time(),$value['pay_amount'],false,$value['company_belong']);
- }
+// $promote_radio = getGamePromoteCompanyRadio($value['company_id'],$value['relation_game_id'],time(),$value['pay_amount'],true,$value['company_belong']);
+// if (!$promote_radio) {
+// $promote_radio = getGamePromoteCompanyRadio($value['company_id'],$value['relation_game_id'],time(),$value['pay_amount'],false,$value['company_belong']);
+// }
+
+ //下游流水
+ $promote_data[$key]['promote_amount'] = $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$value['pay_time'],$value['pay_amount']);
//下游流水
- $promote_data[$key]['promote_amount'] = $value['pay_amount'] * ($promote_radio * 0.01);
+// $promote_data[$key]['promote_amount'] = $value['pay_amount'] * ($promote_radio * 0.01);
+
+
+
+ //特殊补点
+ $specialPayAmount[$value['pay_time']] = $this->getSpecialComplement(strtotime(date("Y-m-1",strtotime($value['pay_time']))),strtotime(date("Y-m-t",strtotime($value['pay_time'])))+86399,$value['promote_id']);
+
+ $specialAmount = $specialPayAmount[$value['pay_time']][$value['company_id']."-".$value['promote_id']."-".$value['relation_game_id']]?$specialPayAmount[$value['pay_time']][$value['company_id']."-".$value['promote_id']."-".$value['relation_game_id']]:0;
+
+
//渠道费用
$promote_data[$key]['channel_amount'] = $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['admin_id']];
$tax = 0;
@@ -919,7 +1151,9 @@ class TimingController extends AdminController {
$promote_data[$key]['company_tax'] = ($value['pay_amount']-$promote_data[$key]['cp_amount']- $promote_data[$key]['promote_amount'])*($tax/100);
//毛利
- $promote_data[$key]['company_profit'] = $value['pay_amount']-$promote_data[$key]['cp_amount']-$promote_data[$key]['promote_amount']-$promote_data[$key]['channel_amount']-$promote_data[$key]['company_tax'];
+ $promote_data[$key]['company_profit'] = $value['pay_amount']-$promote_data[$key]['cp_amount']-$promote_data[$key]['promote_amount']-$promote_data[$key]['channel_amount']-$promote_data[$key]['company_tax']-$specialAmount;
+
+ $promote_data[$key]['promote_amount'] += $specialAmount;
if ($value['promote_id'] == 0) {
// $promote_data[$key]['promote_account']='官方渠道';
@@ -935,6 +1169,7 @@ class TimingController extends AdminController {
->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'admin_id'=>$value['admin_id']])
->find();
echo "日期:{$value['pay_time']},游戏:{$value['game_name']},推广员:{$value['promote_account']}\n";
+ echo "市场员:{$value['admin_id']} 推广员:{$value['promote_id']} 公司id:{$value['company_id']} 游戏关联id:{$value['relation_game_id']} 支付时间:{$value['pay_time']} 金额:{$value['pay_amount']}\n";
// dump($promote_data[$key]);die();
if (!$marker_data) {
M("settleup_marketorder","tab_")
diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php
index 48c7c8bfd..f20320617 100644
--- a/Application/Admin/Controller/UserController.class.php
+++ b/Application/Admin/Controller/UserController.class.php
@@ -387,6 +387,15 @@ class UserController extends AdminController
$this->error('该手机号码已经添加过!');
}
}
+
+ $group = M('auth_group', 'sys_')->where(['id' => I('auth')])->find();
+ if (is_null($group)) {
+ $this->error('角色类型不存在!');
+ } else {
+ if (isMarketLeader() && strpos($group['title'], '市场专员') === false) {
+ $this->error('市场总监只允许操作允许编辑市场专员账号!');
+ }
+ }
// if (isset($_POST['mobile']) && $_POST['mobile'] != '') {
// $dx = A('Phone');
// $res = $dx->check_tel_code($_POST['mobile'], $_POST['code']);
diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php
index c923c197b..b3f15a73e 100644
--- a/Application/Admin/Model/CmdTasksModel.class.php
+++ b/Application/Admin/Model/CmdTasksModel.class.php
@@ -43,10 +43,8 @@ class CmdTasksModel extends Model{
//插入任务
public function addTask($type,$params,$need_path=true)
{
- $task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find();
- if(!empty($task)){
- return false;
- }
+ if(!$this->isCanAddTask($type)) return false;
+
if($need_path){
if(IS_WIN){
$p = explode(':',ROOTTTTT);
@@ -64,4 +62,13 @@ class CmdTasksModel extends Model{
];
return $this->add($save);
}
+ //验证任务
+ public function isCanAddTask($type)
+ {
+ $task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find();
+ if(!empty($task)){
+ return false;
+ }
+ return true;
+ }
}
\ No newline at end of file
diff --git a/Application/Admin/Model/PaymentMerchantModel.class.php b/Application/Admin/Model/PaymentMerchantModel.class.php
index 0ecc5434b..7b8f65ecd 100644
--- a/Application/Admin/Model/PaymentMerchantModel.class.php
+++ b/Application/Admin/Model/PaymentMerchantModel.class.php
@@ -13,8 +13,8 @@ class PaymentMerchantModel extends Model
"4"=>"快捷支付"
];
public $Channel=[
- "1"=>"支付宝",
- "2"=>"微信",
+ "1"=>"官方支付宝",
+ "2"=>"官方微信",
"3"=>"易宝支付",
"4"=>"双乾支付",
"5"=>"汇付宝支付"
diff --git a/Application/Admin/View/CompanyGameRatio/addRatio.html b/Application/Admin/View/CompanyGameRatio/addRatio.html
index e06e7f857..ca657fe45 100644
--- a/Application/Admin/View/CompanyGameRatio/addRatio.html
+++ b/Application/Admin/View/CompanyGameRatio/addRatio.html
@@ -238,6 +238,30 @@ $(function(){
var elementIdName = $(this).attr('id');
promoteGameRatioData[elementIdName] = val;
});
+
+ function getMonday() {
+ var nowTemp = new Date();//当前时间
+
+ var oneDayLong = 24*60*60*1000 ;//一天的毫秒数
+
+ var c_time = nowTemp.getTime() ;//当前时间的毫秒时间
+
+ var c_day = nowTemp.getDay()||7;//当前时间的星期几
+
+ var m_time = c_time - (c_day-1)*oneDayLong;//当前周一的毫秒时间
+
+ var monday = new Date(m_time);//设置周一时间对象
+ var m_year = monday.getFullYear();
+
+ var m_month = monday.getMonth()+1;
+ if (m_month<10) {
+ m_month = '0'+ m_month;
+ }
+
+ var m_date = monday.getDate();
+ return m_year+'-'+m_month+'-'+m_date;
+ }
+
subevn();
function subevn(){
$('#submit').off("click");
@@ -251,7 +275,7 @@ $(function(){
"begin_time":["date","开始时间不能为空"],
"end_time":["nocheck"],
"remark":["nocheck",'',"textarea"]
- }
+ };
var cres = CIC.checkAddInput(obj);
if(!cres){
return false;
@@ -277,7 +301,15 @@ $(function(){
layer.msg("流水及比例不允许为空", {icon: 2});
return false;
}
- })
+ });
+ var momday = getMonday();
+
+ //判断日期是否小于当周周一
+ if (momday > cres.begin_time) {
+ layer.msg("配置的开始日期不能大于当周周一", {icon: 2});
+ return false;
+ }
+
if(!flag){
return false;
diff --git a/Application/Admin/View/CompanyStatement/lists.html b/Application/Admin/View/CompanyStatement/lists.html
index 944bbb1cc..609360396 100644
--- a/Application/Admin/View/CompanyStatement/lists.html
+++ b/Application/Admin/View/CompanyStatement/lists.html
@@ -124,6 +124,8 @@
+
+