财务对比7

master
chenzhi 5 years ago
parent c4eb963cfe
commit 79f4719dec

@ -5,14 +5,13 @@ class FinanceCompareController extends ThinkController
public $zfb = [1];//官方支付宝渠道id public $zfb = [1];//官方支付宝渠道id
public $wx = [2,3];//微信渠道id public $wx = [2,3];//微信渠道id
public $ybzf = [17];//易宝渠道id public $ybzf = [17];//易宝渠道id
public $erro_size = 2000;//错误阈值,到达就不执行 public $erro_size = 2000;//商家不存在的错误阈值,到达就不执行
public $page_size = 10;//每次执行比较的数量 public $page_size = 10;//每次执行比较的数量
public function add() public function add()
{ {
$this->assign("page_size",$this->page_size); $this->assign("page_size",$this->page_size);
$this->display(); $this->display();
# code...
} }
public function creatCompare() public function creatCompare()
{ {
@ -127,7 +126,7 @@ class FinanceCompareController extends ThinkController
]; ];
$res = M("Spend","tab_")->field("pay_order_number,pay_amount,pay_status,pay_way")->where($map)->limit($this->erro_size)->select(); $res = M("Spend","tab_")->field("pay_order_number,pay_amount,pay_status,pay_way")->where($map)->limit($this->erro_size)->select();
if(count($res) >= $this->erro_size){ if(count($res) >= $this->erro_size){
$this->ajaxReturn(array("error"=>"数据差别相差大于{$this->erro_size}条,没有比较的意义,请确认表格的渠道和时间是否正确","code"=>40004)); $this->ajaxReturn(array("error"=>"商家不存在的数据大于{$this->erro_size}条,没有比较的意义,请确认表格的渠道和时间是否正确","code"=>40004));
} }
$saveres = true; $saveres = true;
if(count($res) > 0){ if(count($res) > 0){
@ -181,9 +180,9 @@ class FinanceCompareController extends ThinkController
"pay_status"=>1, "pay_status"=>1,
"pay_way"=>["in",$check_arr] "pay_way"=>["in",$check_arr]
]; ];
$res = M("Deposit","tab_")->field("pay_order_number,pay_amount,pay_status,pay_way")->where($map)->select(); $res = M("Deposit","tab_")->field("pay_order_number,pay_amount,pay_status,pay_way")->where($map)->limit($this->erro_size)->select();
if(count($res) > 10000){ if(count($res) >= $this->erro_size){
$this->ajaxReturn(array("error"=>"数据差别相差大于10000条,没有比较的意义,请确认表格的渠道和时间是否正确","code"=>40004)); $this->ajaxReturn(array("error"=>"商家不存在的数据大于{$this->erro_size}条,没有比较的意义,请确认表格的渠道和时间是否正确","code"=>40004));
} }
$saveres = true; $saveres = true;
if(count($res) > 0){ if(count($res) > 0){
@ -211,7 +210,35 @@ class FinanceCompareController extends ThinkController
$this->ajaxReturn(array("error"=>"比对数据添加失败","code"=>40005)); $this->ajaxReturn(array("error"=>"比对数据添加失败","code"=>40005));
} }
} }
/**
* 生成最终比较统计
* @param [type] $dbres
* @param [type] $ydata
* @return void
*/
public function creatCompareCount()
{
$checkdata = I('POST.');
$compare_id = $checkdata['compare_id'];
//统计
$imap = [
"compare_id"=>$compare_id,
"type"=>["gt",0]
];
$ires = M("finance_compare_info","tab_")->field("IFNULL(sum(diff_money),0) diff_money,IFNULL(count(*),0) count")->find();
$savedata = [
"diff_count"=>$ires['count'],
"diff_money"=>$ires['diff_money'],
"check_status"=>1
];
$res = M("finance_compare","tab_")->where("id='{$compare_id}'")->save($savedata);
if($res){
$this->ajaxReturn(array("success"=>"ok","code"=>0,"data"=>[]));
}else{
$this->ajaxReturn(array("error"=>"save error","code"=>40006));
}
}
//比较数据库与原数据 //比较数据库与原数据
protected function setDiffData($dbres,&$ydata) protected function setDiffData($dbres,&$ydata)
{ {

@ -143,6 +143,7 @@
//循环比较 //循环比较
loopCheck:function(page,callback){ loopCheck:function(page,callback){
if(page > sendDefaultData.check_page){ if(page > sendDefaultData.check_page){
MSG.showmsg("生成平台 游戏流水比对订单......");
callback(); callback();
return; return;
} }
@ -168,7 +169,7 @@
end_time:sendDefaultData.end_time, end_time:sendDefaultData.end_time,
} }
COMPARE.publiucAjax("{:U('checkSpendData')}",senddata,function(data){ COMPARE.publiucAjax("{:U('checkSpendData')}",senddata,function(data){
MSG.showmsg("生成平台 游戏流水比对订单......"); MSG.showmsg("生成平台 平台币比对订单......");
console.log(data) console.log(data)
callback(); callback();
}); });
@ -182,10 +183,21 @@
end_time:sendDefaultData.end_time, end_time:sendDefaultData.end_time,
} }
COMPARE.publiucAjax("{:U('checkDepositData')}",senddata,function(data){ COMPARE.publiucAjax("{:U('checkDepositData')}",senddata,function(data){
MSG.showmsg("生成平台 平台币比对订单......"); MSG.showmsg("生成最后比较统计......");
console.log(data)
callback(); callback();
}); });
},
//执行最后统计
creatCompareCount:function(){
var senddata = {
compare_id:sendDefaultData.compare_id,
};
COMPARE.publiucAjax("{:U('creatCompareCount')}",senddata,function(data){
MSG.showmsg("导入比较成功,执行跳转中......");
setTimeout(function(){
window.location.href = "{:U('index')}";
},2000)
});
} }
} }
@ -260,7 +272,7 @@
COMPARE.loopCheck(1,function(){ COMPARE.loopCheck(1,function(){
COMPARE.checkSpendData(function(){ COMPARE.checkSpendData(function(){
COMPARE.checkDepositData(function(){ COMPARE.checkDepositData(function(){
COMPARE.creatCompareCount();
}) })
}) })
}) })

Loading…
Cancel
Save