支付方式
parent
df885e75a3
commit
923d179ddb
|
|
@ -121,7 +121,7 @@
|
|||
<form class="am-form form-validation" action="{{:url('admin/payment/upload')}}" method="POST" request-type="ajax-reload" enctype="multipart/form-data">
|
||||
<input type="hidden" name="max_file_size" value="{{:MyC('home_max_limit_file', 51200000)}}" />
|
||||
<div class="am-alert am-radius am-alert-tips m-t-0" data-am-alert>
|
||||
<p class="m-t-1)}}1 类名必须于文件名一致(去除 .class.php ),如 Alipay.class.php 则取 Alipay <br />2 类必须定义三个方法<br /> 2.1 Config 配置方法<br /> 2.2 Pay 支付方法<br /> 2.3 Respond 回调方法</p>
|
||||
<p class="m-t-10">1 类名必须于文件名一致(去除 .php ),如 Alipay.php 则取 Alipay <br />2 类必须定义三个方法<br /> 2.1 Config 配置方法<br /> 2.2 Pay 支付方法<br /> 2.3 Respond 回调方法</p>
|
||||
<p class="cr-red">PS:以上条件不满足则无法查看插件</p>
|
||||
</div>
|
||||
<div class="am-form-group am-form-file">
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<span class="msg">{{$msg}}</span>
|
||||
<div class="tips-nav">
|
||||
<a href="{{$Think.__MY_URL__}}" class="am-btn am-btn-secondary am-radius">回到首页</a>
|
||||
<a href="{{:U('index/order/index')}}" class="am-btn am-btn-primary am-radius">我的订单</a>
|
||||
<a href="{{:HomeUrl('order', 'index')}}" class="am-btn am-btn-primary am-radius">我的订单</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
namespace app\service;
|
||||
|
||||
use think\Db;
|
||||
use app\service\ResourcesService;
|
||||
|
||||
/**
|
||||
* APP导航服务层
|
||||
|
|
|
|||
|
|
@ -813,7 +813,7 @@ class BuyService
|
|||
}
|
||||
|
||||
// 获取订单商品
|
||||
$order_detail = Db::name('OrderDetail')->field('goods_id,buy_number')->where(['order_id'=>$params['order_id']])->select();
|
||||
$order_detail = Db::name('OrderDetail')->field('goods_id,buy_number,spec')->where(['order_id'=>$params['order_id']])->select();
|
||||
if(!empty($order_detail))
|
||||
{
|
||||
foreach($order_detail as $v)
|
||||
|
|
@ -828,7 +828,21 @@ class BuyService
|
|||
// 扣除操作
|
||||
if(!Db::name('Goods')->where(['id'=>$v['goods_id']])->setDec('inventory', $v['buy_number']))
|
||||
{
|
||||
return DataReturn('库存扣减失败['.$params['order_id'].'-'.$v['goods_id'].']', -10);
|
||||
return DataReturn('商品库存扣减失败['.$params['order_id'].'-'.$v['goods_id'].'('.$goods['inventory'].'-'.$v['buy_number'].')]', -10);
|
||||
}
|
||||
|
||||
// 扣除规格库存
|
||||
$spec = empty($v['spec']) ? '' : json_decode($v['spec'], true);
|
||||
$base = GoodsService::GoodsSpecDetail(['id'=>$v['goods_id'], 'spec'=>$spec]);
|
||||
if($base['code'] == 0)
|
||||
{
|
||||
// 扣除规格操作
|
||||
if(!Db::name('GoodsSpecBase')->where(['id'=>$base['data']['id'], 'goods_id'=>$v['goods_id']])->setDec('inventory', $v['buy_number']))
|
||||
{
|
||||
return DataReturn('规格库存扣减失败['.$params['order_id'].'-'.$v['goods_id'].'('.$goods['inventory'].'-'.$v['buy_number'].')]', -10);
|
||||
}
|
||||
} else {
|
||||
return $base;
|
||||
}
|
||||
|
||||
// 扣除日志添加
|
||||
|
|
@ -894,7 +908,7 @@ class BuyService
|
|||
}
|
||||
|
||||
// 获取订单商品
|
||||
$order_detail = Db::name('OrderDetail')->field('goods_id,buy_number')->where(['order_id'=>$params['order_id']])->select();
|
||||
$order_detail = Db::name('OrderDetail')->field('goods_id,buy_number,spec')->where(['order_id'=>$params['order_id']])->select();
|
||||
if(!empty($order_detail))
|
||||
{
|
||||
foreach($order_detail as $v)
|
||||
|
|
@ -906,7 +920,21 @@ class BuyService
|
|||
// 回滚操作
|
||||
if(!Db::name('Goods')->where(['id'=>$v['goods_id']])->setInc('inventory', $v['buy_number']))
|
||||
{
|
||||
return DataReturn('库存回滚失败['.$params['order_id'].'-'.$v['goods_id'].']', -10);
|
||||
return DataReturn('商品库存回滚失败['.$params['order_id'].'-'.$v['goods_id'].']', -10);
|
||||
}
|
||||
|
||||
// 扣除规格库存
|
||||
$spec = empty($v['spec']) ? '' : json_decode($v['spec'], true);
|
||||
$base = GoodsService::GoodsSpecDetail(['id'=>$v['goods_id'], 'spec'=>$spec]);
|
||||
if($base['code'] == 0)
|
||||
{
|
||||
// 扣除规格操作
|
||||
if(!Db::name('GoodsSpecBase')->where(['id'=>$base['data']['id'], 'goods_id'=>$v['goods_id']])->setInc('inventory', $v['buy_number']))
|
||||
{
|
||||
return DataReturn('规格库存回滚失败['.$params['order_id'].'-'.$v['goods_id'].']', -10);
|
||||
}
|
||||
} else {
|
||||
return $base;
|
||||
}
|
||||
|
||||
// 回滚日志更新
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
namespace app\service;
|
||||
|
||||
use think\Db;
|
||||
use app\service\ResourcesService;
|
||||
|
||||
/**
|
||||
* 快递服务层
|
||||
|
|
|
|||
|
|
@ -1661,7 +1661,7 @@ class GoodsService
|
|||
// 获取基础值数据
|
||||
if(!empty($base_id))
|
||||
{
|
||||
$base = Db::name('GoodsSpecBase')->field('goods_id,price,inventory,coding,barcode,original_price')->find($base_id);
|
||||
$base = Db::name('GoodsSpecBase')->field('id,goods_id,price,inventory,coding,barcode,original_price')->find($base_id);
|
||||
if(!empty($base))
|
||||
{
|
||||
return DataReturn('操作成功', 0, $base);
|
||||
|
|
@ -1670,7 +1670,7 @@ class GoodsService
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$base = Db::name('GoodsSpecBase')->field('goods_id,price,inventory,coding,barcode,original_price')->where($where)->find();
|
||||
$base = Db::name('GoodsSpecBase')->field('id,goods_id,price,inventory,coding,barcode,original_price')->where($where)->find();
|
||||
if(!empty($base))
|
||||
{
|
||||
return DataReturn('操作成功', 0, $base);
|
||||
|
|
|
|||
|
|
@ -358,13 +358,13 @@ class OrderService
|
|||
];
|
||||
Db::name('PayLog')->insertGetId($pay_log_data);
|
||||
|
||||
// 开启事务
|
||||
Db::startTrans();
|
||||
|
||||
// 消息通知
|
||||
$detail = '订单支付成功,金额'.PriceBeautify($params['order']['total_price']).'元';
|
||||
MessageService::MessageAdd($params['order']['user_id'], '订单支付', $detail, 1, $params['order']['id']);
|
||||
|
||||
// 开启事务
|
||||
Db::startTrans();
|
||||
|
||||
// 更新订单状态
|
||||
$upd_data = array(
|
||||
'status' => 2,
|
||||
|
|
|
|||
|
|
@ -542,6 +542,7 @@ class PaymentService
|
|||
{
|
||||
return DataReturn('资源不存在或已被删除', -2);
|
||||
}
|
||||
|
||||
// 权限
|
||||
if(!is_writable($file))
|
||||
{
|
||||
|
|
@ -612,6 +613,7 @@ class PaymentService
|
|||
// 批量创建
|
||||
foreach(self::$payment_business_type_all as $v)
|
||||
{
|
||||
$name = strtolower($v['name']);
|
||||
// 异步
|
||||
$notify=<<<php
|
||||
<?php
|
||||
|
|
@ -620,20 +622,24 @@ $notify=<<<php
|
|||
* {$v['desc']}支付异步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
\$_GET['m'] = 'Api';
|
||||
\$_GET['c'] = '{$v['name']}Notify';
|
||||
\$_GET['a'] = 'Notify';
|
||||
\$_GET['s'] = '/api/{$name}notify/notify';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', '{$payment}');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 引入ThinkPHP入口文件
|
||||
require './ThinkPHP/ThinkPHP.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
php;
|
||||
|
||||
|
|
@ -645,20 +651,24 @@ $respond=<<<php
|
|||
* {$v['desc']}支付同步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
\$_GET['m'] = 'Home';
|
||||
\$_GET['c'] = '{$v['name']}';
|
||||
\$_GET['a'] = 'Respond';
|
||||
\$_GET['s'] = '/index/{$name}/respond';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', '{$payment}');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 引入ThinkPHP入口文件
|
||||
require './ThinkPHP/ThinkPHP.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
php;
|
||||
$name = strtolower($v['name']);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
namespace app\service;
|
||||
|
||||
use think\Db;
|
||||
use app\service\ResourcesService;
|
||||
|
||||
/**
|
||||
* 筛选价格服务层
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
namespace app\service;
|
||||
|
||||
use think\Db;
|
||||
use app\service\ResourcesService;
|
||||
use app\service\MessageService;
|
||||
use app\service\RegionService;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ class Alipay
|
|||
$base = [
|
||||
'name' => '支付宝', // 插件名称
|
||||
'version' => '0.0.1', // 插件版本
|
||||
'apply_version' => '1.0~1.3', // 适用系统版本描述
|
||||
'apply_terminal'=> ['pc','h5'], // 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu']
|
||||
'apply_version' => '不限', // 适用系统版本描述
|
||||
'apply_terminal'=> ['pc','h5'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu']
|
||||
'desc' => '适用PC+H5,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
'author' => 'Devil', // 开发者
|
||||
'author_url' => 'http://shopxo.net/', // 开发者主页
|
||||
|
|
@ -58,7 +58,7 @@ class Alipay
|
|||
'name' => 'account',
|
||||
'placeholder' => '支付宝账号',
|
||||
'title' => '支付宝账号',
|
||||
'is_required' => 1,
|
||||
'is_required' => 0,
|
||||
'message' => '请填写支付宝账号',
|
||||
],
|
||||
[
|
||||
|
|
@ -68,7 +68,7 @@ class Alipay
|
|||
'name' => 'partner',
|
||||
'placeholder' => '合作者身份 partner ID',
|
||||
'title' => '合作者身份 partner ID',
|
||||
'is_required' => 1,
|
||||
'is_required' => 0,
|
||||
'message' => '请填写合作者身份 partner ID',
|
||||
],
|
||||
[
|
||||
|
|
@ -78,7 +78,7 @@ class Alipay
|
|||
'name' => 'key',
|
||||
'placeholder' => '交易安全校验码 key',
|
||||
'title' => '交易安全校验码 key',
|
||||
'is_required' => 1,
|
||||
'is_required' => 0,
|
||||
'message' => '请填写交易安全校验码 key',
|
||||
],
|
||||
// [
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class AlipayMini
|
|||
'name' => '支付宝', // 插件名称
|
||||
'version' => '0.0.1', // 插件版本
|
||||
'apply_version' => '不限', // 适用系统版本描述
|
||||
'apply_terminal'=> ['alipay'], // 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu']
|
||||
'apply_terminal'=> ['alipay'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu']
|
||||
'desc' => '适用支付宝小程序,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
'author' => 'Devil', // 开发者
|
||||
'author_url' => 'http://shopxo.net/', // 开发者主页
|
||||
|
|
@ -58,7 +58,7 @@ class AlipayMini
|
|||
'name' => 'appid',
|
||||
'placeholder' => 'appid',
|
||||
'title' => 'appid',
|
||||
'is_required' => 1,
|
||||
'is_required' => 0,
|
||||
'message' => '请填写小程序appid',
|
||||
],
|
||||
[
|
||||
|
|
@ -66,24 +66,27 @@ class AlipayMini
|
|||
'name' => 'rsa_public',
|
||||
'placeholder' => '应用公钥',
|
||||
'title' => '应用公钥',
|
||||
'is_required' => 1,
|
||||
'is_required' => 0,
|
||||
'rows' => 6,
|
||||
'message' => '请填写应用公钥',
|
||||
],
|
||||
[
|
||||
'element' => 'textarea',
|
||||
'name' => 'rsa_private',
|
||||
'placeholder' => '应用私钥',
|
||||
'title' => '应用私钥',
|
||||
'is_required' => 1,
|
||||
'is_required' => 0,
|
||||
'rows' => 6,
|
||||
'message' => '请填写应用私钥',
|
||||
],
|
||||
[
|
||||
'element' => 'textarea',
|
||||
'name' => 'out_rsa_public',
|
||||
'placeholder' => '支付宝公钥',
|
||||
'title' => '支付宝公钥',
|
||||
'is_required' => 1,
|
||||
'is_required' => 0,
|
||||
'rows' => 6,
|
||||
'message' => '请填写支付宝公钥',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 订单支付异步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
$_GET['s'] = '/api/ordernotify/notify';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', 'Alipay');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 订单支付同步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
$_GET['s'] = '/index/order/respond';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', 'Alipay');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 订单支付异步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
$_GET['s'] = '/api/ordernotify/notify';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', 'AlipayMini');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 订单支付同步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
$_GET['s'] = '/index/order/respond';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', 'AlipayMini');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 订单支付同步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
$_GET['s'] = '/index/order/respond';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', 'CashPayment');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 订单支付同步入口
|
||||
*/
|
||||
|
||||
namespace think;
|
||||
|
||||
// 默认绑定模块
|
||||
$_GET['s'] = '/index/order/respond';
|
||||
|
||||
// 支付模块标记
|
||||
define('PAYMENT_TYPE', 'DeliveryPayment');
|
||||
|
||||
// 加载基础文件
|
||||
require __DIR__ . '/../thinkphp/base.php';
|
||||
|
||||
// 支持事先使用静态方法设置Request对象和Config对象
|
||||
|
||||
// 引入公共入口文件
|
||||
require './core.php';
|
||||
|
||||
// 执行应用并响应
|
||||
Container::get('app')->run()->send();
|
||||
?>
|
||||
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Loading…
Reference in New Issue