Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3710d8c475 | |||
| 228e11b3bb | |||
| f3ac784215 | |||
| de96e4497a | |||
| c7dc3fb1a6 | |||
| 02f56a0de5 | |||
| 0770d1a172 | |||
| 7eecd59aab | |||
| 4fd83d4275 | |||
| 2e97678b9f | |||
| 8ea06cd81d | |||
| 2bdafc7308 | |||
| 2a1ca7299a | |||
| 4e5e97dfe9 | |||
| 1740dd76d3 | |||
| 38b8af4e25 | |||
| eed29ecb0f | |||
| 3f7d0cb826 | |||
| f2bc971a32 | |||
| 27a50e2853 |
@@ -22,7 +22,7 @@ class Payment extends Controller
|
|||||||
* APP支付
|
* APP支付
|
||||||
*/
|
*/
|
||||||
public function app_pay() {
|
public function app_pay() {
|
||||||
$type = input('type', 0); //1-微信 2-支付宝 4-通联支付宝 5-通联微信
|
$type = input('type', 0); //1-微信 2-支付宝 4-通联支付宝 5-通联微信 6-西来喜微信,7-西来喜支付宝,8-西来喜QQ钱包,9-西来喜云闪付
|
||||||
$user_id = input('user_id', 0);
|
$user_id = input('user_id', 0);
|
||||||
$money = input('money', 0);
|
$money = input('money', 0);
|
||||||
$coin = input('coin', 0);
|
$coin = input('coin', 0);
|
||||||
@@ -82,6 +82,11 @@ class Payment extends Controller
|
|||||||
Loader::import('TongLian.TongLian', EXTEND_PATH, '.php');
|
Loader::import('TongLian.TongLian', EXTEND_PATH, '.php');
|
||||||
$tonglian = new \TongLian();
|
$tonglian = new \TongLian();
|
||||||
$result['tl'] = $tonglian->TongLianPay($data, $type);
|
$result['tl'] = $tonglian->TongLianPay($data, $type);
|
||||||
|
}elseif ($type == 6 || $type == 7 || $type == 8 || $type == 9){
|
||||||
|
//引用西来喜
|
||||||
|
Loader::import('Xilaixi.Xilaixi', EXTEND_PATH, '.php');
|
||||||
|
$xilaixi = new \Xilaixi();
|
||||||
|
$result['xlx'] = $xilaixi->XilaixiPay($data, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return V(1, 'app支付', $result);
|
return V(1, 'app支付', $result);
|
||||||
@@ -105,6 +110,7 @@ class Payment extends Controller
|
|||||||
$where['order_sn']=$out_trade_no;
|
$where['order_sn']=$out_trade_no;
|
||||||
$where['order_type']=1;
|
$where['order_type']=1;
|
||||||
$where['pay_type']=2;
|
$where['pay_type']=2;
|
||||||
|
$where['pay_status']=1;
|
||||||
|
|
||||||
$data=[
|
$data=[
|
||||||
'trade_no'=>$trade_no
|
'trade_no'=>$trade_no
|
||||||
@@ -149,6 +155,7 @@ class Payment extends Controller
|
|||||||
$where['order_sn']=$out_trade_no;
|
$where['order_sn']=$out_trade_no;
|
||||||
$where['order_type']=1;//1 充值
|
$where['order_type']=1;//1 充值
|
||||||
$where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信
|
$where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信
|
||||||
|
$where['pay_status']=1;
|
||||||
|
|
||||||
$data=[
|
$data=[
|
||||||
'trade_no'=>$transaction_id
|
'trade_no'=>$transaction_id
|
||||||
@@ -204,6 +211,7 @@ class Payment extends Controller
|
|||||||
$where['order_sn']=$out_trade_no;
|
$where['order_sn']=$out_trade_no;
|
||||||
$where['order_type']=1;//1 充值
|
$where['order_type']=1;//1 充值
|
||||||
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信
|
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信
|
||||||
|
$where['pay_status']=1;
|
||||||
|
|
||||||
$data=[
|
$data=[
|
||||||
'trade_no'=>$trade_no
|
'trade_no'=>$trade_no
|
||||||
@@ -314,4 +322,76 @@ class Payment extends Controller
|
|||||||
echo "fail";
|
echo "fail";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//西来喜支付回调
|
||||||
|
public function XilaixiPayNotify(){
|
||||||
|
//引用西来喜
|
||||||
|
Loader::import('Xilaixi.Xilaixi', EXTEND_PATH, '.php');
|
||||||
|
$xilaixi = new \Xilaixi();
|
||||||
|
$verify_result = $xilaixi->verifyNotify();
|
||||||
|
|
||||||
|
if($verify_result) {//验证成功
|
||||||
|
|
||||||
|
//商户订单号
|
||||||
|
$out_trade_no = $_GET['out_trade_no'];
|
||||||
|
|
||||||
|
//彩虹易支付交易号
|
||||||
|
$trade_no = $_GET['trade_no'];
|
||||||
|
|
||||||
|
//交易状态
|
||||||
|
$trade_status = $_GET['trade_status'];
|
||||||
|
|
||||||
|
//支付方式
|
||||||
|
$type = $_GET['type'];
|
||||||
|
|
||||||
|
//6-西来喜微信,7-西来喜支付宝,8-西来喜QQ钱包,9-西来喜云闪付
|
||||||
|
if($type == 'wxpay'){
|
||||||
|
$pay_type = 6;
|
||||||
|
}elseif ($type == 'alipay'){
|
||||||
|
$pay_type = 7;
|
||||||
|
}elseif ($type == 'qqpay'){
|
||||||
|
$pay_type = 8;
|
||||||
|
}elseif ($type == 'bank'){
|
||||||
|
$pay_type = 9;
|
||||||
|
}else{
|
||||||
|
$pay_type = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//支付金额
|
||||||
|
$money = $_GET['money'];
|
||||||
|
|
||||||
|
if ($_GET['trade_status'] == 'TRADE_SUCCESS') {
|
||||||
|
//判断该笔订单是否在商户网站中已经做过处理
|
||||||
|
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||||
|
//如果有做过处理,不执行商户的业务程序
|
||||||
|
|
||||||
|
Log::record("通联支付回调信息验签成功".json_encode($_GET),"info");
|
||||||
|
//此处进行业务逻辑处理
|
||||||
|
//成功后的业务逻辑处理
|
||||||
|
$where['order_sn']=$out_trade_no;
|
||||||
|
$where['order_type']=1;//1 充值
|
||||||
|
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信 //6-西来喜微信,7-西来喜支付宝,8-西来喜QQ钱包,9-西来喜云闪付
|
||||||
|
$where['pay_status']=1;
|
||||||
|
|
||||||
|
$data=[
|
||||||
|
'trade_no'=>$trade_no
|
||||||
|
];
|
||||||
|
|
||||||
|
$res = handelCharge($where,$data);
|
||||||
|
if($res==0){
|
||||||
|
echo "fail";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//验证成功返回
|
||||||
|
echo "success";
|
||||||
|
}else{
|
||||||
|
echo "fail";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//验证失败
|
||||||
|
echo "fail";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -628,7 +628,6 @@ class BlindBoxTurntableGift extends Model
|
|||||||
* 礼物特效播放
|
* 礼物特效播放
|
||||||
*/
|
*/
|
||||||
public function gift_send($send_id){
|
public function gift_send($send_id){
|
||||||
try{
|
|
||||||
$blind_box_turntable = db('vs_blind_box_turntable_log')->where(['id'=>$send_id,'is_sued'=>0])->find();
|
$blind_box_turntable = db('vs_blind_box_turntable_log')->where(['id'=>$send_id,'is_sued'=>0])->find();
|
||||||
if(!$blind_box_turntable){
|
if(!$blind_box_turntable){
|
||||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||||
@@ -706,10 +705,6 @@ class BlindBoxTurntableGift extends Model
|
|||||||
}
|
}
|
||||||
db::name('vs_blind_box_turntable_log')->where('id', $send_id)->update(['is_sued' => 1, 'updatetime' => time()]);
|
db::name('vs_blind_box_turntable_log')->where('id', $send_id)->update(['is_sued' => 1, 'updatetime' => time()]);
|
||||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||||
} catch (\Exception $e) {
|
|
||||||
return ['code' => 0, 'msg' => "网络请求错误,请重试!", 'data' => null];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1166,7 +1161,7 @@ class BlindBoxTurntableGift extends Model
|
|||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
'activities_name' => $xlh_box['name'],
|
'activities_name' => $xlh_box['name'],
|
||||||
'icon' => null,
|
'ico' => null,
|
||||||
'xlh_status'=>$xlh_status,
|
'xlh_status'=>$xlh_status,
|
||||||
'end_time'=>$xlh_data['end_time'] ?? 0,
|
'end_time'=>$xlh_data['end_time'] ?? 0,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ class DailyTasks extends Model
|
|||||||
$v['processing_type'] = 2;
|
$v['processing_type'] = 2;
|
||||||
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
||||||
//跳转的房间路径
|
//跳转的房间路径
|
||||||
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
|
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
|
||||||
$v['target_quantity'] = $v['target_quantity'] * 60;
|
$v['target_quantity'] = $v['target_quantity'] * 60;
|
||||||
$v['is_time'] = 1;
|
$v['is_time'] = 1;
|
||||||
}elseif(in_array($v['task_id'],[10])){
|
}elseif(in_array($v['task_id'],[10])){
|
||||||
$v['processing_type'] = 7;
|
$v['processing_type'] = 7;
|
||||||
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
||||||
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
|
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
|
||||||
} else{
|
} else{
|
||||||
$v['processing_type'] = 9;
|
$v['processing_type'] = 9;
|
||||||
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Decorate extends Model
|
|||||||
protected $createTime = 'createtime';
|
protected $createTime = 'createtime';
|
||||||
protected $updateTime = 'updatetime';
|
protected $updateTime = 'updatetime';
|
||||||
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
|
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
|
||||||
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号'];
|
public $TypeArray = [1=>'头像框',2=>'坐骑',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号'];
|
||||||
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送'];
|
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送'];
|
||||||
public function __construct($data = [])
|
public function __construct($data = [])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ class GiveGift extends Model
|
|||||||
*/
|
*/
|
||||||
public function give_gift($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
|
public function give_gift($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
|
||||||
{
|
{
|
||||||
|
if(isset($ext['is_draw_gift']) && $ext['is_draw_gift'] == 1) {
|
||||||
|
$return_pan = $this->give_gift_to_pan($uid, $to_uid, $gid, $num, $from_type, $type, $from_id, $pit_number, $change_type, $ext);
|
||||||
|
return $return_pan;
|
||||||
|
}
|
||||||
//送的礼物信息
|
//送的礼物信息
|
||||||
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
|
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
|
||||||
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
|
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
|
||||||
@@ -262,11 +266,14 @@ class GiveGift extends Model
|
|||||||
}
|
}
|
||||||
//增加房主收益并记录日志
|
//增加房主收益并记录日志
|
||||||
$room_owner_earningss = $room_owner_earnings - $host_earnings;
|
$room_owner_earningss = $room_owner_earnings - $host_earnings;
|
||||||
|
if($room_owner_earningss > 0){
|
||||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益');
|
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益');
|
||||||
if(!$room_owner_earning){
|
if(!$room_owner_earning){
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//增加房主收益并记录日志
|
//增加房主收益并记录日志
|
||||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||||
@@ -275,6 +282,13 @@ class GiveGift extends Model
|
|||||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
//增加房主收益并记录日志
|
||||||
|
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||||
|
if(!$room_owner_earning){
|
||||||
|
Db::rollback();
|
||||||
|
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,7 +317,9 @@ class GiveGift extends Model
|
|||||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||||
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||||
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
|
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
|
||||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning);
|
$receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
|
||||||
|
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
|
||||||
|
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
|
||||||
if (!$gift_rate) {
|
if (!$gift_rate) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||||
@@ -557,6 +573,308 @@ class GiveGift extends Model
|
|||||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
|
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 送礼物-盲盒转盘专用
|
||||||
|
* @param int $uid 用户id
|
||||||
|
* @param int $from_id 来源id
|
||||||
|
* @param str $to_uid 接收礼物用户id字符串逗号分隔
|
||||||
|
* @param int $gid 礼物id
|
||||||
|
* @param int $num 礼物数量
|
||||||
|
* @param int $from_type 来源 1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
|
||||||
|
* @param int $type 金币购买 1金币购买 2送背包礼物
|
||||||
|
* @param int $pit_number 坑位编号
|
||||||
|
* @return array
|
||||||
|
* 用户,在房间中,给谁,送了什么礼物,多少个,来源
|
||||||
|
*/
|
||||||
|
public function give_gift_to_pan($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
|
||||||
|
{
|
||||||
|
//送的礼物信息
|
||||||
|
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
|
||||||
|
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
|
||||||
|
if(empty($gift_info)){
|
||||||
|
return ['code' => 0, 'msg' => '礼物不存在', 'data' => null];
|
||||||
|
}
|
||||||
|
if(!$to_uid){
|
||||||
|
return ['code' => 0, 'msg' => '请选择收礼人', 'data' => null];
|
||||||
|
}
|
||||||
|
$toarray = explode(',',$to_uid);
|
||||||
|
if(in_array($uid,$toarray)){
|
||||||
|
return ['code' => 0, 'msg' => '收礼人不能包含自己', 'data' => null];
|
||||||
|
}
|
||||||
|
if (ceil($num) != $num) {
|
||||||
|
return ['code' => 0, 'msg' => '打赏礼物数量必须为整数', 'data' => null];
|
||||||
|
}
|
||||||
|
if ($num < 1) {
|
||||||
|
return ['code' => 0, 'msg' => '打赏礼物数量必须大于零', 'data' => null];
|
||||||
|
}
|
||||||
|
$user_info = Db::name('user')->where(['id'=>$uid,'status'=>1])->find();
|
||||||
|
if(empty($user_info)){
|
||||||
|
return ['code' => 301, 'msg' => '当前用户登录失效', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取送礼用户昵称
|
||||||
|
$FromUserInfo = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
|
||||||
|
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($uid);//财富图标
|
||||||
|
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($uid);//魅力图标
|
||||||
|
|
||||||
|
//送给一人礼物的总价格(扣除用户的数额)
|
||||||
|
$gift_price = $gift_info['gift_price'] * $num;
|
||||||
|
|
||||||
|
$roomId = 0;
|
||||||
|
if($from_type == 2 || $from_type == 3 || $from_type == 6){
|
||||||
|
$roomId = $from_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//循环送礼
|
||||||
|
$gift_total = 0;
|
||||||
|
$give_gift = 0;
|
||||||
|
$gift_user_data = [];
|
||||||
|
foreach ($toarray as $k => $to_id){
|
||||||
|
$gift_user_data[]['user_id'] = $to_id;
|
||||||
|
$gift_box1 = [];
|
||||||
|
$gift_box = [];
|
||||||
|
$gift_total += $gift_price;
|
||||||
|
//收礼记录行为日志
|
||||||
|
$give_gift = $this -> change_user_give_gift_log($uid,$gid,$gift_price,$num,$to_id,$from_type,$type,$from_id,$pit_number);
|
||||||
|
if(!$give_gift){
|
||||||
|
return ['code' => 0, 'msg' => '送礼失败', 'data' => null];
|
||||||
|
}
|
||||||
|
$gift_user_data[$k]['gift_price'] = $gift_price;
|
||||||
|
|
||||||
|
//计算收礼人得益
|
||||||
|
$receiver_earnings = $this -> receiver_earnings($to_id,$gift_price,$from_type);
|
||||||
|
if($receiver_earnings <= 0){
|
||||||
|
return ['code' => 0, 'msg' => '收礼人收益配置有误', 'data' => null];
|
||||||
|
}
|
||||||
|
//1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
|
||||||
|
if($from_type == 1 || $from_type == 2 || $from_type == 3 ||$from_type == 4 || $from_type == 6){
|
||||||
|
//增加收益并记录日志
|
||||||
|
$receiver = $this -> change_user_cion_or_earnings_log($to_id,$receiver_earnings,$from_id,2,11,'收礼增加收益');
|
||||||
|
}elseif($from_type == 5){
|
||||||
|
//增加收益并记录日志
|
||||||
|
$receiver = $this -> change_user_cion_or_earnings_log($to_id,$receiver_earnings,$from_id,1,$change_type,'活动增加金币');
|
||||||
|
}else{
|
||||||
|
$receiver = false;
|
||||||
|
}
|
||||||
|
if(!$receiver){
|
||||||
|
return ['code' => 0, 'msg' => '收礼人收益失败', 'data' => null];
|
||||||
|
}
|
||||||
|
//用户魅力等级更新
|
||||||
|
$user_level = model('Level')->user_level_data_update($to_id,$gift_price,2,$roomId);
|
||||||
|
if(!$user_level){
|
||||||
|
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
$room_owner_earnings = 0;//房主收益
|
||||||
|
$room_owner_earningsg = 0;//公会会长收益
|
||||||
|
//是否在房间
|
||||||
|
if(isset($from_id) && ($from_type == 2 || $from_type == 6)){
|
||||||
|
if($from_type == 6){ //cp电影房
|
||||||
|
//房主有收益
|
||||||
|
if(get_system_config_value('room_cp_room_user_ratio') > 0){
|
||||||
|
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
|
||||||
|
//计算房主收益//room_author_ratio
|
||||||
|
$room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,699);
|
||||||
|
if($room_owner_earnings > 0){
|
||||||
|
//增加收益并记录日志
|
||||||
|
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||||
|
if(!$room_owner_earning){
|
||||||
|
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//公会长收益
|
||||||
|
if(get_system_config_value('room_cp_guild_user_ratio') > 0){
|
||||||
|
$guild_id = Db::name('vs_guild_user')->where(['user_id'=>$to_uid,'status'=>1])->value('guild_id');
|
||||||
|
if($guild_id){
|
||||||
|
$room_guild = Db::name('vs_guild')->where(['id'=>$guild_id])->value('user_id');
|
||||||
|
//计算会长收益
|
||||||
|
$room_owner_earningsg = $this -> receiver_earnings($room_guild,$gift_price,698);
|
||||||
|
//增加收益并记录日志
|
||||||
|
$room_owner_earningg = $this -> change_user_cion_or_earnings_log($room_guild,$room_owner_earningsg,$from_id,2,21,'工会长收益');
|
||||||
|
if(!$room_owner_earningg){
|
||||||
|
return ['code' => 0, 'msg' => '工会长收益失败', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
|
||||||
|
//计算房主收益//room_author_ratio
|
||||||
|
$room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,99);//结果是钻石
|
||||||
|
if($room_owner_earnings > 0){
|
||||||
|
//主持人收益
|
||||||
|
//在主持位的主持人
|
||||||
|
$host_id = Db::name('vs_room_pit')->where(['room_id'=>$from_id,'pit_number'=>9])->value('user_id');
|
||||||
|
if($host_id){
|
||||||
|
//计算主持人收益
|
||||||
|
$host_earnings = $this -> receiver_earnings($host_id,$room_owner_earnings*get_system_config_value('rmb_coin_ratio'),98,$from_id);
|
||||||
|
if($host_earnings > 0){
|
||||||
|
//增加主持人收益并记录日志
|
||||||
|
$host_earnings_earning = $this -> change_user_cion_or_earnings_log($host_id,$host_earnings,$from_id,2,19,'主持人收益');
|
||||||
|
if(!$host_earnings_earning){
|
||||||
|
return ['code' => 0, 'msg' => '主持人收益失败', 'data' => null];
|
||||||
|
}
|
||||||
|
//增加房主收益并记录日志
|
||||||
|
$room_owner_earningss = $room_owner_earnings - $host_earnings;
|
||||||
|
if($room_owner_earningss > 0){
|
||||||
|
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益');
|
||||||
|
if(!$room_owner_earning){
|
||||||
|
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//增加房主收益并记录日志
|
||||||
|
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||||
|
if(!$room_owner_earning){
|
||||||
|
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//增加房主收益并记录日志
|
||||||
|
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||||
|
if(!$room_owner_earning){
|
||||||
|
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($gift_info['label'] == 2){
|
||||||
|
foreach ($gift_box as $gv) {
|
||||||
|
//记录送礼利率和各方收益
|
||||||
|
//收礼人是否加入公会
|
||||||
|
$configs = get_system_config();
|
||||||
|
$is_join_guild = Db::name('vs_guild_user')->where(['user_id' => $to_uid, 'status' => 1, 'quit_time' => 0])->field('guild_id')->find();
|
||||||
|
//收益增加 加入工会的收益
|
||||||
|
if ($is_join_guild) {
|
||||||
|
$ratiog = $configs['room_gift_guild_ratio'];
|
||||||
|
} else {
|
||||||
|
$ratiog = 0;
|
||||||
|
}
|
||||||
|
//未加入工会的收益
|
||||||
|
$ratiogr = $configs['room_gift_ratio'];
|
||||||
|
//收礼人最终的收益比例
|
||||||
|
$ratio = $ratiogr + $ratiog;
|
||||||
|
//房主收益大于0 就代表有收益 且在房间
|
||||||
|
if ($room_owner_earningsg > 0) {
|
||||||
|
$guid_ratio = $configs['room_cp_guild_user_ratio'];
|
||||||
|
} else {
|
||||||
|
$guid_ratio = 0;
|
||||||
|
}
|
||||||
|
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||||
|
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||||
|
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
|
||||||
|
$receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
|
||||||
|
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
|
||||||
|
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
|
||||||
|
if (!$gift_rate) {
|
||||||
|
Db::rollback();
|
||||||
|
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//记录送礼利率和各方收益
|
||||||
|
//收礼人是否加入公会
|
||||||
|
$configs = get_system_config();
|
||||||
|
$is_join_guild = Db::name('vs_guild_user')->where(['user_id' => $to_uid, 'status' => 1, 'quit_time' => 0])->field('guild_id')->find();
|
||||||
|
//收益增加 加入工会的收益
|
||||||
|
if ($is_join_guild) {
|
||||||
|
$ratiog = $configs['room_gift_guild_ratio'];
|
||||||
|
} else {
|
||||||
|
$ratiog = 0;
|
||||||
|
}
|
||||||
|
//未加入工会的收益
|
||||||
|
$ratiogr = $configs['room_gift_ratio'];
|
||||||
|
//收礼人最终的收益比例
|
||||||
|
$ratio = $ratiogr + $ratiog;
|
||||||
|
//房主收益大于0 就代表有收益 且在房间
|
||||||
|
if ($room_owner_earningsg > 0) {
|
||||||
|
$guid_ratio = $configs['room_cp_guild_user_ratio'];
|
||||||
|
} else {
|
||||||
|
$guid_ratio = 0;
|
||||||
|
}
|
||||||
|
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||||
|
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||||
|
$app_earning = coin_earning($gift_price, $app_ratio);
|
||||||
|
$gift_rate = $this->change_give_gift_profit($give_gift, $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning);
|
||||||
|
if (!$gift_rate) {
|
||||||
|
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ToUserInfo = Db::name('user')->where(['id' => $to_id])->field('id as user_id,nickname,avatar,sex')->find();
|
||||||
|
$ToUserInfo['icon'][0] = model('UserData')->user_wealth_icon($to_id);//财富图标
|
||||||
|
$ToUserInfo['icon'][1] = model('UserData')->user_charm_icon($to_id);//魅力图标
|
||||||
|
$ToUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $to_id,'room_id' => $from_id])->value('charm');//魅力
|
||||||
|
|
||||||
|
if(isset($from_id) && ($from_type == 2 || $from_type == 6)){
|
||||||
|
//查询房间是否在PK中 是fa_vs_room_pk 表中的 room_id_a,还是room_id_b
|
||||||
|
$room_pk = Db::name('vs_room_pk')->where(['status' => 3, 'room_id_a' => $from_id])->field('pk_id')->find();
|
||||||
|
if (!empty($room_pk)) {
|
||||||
|
// 当前 room_id 是 room_id_a 修改create_value_a
|
||||||
|
$rooma = Db::name('vs_room_pk')->where('pk_id', $room_pk['pk_id'])->setInc('create_value_a', $gift_price * 10);
|
||||||
|
$roomPKinfo = Db::name('vs_room_pk')->where('pk_id', $room_pk['pk_id'])->find();
|
||||||
|
//推送变化
|
||||||
|
$text = [
|
||||||
|
'room_id_a' => $roomPKinfo['room_id_a'],//发起者房间id
|
||||||
|
'create_value_a' => $roomPKinfo['create_value_a'],//发起者房间值
|
||||||
|
'room_id_b' => $roomPKinfo['room_id_b'],//接受者房间id
|
||||||
|
'receive_value_b' => $roomPKinfo['receive_value_b'],//接受者房间值
|
||||||
|
'text' => ''
|
||||||
|
];
|
||||||
|
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_a'],$text);
|
||||||
|
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_b'],$text);
|
||||||
|
} else {
|
||||||
|
// 当前 room_id 不是 room_id_a,可能是 room_id_b 或者不存在
|
||||||
|
$room_pk_b = Db::name('vs_room_pk')->where(['status' => 3, 'room_id_b' => $from_id])->field('pk_id')->find();
|
||||||
|
if (!empty($room_pk_b)) {
|
||||||
|
// 当前 room_id 是 room_id_b
|
||||||
|
$roomb = Db::name('vs_room_pk')->where('pk_id', $room_pk_b['pk_id'])->setInc('receive_value_b', $gift_price * 10);
|
||||||
|
$roomPKinfo = Db::name('vs_room_pk')->where('pk_id', $room_pk_b['pk_id'])->find();
|
||||||
|
//推送变化
|
||||||
|
$text = [
|
||||||
|
'room_id_a' => $roomPKinfo['room_id_a'],//发起者房间id
|
||||||
|
'create_value_a' => $roomPKinfo['create_value_a'],//发起者房间值
|
||||||
|
'room_id_b' => $roomPKinfo['room_id_b'],//接受者房间id
|
||||||
|
'receive_value_b' => $roomPKinfo['receive_value_b'],//接受者房间值
|
||||||
|
'text' => ''
|
||||||
|
];
|
||||||
|
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_a'],$text);
|
||||||
|
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_b'],$text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//直播间送礼物 每日任务
|
||||||
|
model('DailyTasks')->tasks_complete($uid,3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//增加房间火热值hot_value
|
||||||
|
$gift_totalaa = $gift_total * get_system_config_value('coin_charm_exp');
|
||||||
|
db::name('vs_room')->where(['id' => $from_id])->inc('hot_value', $gift_totalaa)->inc('today_hot_value', $gift_totalaa)->update();
|
||||||
|
|
||||||
|
$roomtype = Db::name('vs_room')->where(['id' => $from_id])->value('type_id');
|
||||||
|
if($roomtype == 6){
|
||||||
|
//推送消息 交友房创建的私密房 倒计时增加
|
||||||
|
$value = db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)
|
||||||
|
->value('time_day');
|
||||||
|
if($value){
|
||||||
|
db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)
|
||||||
|
->setInc('time_day', $gift_total);
|
||||||
|
$text111 = [
|
||||||
|
'room_id' => $from_id,
|
||||||
|
'time_day' => db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)->value('time_day'),
|
||||||
|
'text' => '房间结束时间变化'
|
||||||
|
];
|
||||||
|
//聊天室推送系统消息
|
||||||
|
model('Chat')->sendMsg(1052,$from_id,$text111);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
|
||||||
|
}
|
||||||
|
|
||||||
//送礼特效
|
//送礼特效
|
||||||
public function give_gift_effect($to_id,$FromUserInfo,$gift_info,$num,$from_id)
|
public function give_gift_effect($to_id,$FromUserInfo,$gift_info,$num,$from_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1068,9 +1068,14 @@ class Room extends Model
|
|||||||
db::name('vs_room_visitor')->where(['room_id' => $room_id, 'user_id' => $user_id])->delete();
|
db::name('vs_room_visitor')->where(['room_id' => $room_id, 'user_id' => $user_id])->delete();
|
||||||
//房间的模式
|
//房间的模式
|
||||||
$res = model('api/Room')->get_room_label($room_id);
|
$res = model('api/Room')->get_room_label($room_id);
|
||||||
|
if($res['code'] != 1){
|
||||||
|
$room_label = 1;
|
||||||
|
$room_type = 1;
|
||||||
|
}else{
|
||||||
$room_label = $res['data']['label_id'];
|
$room_label = $res['data']['label_id'];
|
||||||
$room_type = $res['data']['type_id'];
|
$room_type = $res['data']['type_id'];
|
||||||
|
}
|
||||||
|
|
||||||
$apply_type = 0;
|
$apply_type = 0;
|
||||||
if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||||
$apply_type = 1;
|
$apply_type = 1;
|
||||||
|
|||||||
@@ -313,47 +313,56 @@ class UserData extends Model
|
|||||||
];
|
];
|
||||||
db::name('user_auth')->insert($auth);
|
db::name('user_auth')->insert($auth);
|
||||||
|
|
||||||
$config = get_system_config();
|
$res = $this->real_name_verify($real_name,$id_card);
|
||||||
//获取Access Token
|
if($res['code'] == 200){
|
||||||
$access_token = $this->redis->get('access_token_'.$config['tencent_app_id']);
|
//修改状态
|
||||||
//判断是否过期
|
db::name('user_auth')->where(['real_name' => $real_name,'card_id' => $id_card])->update(['is_real' => 1]);
|
||||||
if(empty($access_token)){
|
return ['code' => 1, 'msg' => '验证通过!','data' =>null];
|
||||||
$access_token = model('Tencent')->getAccessToken($config['tencent_app_id'],$config['tencent_app_secret']);
|
}else{
|
||||||
$this->redis->set('access_token_'.$config['tencent_app_id'],$access_token,1000);
|
return ['code' => 0, 'msg' => $res['msg'],'data' =>null];
|
||||||
sleep(1);
|
|
||||||
//获取SignTicket
|
|
||||||
$sign_ticket = model('Tencent')->getSignTicket($access_token,$config['tencent_app_id']);
|
|
||||||
$this->redis->set('sign_ticket_'.$config['tencent_app_id'],$sign_ticket,1100);
|
|
||||||
}
|
|
||||||
$sign_ticket = $this->redis->get('sign_ticket_'.$config['tencent_app_id']);
|
|
||||||
|
|
||||||
//获取NONCE Ticket
|
|
||||||
$nonce_ticket = model('Tencent')->getNonceTicket($access_token,$user_id,$config['tencent_app_id']);
|
|
||||||
//获取随机字符串
|
|
||||||
$nonceStr = generateRandom(32);
|
|
||||||
//生成一个订单号 并保存在redis
|
|
||||||
$orderNo = generateRandom(12);
|
|
||||||
//保存在redis
|
|
||||||
$this->redis->set('order_no_tencent_'.$user_id,$orderNo,3600);
|
|
||||||
//生成签名
|
|
||||||
$sign = model('Tencent')->getSign($user_id,$nonceStr,$sign_ticket,$config['tencent_app_id']);
|
|
||||||
//生成faceId
|
|
||||||
$faceId = model('Tencent')->getFaceId($orderNo,$real_name,$id_card,$sign,$user_id,$config['tencent_app_id'],$nonceStr);
|
|
||||||
if(isset($faceId['code'])){
|
|
||||||
return ['code' => 0, 'msg' => $faceId['msg'],'data' =>null];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
// $config = get_system_config();
|
||||||
'userid' => 'u'.$user_id,
|
// //获取Access Token
|
||||||
'nonce' => $nonceStr,
|
// $access_token = $this->redis->get('access_token_'.$config['tencent_app_id']);
|
||||||
'sign' => $sign,
|
// //判断是否过期
|
||||||
'appid' => $config['tencent_app_id'],
|
// if(empty($access_token)){
|
||||||
'orderNo' => $orderNo,
|
// $access_token = model('Tencent')->getAccessToken($config['tencent_app_id'],$config['tencent_app_secret']);
|
||||||
'apiVersion'=>'1.0.0',
|
// $this->redis->set('access_token_'.$config['tencent_app_id'],$access_token,1000);
|
||||||
'licence'=>$config['tencent_licence'],
|
// sleep(1);
|
||||||
'faceId' => $faceId
|
// //获取SignTicket
|
||||||
];
|
// $sign_ticket = model('Tencent')->getSignTicket($access_token,$config['tencent_app_id']);
|
||||||
return ['code' => 1, 'msg' => '获取成功','data' =>$data];
|
// $this->redis->set('sign_ticket_'.$config['tencent_app_id'],$sign_ticket,1100);
|
||||||
|
// }
|
||||||
|
// $sign_ticket = $this->redis->get('sign_ticket_'.$config['tencent_app_id']);
|
||||||
|
//
|
||||||
|
// //获取NONCE Ticket
|
||||||
|
// $nonce_ticket = model('Tencent')->getNonceTicket($access_token,$user_id,$config['tencent_app_id']);
|
||||||
|
// //获取随机字符串
|
||||||
|
// $nonceStr = generateRandom(32);
|
||||||
|
// //生成一个订单号 并保存在redis
|
||||||
|
// $orderNo = generateRandom(12);
|
||||||
|
// //保存在redis
|
||||||
|
// $this->redis->set('order_no_tencent_'.$user_id,$orderNo,3600);
|
||||||
|
// //生成签名
|
||||||
|
// $sign = model('Tencent')->getSign($user_id,$nonceStr,$sign_ticket,$config['tencent_app_id']);
|
||||||
|
// //生成faceId
|
||||||
|
// $faceId = model('Tencent')->getFaceId($orderNo,$real_name,$id_card,$sign,$user_id,$config['tencent_app_id'],$nonceStr);
|
||||||
|
// if(isset($faceId['code'])){
|
||||||
|
// return ['code' => 0, 'msg' => $faceId['msg'],'data' =>null];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $data = [
|
||||||
|
// 'userid' => 'u'.$user_id,
|
||||||
|
// 'nonce' => $nonceStr,
|
||||||
|
// 'sign' => $sign,
|
||||||
|
// 'appid' => $config['tencent_app_id'],
|
||||||
|
// 'orderNo' => $orderNo,
|
||||||
|
// 'apiVersion'=>'1.0.0',
|
||||||
|
// 'licence'=>$config['tencent_licence'],
|
||||||
|
// 'faceId' => $faceId
|
||||||
|
// ];
|
||||||
|
// return ['code' => 1, 'msg' => '获取成功','data' =>$data];
|
||||||
}
|
}
|
||||||
|
|
||||||
//实名认证结果
|
//实名认证结果
|
||||||
@@ -477,28 +486,60 @@ class UserData extends Model
|
|||||||
$lists['ali']['name'] = "支付宝";
|
$lists['ali']['name'] = "支付宝";
|
||||||
$lists['wx']['name'] = "微信";
|
$lists['wx']['name'] = "微信";
|
||||||
$lists['bank']['name'] = "银行卡";
|
$lists['bank']['name'] = "银行卡";
|
||||||
|
|
||||||
$lists['ali_tl']['name'] = "支付宝(通联)";
|
$lists['ali_tl']['name'] = "支付宝(通联)";
|
||||||
$lists['wx_tl']['name'] = "微信(通联)";
|
$lists['wx_tl']['name'] = "微信(通联)";
|
||||||
|
|
||||||
|
$lists['xlx_wx']['name'] = "微信(西来喜)";
|
||||||
|
$lists['xlx_ali']['name'] = "支付宝(西来喜)";
|
||||||
|
$lists['xlx_bank']['name'] = "云闪付(西来喜)";
|
||||||
|
|
||||||
$lists['ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
$lists['ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
||||||
$lists['wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
$lists['wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
$lists['bank']['icon'] = localpath_to_netpath('data/default/bankpay.png');
|
$lists['bank']['icon'] = localpath_to_netpath('data/default/bankpay.png');
|
||||||
|
|
||||||
$lists['ali_tl']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
$lists['ali_tl']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
||||||
$lists['wx_tl']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
$lists['wx_tl']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
|
|
||||||
|
$lists['xlx_ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
||||||
|
$lists['xlx_wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
|
$lists['xlx_bank']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
|
|
||||||
$lists['ali']['is_with_draw_open'] = get_system_config_value('withdraw_ali');
|
$lists['ali']['is_with_draw_open'] = get_system_config_value('withdraw_ali');
|
||||||
$lists['wx']['is_with_draw_open'] = get_system_config_value('withdraw_wx');
|
$lists['wx']['is_with_draw_open'] = get_system_config_value('withdraw_wx');
|
||||||
$lists['bank']['is_with_draw_open'] = get_system_config_value('withdraw_bank');
|
$lists['bank']['is_with_draw_open'] = get_system_config_value('withdraw_bank');
|
||||||
|
|
||||||
$lists['ali_tl']['is_with_draw_open'] = 0;
|
$lists['ali_tl']['is_with_draw_open'] = 0;
|
||||||
$lists['wx_tl']['is_with_draw_open'] = 0;
|
$lists['wx_tl']['is_with_draw_open'] = 0;
|
||||||
|
|
||||||
|
$lists['xlx_ali']['is_with_draw_open'] = 0;
|
||||||
|
$lists['xlx_wx']['is_with_draw_open'] = 0;
|
||||||
|
$lists['xlx_bank']['is_with_draw_open'] = 0;
|
||||||
|
|
||||||
$lists['ali']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('alipay_account') ? 1 : 0;
|
$lists['ali']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('alipay_account') ? 1 : 0;
|
||||||
$lists['wx']['is_bind'] = 0;
|
$lists['wx']['is_bind'] = 0;
|
||||||
$lists['bank']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('bank_card_number') ? 1 : 0;
|
$lists['bank']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('bank_card_number') ? 1 : 0;
|
||||||
|
|
||||||
$lists['ali_tl']['is_bind'] = 0;
|
$lists['ali_tl']['is_bind'] = 0;
|
||||||
$lists['wx_tl']['is_bind'] = 0;
|
$lists['wx_tl']['is_bind'] = 0;
|
||||||
|
|
||||||
|
$lists['xlx_ali']['is_bind'] =0;
|
||||||
|
$lists['xlx_wx']['is_bind'] = 0;
|
||||||
|
$lists['xlx_bank']['is_bind'] = 0;
|
||||||
|
|
||||||
|
|
||||||
$lists['ali']['type'] = 2;
|
$lists['ali']['type'] = 2;
|
||||||
$lists['wx']['type'] = 1;
|
$lists['wx']['type'] = 1;
|
||||||
$lists['bank']['type'] = 3;
|
$lists['bank']['type'] = 3;
|
||||||
|
|
||||||
$lists['ali_tl']['type'] = 4;
|
$lists['ali_tl']['type'] = 4;
|
||||||
$lists['wx_tl']['type'] = 5;
|
$lists['wx_tl']['type'] = 5;
|
||||||
|
|
||||||
|
//6-西来喜微信,7-西来喜支付宝,8-西来喜QQ钱包,9-西来喜云闪付
|
||||||
|
$lists['xlx_ali']['type'] = 7;
|
||||||
|
$lists['xlx_wx']['type'] = 6;
|
||||||
|
$lists['xlx_bank']['type'] = 9;
|
||||||
|
|
||||||
// $lists['ali']['is_pay_open'] = 0;
|
// $lists['ali']['is_pay_open'] = 0;
|
||||||
// $lists['wx']['is_pay_open'] = 0;
|
// $lists['wx']['is_pay_open'] = 0;
|
||||||
// $lists['bank']['is_pay_open'] = 0;
|
// $lists['bank']['is_pay_open'] = 0;
|
||||||
@@ -507,39 +548,63 @@ class UserData extends Model
|
|||||||
$lists['ali']['is_pay_open'] = get_system_config_value('pay_open_ali');
|
$lists['ali']['is_pay_open'] = get_system_config_value('pay_open_ali');
|
||||||
$lists['wx']['is_pay_open'] = get_system_config_value('pay_open_wx');
|
$lists['wx']['is_pay_open'] = get_system_config_value('pay_open_wx');
|
||||||
$lists['bank']['is_pay_open'] = get_system_config_value('pay_open_bank');
|
$lists['bank']['is_pay_open'] = get_system_config_value('pay_open_bank');
|
||||||
|
|
||||||
$lists['ali_tl']['is_pay_open'] = get_system_config_value('pay_open_ali_tl');
|
$lists['ali_tl']['is_pay_open'] = get_system_config_value('pay_open_ali_tl');
|
||||||
$lists['wx_tl']['is_pay_open'] = get_system_config_value('pay_open_wx_tl');
|
$lists['wx_tl']['is_pay_open'] = get_system_config_value('pay_open_wx_tl');
|
||||||
|
|
||||||
|
$lists['xlx_ali']['is_pay_open'] = get_system_config_value('pay_open_xlx_ali');
|
||||||
|
$lists['xlx_wx']['is_pay_open'] = get_system_config_value('pay_open_xlx_wx');
|
||||||
|
$lists['xlx_bank']['is_pay_open'] = get_system_config_value('pay_open_xlx_bank');
|
||||||
}else{
|
}else{
|
||||||
$lists['ali']['name'] = "支付宝";
|
$lists['ali']['name'] = "支付宝";
|
||||||
$lists['wx']['name'] = "微信";
|
$lists['wx']['name'] = "微信";
|
||||||
$lists['bank']['name'] = "银行卡";
|
$lists['bank']['name'] = "银行卡";
|
||||||
$lists['ali_tl']['name'] = "支付宝(通联)";
|
$lists['ali_tl']['name'] = "支付宝(通联)";
|
||||||
$lists['wx_tl']['name'] = "微信(通联)";
|
$lists['wx_tl']['name'] = "微信(通联)";
|
||||||
|
$lists['xlx_wx']['name'] = "微信(西来喜)";
|
||||||
|
$lists['xlx_ali']['name'] = "支付宝(西来喜)";
|
||||||
|
$lists['xlx_bank']['name'] = "云闪付(西来喜)";
|
||||||
$lists['ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
$lists['ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
||||||
$lists['wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
$lists['wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
$lists['bank']['icon'] = localpath_to_netpath('data/default/bankpay.png');
|
$lists['bank']['icon'] = localpath_to_netpath('data/default/bankpay.png');
|
||||||
$lists['ali_tl']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
$lists['ali_tl']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
||||||
$lists['wx_tl']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
$lists['wx_tl']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
|
$lists['xlx_ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
|
||||||
|
$lists['xlx_wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
|
$lists['xlx_bank']['icon'] = localpath_to_netpath('data/default/wxpay.png');
|
||||||
$lists['ali']['is_with_draw_open'] = get_system_config_value('withdraw_ali');
|
$lists['ali']['is_with_draw_open'] = get_system_config_value('withdraw_ali');
|
||||||
$lists['wx']['is_with_draw_open'] = get_system_config_value('withdraw_wx');
|
$lists['wx']['is_with_draw_open'] = get_system_config_value('withdraw_wx');
|
||||||
$lists['bank']['is_with_draw_open'] = get_system_config_value('withdraw_bank');
|
$lists['bank']['is_with_draw_open'] = get_system_config_value('withdraw_bank');
|
||||||
$lists['ali_tl']['is_with_draw_open'] = 0;
|
$lists['ali_tl']['is_with_draw_open'] = 0;
|
||||||
$lists['wx_tl']['is_with_draw_open'] = 0;
|
$lists['wx_tl']['is_with_draw_open'] = 0;
|
||||||
|
$lists['xlx_ali']['is_with_draw_open'] = 0;
|
||||||
|
$lists['xlx_wx']['is_with_draw_open'] = 0;
|
||||||
|
$lists['xlx_bank']['is_with_draw_open'] = 0;
|
||||||
$lists['ali']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('alipay_account') ? 1 : 0;
|
$lists['ali']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('alipay_account') ? 1 : 0;
|
||||||
$lists['wx']['is_bind'] = 0;
|
$lists['wx']['is_bind'] = 0;
|
||||||
$lists['bank']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('bank_card_number') ? 1 : 0;
|
$lists['bank']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('bank_card_number') ? 1 : 0;
|
||||||
$lists['ali_tl']['is_bind'] = 0;
|
$lists['ali_tl']['is_bind'] = 0;
|
||||||
$lists['wx_tl']['is_bind'] = 0;
|
$lists['wx_tl']['is_bind'] = 0;
|
||||||
|
$lists['xlx_ali']['is_bind'] =0;
|
||||||
|
$lists['xlx_wx']['is_bind'] = 0;
|
||||||
|
$lists['xlx_bank']['is_bind'] = 0;
|
||||||
$lists['ali']['type'] = 2;
|
$lists['ali']['type'] = 2;
|
||||||
$lists['wx']['type'] = 1;
|
$lists['wx']['type'] = 1;
|
||||||
$lists['bank']['type'] = 3;
|
$lists['bank']['type'] = 3;
|
||||||
$lists['ali_tl']['type'] = 4;
|
$lists['ali_tl']['type'] = 4;
|
||||||
$lists['wx_tl']['type'] = 5;
|
$lists['wx_tl']['type'] = 5;
|
||||||
|
//6-西来喜微信,7-西来喜支付宝,8-西来喜QQ钱包,9-西来喜云闪付
|
||||||
|
$lists['xlx_ali']['type'] = 7;
|
||||||
|
$lists['xlx_wx']['type'] = 6;
|
||||||
|
$lists['xlx_bank']['type'] = 9;
|
||||||
$lists['ali']['is_pay_open'] = get_system_config_value('pay_open_ali');
|
$lists['ali']['is_pay_open'] = get_system_config_value('pay_open_ali');
|
||||||
$lists['wx']['is_pay_open'] = get_system_config_value('pay_open_wx');
|
$lists['wx']['is_pay_open'] = get_system_config_value('pay_open_wx');
|
||||||
$lists['bank']['is_pay_open'] = get_system_config_value('pay_open_bank');
|
$lists['bank']['is_pay_open'] = get_system_config_value('pay_open_bank');
|
||||||
$lists['ali_tl']['is_pay_open'] = get_system_config_value('pay_open_ali_tl');
|
$lists['ali_tl']['is_pay_open'] = get_system_config_value('pay_open_ali_tl');
|
||||||
$lists['wx_tl']['is_pay_open'] = get_system_config_value('pay_open_wx_tl');
|
$lists['wx_tl']['is_pay_open'] = get_system_config_value('pay_open_wx_tl');
|
||||||
|
$lists['xlx_ali']['is_pay_open'] = get_system_config_value('pay_open_xlx_ali');
|
||||||
|
$lists['xlx_wx']['is_pay_open'] = get_system_config_value('pay_open_xlx_wx');
|
||||||
|
$lists['xlx_bank']['is_pay_open'] = get_system_config_value('pay_open_xlx_bank');
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['code' => 1, 'msg' => '获取成功','data' =>$lists];
|
return ['code' => 1, 'msg' => '获取成功','data' =>$lists];
|
||||||
@@ -596,4 +661,71 @@ class UserData extends Model
|
|||||||
}
|
}
|
||||||
return ['code' => 1, 'msg' => '获取成功','data' =>$data];
|
return ['code' => 1, 'msg' => '获取成功','data' =>$data];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//身份证二要素认证
|
||||||
|
public function real_name_verify($real_name, $card_id)
|
||||||
|
{
|
||||||
|
// 云市场分配的密钥Id
|
||||||
|
$secretId = '1QMATmzeRHC7Auz8';
|
||||||
|
// 云市场分配的密钥Key
|
||||||
|
$secretKey = 'FKeTuxiKC76DrdPMAu4nhsppLZ1mI93l';
|
||||||
|
|
||||||
|
// 签名
|
||||||
|
$datetime = gmdate('D, d M Y H:i:s T');
|
||||||
|
$signStr = sprintf("x-date: %s", $datetime);
|
||||||
|
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
|
||||||
|
$auth = sprintf('{"id": "%s", "x-date": "%s" , "signature": "%s"}', $secretId, $datetime, $sign);
|
||||||
|
|
||||||
|
// 请求方法
|
||||||
|
$method = 'GET';
|
||||||
|
// 请求头
|
||||||
|
$headers = array(
|
||||||
|
'Authorization' => $auth,
|
||||||
|
);
|
||||||
|
// 查询参数
|
||||||
|
$queryParams = array (
|
||||||
|
'cardNo' => $card_id,
|
||||||
|
'realName' => $real_name,
|
||||||
|
);
|
||||||
|
// body参数(POST方法下)
|
||||||
|
$bodyParams = array (
|
||||||
|
|
||||||
|
);
|
||||||
|
$sendData = http_build_query($bodyParams);
|
||||||
|
// url参数拼接
|
||||||
|
$url = 'https://ap-beijing.cloudmarket-apigw.com/service-hcgajsa5/idcard/VerifyIdcardv2';
|
||||||
|
if (count($queryParams) > 0) {
|
||||||
|
$url .= '?' . http_build_query($queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||||
|
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
|
||||||
|
$headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $sendData);
|
||||||
|
}
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
|
||||||
|
return $k . ': ' . $v;
|
||||||
|
}, array_values($headers), array_keys($headers)));
|
||||||
|
|
||||||
|
// $data = json_decode(curl_exec($ch), true);
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
if($result) {
|
||||||
|
$data = json_decode($result, true);
|
||||||
|
// var_dump($data);exit;
|
||||||
|
if ($data['error_code'] == 0) {
|
||||||
|
if ($data['result']['isok']) {
|
||||||
|
return ['code' => 200, 'msg' => '验证成功', 'data' => null];
|
||||||
|
} else {
|
||||||
|
return ['code' => 201, 'msg' => '信息有误' . json_encode($data), 'data' => null];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ['code' => 201, 'msg' => '信息有误' . json_encode($data), 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ['code' => 201, 'msg' => '信息有误', 'data' => null];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
199
extend/Xilaixi/Xilaixi.php
Normal file
199
extend/Xilaixi/Xilaixi.php
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\Env;
|
||||||
|
use think\Log;
|
||||||
|
|
||||||
|
class Xilaixi
|
||||||
|
{
|
||||||
|
private $pid;
|
||||||
|
private $key;
|
||||||
|
private string $sign_type = 'MD5';
|
||||||
|
// private string $mapi_url = 'https://wxjs.980city.com/mapi.php';
|
||||||
|
private string $mapi_url = 'https://wxjs.980city.com/submit.php';
|
||||||
|
private string $api_url = 'https://wxjs.980city.com/api.php';//https://wxjs.980city.com/api.php?
|
||||||
|
|
||||||
|
function __construct(){
|
||||||
|
$this->pid = Env::get('XilaixiPay.pid');//平台分配的APPID
|
||||||
|
$this->key = Env::get('XilaixiPay.key');//平台分配的APPID
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 西来喜支付
|
||||||
|
*/
|
||||||
|
public function XilaixiPay($date, $type) {
|
||||||
|
//6-西来喜微信,7-西来喜支付宝,8-西来喜QQ钱包,9-西来喜云闪付
|
||||||
|
if($type == 6){
|
||||||
|
$types = 'wxpay';
|
||||||
|
}elseif ($type == 7){
|
||||||
|
$types = 'alipay';
|
||||||
|
}elseif ($type == 8){
|
||||||
|
$types = 'qqpay';
|
||||||
|
}elseif ($type == 9){
|
||||||
|
$types = 'bank';
|
||||||
|
}else{
|
||||||
|
$types = 'wxpay';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ip = $this->get_client_ip();
|
||||||
|
if ($ip == '::1')
|
||||||
|
$ip = '1.1.1.1';
|
||||||
|
//构造要请求的参数数组,无需改动
|
||||||
|
$parameter = array(
|
||||||
|
"pid" => $this->pid,
|
||||||
|
"type" => $types,
|
||||||
|
"notify_url" => get_system_config_value("web_site")."/api/Payment/XilaixiPayNotify",
|
||||||
|
"return_url" => get_system_config_value("web_site")."/api/Payment/XilaixiPayNotify",
|
||||||
|
"out_trade_no" => $date['order_sn'],//商户订单号,
|
||||||
|
"name" => $date['remarke'],//订单标题(不能有空格),
|
||||||
|
"money" => $date['money'],
|
||||||
|
'clientip' => $ip,
|
||||||
|
);
|
||||||
|
Log::record("西来喜支付参数:".json_encode($parameter),"info");
|
||||||
|
$param = $this->buildRequestParam($parameter);
|
||||||
|
// $response = $this->getHttpResponse($this->mapi_url, http_build_query($param));
|
||||||
|
return $this->getHttpRequest($this->mapi_url,$param);
|
||||||
|
// return json_decode($response, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildRequestParam($param){
|
||||||
|
$mysign = $this->getSign($param);
|
||||||
|
$param['sign'] = $mysign;
|
||||||
|
$param['sign_type'] = $this->sign_type;
|
||||||
|
return $param;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算签名
|
||||||
|
private function getSign($param){
|
||||||
|
ksort($param);
|
||||||
|
reset($param);
|
||||||
|
$signstr = '';
|
||||||
|
|
||||||
|
foreach($param as $k => $v){
|
||||||
|
if($k != "sign" && $k != "sign_type" && $v!=''){
|
||||||
|
$signstr .= $k.'='.$v.'&';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$signstr = substr($signstr,0,-1);
|
||||||
|
$signstr .= $this->key;
|
||||||
|
$sign = md5($signstr);
|
||||||
|
return $sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求外部资源
|
||||||
|
private function getHttpResponse($url, $post = false, $timeout = 10){
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
$httpheader[] = "Accept: */*";
|
||||||
|
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
|
||||||
|
$httpheader[] = "Connection: close";
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||||
|
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
if($post){
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||||
|
}
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 异步回调验证
|
||||||
|
public function verifyNotify(){
|
||||||
|
if(empty($_GET)) return false;
|
||||||
|
|
||||||
|
$sign = $this->getSign($_GET);
|
||||||
|
|
||||||
|
if($sign === $_GET['sign']){
|
||||||
|
$signResult = true;
|
||||||
|
}else{
|
||||||
|
$signResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $signResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查询订单支付状态
|
||||||
|
public function orderStatus($trade_no){
|
||||||
|
$result = $this->queryOrder($trade_no);
|
||||||
|
if($result['status']==1){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询订单
|
||||||
|
public function queryOrder($trade_no){
|
||||||
|
$url = $this->api_url.'?act=order&pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no;
|
||||||
|
$response = $this->getHttpResponse($url);
|
||||||
|
$arr = json_decode($response, true);
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单退款
|
||||||
|
public function refund($trade_no, $money){
|
||||||
|
$url = $this->api_url.'?act=refund';
|
||||||
|
$post = 'pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no . '&money=' . $money;
|
||||||
|
$response = $this->getHttpResponse($url, $post);
|
||||||
|
$arr = json_decode($response, true);
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前服务器的IP
|
||||||
|
function get_client_ip() {
|
||||||
|
if ($_SERVER ['REMOTE_ADDR']) {
|
||||||
|
$cip = $_SERVER ['REMOTE_ADDR'];
|
||||||
|
} elseif (getenv("REMOTE_ADDR")) {
|
||||||
|
$cip = getenv("REMOTE_ADDR");
|
||||||
|
} elseif (getenv("HTTP_CLIENT_IP")) {
|
||||||
|
$cip = getenv("HTTP_CLIENT_IP");
|
||||||
|
} else {
|
||||||
|
$cip = "unknown";
|
||||||
|
}
|
||||||
|
return $cip;
|
||||||
|
}
|
||||||
|
|
||||||
|
//拼接参数get请求
|
||||||
|
private function getHttpRequest($url, $param) {
|
||||||
|
// 将参数数组转换为查询字符串
|
||||||
|
$query = http_build_query($param);
|
||||||
|
|
||||||
|
// 拼接完整的URL
|
||||||
|
$fullUrl = $url . '?' . $query;
|
||||||
|
|
||||||
|
// // 初始化curl
|
||||||
|
// $ch = curl_init();
|
||||||
|
//
|
||||||
|
// // 设置curl选项
|
||||||
|
// curl_setopt($ch, CURLOPT_URL, $fullUrl);
|
||||||
|
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
// curl_setopt($ch, CURLOPT_HEADER, false);
|
||||||
|
// curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||||
|
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
//
|
||||||
|
// // 设置HTTP头
|
||||||
|
// $httpheader[] = "Accept: */*";
|
||||||
|
// $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
|
||||||
|
// $httpheader[] = "Connection: close";
|
||||||
|
// curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||||
|
//
|
||||||
|
// // 执行请求
|
||||||
|
// $response = curl_exec($ch);
|
||||||
|
//
|
||||||
|
// // 检查是否有错误
|
||||||
|
// if (curl_errno($ch)) {
|
||||||
|
// Log::record("西来喜支付请求错误: " . curl_error($ch), "error");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 关闭curl
|
||||||
|
// curl_close($ch);
|
||||||
|
|
||||||
|
return $fullUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
60
extend/Xilaixi/epayapi.php
Normal file
60
extend/Xilaixi/epayapi.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>正在为您跳转到支付页面,请稍候...</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body{margin:0;padding:0}
|
||||||
|
p{position:absolute;left:50%;top:50%;height:35px;margin:-35px 0 0 -160px;padding:20px;font:bold 16px/30px "宋体",Arial;text-indent:40px;border:1px solid #c5d0dc}
|
||||||
|
#waiting{font-family:Arial}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once("lib/epay.config.php");
|
||||||
|
require_once("lib/EpayCore.class.php");
|
||||||
|
|
||||||
|
/**************************请求参数**************************/
|
||||||
|
$notify_url = "http://127.0.0.1/SDK/notify_url.php";
|
||||||
|
//需http://格式的完整路径,不能加?id=123这类自定义参数
|
||||||
|
|
||||||
|
//页面跳转同步通知页面路径
|
||||||
|
$return_url = "http://127.0.0.1/SDK/return_url.php";
|
||||||
|
//需http://格式的完整路径,不能加?id=123这类自定义参数
|
||||||
|
|
||||||
|
//商户订单号
|
||||||
|
$out_trade_no = $_POST['WIDout_trade_no'];
|
||||||
|
//商户网站订单系统中唯一订单号,必填
|
||||||
|
|
||||||
|
//支付方式(可传入alipay,wxpay,qqpay,bank,jdpay)
|
||||||
|
$type = $_POST['type'];
|
||||||
|
//商品名称
|
||||||
|
$name = $_POST['WIDsubject'];
|
||||||
|
//付款金额
|
||||||
|
$money = $_POST['WIDtotal_fee'];
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************/
|
||||||
|
|
||||||
|
//构造要请求的参数数组,无需改动
|
||||||
|
$parameter = array(
|
||||||
|
"pid" => $epay_config['pid'],
|
||||||
|
"type" => $type,
|
||||||
|
"notify_url" => $notify_url,
|
||||||
|
"return_url" => $return_url,
|
||||||
|
"out_trade_no" => $out_trade_no,
|
||||||
|
"name" => $name,
|
||||||
|
"money" => $money,
|
||||||
|
);
|
||||||
|
|
||||||
|
//建立请求
|
||||||
|
$epay = new EpayCore($epay_config);
|
||||||
|
$html_text = $epay->pagePay($parameter);
|
||||||
|
echo $html_text;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<p>正在为您跳转到支付页面,请稍候...</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
205
extend/Xilaixi/index.php
Normal file
205
extend/Xilaixi/index.php
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<?php
|
||||||
|
/* *
|
||||||
|
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>彩虹易支付接口测试</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<style>
|
||||||
|
*{
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
ul,ol{
|
||||||
|
list-style:none;
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
color: #ADADAD;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 8px 16px 5px 10px;
|
||||||
|
}
|
||||||
|
.hidden{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-btn-login-sp{
|
||||||
|
border:1px solid #D74C00;
|
||||||
|
padding:1px;
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-btn-login{
|
||||||
|
background-color: #ff8c00;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-weight: bold;
|
||||||
|
border: medium none;
|
||||||
|
width:82px;
|
||||||
|
height:28px;
|
||||||
|
}
|
||||||
|
.new-btn-login:hover{
|
||||||
|
background-color: #ffa300;
|
||||||
|
width: 82px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-weight: bold;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
.bank-list{
|
||||||
|
overflow:hidden;
|
||||||
|
margin-top:5px;
|
||||||
|
}
|
||||||
|
.bank-list li{
|
||||||
|
float:left;
|
||||||
|
width:153px;
|
||||||
|
margin-bottom:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main{
|
||||||
|
width:750px;
|
||||||
|
margin:0 auto;
|
||||||
|
font-size:14px;
|
||||||
|
font-family:'宋体';
|
||||||
|
}
|
||||||
|
#logo{
|
||||||
|
background-color: transparent;
|
||||||
|
background-image: url("images/new-btn-fixed.png");
|
||||||
|
border: medium none;
|
||||||
|
background-position:0 0;
|
||||||
|
width:166px;
|
||||||
|
height:35px;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
.red-star{
|
||||||
|
color:#f00;
|
||||||
|
width:10px;
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
.null-star{
|
||||||
|
color:#fff;
|
||||||
|
}
|
||||||
|
.content{
|
||||||
|
margin-top:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content dt{
|
||||||
|
width:160px;
|
||||||
|
display:inline-block;
|
||||||
|
text-align:right;
|
||||||
|
float:left;
|
||||||
|
|
||||||
|
}
|
||||||
|
.content dd{
|
||||||
|
margin-left:100px;
|
||||||
|
margin-bottom:5px;
|
||||||
|
}
|
||||||
|
#foot{
|
||||||
|
margin-top:10px;
|
||||||
|
}
|
||||||
|
.foot-ul li {
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
.note-help {
|
||||||
|
color: #999999;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 130%;
|
||||||
|
padding-left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cashier-nav {
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 15px 0 10px;
|
||||||
|
text-align: left;
|
||||||
|
height:30px;
|
||||||
|
border-bottom:solid 2px #CFD2D7;
|
||||||
|
}
|
||||||
|
.cashier-nav ol li {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.cashier-nav li.current {
|
||||||
|
color: #AB4400;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.cashier-nav li.last {
|
||||||
|
clear:right;
|
||||||
|
}
|
||||||
|
.alipay_link {
|
||||||
|
text-align:right;
|
||||||
|
}
|
||||||
|
.alipay_link a:link{
|
||||||
|
text-decoration:none;
|
||||||
|
color:#8D8D8D;
|
||||||
|
}
|
||||||
|
.alipay_link a:visited{
|
||||||
|
text-decoration:none;
|
||||||
|
color:#8D8D8D;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body text=#000000 bgColor=#ffffff leftMargin=0 topMargin=4>
|
||||||
|
<div id="main">
|
||||||
|
<div id="head">
|
||||||
|
<dl class="alipay_link">
|
||||||
|
</dl>
|
||||||
|
<span class="title">彩虹易支付接口测试</span>
|
||||||
|
</div>
|
||||||
|
<div class="cashier-nav">
|
||||||
|
<ol>
|
||||||
|
<li class="current">1、确认信息 →</li>
|
||||||
|
<li>2、点击确认 →</li>
|
||||||
|
<li class="last">3、确认完成</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<form name=alipayment action=epayapi.php method=post target="_blank">
|
||||||
|
<div id="body" style="clear:left">
|
||||||
|
<dl class="content">
|
||||||
|
<dt>商户订单号:</dt>
|
||||||
|
<dd>
|
||||||
|
<span class="null-star">*</span>
|
||||||
|
<input size="30" name="WIDout_trade_no" value="<?php echo date("YmdHis").mt_rand(100,999); ?>"/>
|
||||||
|
<span>商户网站订单系统中唯一订单号,必填
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
<dt>商品名称:</dt>
|
||||||
|
<dd>
|
||||||
|
<span class="null-star">*</span>
|
||||||
|
<input size="30" name="WIDsubject" value="测试商品"/>
|
||||||
|
<span>必填
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
<dt>付款金额:</dt>
|
||||||
|
<dd>
|
||||||
|
<span class="null-star">*</span>
|
||||||
|
<input size="30" name="WIDtotal_fee" value="1"/>
|
||||||
|
<span>必填
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
<dt>支付方式:</dt>
|
||||||
|
<dd>
|
||||||
|
<label><input type="radio" name="type" value="alipay" checked="">支付宝</label> <label><input type="radio" name="type" value="qqpay">QQ钱包</label> <label><input type="radio" name="type" value="wxpay">微信支付</label> <label><input type="radio" name="type" value="bank">云闪付</label>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
|
||||||
|
<dt></dt>
|
||||||
|
<dd>
|
||||||
|
<span class="new-btn-login-sp">
|
||||||
|
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div id="foot">
|
||||||
|
<ul class="foot-ul">
|
||||||
|
<li><font class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。 </font></li>
|
||||||
|
<li>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
154
extend/Xilaixi/lib/EpayCore.class.php
Normal file
154
extend/Xilaixi/lib/EpayCore.class.php
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
/* *
|
||||||
|
* 彩虹易支付SDK服务类
|
||||||
|
* 说明:
|
||||||
|
* 包含发起支付、查询订单、回调验证等功能
|
||||||
|
*/
|
||||||
|
|
||||||
|
class EpayCore
|
||||||
|
{
|
||||||
|
private $pid;
|
||||||
|
private $key;
|
||||||
|
private $submit_url;
|
||||||
|
private $mapi_url;
|
||||||
|
private $api_url;
|
||||||
|
private $sign_type = 'MD5';
|
||||||
|
|
||||||
|
function __construct($config){
|
||||||
|
$this->pid = $config['pid'];
|
||||||
|
$this->key = $config['key'];
|
||||||
|
$this->submit_url = $config['apiurl'].'submit.php';
|
||||||
|
$this->mapi_url = $config['apiurl'].'mapi.php';
|
||||||
|
$this->api_url = $config['apiurl'].'api.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发起支付(页面跳转)
|
||||||
|
public function pagePay($param_tmp, $button='正在跳转'){
|
||||||
|
$param = $this->buildRequestParam($param_tmp);
|
||||||
|
|
||||||
|
$html = '<form id="dopay" action="'.$this->submit_url.'" method="post">';
|
||||||
|
foreach ($param as $k=>$v) {
|
||||||
|
$html.= '<input type="hidden" name="'.$k.'" value="'.$v.'"/>';
|
||||||
|
}
|
||||||
|
$html .= '<input type="submit" value="'.$button.'"></form><script>document.getElementById("dopay").submit();</script>';
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发起支付(获取链接)
|
||||||
|
public function getPayLink($param_tmp){
|
||||||
|
$param = $this->buildRequestParam($param_tmp);
|
||||||
|
$url = $this->submit_url.'?'.http_build_query($param);
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发起支付(API接口)
|
||||||
|
public function apiPay($param_tmp){
|
||||||
|
$param = $this->buildRequestParam($param_tmp);
|
||||||
|
$response = $this->getHttpResponse($this->mapi_url, http_build_query($param));
|
||||||
|
$arr = json_decode($response, true);
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 异步回调验证
|
||||||
|
public function verifyNotify(){
|
||||||
|
if(empty($_GET)) return false;
|
||||||
|
|
||||||
|
$sign = $this->getSign($_GET);
|
||||||
|
|
||||||
|
if($sign === $_GET['sign']){
|
||||||
|
$signResult = true;
|
||||||
|
}else{
|
||||||
|
$signResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $signResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同步回调验证
|
||||||
|
public function verifyReturn(){
|
||||||
|
if(empty($_GET)) return false;
|
||||||
|
|
||||||
|
$sign = $this->getSign($_GET);
|
||||||
|
|
||||||
|
if($sign === $_GET['sign']){
|
||||||
|
$signResult = true;
|
||||||
|
}else{
|
||||||
|
$signResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $signResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询订单支付状态
|
||||||
|
public function orderStatus($trade_no){
|
||||||
|
$result = $this->queryOrder($trade_no);
|
||||||
|
if($result['status']==1){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询订单
|
||||||
|
public function queryOrder($trade_no){
|
||||||
|
$url = $this->api_url.'?act=order&pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no;
|
||||||
|
$response = $this->getHttpResponse($url);
|
||||||
|
$arr = json_decode($response, true);
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单退款
|
||||||
|
public function refund($trade_no, $money){
|
||||||
|
$url = $this->api_url.'?act=refund';
|
||||||
|
$post = 'pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no . '&money=' . $money;
|
||||||
|
$response = $this->getHttpResponse($url, $post);
|
||||||
|
$arr = json_decode($response, true);
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildRequestParam($param){
|
||||||
|
$mysign = $this->getSign($param);
|
||||||
|
$param['sign'] = $mysign;
|
||||||
|
$param['sign_type'] = $this->sign_type;
|
||||||
|
return $param;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算签名
|
||||||
|
private function getSign($param){
|
||||||
|
ksort($param);
|
||||||
|
reset($param);
|
||||||
|
$signstr = '';
|
||||||
|
|
||||||
|
foreach($param as $k => $v){
|
||||||
|
if($k != "sign" && $k != "sign_type" && $v!=''){
|
||||||
|
$signstr .= $k.'='.$v.'&';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$signstr = substr($signstr,0,-1);
|
||||||
|
$signstr .= $this->key;
|
||||||
|
$sign = md5($signstr);
|
||||||
|
return $sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求外部资源
|
||||||
|
private function getHttpResponse($url, $post = false, $timeout = 10){
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
$httpheader[] = "Accept: */*";
|
||||||
|
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
|
||||||
|
$httpheader[] = "Connection: close";
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||||
|
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
if($post){
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||||
|
}
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
extend/Xilaixi/lib/epay.config.php
Normal file
13
extend/Xilaixi/lib/epay.config.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
/* *
|
||||||
|
* 配置文件
|
||||||
|
*/
|
||||||
|
|
||||||
|
//支付接口地址
|
||||||
|
$epay_config['apiurl'] = 'http://pay.www.com/';
|
||||||
|
|
||||||
|
//商户ID
|
||||||
|
$epay_config['pid'] = '1000';
|
||||||
|
|
||||||
|
//商户密钥
|
||||||
|
$epay_config['key'] = 'WWc3Z2jkK7jhNGPALcGKjHLPK47wRK85';
|
||||||
45
extend/Xilaixi/notify_url.php
Normal file
45
extend/Xilaixi/notify_url.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/* *
|
||||||
|
* 功能:彩虹易支付异步通知页面
|
||||||
|
* 说明:
|
||||||
|
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("lib/epay.config.php");
|
||||||
|
require_once("lib/EpayCore.class.php");
|
||||||
|
|
||||||
|
//计算得出通知验证结果
|
||||||
|
$epay = new EpayCore($epay_config);
|
||||||
|
$verify_result = $epay->verifyNotify();
|
||||||
|
|
||||||
|
if($verify_result) {//验证成功
|
||||||
|
|
||||||
|
//商户订单号
|
||||||
|
$out_trade_no = $_GET['out_trade_no'];
|
||||||
|
|
||||||
|
//彩虹易支付交易号
|
||||||
|
$trade_no = $_GET['trade_no'];
|
||||||
|
|
||||||
|
//交易状态
|
||||||
|
$trade_status = $_GET['trade_status'];
|
||||||
|
|
||||||
|
//支付方式
|
||||||
|
$type = $_GET['type'];
|
||||||
|
|
||||||
|
//支付金额
|
||||||
|
$money = $_GET['money'];
|
||||||
|
|
||||||
|
if ($_GET['trade_status'] == 'TRADE_SUCCESS') {
|
||||||
|
//判断该笔订单是否在商户网站中已经做过处理
|
||||||
|
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||||
|
//如果有做过处理,不执行商户的业务程序
|
||||||
|
}
|
||||||
|
|
||||||
|
//验证成功返回
|
||||||
|
echo "success";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//验证失败
|
||||||
|
echo "fail";
|
||||||
|
}
|
||||||
|
?>
|
||||||
55
extend/Xilaixi/return_url.php
Normal file
55
extend/Xilaixi/return_url.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/* *
|
||||||
|
* 功能:彩虹易支付页面跳转同步通知页面
|
||||||
|
* 说明:
|
||||||
|
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("lib/epay.config.php");
|
||||||
|
require_once("lib/EpayCore.class.php");
|
||||||
|
?>
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>支付返回页面</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
//计算得出通知验证结果
|
||||||
|
$epay = new EpayCore($epay_config);
|
||||||
|
$verify_result = $epay->verifyReturn();
|
||||||
|
|
||||||
|
if($verify_result) {//验证成功
|
||||||
|
|
||||||
|
//商户订单号
|
||||||
|
$out_trade_no = $_GET['out_trade_no'];
|
||||||
|
|
||||||
|
//支付宝交易号
|
||||||
|
$trade_no = $_GET['trade_no'];
|
||||||
|
|
||||||
|
//交易状态
|
||||||
|
$trade_status = $_GET['trade_status'];
|
||||||
|
|
||||||
|
//支付方式
|
||||||
|
$type = $_GET['type'];
|
||||||
|
|
||||||
|
|
||||||
|
if($_GET['trade_status'] == 'TRADE_SUCCESS') {
|
||||||
|
//判断该笔订单是否在商户网站中已经做过处理
|
||||||
|
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||||
|
//如果有做过处理,不执行商户的业务程序
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "trade_status=".$_GET['trade_status'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<h3>验证成功</h3><br />";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//验证失败
|
||||||
|
echo "<h3>验证失败</h3>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user