财务对比ok

master
chenzhi 5 years ago
parent b2ad4e8b6e
commit 5ddf75a600

@ -5,7 +5,7 @@ class FinanceCompareController extends ThinkController
public $zfb = [1];//官方支付宝渠道id
public $wx = [2,3];//微信渠道id
public $ybzf = [17];//易宝渠道id
public $erro_size = 2000;//商家不存在的错误阈值,到达就不执行
public $erro_size = 20000;//商家不存在的错误阈值,到达就不执行
public $page_size = 1000;//每次执行比较的数量
public $payway = [
"1"=>"支付宝",
@ -39,7 +39,7 @@ class FinanceCompareController extends ThinkController
if ($_REQUEST['pay_way'] != '') {
$map['pay_way'] = $_REQUEST['pay_way'];
}
$listdata = M("finance_compare","tab_")->where($map);
$listdata = M("finance_compare","tab_")->where($map)->order("create_time desc");
if(isset($_REQUEST['export'])){
$listdata = $listdata->select();
$count = M("finance_compare","tab_")->where($map)->count();
@ -244,6 +244,7 @@ class FinanceCompareController extends ThinkController
"pay_way"=>$pay_way,
"is_read"=>0
];
if($pay_where == 'SP'){
$tmp['order_type']=1;
$sp[$v[$keys[0]]] = $tmp;
@ -313,14 +314,22 @@ class FinanceCompareController extends ThinkController
"compare_id"=>$checkdata['compare_id'],
"order_type"=>1
];
$fcisql = M("finance_compare_info","tab_")->field("pay_order_number")->where($fmap)->select(false);
//改为join
$fcisql = M("finance_compare_info","tab_")->field("pay_order_number,compare_id")->where($fmap)->select(false);
$map = [
"pay_order_number"=>["not in",$fcisql],
"pay_time" => ['between', [strtotime($checkdata['begin_time']), strtotime($checkdata['end_time']) + 86399]],
"pay_status"=>1,
"pay_way"=>["in",$check_arr]
// "pay_order_number"=>["not in",$fcisql],
"s.pay_time" => ['between', [strtotime($checkdata['begin_time']), strtotime($checkdata['end_time']) + 86399]],
"s.pay_status"=>1,
"s.pay_way"=>["in",$check_arr]
];
$res = M("Spend","tab_")->field("pay_order_number,pay_amount,pay_status,pay_way")->where($map)->limit($this->erro_size)->select();
$res = M("Spend s","tab_")
->field("s.pay_order_number,s.pay_amount,s.pay_status,s.pay_way,ifnull(fc.compare_id,0) compare_id")
->join("( $fcisql ) fc on s.pay_order_number = fc.pay_order_number","left")
->where($map)
->having("compare_id = 0")
->limit($this->erro_size)
->select();
if(count($res) >= $this->erro_size){
$this->delCompare($checkdata['compare_id']);
$this->ajaxReturn(array("error"=>"商家不存在的数据大于{$this->erro_size}条,没有比较的意义,请确认表格的渠道和时间是否正确","code"=>40004));
@ -371,14 +380,19 @@ class FinanceCompareController extends ThinkController
"compare_id"=>$checkdata['compare_id'],
"order_type"=>2
];
$fcisql = M("finance_compare_info","tab_")->field("pay_order_number")->where($fmap)->select(false);
$fcisql = M("finance_compare_info","tab_")->field("pay_order_number,compare_id")->where($fmap)->select(false);
$map = [
"pay_order_number"=>["not in",$fcisql],
"create_time" => ['between', [strtotime($checkdata['begin_time']), strtotime($checkdata['end_time']) + 86399]],
"pay_status"=>1,
"pay_way"=>["in",$check_arr]
];
$res = M("Deposit","tab_")->field("pay_order_number,pay_amount,pay_status,pay_way")->where($map)->limit($this->erro_size)->select();
$res = M("Deposit s","tab_")
->field("s.pay_order_number,s.pay_amount,s.pay_status,s.pay_way,ifnull(fc.compare_id,0) compare_id")
->join("( $fcisql ) fc on s.pay_order_number = fc.pay_order_number","left")
->where($map)
->having("compare_id = 0")
->limit($this->erro_size)
->select();
if(count($res) >= $this->erro_size){
$this->delCompare($checkdata['compare_id']);
$this->ajaxReturn(array("error"=>"商家不存在的数据大于{$this->erro_size}条,没有比较的意义,请确认表格的渠道和时间是否正确","code"=>40004));
@ -446,9 +460,9 @@ class FinanceCompareController extends ThinkController
//存在
$flag = true;
$ydata[$v['pay_order_number']]['pt_pay_amount'] = $v['pay_amount'];
$ydata[$v['pay_order_number']]['diff_money'] = abs($ydata[$v['pay_order_number']]['pt_pay_amount']-$v['pay_amount']);
$ydata[$v['pay_order_number']]['diff_money'] = abs($ydata[$v['pay_order_number']]['pt_pay_amount']-$ydata[$v['pay_order_number']]['sj_pay_amount']);
if($ydata[$v['pay_order_number']]['sj_pay_amount'] != $v['pay_amount']){//金额不符
if($ydata[$v['pay_order_number']]['sj_pay_amount'] - $v['pay_amount'] > 0){//金额不符
$ydata[$v['pay_order_number']]['type'] = 1;
$flag = false;
continue;

@ -156,6 +156,11 @@
}
},
error:function(){
MSG.hidemsg();
layer.alert("网络错误或超时");
return false;
}
});
},
//创建面单
@ -169,7 +174,7 @@
//循环比较
loopCheck:function(page,callback){
if(page > sendDefaultData.check_page){
MSG.showmsg("生成平台 游戏流水比对订单......");
MSG.showmsg("生成平台 游戏流水比对订单,此过程需要较长时间,请耐心等待......");
callback();
return;
}

Loading…
Cancel
Save