提交 c360c3be 编写于 作者: G gongfuxiang

钱包支付

上级 1dc1d4b7
......@@ -736,6 +736,22 @@ class NavigationService
],
]
],
'property' => [
'name' => '财产中心',
'is_show' => 1,
'icon' => 'am-icon-trophy',
'is_system' => 1,
'item' => [
[
'name' => '我的积分',
'url' => MyUrl('index/userintegral/index'),
'contains' => ['userintegralindex'],
'is_show' => 1,
'icon' => 'am-icon-fire',
'is_system' => 1,
],
]
],
'base' => [
'name' => '资料管理',
'is_show' => 1,
......@@ -792,22 +808,6 @@ class NavigationService
],
]
],
'property' => [
'name' => '财产中心',
'is_show' => 1,
'icon' => 'am-icon-trophy',
'is_system' => 1,
'item' => [
[
'name' => '我的积分',
'url' => MyUrl('index/userintegral/index'),
'contains' => ['userintegralindex'],
'is_show' => 1,
'icon' => 'am-icon-fire',
'is_system' => 1,
],
]
],
'logout' => [
'name' => '安全退出',
'url' => MyUrl('index/user/logout'),
......
......@@ -390,7 +390,7 @@ class OrderService
* @datetime 2018-10-05T23:02:14+0800
* @param [array] $params [输入参数]
*/
private static function OrderPayHandle($params = [])
public static function OrderPayHandle($params = [])
{
// 订单信息
if(empty($params['order']))
......
......@@ -925,6 +925,14 @@ php;
{
return DataReturn('应用images目录没有操作权限'.'['.$app_static_images_dir.']', -3);
}
// 应用upload目录
$app_upload_dir = ROOT.'public'.DS.'static'.DS.'upload';
if(!is_writable($app_upload_dir))
{
return DataReturn('应用upload目录没有操作权限'.'['.$app_upload_dir.']', -3);
}
return DataReturn('权限正常', 0);
}
......
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace payment;
use think\Db;
use app\service\PaymentService;
use app\service\OrderService;
use app\plugins\wallet\service\WalletService;
/**
* 钱包支付
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-06-16
* @desc description
*/
class WalletPay
{
// 插件配置参数
private $config;
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-17
* @desc description
* @param [array] $params [输入参数(支付配置参数)]
*/
public function __construct($params = [])
{
$this->config = $params;
}
/**
* 配置信息
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-06-16
* @desc description
*/
public function Config()
{
// 基础信息
$base = [
'name' => '钱包', // 插件名称
'version' => '0.0.1', // 插件版本
'apply_version' => '1.5.0', // 适用系统版本描述
'desc' => '钱包余额支付', // 插件描述(支持html)
'author' => 'Devil', // 开发者
'author_url' => 'http://shopxo.net/', // 开发者主页
];
// 配置信息
$element = [];
return [
'base' => $base,
'element' => $element,
];
}
/**
* 钱包校验
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-06-16T17:17:58+0800
* @param [array] $params [输入参数]
*/
private function Check($params = [])
{
// 钱包校验
$wallet = Db::name('Plugins')->where(['plugins'=>'wallet'])->find();
if(empty($wallet))
{
return DataReturn('请先安装钱包插件[ Wallet ]', -1);
}
return DataReturn('钱包正常', 0);
}
/**
* 支付入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-06-16
* @desc description
* @param [array] $params [输入参数]
*/
public function Pay($params = [])
{
// 校验
$ret = $this->Check($params);
if($ret['code'] != 0)
{
return $ret;
}
// 获取用户钱包校验
$user_wallet = WalletService::UserWallet($params['user']['id']);
if($user_wallet['code'] != 0)
{
return $user_wallet;
}
// 余额校验
if($user_wallet['data']['normal_money'] < $params['total_price'])
{
return DataReturn('钱包余额不足', -10);
}
// 处理支付
$ret = WalletService::UserWalletMoneyUpdate($params['user']['id'], $params['total_price'], 0, 'normal_money', 3, '钱包余额支付[订单'.$params['order_no'].']');
if($ret['code'] == 0)
{
// 支付方式
$payment = PaymentService::PaymentList(['where'=>['payment'=>'wallet']]);
// 获取订单信息
$order = Db::name('Order')->find($params['order_id']);
// 支付处理
$pay_params = [
'order' => $order,
'payment' => $payment[0],
'pay' => [
'trade_no' => '钱包支付',
'subject' => $params['name'],
'buyer_user' => $params['user']['user_name_view'],
'pay_price' => $params['total_price'],
],
];
$ret = OrderService::OrderPayHandle($pay_params);
if($ret['code'] == 0)
{
return DataReturn('支付成功', 0, MyUrl('index/order/respond', ['appoint_status'=>0]));
}
}
return $ret;
}
/**
* 支付回调处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-06-16
* @desc description
* @param [array] $params [输入参数]
*/
public function Respond($params = [])
{
return DataReturn('处理成功', 0, $params);
}
/**
* 退款处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-06-16
* @desc description
* @param [array] $params [输入参数]
*/
public function Refund($params = [])
{
return DataReturn('请选择退至钱包', -1);
}
}
?>
\ No newline at end of file
文件模式从 100644 更改为 100755
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册