You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

836 lines
30 KiB
PHP

<?php
namespace Payment\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class PaymentController extends BaseController
{
public $PayStatus=[
"-2"=>"信息配置不全",
"-1"=>"打款失败",
"0"=>"未打款",
"1"=>"打款成功"
];
public $CompanyType = [
"1"=>"下游公司",
"2"=>"下游个人",
"3"=>"上游CP"
];
public $ALIRSP=[
"out_biz_no"=>"商户订单号",
"order_id"=>"支付订单号",
"pay_fund_order_id"=>"资金流水号",
"status"=>"转账状态",
"trans_date"=>"订单支付时间",
"msg"=>"支付信息",
"sub_msg"=>"失败描述",
"sub_code"=>"失败码",
"remark"=>"打款备注",
"code"=>"打款状态码"
];
public function _initialize()
{
$this->admininfo = session('payment_user');;
// $this->DBModel = M("CompanyStatementPool","tab_");
parent::_initialize();
}
public function lists()
{
$params = I('get.');
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$map=[
"i.verify_status"=>["in","-1,1"],
];
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(i.statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (i.statement_end_time BETWEEN {$time_start} AND {$time_end})";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
$map["_string"] = "(i.statement_begin_time >= {$time_start} ) OR (i.statement_end_time >= {$time_start})";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(i.statement_begin_time <= {$time_end} ) OR (i.statement_end_time <= {$time_end})";
}
if (isset($_REQUEST['pay_time_start']) && isset($_REQUEST['pay_time_end'])) {
$map['i.pay_time'] = ['between', [strtotime($_REQUEST['pay_time_start']), strtotime($_REQUEST['pay_time_end']) + 86399]];
} elseif (isset($_REQUEST['pay_time_start'])) {
$map['i.pay_time'] = ['EGT', strtotime($_REQUEST['pay_time_start'])];
} elseif (isset($_REQUEST['pay_time_end'])) {
$map['i.pay_time'] = ['ELT', strtotime($_REQUEST['pay_time_end']) + 86399];
}
if (isset($_REQUEST['verifytime_start']) && isset($_REQUEST['verifytime_end'])) {
$map['i.verify_time'] = ['between', [strtotime($_REQUEST['verifytime_start']), strtotime($_REQUEST['verifytime_end']) + 86399]];
} elseif (isset($_REQUEST['verifytime_start'])) {
$map['i.verify_time'] = ['EGT', strtotime($_REQUEST['verifytime_start'])];
} elseif (isset($_REQUEST['verifytime_end'])) {
$map['i.verify_time'] = ['ELT', strtotime($_REQUEST['verifytime_end']) + 86399];
}
if(isset($_REQUEST['company_type'])){
$map['i.company_type'] = $_REQUEST['company_type'];
}
if(isset($_REQUEST['company_id'])){
$map['i.company_id'] = $_REQUEST['company_id'];
}
if(isset($_REQUEST['pay_status'])){
if($_REQUEST['pay_status'] == -2){
$map['i.verify_status'] = -1;
}else{
$map['i.pay_status'] = $_REQUEST['pay_status'];
}
}
if(isset($_REQUEST['pay_type'])){
$map['i.pay_type'] = $_REQUEST['pay_type'];
}
// dump($map);
$CompanyInfo = M("company_statement_info","tab_")
->alias('i')
->field("i.*,p.statement_num statement_pool_num")
->join("tab_company_statement_pool p ON p.id = i.pool_id")
->where($map)
->page($page,$row)
->order("FIELD(pay_status,0,-1,1),verify_status desc")
->select();
foreach($CompanyInfo as $k=>&$v){
$v['can_pay'] = 1;
if($v['verify_status'] == -1){
$v['verify_status_str']="信息配置不全";
$v['can_pay'] = 0;
}else{
if($v['pay_status'] == 1){ $v['can_pay'] = 0; }
$v['verify_status_str'] = $this->PayStatus[$v['pay_status']];
if($v['pay_status'] == 1){
$v['pay_type'] = $v['pay_type'] == 1 ? "提现" :"线上打款";
$v['verify_status_str'] .= ("/". $v['pay_type']);
}
}
if($v['pay_verify_status'] == 0){
$v['verify'] = "--";
}else {
$member = M("payment_member")
->field("name")
->where(['id'=>$v['verify_member_id']])
->find();
$v['verify'] = (($v['pay_verify_status'] == 1)?'审核通过':'审核拒绝')."({$member['name']})<br>".date('Y-m-d H:i:s', $v['verify_time']);;
}
$v['company_type'] = $this->CompanyType[$v['company_type']];
$v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
$v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
if(empty($v['pay_time'])){
$v['pay_time'] = "--";
}else{
$v['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']);
}
$v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
}
//统计待打款金额
$countmap = $map;
$countmap['pay_status']=["neq",1];
$money = M("company_statement_info","tab_")->alias('i')->field("sum(statement_money) statement_money")->where($countmap)->find();
$count = M("company_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
$page = set_pagination($count['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
$this->meta_title = '打款结算单';
$this->assign("data",$CompanyInfo);
$this->assign("money",$money);
$this->assign("CompanyType", $this->CompanyType);
$this->assign("PayStatus", $this->PayStatus);
$this->display();
}
//查看
public function viewPool()
{
if(!isset($_REQUEST['id'])){
$this->error('参数错误');
}
$id = $_REQUEST['id'];
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
}
//获取基本信息
$dbres = M("company_statement_info","tab_")->where("id='{$id}'")->select();
$title = $dbres[0]['company_name'];
$this->assign("title",$title);
if($dbres[0]['company_type'] == 3){
//上游
$this->viewCpPool($dbres,$is_export);
}elseif($dbres[0]['company_type'] == 1){
//下游公司
$this->viewPcPool($dbres,$is_export);
}else{
$this->viewPuPool($dbres,$is_export);
}
}
//个人汇总结算查看
public function viewPuPool(&$infolist,$is_export){
$line = 1;
$count = [];
//获取对接人
foreach($infolist as $k=>&$v){
$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']);
$cline = $line+1;
if($is_export){
$v['sum_money_exp'] = "=";
}
foreach($v['statement_info'] as $ke=>&$va){
$line ++;
if(isset($va['ratio'])){
$va['increment_ratio'] = 0;
}else{
$va['ratio'] = 0;
}
if($is_export){
//J3*(K3+L3)+M3-N3
$va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
$count['sum_money_exp'] .= "O{$line}+";
$count['platform_amount_exp'] .= "J{$line}+";
}else{
$count['platform_amount'] += $va['pay_amount'];
$count['sum_money'] += $va['sum_money'];
}
}
$v['statement_count'] = count($v['statement_info']);
}
if($is_export){
$count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+");
$count["sum_money"] = "=".trim($count["sum_money_exp"],"+");
}
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
$this->display("viewPuPool");
}
//下游汇总结算查看
public function viewPcPool(&$infolist,$is_export){
$line = 1;
$count = [];
//获取对接人
$p_id = array_column($infolist,'company_id');
$map['id'] = ['in',$p_id];
$pl = M("promote_company","tab_")->field("id,settlement_contact")->where($map)->select();
$Partner = [];
foreach($pl as $k=>$v){
$Partner[$v['id']] = $v['settlement_contact'];
}
unset($pl);
foreach($infolist as $k=>&$v){
$v['statement_info'] = json_decode($v['statement_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']);
$cline = $line+1;
if($is_export){
$v['statement_money_exp'] = "=";
}
foreach($v['statement_info'] as $ke=>&$va){
$line ++;
if(isset($va['ratio'])){
$va['increment_ratio'] = 0;
}else{
$va['ratio'] = 0;
}
if($is_export){
$v['statement_money_exp'] .= "H{$line}+";
$va['d_statement_money'] = "=D{$line}*(1-G{$line})*(E{$line}+F{$line})";
$count['platform_amount_exp'] .= "D{$line}+";
$count['d_statement_money_exp'] .= "H{$line}+";
}else{
$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['d_statement_money'] += $va['d_statement_money'];
}
}
$v['settlement_contact'] = $Partner[$v['company_id']];
if($is_export){
$v['statement_money_exp'] .= "J{$cline}-I{$cline}";
$v['statement_money'] = $v['statement_money_exp'];
$count['fine_exp'] .= "I{$cline}+";
$count['reward_exp'] .= "J{$cline}+";
$count['statement_money_exp'] .= "K{$cline}+";
}else{
$count['fine'] += $v['fine'];
$count['reward'] += $v['reward'];
$count['statement_money'] += $v['statement_money'];
}
$v['statement_count'] = count($v['statement_info']);
}
if($is_export){
$count["d_statement_money"] = "=".trim($count["d_statement_money_exp"],"+");
$count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+");
$count["fine"] = "=".trim($count["fine_exp"],"+");
$count["reward"] = "=".trim($count["reward_exp"],"+");
$count["statement_money"] = "=".trim($count["statement_money_exp"],"+");
}
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
$this->display("viewPcPool");
}
//上游汇总查看及导出
public function viewCpPool(&$infolist,$is_export)
{
$line = 2;
$count = [];
//获取平台名
$p_id = array_column($infolist,'company_id');
$map['id'] = ['in',$p_id];
$pl = M("Partner","tab_")->field("id,matche_platform")->where($map)->select();
$Partner = [];
foreach($pl as $k=>$v){
$Partner[$v['id']] = $v['matche_platform'];
}
unset($pl);
//
foreach($infolist as $k=>&$v){
$v['statement_info'] = json_decode($v['statement_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']);
$cline = $line+1;
if($is_export){
$v['statement_money_exp'] = "=";
}
foreach($v['statement_info'] as $ke=>&$va){
$line ++;
$va['company_ratio'] = 100-$va['ratio'];
if($is_export){
$v['statement_money_exp'] .= "K{$line}+";
$va['d_statement_money'] = "=F{$line}*G{$line}";
$count['platform_amount_exp'] .= "E{$line}+";
$count['platform_amount_exp2'] .= "F{$line}+";
$count['d_statement_money_exp'] .= "K{$line}+";
}else{
$va['d_statement_money'] = round($va['pay_amount']*$va['ratio']/100,2);
$count['platform_amount'] += $va['pay_amount'];
$count['platform_amount2'] += $va['pay_amount'];
$count['d_statement_money'] += $va['d_statement_money'];
}
}
$v['matche_platform'] = $Partner[$v['company_id']];
if($is_export){
$v['statement_money_exp'] .= "M{$cline}-L{$cline}";
$v['statement_money'] = $v['statement_money_exp'];
$count['fine_exp'] .= "L{$cline}+";
$count['reward_exp'] .= "M{$cline}+";
$count['statement_money_exp'] .= "N{$cline}+";
}else{
$count['fine'] += $v['fine'];
$count['reward'] += $v['reward'];
$count['statement_money'] += $v['statement_money'];
}
$v['statement_count'] = count($v['statement_info']);
}
if($is_export){
$count["d_statement_money"] = "=".trim($count["d_statement_money_exp"],"+");
$count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+");
$count["platform_amount2"] = "=".trim($count["platform_amount_exp2"],"+");
$count["fine"] = "=".trim($count["fine_exp"],"+");
$count["reward"] = "=".trim($count["reward_exp"],"+");
$count["statement_money"] = "=".trim($count["statement_money_exp"],"+");
}
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
$this->display("viewCpPool");
}
public function transfer_set()
{
$this->getAccountMoney();
$this->meta_title = '复核账号设置';
$this->assign("mobile",$this->admininfo['mobile']);
$this->display();
}
public function memberList()
{
$params = I('get.');
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$map=[
"_string"=>"1=1",
];
$payment_menber = M("payment_member")
->alias('p')
->field("p.*")
->where($map)
->page($page,$row)
->select();
foreach ($payment_menber as $key => $value) {
$payment_menber[$key]['is_payment_str'] = $value['is_payment'] == 1?"":"";
}
$count = M("payment_member")->where($map)->count();
$page = set_pagination_all($count['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('is_auth',$_SESSION['onethink_admin']['payment_user']['id']);
$this->assign("data",$payment_menber);
$this->getAccountMoney();
$this->meta_title = '复核账号';
$this->display();
}
public function del() {
if (!$_REQUEST['id']) {
$this->ajaxReturn(['status'=>0,'msg'=>'传输数据错误']);
}
if ($_REQUEST['id'] == 1) {
$this->ajaxReturn(['status'=>0,'msg'=>'管理员账号不能删除']);
}
$is_del = M("payment_member")->where(['id'=>$_REQUEST['id']])->delete();
if ($is_del) {
$this->ajaxReturn(['status'=>1,'msg'=>'删除成功']);
} else {
$this->ajaxReturn(['status'=>0,'msg'=>'删除失败']);
}
}
public function add() {
if (IS_POST)
{
$data = $_POST;
if(!$data['name']) {
$this->error('名称不能为空');
}
if(!$data['mobile']) {
$this->error('手机号不能为空');
}
$is_hav = M("payment_member")
->where("mobile = '{$data['mobile']}'")
->find();
if ($is_hav) {
$this->error('手机号已经存在');
}
$is_hav = M("payment_member")
->where("name = '{$data['name']}'")
->find();
if ($is_hav) {
$this->error('名称已经存在');
}
$is_success = M("payment_member")
->add([
'name'=>$data['name'],
'mobile'=>$data['mobile']
]);
if ($is_success) {
$this->success('添加成功',U('Payment/memberList'));
} else {
$this->error('添加失败');
}
} else {
$this->display();
}
}
public function edit() {
if (IS_POST)
{
$data = $_POST;
if(!$data['id']) {
$this->ajaxReturn(['status'=>0,'msg'=>'id不能传输为空']);
// $this->error('名称不能为空');
}
if(!$data['name']) {
$this->ajaxReturn(['status'=>0,'msg'=>'名称不能为空']);
// $this->error('名称不能为空');
}
if(!$data['mobile']) {
$this->ajaxReturn(['status'=>0,'msg'=>'手机号不能为空']);
// $this->error('手机号不能为空');
}
if ($data['id'] == 1) {
$verify = $_REQUEST['verify'];
if (!A("Public")->checksafecode($data['mobile'], $verify)) {
$this->ajaxReturn(["error"=>"验证码错误"]);
}
}
if(strlen($data['mobile']) < 11) {
$this->ajaxReturn(['status'=>0,'msg'=>'手机号格式错误']);
// $this->error('手机号格式错误');
}
$is_hav = M("payment_member")
->where("id = {$data['id']}")
->find();
if (!$is_hav) {
$this->ajaxReturn(['status'=>0,'msg'=>'账号不存在']);
// $this->error('账号不存在');
}
$is_hav = M("payment_member")
->where("mobile = '{$data['name']}' and id != {$data['id']}")
->select();
if($is_hav) {
$this->ajaxReturn(['status'=>0,'msg'=>'名称重复请验证']);
// $this->error('名称重复请验证');
}
$is_hav = M("payment_member")
->where("mobile = '{$data['mobile']}' and id != {$data['id']}")
->find();
if($is_hav) {
$this->ajaxReturn(['status'=>0,'msg'=>'手机号重复请验证']);
// $this->error('手机号重复请验证');
}
$is_success = M("payment_member")
->where(['id'=>$data['id']])
->save([
'name'=>$data['name'],
'mobile'=>$data['mobile']
]);
if ($is_success) {
$this->ajaxReturn(['status'=>1,'msg'=>'修改成功']);
// $this->success('添加成功',U('Payment/memberList'));
} else {
$this->ajaxReturn(['status'=>0,'msg'=>'尚未修改数据,修改失败']);
// $this->error('添加失败');
}
} else {
$data = M("payment_member")
->where("id = {$_REQUEST['id']}")
->find();
$this->assign('data',$data);
$this->display();
}
}
public function saveTransferSet()
{
$mobile = $_REQUEST['mobile'];
$verify = $_REQUEST['verify'];
$flag = A("Public")->checksafecode($this->admininfo['mobile'], $verify);
if (!$flag ) {
$this->error('验证码错误');
}
$dbres = M("Kv")->where("`key`='payment_check_mobile'")->save(['value'=>$mobile]);
if($dbres !== false){
$logout = U('Public/logout');
$this->ajaxReturn(["status"=>1,"msg"=>"验证手机修改成功,即将跳转","url"=>"{$logout}"]);
}
$this->ajaxReturn(["status"=>0,"msg"=>"验证手机修改失败"]);
}
public function showPayment()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$CompanyInfo = M("company_statement_info","tab_")
->alias('i')
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,p.statement_num,i.remark,i.pay_status")
->join("left join tab_company_statement_pool p ON p.id = i.pool_id")
->where("i.id in ({$ids})")
->select();
foreach($CompanyInfo as $k=>&$v){
$v['company_info'] = json_decode($v['company_info'],true);
$v['company_info']['ali_user'] ?? '';
$v['company_info']['ali_account'] ?? '';
}
$count = M("company_statement_info","tab_")->field("sum(statement_money) statement_money")->where("id in ({$ids})")->find();
$this->getAccountMoney();
// dd($CompanyInfo);
$this->assign("CompanyInfo",$CompanyInfo);
$this->assign("mobile",$this->admininfo['mobile']);
$this->assign("count",$count);
$this->display();
// $this->display();
}
public function getAccountMoney(){
Vendor("Alipay2020/Fund");
if(empty(C("ALI_PAYMENT"))){
$money = "测试站无法查看";
}else{
$fund = new \Fund(C("ALI_PAYMENT"));
$money = $fund->account();
if($money !== -1){
$money = $money['amount'];
}else{
$money = "--";
}
}
$this->assign("money",$money);
}
//以下打款流程
public function checkVerify()
{
$mobile = $this->admininfo['mobile'];
$verify = $_REQUEST['verify'];
if (!A("Public")->checksafecode($mobile, $verify)) {
$this->ajaxReturn(["error"=>"验证码错误"]);
}
$this->ajaxReturn(["success"=>"验证码验证成功","data"=>[]]);
}
//执行打款
public function doPayment()
{
$id = $_REQUEST['id'];
$limit_amount = 20000;
$remark = $_REQUEST['remark'];
if(empty(C("ALI_PAYMENT"))){
$this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>[]]);
}
Vendor("Alipay2020/Fund");
$fund = new \Fund(C("ALI_PAYMENT"));
$dbres = M("company_statement_info", "tab_")->where("id='{$id}'")->find();
$company_info = json_decode($dbres['company_info'], true);
if ($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1) {
//执行打款
$title = "信息服务费";
$amount = $dbres['statement_money'];
$payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title);
$resultCode = $payres->code;
$savedata = ["id"=>$dbres['id']];
if (!empty($resultCode)&&$resultCode == 10000) {
$savedata["pay_status"]=1;
} else {
$savedata["pay_status"]=-1;
}
$payres = json_decode(json_encode($payres), true);
$payres["remark"] = $remark;
$savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE);
$savedata["pay_type"]=2;
$savedata["pay_time"]=time();
}
M("company_statement_info","tab_")->save($savedata);
$this->ajaxReturn(["success"=>"打款成功","data"=>[]]);
}
/**
* 执行最后聚合表统计
* 整合数据,全部成功则支付成功,否则为支付中
*/
public function poolCount(){
$pool_id = $_REQUEST['pool_id'];
$CompanyInfo = M("company_statement_info","tab_");
if(count($pool_id) > 0){
foreach($pool_id as $k=>$v){
$f = $CompanyInfo->where("pool_id = {$v} AND pay_status <> 1")->find();
if(empty($f)){
//全部完成
$this->setOneVerifyStatus(4,"payment",$v);
}else{
//打款中
$this->setOneVerifyStatus(3,"payment",$v);
}
}
}
$this->ajaxReturn(["success"=>"打款成功","data"=>[]]);
}
/**
* 打款详情
*/
public function paymentInfo()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$info = M("company_statement_info","tab_")->field("pay_info")->where("id='{$id}'")->find()['pay_info'];
$info = json_decode($info,true);
$senddata = [];
foreach($info as $k => &$v){
if(isset($this->ALIRSP[$k])){
$senddata[$this->ALIRSP[$k]] = $v;
}else{
$senddata[$k] = $v;
}
}
$this->assign("info",$senddata);
$this->display();
}
protected function setOneVerifyStatus($change_status,$op_pre,$id)
{
$dbres = M("company_statement_pool","tab_")->field("id,verify_status,verify_log")->where("id = {$id}")->find();
$dbres['verify_log'] = json_decode($dbres['verify_log'],true);
$dbres['verify_log'][$op_pre.'_user']=$this->admininfo["mobile"];
$dbres['verify_log'][$op_pre.'_time']=date("Y-m-d H:i:s");
$dbres['verify_log'] = json_encode($dbres['verify_log']);
$dbres['verify_status']=$change_status;
M("company_statement_pool","tab_")->save($dbres);
}
/**
* 打款审核
*/
public function verify() {
// dump($_SESSION['onethink_admin']['payment_user']['id']);die();
if (!$_REQUEST['id']||!$_REQUEST['status']) {
$this->ajaxReturn(['status'=>0,'msg'=>'数据传输错误']);
}
$id = $_REQUEST['id'];
$status = $_REQUEST['status'];
$member_id = $_SESSION['onethink_admin']['payment_user']['id'];
($status == 1)?($status_str = '已审核通过'):($status_str = '已审核拒绝');
$verify = M("company_statement_info","tab_")
->where([
'id'=>['in',$id]
])
->save([
'pay_verify_status'=>$status,
'verify_time'=>time(),
'verify_member_id'=>$member_id
]);
if ($verify) {
$this->ajaxReturn(['status'=>1,'msg'=>$status_str]);
} else {
$this->ajaxReturn(['status'=>0,'msg'=>'审核失败请重新审核']);
}
}
/**
* 验证订单
*/
public function checkOrder() {
if(!$_REQUEST['ids']) {
$this->ajaxReturn(['data'=>[]]);
}
$ids = $_REQUEST['ids'];
$data = M("company_statement_info","tab_")
->field("id,statement_money,company_name,statement_begin_time,statement_end_time,pay_time")
->where(['id'=>['in',$ids]])
->select();
$return = [];
foreach ($data as $key => $value) {
$check_data = M("excel_statement_info","tab_")
->where([
'statement_money'=>$value['statement_money'],
'company_name'=>$value['company_name'],
'statement_begin_time'=>$value['statement_begin_time'],
'statement_end_time'=>$value['statement_end_time'],
// 'id'=>['neq',$value['id']],
'pay_status'=>1
])
->select();
$check_company_statement_info = M("company_statement_info","tab_")
->where([
'pay_status'=>1,
'company_name'=>$value['company_name'],
'statement_begin_time'=>$value['statement_begin_time'],
'statement_end_time'=>$value['statement_end_time'],
'statement_money'=>$value['statement_money'],
])
->select();
$return = array_merge($return,$check_data,$check_company_statement_info);
}
foreach ($return as $key => $value) {
$return[$key]['time'] = ($value['statement_begin_time']?date("Y-m-d",$value['statement_begin_time']):'无').'-'.($value['statement_end_time']?date("Y-m-d",$value['statement_end_time']):'无');
$return[$key]['pay_time'] = date("Y-m-d H:m:s",$value['pay_time']);
}
$this->ajaxReturn(['data'=>$return]);
}
}