修改支付通道

This commit is contained in:
邹景立 2021-03-16 15:38:43 +08:00
parent a93dfbb3b6
commit 31f27c25c8
10 changed files with 23 additions and 16 deletions

View File

@ -8,7 +8,7 @@ use think\admin\Controller;
use think\admin\extend\CodeExtend; use think\admin\extend\CodeExtend;
/** /**
* 支付参数通道 * 支付参数支付
* Class ShopPayment * Class ShopPayment
* @package app\data\controller * @package app\data\controller
*/ */
@ -39,7 +39,7 @@ class ShopPayment extends Controller
$this->title = '支付参数管理'; $this->title = '支付参数管理';
$query = $this->_query($this->table); $query = $this->_query($this->table);
$query->where(['deleted' => 0])->order('sort desc,id desc'); $query->where(['deleted' => 0])->order('sort desc,id desc');
$query->equal('type,status')->like('name')->dateBetween('create_at')->page(); $query->like('name,code')->equal('type,status')->dateBetween('create_at')->page();
} }
/** /**

View File

@ -47,7 +47,7 @@ abstract class Auth extends Controller
$this->type = $this->request->header('api-name') ?: input('api'); $this->type = $this->request->header('api-name') ?: input('api');
$this->type = $this->type ?: $this->request->header('api-type'); $this->type = $this->type ?: $this->request->header('api-type');
if (empty($this->type) || empty(UserService::TYPES[$this->type])) { if (empty($this->type) || empty(UserService::TYPES[$this->type])) {
$this->error("接口通道未定义!"); $this->error("接口支付未定义!");
} }
// 获取用户数据 // 获取用户数据
$this->user = $this->getUser(); $this->user = $this->getUser();

View File

@ -32,7 +32,7 @@ class Login extends Controller
{ {
$this->type = input('api', UserService::API_TYPE_WAP); $this->type = input('api', UserService::API_TYPE_WAP);
if (empty(UserService::TYPES[$this->type])) { if (empty(UserService::TYPES[$this->type])) {
$this->error("接口通道[{$this->type}]未定义规则!"); $this->error("接口支付[{$this->type}]未定义规则!");
} }
} }

View File

@ -87,7 +87,7 @@ class Order extends Auth
if ($goodsInfo['limit_low_vip'] > $this->user['vip_code']) $this->error('用户等级不够'); if ($goodsInfo['limit_low_vip'] > $this->user['vip_code']) $this->error('用户等级不够');
// 商品库存检查 // 商品库存检查
if ($goodsItem['stock_sales'] + $count > $goodsItem['stock_total']) $this->error('商品库存不足'); if ($goodsItem['stock_sales'] + $count > $goodsItem['stock_total']) $this->error('商品库存不足');
// 支付通道处理 // 支付支付处理
$_allowPayments = []; $_allowPayments = [];
foreach (str2arr($goodsInfo['payment']) as $code) { foreach (str2arr($goodsInfo['payment']) as $code) {
if (is_null($allowPayments) || in_array($code, $allowPayments)) $_allowPayments[] = $code; if (is_null($allowPayments) || in_array($code, $allowPayments)) $_allowPayments[] = $code;
@ -281,7 +281,7 @@ class Order extends Auth
} }
/** /**
* 获取支付通道数据 * 获取支付支付数据
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException

View File

@ -29,7 +29,7 @@ abstract class PaymentService
const PAYMENT_JOINPAY_GZH = 'joinpay_gzh'; const PAYMENT_JOINPAY_GZH = 'joinpay_gzh';
const PAYMENT_JOINPAY_XCX = 'joinpay_xcx'; const PAYMENT_JOINPAY_XCX = 'joinpay_xcx';
// 微信商户通道 // 微信商户支付
const PAYMENT_WECHAT_APP = 'wechat_app'; const PAYMENT_WECHAT_APP = 'wechat_app';
const PAYMENT_WECHAT_GZH = 'wechat_gzh'; const PAYMENT_WECHAT_GZH = 'wechat_gzh';
const PAYMENT_WECHAT_XCX = 'wechat_xcx'; const PAYMENT_WECHAT_XCX = 'wechat_xcx';
@ -196,7 +196,7 @@ abstract class PaymentService
} }
/** /**
* 获取支付通道名称 * 获取支付支付名称
* @param string $type * @param string $type
* @return string * @return string
*/ */
@ -221,7 +221,7 @@ abstract class PaymentService
} }
/** /**
* 获取通道配置参数 * 获取支付配置参数
* @param string $code * @param string $code
* @param array $payment * @param array $payment
* @return array [code, type, params] * @return array [code, type, params]

View File

@ -21,7 +21,7 @@ class UserService extends Service
const API_TYPE_ANDROID = 'android'; const API_TYPE_ANDROID = 'android';
const TYPES = [ const TYPES = [
// 接口通道配置(不需要的直接注释) // 接口支付配置(不需要的直接注释)
UserService::API_TYPE_WAP => [ UserService::API_TYPE_WAP => [
'name' => '手机浏览器', 'name' => '手机浏览器',
'auth' => 'phone', 'auth' => 'phone',

View File

@ -7,7 +7,7 @@ use think\admin\extend\CodeExtend;
use think\admin\Exception; use think\admin\Exception;
/** /**
* 空支付通道 * 空支付支付
* Class EmptyPaymentService * Class EmptyPaymentService
* @package app\data\service\payment * @package app\data\service\payment
*/ */

