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.
858 lines
28 KiB
PHP
858 lines
28 KiB
PHP
<?php
|
|
|
|
namespace Callback\Controller;
|
|
|
|
use Org\UcenterSDK\Ucservice;
|
|
use Org\SwiftpassSDK\Swiftpass;
|
|
use Think\Log;
|
|
use Qiniu\json_decode;
|
|
use Sdk\Controller\Ipa365Controller;
|
|
|
|
|
|
/**
|
|
* 支付回调控制器
|
|
* @author 小纯洁
|
|
*/
|
|
class NotifyController extends BaseController
|
|
{
|
|
/**
|
|
*通知方法
|
|
*/
|
|
|
|
public function notify()
|
|
{
|
|
C(api('Config/lists'));
|
|
|
|
$apitype = I('get.apitype');#获取支付api类型
|
|
|
|
if (IS_POST && !empty($_POST)) {
|
|
|
|
$notify = $_POST;
|
|
|
|
} elseif (IS_GET && !empty($_GET)) {
|
|
|
|
$notify = $_GET;
|
|
|
|
unset($notify['method']);
|
|
|
|
unset($notify['apitype']);
|
|
unset($notify['model']);
|
|
|
|
} else {
|
|
|
|
$notify = file_get_contents("php://input");
|
|
|
|
if (empty($notify)) {
|
|
|
|
$this->record_logs("Access Denied");
|
|
|
|
exit('Access Denied');
|
|
|
|
}
|
|
|
|
}
|
|
$pay_way = $apitype;
|
|
|
|
if ($apitype == "swiftpass") {
|
|
$apitype = "weixin";
|
|
}
|
|
$pay = new \Think\Pay($pay_way, C($apitype));
|
|
if ($pay->verifyNotify($notify)) {
|
|
|
|
//获取回调订单信息
|
|
|
|
$order_info = $pay->getInfo();
|
|
Log::write(serialize($order_info), Log::DEBUG);
|
|
if ($order_info['status']) {
|
|
$pay_where = substr($order_info['out_trade_no'], 0, 2);
|
|
Log::write("PAY_SWI:".$pay_where, Log::DEBUG);
|
|
$result = false;
|
|
|
|
switch ($pay_where) {
|
|
|
|
case 'SP':
|
|
|
|
$result = $this->set_spend($order_info);
|
|
|
|
break;
|
|
|
|
case 'PF':
|
|
|
|
$result = $this->set_deposit($order_info);
|
|
|
|
break;
|
|
|
|
case 'AG':
|
|
|
|
$result = $this->set_agent($order_info);
|
|
|
|
break;
|
|
case 'TB':
|
|
|
|
$result = $this->set_balance($order_info);
|
|
$to_balance = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php/Home/PromoteCoin/lists';
|
|
break;
|
|
|
|
case 'BR':
|
|
$result = $this->set_bind_recharge($order_info);
|
|
break;
|
|
case 'SI':
|
|
$result = $this->set_order($order_info);
|
|
break;
|
|
case 'SS': // 超级签
|
|
$this->supersign_pay_notify(array(
|
|
'trade_id' => $order_info['trade_no'],
|
|
'order_id' => $order_info['out_trade_no']
|
|
));
|
|
break;
|
|
default:
|
|
|
|
exit('accident order data');
|
|
|
|
break;
|
|
|
|
}
|
|
if($result){
|
|
echo "success";
|
|
}
|
|
if (I('get.method') == "return") {
|
|
switch (I('get.model')) {
|
|
case 'Home':
|
|
if($to_balance) {
|
|
redirect($to_balance);
|
|
} else {
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/index.php/Home/Charge/agent_pay_list');
|
|
}
|
|
break;
|
|
case 'Media':
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/media.php/Member/users_index');
|
|
break;
|
|
case 'Mobile':
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/mobile.php/User/recharge');
|
|
break;
|
|
default:
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/media.php/Member/users_index');
|
|
break;
|
|
}
|
|
|
|
} else {
|
|
$pay->notifySuccess();
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->record_logs("支付失败!");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->record_logs("支付验证失败");
|
|
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/media.php', 3, '支付验证失败');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
*微信回调
|
|
*/
|
|
public function swiftpass_callback(){
|
|
$xml = file_get_contents('php://input');
|
|
$Swiftpass=new Swiftpass(C('weixin_gf.partner'),C('weixin_gf.key'));
|
|
$Swiftpass->resHandler->setContent($xml);
|
|
$Swiftpass->resHandler->setKey(C('weixin_gf.key'));
|
|
if($Swiftpass->resHandler->isTenpaySign()){
|
|
if($Swiftpass->resHandler->getParameter('status') == 0 && $Swiftpass->resHandler->getParameter('result_code') == 0){
|
|
$pay_where = substr($Swiftpass->resHandler->getParameter('out_trade_no'),0,2);
|
|
$order_info['trade_no']=$Swiftpass->resHandler->getParameter('transaction_id');
|
|
$order_info['out_trade_no']=$Swiftpass->resHandler->getParameter('out_trade_no');
|
|
$result = false;
|
|
switch ($pay_where) {
|
|
case 'SP':
|
|
$result = $this->set_spend($order_info);
|
|
break;
|
|
case 'PF':
|
|
$result = $this->set_deposit($order_info);
|
|
break;
|
|
case 'AG':
|
|
$result = $this->set_agent($order_info);
|
|
break;
|
|
case 'TB':
|
|
$result = $this->set_balance($order_info);
|
|
break;
|
|
case 'SI':
|
|
$result = $this->set_order($order_info);
|
|
break;
|
|
default:
|
|
exit('accident order data');
|
|
break;
|
|
}
|
|
echo 'success';
|
|
exit();
|
|
|
|
}else{
|
|
echo 'failure';
|
|
exit();
|
|
}
|
|
}else{
|
|
echo 'failure';
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
*超级签微信充值回调
|
|
*/
|
|
public function supersign_wxpay_notify(){
|
|
$xml = file_get_contents('php://input');
|
|
$Swiftpass=new Swiftpass(C('wei_xin.partner'), C('wei_xin.key'));
|
|
$Swiftpass->resHandler->setContent($xml);
|
|
$Swiftpass->resHandler->setKey( C('wei_xin.key'));
|
|
if($Swiftpass->resHandler->isTenpaySign()){
|
|
if($Swiftpass->resHandler->getParameter('status') == 0 && $Swiftpass->resHandler->getParameter('result_code') == 0){
|
|
$trade_no=$Swiftpass->resHandler->getParameter('transaction_id');
|
|
$out_trade_no = $Swiftpass->resHandler->getParameter('out_trade_no');
|
|
$this->supersign_pay_notify(array(
|
|
'trade_id' => $trade_no,
|
|
'order_id' => $out_trade_no,
|
|
'pay_way'=>2
|
|
));
|
|
echo 'success';
|
|
}else{
|
|
echo 'failure';
|
|
}
|
|
}else{
|
|
echo 'failure';
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* 支付宝退款回调
|
|
* @return [type] [description]
|
|
*/
|
|
public function refund_validation()
|
|
{
|
|
if (empty($_POST)) {
|
|
$this->record_logs("回调!");
|
|
} else {
|
|
$pay = new \Think\Pay('alipay', C('alipay'));
|
|
|
|
if ($pay->verifyNotify($_POST)) {
|
|
//批次号
|
|
$batch_no = $_POST['batch_no'];
|
|
//批量退款数据中转账成功的笔数
|
|
$success_num = $_POST['success_num'];
|
|
if ($success_num > 0) {
|
|
$map['batch_no'] = $batch_no;
|
|
$date['tui_status'] = 1;
|
|
$date['tui_time'] = time();
|
|
M('refund_record', 'tab_')->where($map)->save($date);
|
|
file_put_contents(dirname(__FILE__)."/as.txt", json_encode(M('refund_record','tab_')->getlastsql()));
|
|
|
|
$map_spend['pay_order_number'] = get_refund_pay_order_number($batch_no);
|
|
$spen_date['sub_status']=1;
|
|
$spen_date['settle_check']= 1;
|
|
M('spend','tab_')->where($map_spend)->save($spen_date);
|
|
}
|
|
echo "success"; //请不要修改或删除
|
|
|
|
} else {
|
|
//验证失败
|
|
echo "fail";
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
*微信回调
|
|
*/
|
|
|
|
public function wxpay_callback()
|
|
{
|
|
$values = array();
|
|
Vendor("WxPayPubHelper.WxPayPubHelper");
|
|
$weixin = A("WeiXin", "Event");
|
|
$request = file_get_contents("php://input");
|
|
$reqdata = $weixin->xmlstr_to_array($request);
|
|
if ($reqdata['return_code'] != 'SUCCESS') {
|
|
$this->record_logs("return_code返回数据错误");
|
|
exit();
|
|
} else {
|
|
if ($_REQUEST['method'] == "notify2") {//sdk
|
|
$Common_util_pub = new \Common_util_pub(C('wei_xin_app.email'), C('wei_xin_app.partner'), C('wei_xin_app.key'));
|
|
} elseif ($_REQUEST['method'] == "notify3") { //app
|
|
$Common_util_pub = new \Common_util_pub(C('wei_xin_apps.email'), C('wei_xin_apps.partner'), C('wei_xin_apps.key'));
|
|
} elseif ($_REQUEST['method'] == "notify") {//扫码
|
|
$Common_util_pub = new \Common_util_pub(C('wei_xin.email'), C('wei_xin.partner'), C('wei_xin.key'));
|
|
}
|
|
if ($Common_util_pub->getSign($reqdata) == $reqdata['sign']) {
|
|
$pay_where = substr($reqdata['out_trade_no'], 0, 2);
|
|
$data['trade_no'] = $reqdata['transaction_id'];
|
|
$data['out_trade_no'] = $reqdata['out_trade_no'];
|
|
switch ($pay_where) {
|
|
case 'SP'://充值游戏
|
|
if ($this->recharge_is_exist($reqdata['out_trade_no'])) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
exit();
|
|
}
|
|
$result = $this->set_spend($data);
|
|
if ($result) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
} else {
|
|
echo " <xml> <return_code><![CDATA[FAILURE]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
}
|
|
break;
|
|
case 'PF'://充值平台币
|
|
if ($this->deposit_is_exist($reqdata["out_trade_no"])) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
exit();
|
|
}
|
|
$result = $this->set_deposit($data);
|
|
if ($result) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
} else {
|
|
echo " <xml> <return_code><![CDATA[FAILURE]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
}
|
|
break;
|
|
case 'AG'://代充
|
|
if ($this->agent_is_exist($reqdata["out_trade_no"])) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
exit();
|
|
}
|
|
$result = $this->set_agent($data);
|
|
if ($result) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
} else {
|
|
echo " <xml> <return_code><![CDATA[FAILURE]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
}
|
|
break;
|
|
case 'TB'://代充
|
|
if ($this->balance_is_exist($reqdata["out_trade_no"])) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
exit();
|
|
}
|
|
$result = $this->set_balance($data);
|
|
if ($result) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
} else {
|
|
echo " <xml> <return_code><![CDATA[FAILURE]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
}
|
|
break;
|
|
case 'SI':
|
|
if ($this->order_is_exist($reqdata["out_trade_no"])) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
exit();
|
|
}
|
|
$result = $this->set_order($data);
|
|
if ($result) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
} else {
|
|
echo " <xml> <return_code><![CDATA[FAILURE]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
}
|
|
break;
|
|
case 'BR'://充值绑币
|
|
if ($this->bind_recharge_is_exist($reqdata["out_trade_no"])) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
exit();
|
|
}
|
|
$result = $this->set_bind_recharge($data);
|
|
if ($result) {
|
|
echo " <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
} else {
|
|
echo " <xml> <return_code><![CDATA[FAILURE]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>";
|
|
}
|
|
break;
|
|
default:
|
|
$this->record_logs("订单号错误!!");
|
|
break;
|
|
}
|
|
} else {
|
|
$this->record_logs("支付验证失败");
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/front.php/Recharge/index.html', 3, '支付验证失败');
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 竣付通回调
|
|
* @return [type] [description]
|
|
*/
|
|
public function jft_callback(){
|
|
if(!empty($_GET['model'])){
|
|
switch (I('get.model')) {
|
|
case 'Home':
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/index.php/Home/Charge/agent_pay_list');
|
|
break;
|
|
case 'Media':
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/media.php/Member/users_index');
|
|
break;
|
|
case 'Mobile':
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/mobile.php/User/recharge');
|
|
break;
|
|
default:
|
|
redirect('http://' . $_SERVER['HTTP_HOST'] . '/media.php/Member/users_index');
|
|
break;
|
|
}
|
|
exit;
|
|
}
|
|
@$p7_paychannelnum=$_POST['p7_paychannelnum'];
|
|
if(empty($p7_paychannelnum))
|
|
{
|
|
$p7_paychannelnum="";
|
|
}
|
|
$signmsg=C('jft.key');//支付秘钥
|
|
@$md5info_paramet = $_REQUEST['p1_usercode']."&".$_REQUEST['p2_order']."&".$_REQUEST['p3_money']."&".$_REQUEST['p4_status']."&".$_REQUEST['p5_jtpayorder']."&".$_REQUEST['p6_paymethod']."&".$_REQUEST['p7_paychannelnum']."&".$_REQUEST['p8_charset']."&".$_REQUEST['p9_signtype']."&".$signmsg;
|
|
$md5info_tem= strtoupper(md5($md5info_paramet));
|
|
$requestsign=$_REQUEST['p10_sign'];
|
|
if ($md5info_tem == $_REQUEST['p10_sign'])
|
|
{
|
|
$order_info['trade_no'] = $_REQUEST['p5_jtpayorder'];
|
|
$order_info['out_trade_no'] = $_REQUEST['p2_order'];
|
|
$pay_where = substr($_REQUEST['p2_order'], 0, 2);
|
|
switch ($pay_where) {
|
|
case 'SP':
|
|
$result = $this->set_spend($order_info);
|
|
break;
|
|
case 'PF':
|
|
$result = $this->set_deposit($order_info);
|
|
break;
|
|
case 'AG':
|
|
$result = $this->set_agent($order_info);
|
|
break;
|
|
default:
|
|
exit('accident order data');
|
|
break;
|
|
}
|
|
|
|
//改变订单状态,及其他业务修改
|
|
echo "success";
|
|
//接收通知后必须输出”success“代表接收成功。
|
|
}else{
|
|
$this->record_logs("竣付通验证失败!!");
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* 双乾回调
|
|
* @return [type] [description]
|
|
*/
|
|
public function sq_callback(){
|
|
$merNo = I('MerNo');
|
|
$amount = I('Amount');
|
|
$billNo = I('BillNo'); // 平台订单号
|
|
$orderNo = I('Orderno'); // 支付平台订单号
|
|
$succed = I('Succeed');
|
|
$result = I('Result');
|
|
$bankOrderNo = I('bankOrderNo');
|
|
$merRemark = I('MerRemark');
|
|
$md5Info = I('MD5info');
|
|
|
|
Log::write(serialize(I()), Log::DEBUG);
|
|
|
|
// pp(C('sqpay.key'));
|
|
$secret = strtoupper(md5(C('sqpay.key')));//支付秘钥
|
|
// 参与校验
|
|
$sign = strtoupper(md5("Amount={$amount}&BillNo={$billNo}&MerNo={$merNo}&Succeed={$succed}&{$secret}"));
|
|
|
|
if ($md5Info == $sign)
|
|
{
|
|
$order_info['trade_no'] = $orderNo;
|
|
$order_info['out_trade_no'] = $billNo;
|
|
$pay_where = substr($billNo, 0, 2);
|
|
switch ($pay_where) {
|
|
case 'SP':
|
|
$result = $this->set_spend($order_info);
|
|
break;
|
|
case 'PF':
|
|
$result = $this->set_deposit($order_info);
|
|
break;
|
|
case 'AG':
|
|
$result = $this->set_agent($order_info);
|
|
break;
|
|
default:
|
|
exit('accident order data');
|
|
break;
|
|
}
|
|
|
|
//改变订单状态,及其他业务修改
|
|
echo "success";
|
|
//接收通知后必须输出”success“代表接收成功。
|
|
}else{
|
|
$this->record_logs("双乾验证失败!!");
|
|
}
|
|
|
|
}
|
|
|
|
public function heepay_callback()
|
|
{
|
|
|
|
$result = $_GET['result'];
|
|
|
|
$pay_message = $_GET['pay_message'];
|
|
|
|
$agent_id = $_GET['agent_id'];
|
|
|
|
$jnet_bill_no = $_GET['jnet_bill_no'];
|
|
|
|
$agent_bill_id = $_GET['agent_bill_id'];
|
|
|
|
$pay_type = $_GET['pay_type'];
|
|
|
|
$pay_amt = $_GET['pay_amt'];
|
|
|
|
$remark = $_GET['remark'];
|
|
|
|
$return_sign = $_GET['sign'];
|
|
|
|
|
|
$remark = iconv("GB2312", "UTF-8//IGNORE", urldecode($remark));//签名验证中的中文采用UTF-8编码;
|
|
|
|
|
|
$signStr = '';
|
|
|
|
$signStr = $signStr . 'result=' . $result;
|
|
|
|
$signStr = $signStr . '&agent_id=' . $agent_id;
|
|
|
|
$signStr = $signStr . '&jnet_bill_no=' . $jnet_bill_no;
|
|
|
|
$signStr = $signStr . '&agent_bill_id=' . $agent_bill_id;
|
|
|
|
$signStr = $signStr . '&pay_type=' . $pay_type;
|
|
|
|
|
|
$signStr = $signStr . '&pay_amt=' . $pay_amt;
|
|
|
|
$signStr = $signStr . '&remark=' . $remark;
|
|
|
|
|
|
$signStr = $signStr . '&key=' . C('heepay.key'); //商户签名密钥
|
|
|
|
|
|
$sign = '';
|
|
|
|
$sign = strtolower(md5($signStr));
|
|
|
|
if ($sign == $return_sign) { //比较签名密钥结果是否一致,一致则保证了数据的一致性
|
|
|
|
//商户自行处理自己的业务逻辑
|
|
|
|
$pay_where = substr($agent_bill_id, 0, 2);
|
|
|
|
$data['trade_no'] = $_GET['jnet_bill_no'];
|
|
|
|
$data['out_trade_no'] = $_GET['agent_bill_id'];
|
|
|
|
switch ($pay_where) {
|
|
|
|
case 'SP':
|
|
|
|
$result = $this->set_spend($data);
|
|
|
|
break;
|
|
|
|
case 'PF':
|
|
|
|
$result = $this->set_deposit($data);
|
|
|
|
break;
|
|
|
|
case 'AG':
|
|
|
|
$result = $this->set_agent($data);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
exit('accident order data');
|
|
|
|
break;
|
|
|
|
}
|
|
echo 'ok';
|
|
} else {
|
|
|
|
echo 'error';
|
|
|
|
//商户自行处理,可通过查询接口更新订单状态,也可以通过商户后台自行补发通知,或者反馈运营人工补发
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* 金猪支付
|
|
* @return [type] [description]
|
|
* @author cb <[email address]>
|
|
*/
|
|
public function goldpig_callback(){
|
|
|
|
//接口ID
|
|
$UserID='357p';//此项固定为357p
|
|
//接口密钥
|
|
$Key=C('goldpig.key');//此项需要您设置,和金猪平台一致
|
|
$ProID=$_POST['ProID'];//产品ID
|
|
$OrderID=$_POST['OrderID'];//订单号
|
|
$Num=$_POST['Num'];//充值数量
|
|
$UserName=$_POST['UserName'];//充值账号或角色名
|
|
$Money=$_POST['Money'];//充值金额
|
|
$yuanbao=$_POST['yuanbao'];//货币数量
|
|
$Sign=$_POST['Sign'];//与金猪服务器通讯加密字符串
|
|
$fencheng=$_POST['fencheng'];//商户分成金额,适用于纯接口模式
|
|
$jinzhua=$_POST['jinzhua'];//预留回调1
|
|
$jinzhub=$_POST['jinzhub'];//预留回调2
|
|
$jinzhuc=$_POST['jinzhuc'];//预留回调3
|
|
|
|
$Str='UserID='.$UserID.'&ProID='.$ProID.'&OrderID='.$OrderID.'&Num='.$Num.'&yuanbao='.$yuanbao.'&UserName='.$UserName.'&Money='.$Money.'&Key='.$Key;
|
|
|
|
$MySign=md5($Str);
|
|
|
|
//验证是否合法
|
|
if($Sign==$MySign){
|
|
|
|
$pay_where = substr($jinzhua,0,2);
|
|
$order_info['trade_no']=$OrderID;
|
|
$order_info['out_trade_no']=$jinzhua;
|
|
$result = false;
|
|
|
|
switch ($pay_where) {
|
|
case 'SP':
|
|
$d=M('spend','tab_')->field('pay_amount')->where(['pay_order_number'=>$order_info['out_trade_no']])->find();
|
|
if($d['pay_amount'] != $Money){
|
|
$this->record_logs("金额验证错误");
|
|
echo '357papiSQLFALSE357papi';//失败
|
|
return false;
|
|
}
|
|
|
|
$result = $this->set_spend($order_info);
|
|
break;
|
|
case 'PF':
|
|
$d=M('deposit','tab_')->field('pay_amount')->where(['pay_order_number'=>$order_info['out_trade_no']])->find();
|
|
if($d['pay_amount'] != $Money){
|
|
$this->record_logs("金额验证错误");
|
|
echo '357papiSQLFALSE357papi';//失败
|
|
return false;
|
|
}
|
|
|
|
$result = $this->set_deposit($order_info);
|
|
break;
|
|
case 'AG':
|
|
$d=M('agent','tab_')->field('real_amount')->where(['pay_order_number'=>$order_info['out_trade_no']])->find();
|
|
if($d['real_amount'] != $Money){
|
|
$this->record_logs("金额验证错误");
|
|
echo '357papiSQLFALSE357papi';//失败
|
|
return false;
|
|
}
|
|
$result = $this->set_agent($order_info);
|
|
break;
|
|
case 'BR':
|
|
$d=M('bind_recharge','tab_')->field('real_amount')->where(['pay_order_number'=>$order_info['out_trade_no']])->find();
|
|
if($d['real_amount'] != $Money){
|
|
$this->record_logs("金额验证错误");
|
|
echo '357papiSQLFALSE357papi';//失败
|
|
return false;
|
|
}
|
|
$result = $this->set_bind_recharge($order_info);
|
|
break;
|
|
case 'TB':
|
|
$d=M('balance','tab_')->field('money')->where(['pay_order_number'=>$order_info['out_trade_no']])->find();
|
|
if($d['money'] != $Money){
|
|
$this->record_logs("金额验证错误");
|
|
echo '357papiSQLFALSE357papi';//失败
|
|
return false;
|
|
}
|
|
$result = $this->set_balance($order_info);
|
|
break;
|
|
case 'SI':
|
|
$d=M('order','tab_')->field('order_price')->where(['order_number'=>$order_info['out_trade_no']])->find();
|
|
if($d['order_price'] != $Money){
|
|
$this->record_logs("金额验证错误");
|
|
echo '357papiSQLFALSE357papi';//失败
|
|
return false;
|
|
}
|
|
|
|
$result = $this->set_order($order_info);
|
|
break;
|
|
default:
|
|
exit('accident order data');
|
|
break;
|
|
}
|
|
|
|
|
|
if($result){
|
|
echo '357papiSuccess357papi';//成功
|
|
return;
|
|
}
|
|
else{
|
|
echo '357papiSQLFALSE357papi';//失败
|
|
return;
|
|
}
|
|
|
|
}else{
|
|
echo '357papiAPIFALSE357papi';//失败
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
*判断平台币充值是否存在
|
|
*/
|
|
|
|
protected function deposit_is_exist($out_trade_no)
|
|
{
|
|
|
|
$deposit = M('deposit', 'tab_');
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
$map['pay_order_number'] = $out_trade_no;
|
|
|
|
$res = $deposit->where($map)->find();
|
|
|
|
if (empty($res)) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//判断订单是否存在
|
|
|
|
public function order_is_exist($out_trade_no)
|
|
{
|
|
|
|
$order = M('Order', 'tab_');
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
$map['order_number'] = $out_trade_no;
|
|
|
|
$res = $order->where($map)->find();
|
|
|
|
if (empty($res)) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//判断充值是否存在
|
|
|
|
public function recharge_is_exist($out_trade_no)
|
|
{
|
|
|
|
$recharge = M('spend', 'tab_');
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
$map['pay_order_number'] = $out_trade_no;
|
|
|
|
$res = $recharge->where($map)->find();
|
|
|
|
if (empty($res)) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//判断代充是否存在
|
|
|
|
public function agent_is_exist($out_trade_no)
|
|
{
|
|
|
|
$recharge = M('agent', 'tab_');
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
$map['pay_order_number'] = $out_trade_no;
|
|
|
|
$res = $recharge->where($map)->find();
|
|
|
|
if (empty($res)) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
*WAP支付成功后 通知SDK
|
|
*/
|
|
public function notifySdk($stauts='200',$info=''){
|
|
return "";
|
|
}
|
|
|
|
|
|
//判断余额币是否存在
|
|
public function balance_is_exist($out_trade_no){
|
|
$balance = M('balance', 'tab_');
|
|
$map['pay_status'] = 1;
|
|
$map['pay_order_number'] = $out_trade_no;
|
|
$res = $balance->where($map)->find();
|
|
if (empty($res)) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
//判断充值是否存在
|
|
public function bind_recharge_is_exist($out_trade_no)
|
|
{
|
|
$bind_recharge = M('bind_recharge', 'tab_');
|
|
$map['pay_status'] = 1;
|
|
$map['pay_order_number'] = $out_trade_no;
|
|
$res = $bind_recharge->where($map)->find();
|
|
if (empty($res)) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
} |