|
|
@ -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)
|
|
|
|
{
|
|
|
|
{
|
|
|
|