From c360c3beba0d2825ac8d126fa1da75e5b9b83544 Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Sun, 16 Jun 2019 18:02:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=B1=E5=8C=85=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/NavigationService.php | 32 ++-- application/service/OrderService.php | 2 +- application/service/PluginsAdminService.php | 8 + extend/payment/WalletPay.php | 182 ++++++++++++++++++++ public/static/upload/.gitignore | 0 5 files changed, 207 insertions(+), 17 deletions(-) create mode 100644 extend/payment/WalletPay.php mode change 100644 => 100755 public/static/upload/.gitignore diff --git a/application/service/NavigationService.php b/application/service/NavigationService.php index 86827624d..154abd09a 100755 --- a/application/service/NavigationService.php +++ b/application/service/NavigationService.php @@ -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'), diff --git a/application/service/OrderService.php b/application/service/OrderService.php index 56b109f0a..a4bc4337c 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -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'])) diff --git a/application/service/PluginsAdminService.php b/application/service/PluginsAdminService.php index 3f0edd563..cea3aba6f 100755 --- a/application/service/PluginsAdminService.php +++ b/application/service/PluginsAdminService.php @@ -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); } diff --git a/extend/payment/WalletPay.php b/extend/payment/WalletPay.php new file mode 100644 index 000000000..e3b689340 --- /dev/null +++ b/extend/payment/WalletPay.php @@ -0,0 +1,182 @@ +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 diff --git a/public/static/upload/.gitignore b/public/static/upload/.gitignore old mode 100644 new mode 100755 -- GitLab