View File

@ -8,7 +8,7 @@
<span class="color-green font-w7">支付名称</span> <span class="color-green font-w7">支付名称</span>
<span class="color-desc margin-left-5">Payment Name</span> <span class="color-desc margin-left-5">Payment Name</span>
<input class="layui-input" required placeholder="请输入支付名称" maxlength="50" name="name" value="{$vo.name|default=''}"/> <input class="layui-input" required placeholder="请输入支付名称" maxlength="50" name="name" value="{$vo.name|default=''}"/>
<span class="help-block"><b>必填,</b>请填写支付参数名称,通道名称尽量不要重复字符不要太长一般4-6个汉字</span> <span class="help-block"><b>必填,</b>请填写支付参数名称,支付名称尽量不要重复字符不要太长一般4-6个汉字</span>
</label> </label>
<div class="layui-form-item"> <div class="layui-form-item">

View File

@ -23,8 +23,8 @@
<th class='list-table-sort-td'> <th class='list-table-sort-td'>
<button type="button" data-reload class="layui-btn layui-btn-xs"> </button> <button type="button" data-reload class="layui-btn layui-btn-xs"> </button>
</th> </th>
<th class="text-left nowrap">通道名称</th> <th class="text-left nowrap">支付名称</th>
<th class="text-left nowrap">通道编号</th> <th class="text-left nowrap">支付编号</th>
<th class="text-left nowrap">支付方式</th> <th class="text-left nowrap">支付方式</th>
<th class="text-left nowrap">使用状态</th> <th class="text-left nowrap">使用状态</th>
<th class="text-left nowrap">创建时间</th> <th class="text-left nowrap">创建时间</th>

View File

@ -2,9 +2,16 @@
<legend>条件搜索</legend> <legend>条件搜索</legend>
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off"> <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
<label class="layui-form-label">通道名称</label> <label class="layui-form-label">支付名称</label>
<label class="layui-input-inline"> <label class="layui-input-inline">
<input name="name" value="{:input('name','')}" placeholder="请输入通道名称" class="layui-input"> <input name="name" value="{:input('name','')}" placeholder="请输入支付名称" class="layui-input">
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">支付编号</label>
<label class="layui-input-inline">
<input name="code" value="{:input('code','')}" placeholder="请输入支付编号" class="layui-input">
</label> </label>
</div> </div>