diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 6d27b89b1..74befec87 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -493,16 +493,32 @@ class PaymentController extends BaseController { $data = $_POST; + if(!$data['id']) { + $this->ajaxReturn(['status'=>0,'msg'=>'id不能传输为空']); +// $this->error('名称不能为空'); + } + if(!$data['name']) { - $this->error('名称不能为空'); + $this->ajaxReturn(['status'=>0,'msg'=>'名称不能为空']); +// $this->error('名称不能为空'); } if(!$data['mobile']) { - $this->error('手机号不能为空'); + $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->error('手机号格式错误'); + $this->ajaxReturn(['status'=>0,'msg'=>'手机号格式错误']); +// $this->error('手机号格式错误'); } $is_hav = M("payment_member") @@ -510,7 +526,8 @@ class PaymentController extends BaseController ->find(); if (!$is_hav) { - $this->error('账号不存在'); + $this->ajaxReturn(['status'=>0,'msg'=>'账号不存在']); +// $this->error('账号不存在'); } $is_hav = M("payment_member") @@ -518,7 +535,8 @@ class PaymentController extends BaseController ->select(); if($is_hav) { - $this->error('名称重复请验证'); + $this->ajaxReturn(['status'=>0,'msg'=>'名称重复请验证']); +// $this->error('名称重复请验证'); } $is_hav = M("payment_member") @@ -526,7 +544,8 @@ class PaymentController extends BaseController ->find(); if($is_hav) { - $this->error('手机号重复请验证'); + $this->ajaxReturn(['status'=>0,'msg'=>'手机号重复请验证']); +// $this->error('手机号重复请验证'); } $is_success = M("payment_member") @@ -537,9 +556,11 @@ class PaymentController extends BaseController ]); if ($is_success) { - $this->success('添加成功',U('Payment/memberList')); + $this->ajaxReturn(['status'=>1,'msg'=>'修改成功']); +// $this->success('添加成功',U('Payment/memberList')); } else { - $this->error('添加失败'); + $this->ajaxReturn(['status'=>0,'msg'=>'尚未修改数据,修改失败']); +// $this->error('添加失败'); } } else { @@ -630,34 +651,37 @@ class PaymentController extends BaseController 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")); + $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; + $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); + $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"=>[]]); } /** @@ -748,5 +772,64 @@ class PaymentController extends BaseController } + /** + * 验证订单 + */ + 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]); + + } + } diff --git a/Application/Payment/View/ExcelPayment/lists.html b/Application/Payment/View/ExcelPayment/lists.html index 8223d12da..e1dcb35a8 100644 --- a/Application/Payment/View/ExcelPayment/lists.html +++ b/Application/Payment/View/ExcelPayment/lists.html @@ -115,6 +115,7 @@ ::-webkit-scrollbar-thumb:active { cursor: pointer; + } @@ -270,7 +271,7 @@ {$_page|default=''}