591 lines
21 KiB
PHP
Executable File
591 lines
21 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\api\logic\PayLogic;
|
|
use app\common\basics\Api;
|
|
use app\common\enum\OrderEnum;
|
|
use app\common\enum\PayEnum;
|
|
use app\common\model\Client_;
|
|
use app\common\model\order\OrderTrade;
|
|
use app\common\model\order\Order;
|
|
use app\common\model\order\OrderLog;
|
|
use app\common\server\AliPayServer;
|
|
use app\common\server\JsonServer;
|
|
use app\common\model\Test;
|
|
use app\common\logic\Billions;
|
|
use app\common\server\WeChatPayServer;
|
|
use app\common\server\WeChatServer;
|
|
use app\common\model\integral\IntegralOrder;
|
|
use app\common\model\RechargeOrder;
|
|
require_once ROOT_PATH . "/../vendor/hf/BsPayDemo/loader.php";
|
|
require_once ROOT_PATH . "/../vendor/hf/BsPaySdk/init.php";
|
|
use BsPaySdk\core\BsPay;
|
|
use BsPaySdk\config\MerConfig;
|
|
use think\facade\Db;
|
|
use think\facade\Log;
|
|
/**
|
|
* Class Pay
|
|
* @package app\api\controller
|
|
*/
|
|
class Pay extends Api
|
|
{
|
|
public $like_not_need_login = ['huifuyueFz','checkFz','huifuFz','huifuzfNotify','huifuNotify','notifyMnp1','notifyMnp', 'notifyOa', 'notifyApp', 'aliNotify', 'localPay', 'localBalance'];
|
|
|
|
/**
|
|
* @notes 支付入口
|
|
* @return \think\response\Json
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author suny
|
|
* @date 2021/7/13 6:13 下午
|
|
*/
|
|
public function unifiedpay()
|
|
{
|
|
$user_id = $this->user_id;
|
|
$post = $this->request->post();
|
|
if ($post['from'] == 'recharge') {
|
|
return $this->huifuCz($user_id, $post);
|
|
}
|
|
if(!isset($post['pay_way'])) {
|
|
return JsonServer::error('请选择支付方式');
|
|
}
|
|
// 信用支付
|
|
if ($post['from'] == 'repayment') {
|
|
$pay_way = $post['pay_way'];
|
|
$order['order_id'] = $user_id;
|
|
$post['order_id'] = $user_id;
|
|
}
|
|
|
|
if ($post['from'] == 'order') {
|
|
// 更新支付方式
|
|
$order = Order::findOrEmpty($post['order_id']);
|
|
$order->pay_way = $post['pay_way'];
|
|
$order->save();
|
|
$pay_way = $order['pay_way'];
|
|
}
|
|
if ($post['from'] == 'trade') {
|
|
$order = Order::where('trade_id', $post['order_id'])->findOrEmpty();
|
|
// 更新支付方式
|
|
Order::where('trade_id', $post['order_id'])->update(['pay_way' => $post['pay_way']]);
|
|
$pay_way = $post['pay_way'];
|
|
}
|
|
|
|
if ($post['from'] == 'recharge') {
|
|
return JsonServer::error('充值接口维护中');
|
|
$pay_way = isset($post['pay_way']) ? $post['pay_way'] : PayEnum::WECHAT_PAY;
|
|
}
|
|
|
|
// 积分订单
|
|
if ($post['from'] == 'integral') {
|
|
$order = IntegralOrder::findOrEmpty($post['order_id']);
|
|
IntegralOrder::where('id', $post['order_id'])->update(['pay_way' => $post['pay_way']]);
|
|
$pay_way = $post['pay_way'];
|
|
}
|
|
if( $pay_way != 5){
|
|
if($post['from'] != 'repayment'){
|
|
// order,trade方式金额为0直接走余额支付
|
|
if (isset($order) && $order['order_amount'] == 0) {
|
|
$result = PayLogic::balancePay($post['order_id'], $post['from']);
|
|
return $result;
|
|
}
|
|
}
|
|
}
|
|
if(isset($post['payment_method'])){
|
|
$payment_method = $post['payment_method'];
|
|
}else{
|
|
$payment_method = "";
|
|
}
|
|
switch ($pay_way) {
|
|
case OrderEnum::PAY_WAY_BALANCE://余额支付
|
|
$result = PayLogic::balancePay($post['order_id'], $post['from']);
|
|
break;
|
|
case OrderEnum::PAY_WAY_WECHAT://微信支付
|
|
$result = PayLogic::wechatPay($post['order_id'], $post['from'],$payment_method, $this->client);
|
|
break;
|
|
case OrderEnum::PAY_WAY_XINY://信用支付
|
|
$result = PayLogic::xinyPay($post['order_id'], $post['from']);
|
|
break;
|
|
case OrderEnum::PAY_WAY_ALIPAY://支付宝支付
|
|
$result = PayLogic::aliPay($post['order_id'], $post['from'],$this->client);
|
|
$data = [
|
|
'code' => 10001,
|
|
'msg' => '发起成功',
|
|
'data' => $result,
|
|
'show' => 0,
|
|
];
|
|
return json($data);
|
|
break;
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
public function huifuzf($user_id,$post)
|
|
{
|
|
$data['order_sn'] = time().$user_id;
|
|
$data['order_source'] = 1;
|
|
$data['pay_way'] = 1;
|
|
$data['pay_status'] = 0;
|
|
$data['local_id'] = $post['lid'];
|
|
$data['user_id'] = $user_id;
|
|
$data['order_amount'] = $post['money'];
|
|
$data['pay_type'] = 2;
|
|
$data['create_time'] = date("Y-m-d H:i:s");
|
|
$r = Db::name("local_pay")->save($data);
|
|
|
|
$company = Db::name("local_store")->where("lstore_id",$post['lid'])->where("is_delete",0)->find();
|
|
$dt['lstore_id'] = $post['lid'];
|
|
$dt['payment_type'] = $company['bankType'];
|
|
$dt['total_amount'] = $post['money'];
|
|
$dt['account_name'] = $company['shopName'];
|
|
$dt['bank_name'] = $company['bankName'];
|
|
$dt['bank_card'] = $company['bankCard'];
|
|
$dt['large_number'] = $company['largeNumber'];
|
|
$dt['separate_account'] = round($post['money'],2);
|
|
$dt['create_time'] = date("Y-m-d H:i:s");
|
|
$dt['user_id'] = $user_id;
|
|
$dt['order_no'] = $data['order_sn'];
|
|
$dt['pay_shop_type'] = 1;
|
|
$r = Db::name("local_store_order")->save($dt);
|
|
$user = Db::name("user_auth")->where("user_id",$user_id)->find();
|
|
// $out = "dlh".time().$user_id;
|
|
$config = new BsPay();
|
|
$merConfig = $config->getConfig();
|
|
// 2.组装请求参数
|
|
$paramsInfo = array();
|
|
// 请求日期
|
|
$paramsInfo["req_date"] = date("Ymd");
|
|
// 请求流水号
|
|
$paramsInfo["req_seq_id"] = $data['order_sn'];
|
|
// 商户号
|
|
$paramsInfo["huifu_id"] = "6666000158818881";
|
|
// 商品描述
|
|
$paramsInfo["goods_desc"] = "支付";
|
|
// 交易类型
|
|
$paramsInfo["trade_type"] = "T_MINIAPP";
|
|
// 交易金额
|
|
$money =(string)number_format(floatval($post['money']), 2,'.','');
|
|
$paramsInfo["trans_amt"] = $money;
|
|
// 交易有效期
|
|
$paramsInfo["time_expire"] = "20250518235959";
|
|
// 分账对象
|
|
// $acct_split_bunch =array(
|
|
// "wacct_infos"=>array(
|
|
// "div_amt"=>$money-0.5,
|
|
// "huifu_id"=>$company['huifu_id']
|
|
// )
|
|
// );
|
|
// $paramsInfo["acct_split_bunch"] = json_encode($acct_split_bunch,true);
|
|
// 微信参数集合
|
|
$arr = array(
|
|
"sub_appid"=>"wx586d77b9edb0636d",
|
|
"sub_openid"=>$user['openid']
|
|
);
|
|
$paramsInfo["wx_data"] = json_encode($arr,true);
|
|
// $paramsInfo["wx_data"] =
|
|
// "{\"sub_appid\":\"wx586d77b9edb0636d\",\"sub_openid\":\"ouOMm4zEGaZbvNhq9PyoYN53902c\",
|
|
// \"detail\":{\"cost_price\":\"43.00\",\"receipt_id\":\"20220628132043853798\",\"goods_detail\":
|
|
// [{\"goods_id\":\"6934572310301\",\"goods_name\":\"太龙双黄连口服液\",\"price\":\"43.00\"
|
|
// ,\"quantity\":\"1\",\"wxpay_goods_id\":\"12235413214070356458058\"}]}}";
|
|
// 是否延迟交易
|
|
$paramsInfo["delay_acct_flag"] = "N";
|
|
// // 分账对象
|
|
// $paramsInfo["acct_split_bunch"] = "{\"acct_infos\":[{\"div_amt\":\"0.10\",\"huifu_id\":\"6666000156739560\"}]}";
|
|
// 传入分账遇到优惠的处理规则
|
|
$paramsInfo["term_div_coupon_type"] = "0";
|
|
// 禁用信用卡标记
|
|
$paramsInfo["limit_pay_type"] = "NO_CREDIT";
|
|
// 场景类型
|
|
$paramsInfo["pay_scene"] = "02";
|
|
// 备注
|
|
$paramsInfo["remark"] = "string";
|
|
// 异步通知地址
|
|
$paramsInfo["notify_url"] = "https://dlh.hainings.com/api/pay/huifuzfNotify";
|
|
// print_r("<pre>");
|
|
// var_dump($paramsInfo);
|
|
// 3. 发起API调用
|
|
$bspay = new BsPay();
|
|
$result = $bspay->post("v2.trade.payment.jspay", $paramsInfo, '', 'default');
|
|
// var_dump($result);
|
|
$result = $this->objectToArray($result);
|
|
$rspDatas = $result['rspDatas']['data'];
|
|
return JsonServer::success('操作成功', json_decode($rspDatas['pay_info'], true));
|
|
}
|
|
|
|
public function checkFz(){
|
|
$config = new BsPay();
|
|
$merConfig = $config->getConfig();
|
|
// 2.组装请求参数
|
|
$paramsInfo = array();
|
|
|
|
// 请求日期
|
|
$paramsInfo["org_req_date"] = date("Ymd");
|
|
// 请求流水号
|
|
$paramsInfo["org_req_seq_id"] = "org_req_seq_id";
|
|
// 商户号
|
|
$paramsInfo["huifu_id"] = "6666000158818881";
|
|
|
|
print_r("<pre>");
|
|
var_dump($paramsInfo);
|
|
// 3. 发起API调用
|
|
$bspay = new BsPay();
|
|
$result = $bspay->post("v2.trade.payment.scanpay.query", $paramsInfo, '', 'default');
|
|
var_dump($result);
|
|
$result = $this->objectToArray($result);
|
|
$rspDatas = $result['rspDatas']['data'];
|
|
return JsonServer::success('操作成功', json_decode($rspDatas['pay_info'], true));
|
|
}
|
|
|
|
public function huifuzfNotify(){
|
|
$result = $_REQUEST;
|
|
// Log::write($result, '回调信息');
|
|
// $resp_data['req_seq_id'] = "17349345377";
|
|
// $result['out_trans_id'] = "17349345377";
|
|
// $result['resp_code'] = "00000000";
|
|
// $result['req_seq_id'] = "17349345377";
|
|
if(isset($result['resp_code'])&&$result['resp_code']=="00000000"){
|
|
$resp_data = json_decode($result['resp_data'],true);
|
|
$pay = Db::name("local_pay")
|
|
->where("order_sn", $resp_data['req_seq_id'])
|
|
->find();
|
|
if($pay['pay_status'] == 1){
|
|
return true;
|
|
}
|
|
// var_dump(111);die;
|
|
$d['pay_status'] = 1;
|
|
$d['pay_time'] = date("Y-m-d H:i:s");
|
|
$d['transaction_id'] = $resp_data['out_trans_id'];
|
|
$pay = Db::name("local_pay")
|
|
->where("order_sn", $resp_data['req_seq_id'])
|
|
->update($d);
|
|
|
|
$this->huifuFz($resp_data['req_seq_id']);
|
|
}else{
|
|
Log::write($result, '回调信息');
|
|
}
|
|
}
|
|
public function huifuFz($order_sn)
|
|
{
|
|
$msg = Db::name("local_pay")
|
|
->where("order_sn", $order_sn)
|
|
->find();
|
|
$company = Db::name("local_store")
|
|
->where("lstore_id", $msg['local_id'])
|
|
->find();
|
|
$out = "dlh".time().$msg['user_id'];
|
|
$config = new BsPay();
|
|
$merConfig = $config->getConfig();
|
|
// 2.组装请求参数
|
|
$paramsInfo = array();
|
|
// 请求日期
|
|
$paramsInfo["req_date"] = date("Ymd");
|
|
// 请求流水号
|
|
$paramsInfo["req_seq_id"] = $out;
|
|
// 商户号
|
|
$paramsInfo["out_huifu_id"] = "6666000158818881";
|
|
// 交易金额
|
|
$money =(string)number_format(floatval($msg['order_amount']*0.6967), 2);
|
|
$paramsInfo["ord_amt"] = $money;
|
|
// 交易有效期
|
|
$paramsInfo["risk_check_data"] = "{\"transfer_type\":\"04\",\"sub_product\":\"1\"}";
|
|
// 分账对象
|
|
$acct_split_bunch =array(
|
|
"acct_infos"=>array(
|
|
"div_amt"=>$paramsInfo["ord_amt"],
|
|
"huifu_id"=>$company['huifu_id']
|
|
)
|
|
);
|
|
$paramsInfo["acct_split_bunch"] = json_encode($acct_split_bunch,true);
|
|
// $paramsInfo["acct_split_bunch"] = "{\"acct_infos\":[{\"div_amt\":\"1.00\",\"huifu_id\":\"6666000159235336\"},{\"div_amt\":\"0.40\",\"huifu_id\":\"6666000159235170\"}]}";
|
|
print_r("<pre>");
|
|
var_dump($paramsInfo);
|
|
// 3. 发起API调用
|
|
$bspay = new BsPay();
|
|
$result = $bspay->post("v2.trade.acctpayment.pay", $paramsInfo, '', 'default');
|
|
var_dump($result);
|
|
$result = $this->objectToArray($result);
|
|
$rspDatas = $result['rspDatas']['data'];
|
|
|
|
var_dump($result);
|
|
|
|
$da['pay_type'] = 1;
|
|
$da['state'] = 1;
|
|
$da['huifu_fz_orderno'] = $out;
|
|
$local_order = Db::name("local_store_order")
|
|
->where("order_no", $order_sn)
|
|
->update($da);
|
|
$local_order_msg = Db::name("local_store_order")
|
|
->where("order_no", $order_sn)
|
|
->find();
|
|
// if (!$result || $result->isError()) { //失败处理
|
|
// var_dump($result->getErrorInfo());
|
|
// } else { //成功处理
|
|
// var_dump($result);
|
|
// }
|
|
$billions = new Billions();
|
|
$order['order_amount'] = round($msg['order_amount'],2);
|
|
$order['id'] = $msg['id'];
|
|
$order['lstore_id'] = $local_order_msg['lstore_id'];
|
|
$order['type'] = 3;
|
|
$type = "local_pay";
|
|
$billions_result = $billions->billions($order,$msg['user_id'],$type);
|
|
return true;
|
|
}
|
|
// 余额分账
|
|
public function huifuyueFz($price=100,$lstore_id=10)
|
|
{die;
|
|
$company = Db::name("local_store")->where("lstore_id",$lstore_id)->find();
|
|
$out = "dlh".time();
|
|
$config = new BsPay();
|
|
$merConfig = $config->getConfig();
|
|
// 2.组装请求参数
|
|
$paramsInfo = array();
|
|
// 请求日期
|
|
$paramsInfo["req_date"] = date("Ymd");
|
|
// 请求流水号
|
|
$paramsInfo["req_seq_id"] = $out;
|
|
// 商户号
|
|
$paramsInfo["out_huifu_id"] = "6666000158818881";
|
|
// 交易金额
|
|
$money =(string)number_format(floatval($price*99.67*0.7/100-0.51), 2);
|
|
$paramsInfo["ord_amt"] = $money;
|
|
// 交易有效期
|
|
$paramsInfo["risk_check_data"] = "{\"transfer_type\":\"04\",\"sub_product\":\"1\"}";
|
|
// 分账对象
|
|
$acct_split_bunch =array(
|
|
"acct_infos"=>array(
|
|
"div_amt"=>$paramsInfo["ord_amt"],
|
|
"huifu_id"=>$company['huifu_id']
|
|
)
|
|
);
|
|
$paramsInfo["acct_split_bunch"] = json_encode($acct_split_bunch,true);
|
|
// $paramsInfo["acct_split_bunch"] = "{\"acct_infos\":[{\"div_amt\":\"1.00\",\"huifu_id\":\"6666000159235336\"},{\"div_amt\":\"0.40\",\"huifu_id\":\"6666000159235170\"}]}";
|
|
print_r("<pre>");
|
|
var_dump($paramsInfo);
|
|
// 3. 发起API调用
|
|
$bspay = new BsPay();
|
|
$result = $bspay->post("v2.trade.acctpayment.pay", $paramsInfo, '', 'default');
|
|
var_dump($result);
|
|
$result = $this->objectToArray($result);
|
|
$rspDatas = $result['rspDatas']['data'];
|
|
|
|
var_dump($result);
|
|
// $da['huifu_fz_orderno'] = $out;
|
|
// $local_order = Db::name("local_store_order")
|
|
// ->where("order_no", $order_sn)
|
|
// ->update($da);
|
|
|
|
return true;
|
|
}
|
|
|
|
public function huifuCz($user_id,$post)
|
|
{
|
|
$order = RechargeOrder::where([
|
|
['id', '=', $post['order_id']]
|
|
])->find();
|
|
$user = Db::name("user_auth")->where("user_id",$user_id)->find();
|
|
// $out = "dlh".time().$user_id;
|
|
$config = new BsPay();
|
|
$merConfig = $config->getConfig();
|
|
// 2.组装请求参数
|
|
$paramsInfo = array();
|
|
// 请求日期
|
|
$paramsInfo["req_date"] = date("Ymd");
|
|
// 请求流水号
|
|
$paramsInfo["req_seq_id"] = $order['order_sn'];
|
|
// 商户号
|
|
$paramsInfo["huifu_id"] = "6666000158818881";
|
|
// 商品描述
|
|
$paramsInfo["goods_desc"] = "充值";
|
|
// 交易类型
|
|
$paramsInfo["trade_type"] = "T_MINIAPP";
|
|
// 交易金额
|
|
$paramsInfo["trans_amt"] = $order['order_amount'];
|
|
// 交易有效期
|
|
$paramsInfo["time_expire"] = "20250518235959";
|
|
// 微信参数集合
|
|
$arr = array(
|
|
"sub_appid"=>"wx586d77b9edb0636d",
|
|
"sub_openid"=>$user['openid']
|
|
);
|
|
$paramsInfo["wx_data"] = json_encode($arr,true);
|
|
// $paramsInfo["wx_data"] =
|
|
// "{\"sub_appid\":\"wx586d77b9edb0636d\",\"sub_openid\":\"ouOMm4zEGaZbvNhq9PyoYN53902c\",
|
|
// \"detail\":{\"cost_price\":\"43.00\",\"receipt_id\":\"20220628132043853798\",\"goods_detail\":
|
|
// [{\"goods_id\":\"6934572310301\",\"goods_name\":\"太龙双黄连口服液\",\"price\":\"43.00\"
|
|
// ,\"quantity\":\"1\",\"wxpay_goods_id\":\"12235413214070356458058\"}]}}";
|
|
// 是否延迟交易
|
|
$paramsInfo["delay_acct_flag"] = "N";
|
|
// // 分账对象
|
|
// $paramsInfo["acct_split_bunch"] = "{\"acct_infos\":[{\"div_amt\":\"0.10\",\"huifu_id\":\"6666000156739560\"}]}";
|
|
// 传入分账遇到优惠的处理规则
|
|
$paramsInfo["term_div_coupon_type"] = "0";
|
|
// 禁用信用卡标记
|
|
$paramsInfo["limit_pay_type"] = "NO_CREDIT";
|
|
// 场景类型
|
|
$paramsInfo["pay_scene"] = "02";
|
|
// 备注
|
|
$paramsInfo["remark"] = "string";
|
|
// 异步通知地址
|
|
$paramsInfo["notify_url"] = "https://dlh.hainings.com/api/pay/huifuNotify";
|
|
// print_r("<pre>");
|
|
// var_dump($paramsInfo);
|
|
// 3. 发起API调用
|
|
$bspay = new BsPay();
|
|
$result = $bspay->post("v2.trade.payment.jspay", $paramsInfo, '', 'default');
|
|
|
|
$result = $this->objectToArray($result);
|
|
$rspDatas = $result['rspDatas']['data'];
|
|
return JsonServer::success('操作成功', json_decode($rspDatas['pay_info'], true));
|
|
}
|
|
public function huifuNotify(){
|
|
$result = $_REQUEST;
|
|
// Log::write($result, '回调信息');
|
|
if(isset($result['resp_code'])&&$result['resp_code']=="00000000"){
|
|
$d['pay_status'] = 1;
|
|
$d['pay_time'] = time();
|
|
$d['pay_company'] = 3;
|
|
$resp_data = json_decode($result['resp_data'],true);
|
|
$d['transaction_id'] = $resp_data['out_trans_id'];
|
|
$order = RechargeOrder::where([
|
|
['order_sn', '=', $resp_data['req_seq_id']]
|
|
])->update($d);
|
|
|
|
}else{
|
|
Log::write($result, '回调信息');
|
|
}
|
|
}
|
|
private function objectToArray($object) {
|
|
$reflectionClass = new \ReflectionClass($object);
|
|
$properties = $reflectionClass->getProperties();
|
|
$array = [];
|
|
|
|
foreach ($properties as $property) {
|
|
$property->setAccessible(true);
|
|
$array[$property->getName()] = $property->getValue($object);
|
|
}
|
|
|
|
return $array;
|
|
}
|
|
public function localPay()
|
|
{
|
|
$post = $this->request->post();
|
|
$user_id = $this->user_id;
|
|
if(!isset($user_id)){
|
|
$user_id = $post['user_id'];
|
|
}
|
|
if(isset($this->client)){
|
|
$client = $this->client;
|
|
}else{
|
|
$client = 1;
|
|
}
|
|
|
|
$store_msg = Db::name("local_store")->where("lstore_id",$post['lid'])->find();
|
|
if($store_msg['huifu_id'] != 0){
|
|
return $this->huifuzf($user_id,$post);
|
|
}
|
|
// if($post['lid'] != 138){
|
|
return JsonServer::error('因银行及第三方系统更换,请联系客服更新资料');
|
|
// }
|
|
$result = PayLogic::localWxPay($user_id,$post, $client);
|
|
return $result;
|
|
}
|
|
// 分销支付
|
|
public function distributionPay()
|
|
{
|
|
$post = $this->request->post();
|
|
$user_id = $this->user_id;
|
|
if(!isset($user_id)){
|
|
$user_id = $post['user_id'];
|
|
}
|
|
if(isset($this->client)){
|
|
$client = $this->client;
|
|
}else{
|
|
$client = 1;
|
|
}
|
|
// $result = PayLogic::distributionPay($user_id,$post,$client);
|
|
$result = PayLogic::abc($user_id,$post);
|
|
return $result;
|
|
}
|
|
|
|
// 本地生活余额支付
|
|
public function localBalance()
|
|
{
|
|
$user_id = $this->user_id;
|
|
$post = $this->request->post();
|
|
// if($post['lid'] != 138){
|
|
// return JsonServer::error('因银行及第三方系统维护中,该功能暂时无法适用,请等待通知');
|
|
// }
|
|
$result = PayLogic::localBalance($user_id,$post);
|
|
return $result;
|
|
|
|
}
|
|
|
|
/**
|
|
* @notes 小程序回调
|
|
* @throws \EasyWeChat\Kernel\Exceptions\Exception
|
|
* @author suny
|
|
* @date 2021/7/13 6:13 下午
|
|
*/
|
|
public function notifyMnp()
|
|
{
|
|
$user_id = $this->user_id;
|
|
$config = WeChatServer::getPayConfig(Client_::mnp);
|
|
return WeChatPayServer::notify($config);
|
|
}
|
|
public function notifyMnp1()
|
|
{
|
|
//$user_id = $this->user_id;
|
|
$config = WeChatServer::getPayConfig(Client_::mnp);
|
|
return WeChatPayServer::notify1($config);
|
|
}
|
|
|
|
/**
|
|
* @notes 公众号回调
|
|
* @throws \EasyWeChat\Kernel\Exceptions\Exception
|
|
* @author suny
|
|
* @date 2021/7/13 6:13 下午
|
|
*/
|
|
public function notifyOa()
|
|
{
|
|
|
|
$config = WeChatServer::getPayConfig(Client_::oa);
|
|
return WeChatPayServer::notify($config);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes APP回调
|
|
* @throws \EasyWeChat\Kernel\Exceptions\Exception
|
|
* @author suny
|
|
* @date 2021/7/13 6:14 下午
|
|
*/
|
|
public function notifyApp()
|
|
{
|
|
|
|
$config = WeChatServer::getPayConfig(Client_::ios);
|
|
return WeChatPayServer::notify($config);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @notes 支付宝回调
|
|
* @return bool
|
|
* @author suny
|
|
* @date 2021/7/13 6:14 下午
|
|
*/
|
|
public function aliNotify()
|
|
{
|
|
$data = $this->request->post();
|
|
$result = (new AliPayServer())->verifyNotify($data);
|
|
if (true === $result) {
|
|
echo 'success';
|
|
} else {
|
|
echo 'fail';
|
|
}
|
|
}
|
|
} |