diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index 3f775b905474205695bb9c03e64af3a86622ea7e..6e85b287d3800dfd6b5c7b9a42e74fa0f4200455 100755 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -2,7 +2,7 @@ namespace app\admin\controller; use app\service\OrderService; -use app\service\ResourcesService; +use app\service\PaymentService; use app\service\ExpressService; /** @@ -89,10 +89,10 @@ class Order extends Common $pay_where = [ 'where' => ['is_enable'=>1, 'is_open_user'=>1, 'payment'=>config('under_line_list')], ]; - $this->assign('buy_payment_list', ResourcesService::BuyPaymentList($pay_where)); + $this->assign('buy_payment_list', PaymentService::BuyPaymentList($pay_where)); // 支付方式 - $this->assign('payment_list', ResourcesService::PaymentList()); + $this->assign('payment_list', PaymentService::PaymentList()); // 评价状态 $this->assign('common_comments_status_list', lang('common_comments_status_list')); diff --git a/application/admin/controller/Payment.php b/application/admin/controller/Payment.php index f6f16551d46fba63771391c551642fc2a61bf124..625747581b88a89a6ea4427467371d1ee10235a0 100755 --- a/application/admin/controller/Payment.php +++ b/application/admin/controller/Payment.php @@ -1,8 +1,7 @@ Is_Power(); - - // 插件目录 - $this->payment_dir = APP_PATH.'Library'.DS.'Payment'.DS; - - // 支付业务类型 - $this->payment_business_type_all = config('payment_business_type_all'); - - // 不删除的支付方式 - $this->cannot_deleted_list = ['DeliveryPayment', 'CashPayment']; } /** @@ -54,114 +40,17 @@ class Payment extends Common */ public function Index() { - $this->assign('list', $this->GetPaymentList()); - $this->assign('cannot_deleted_list', $this->cannot_deleted_list); - $this->display('Index'); - } - - /** - * 获取支付插件列表 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-17 - * @desc description - */ - private function GetPaymentList() - { - $data = []; - if(is_dir($this->payment_dir)) - { - if($dh = opendir($this->payment_dir)) - { - while(($temp_file = readdir($dh)) !== false) - { - if(substr($temp_file, 0, 1) != '.') - { - // 获取模块配置信息 - $payment = htmlentities(str_replace('.class.php', '', $temp_file)); - $config = $this->GetPaymentConfig($payment); - if($config !== false) - { - // 数据组装 - $temp = $this->DataAnalysis($config); - $temp['id'] = date('YmdHis').GetNumberCode(8); - $temp['payment'] = $payment; + // 插件列表 + $this->assign('data_list', PaymentService::PlugPaymentList()); - // 获取数据库配置信息 - $db_config = ResourcesService::PaymentList(['where'=>['payment'=>$payment]]); - if(!empty($db_config[0])) - { - $temp['is_install'] = 1; - $temp['id'] = $db_config[0]['id']; - $temp['name'] = $db_config[0]['name']; - $temp['logo'] = $db_config[0]['logo']; - $temp['apply_terminal'] = $db_config[0]['apply_terminal']; - $temp['config'] = $db_config[0]['config']; - $temp['is_enable'] = $db_config[0]['is_enable']; - $temp['is_open_user'] = $db_config[0]['is_open_user']; - } - $data[] = $temp; - } - } - } - closedir($dh); - } - } - return $data; - } - - /** - * 数据解析 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-17 - * @desc description - * @param [array] $data [插件配置信息] - */ - private function DataAnalysis($data) - { - return [ - 'name' => isset($data['base']['name']) ? htmlentities($data['base']['name']) : $payment, - 'version' => isset($data['base']['version']) ? htmlentities($data['base']['version']) : '', - 'apply_version' => isset($data['base']['apply_version']) ? htmlentities($data['base']['apply_version']) : '', - 'desc' => isset($data['base']['desc']) ? $data['base']['desc'] : '', - 'author' => isset($data['base']['author']) ? htmlentities($data['base']['author']) : '', - 'author_url' => isset($data['base']['author_url']) ? htmlentities($data['base']['author_url']) : '', - 'element' => isset($data['element']) ? $data['element'] : [], + // 不删除的支付方式 + $this->assign('cannot_deleted_list', PaymentService::$cannot_deleted_list); - 'logo' => '', - 'is_enable' => 0, - 'is_open_user' => 0, - 'is_install' => 0, - 'apply_terminal'=> array_column(lang('common_platform_type'), 'value'), - 'config' => '', - ]; - } + // 适用平台 + $this->assign('common_platform_type', lang('common_platform_type')); - /** - * 获取支付模块配置信息 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-17 - * @desc description - * @param [string] $payment [模块名称] - */ - private function GetPaymentConfig($payment) - { - $payment = '\base\Payment\\'.$payment; - if(class_exists($payment)) - { - $obj = new $payment(); - if(method_exists($obj, 'Config') && method_exists($obj, 'Pay') && method_exists($obj, 'Respond')) - { - return $obj->Config(); - } - } - return false; - } + return $this->fetch(); + } /** * [SaveInfo 添加/编辑页面] @@ -172,21 +61,32 @@ class Payment extends Common */ public function SaveInfo() { - // 轮播图片信息 - $data = empty($_REQUEST['id']) ? array() : db('Payment')->find(I('id')); - $data['apply_terminal'] = empty($data['apply_terminal']) ? [] : json_decode($data['apply_terminal'], true); - $data['element'] = empty($data['element']) ? [] : json_decode($data['element'], true); - $data['config'] = empty($data['config']) ? [] : json_decode($data['config'], true); - //print_r($data['config']); - $this->assign('data', $data); + // 参数 + $params = input(); + + // 商品信息 + if(!empty($params['id'])) + { + $data_params = [ + 'where' => ['id'=>$params['id']], + 'm' => 0, + 'n' => 1, + ]; + $data = PaymentService::PaymentList($data_params); + if(empty($data[0])) + { + return $this->error('没有相关支付方式', url('admin/payment/index')); + } + $this->assign('data', $data[0]); + } // 适用平台 $this->assign('common_platform_type', lang('common_platform_type')); // 参数 - $this->assign('param', array_merge($_POST, $_GET)); + $this->assign('params', $params); - $this->display('SaveInfo'); + return $this->fetch(); } /** @@ -199,67 +99,15 @@ class Payment extends Common public function Save() { // 是否ajax请求 - if(!IS_AJAX) - { - $this->error('非法访问'); - } - - // 图片 - $this->FileSave('logo', 'file_logo', 'payment'); - - // id为空则表示是新增 - $m = D('Payment'); - - // 公共额外数据处理 - $_POST['is_enable'] = intval(I('is_enable', 0)); - $_POST['is_open_user'] = intval(I('is_open_user', 0)); - - // 编辑 - if($m->create($_POST, 2)) - { - // 额外数据处理 - $m->upd_time = time(); - $m->apply_terminal = empty($_POST['apply_terminal']) ? '' : json_encode(explode(',', I('apply_terminal'))); - $m->name = I('name'); - $m->sort = intval(I('sort')); - - // 插件配置信息处理 - $m->config = json_encode($this->GetPlugConfig()); - - // 移除 id - unset($m->id); - - // 更新数据库 - if($m->where(array('id'=>I('id')))->save()) - { - $this->ajaxReturn('编辑成功'); - } else { - $this->ajaxReturn('编辑失败或数据未改变', -100); - } - } else { - $this->ajaxReturn($m->getError(), -1); - } - } - - /** - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-18 - * @desc description - */ - private function GetPlugConfig() - { - $data = []; - foreach($_POST as $k=>$v) + if(!IS_AJAX) { - if(substr($k, 0, 8) == 'plugins_') - { - $data[substr($k, 8)] = $v; - } + $this->error('非法访问'); } - return $data; - } + + // 开始操作 + $ret = PaymentService::PaymentUpdate(input()); + return json($ret); + } /** * [StatusUpdate 状态更新] @@ -270,47 +118,15 @@ class Payment extends Common */ public function StatusUpdate() { + // 是否ajax请求 if(!IS_AJAX) { $this->error('非法访问'); } - // 参数 - if(empty($_POST['id']) || !isset($_POST['state'])) - { - $this->ajaxReturn('参数错误', -1); - } - $field = I('field', 'is_enable'); - - // 数据更新 - if(db('Payment')->where(array('payment'=>I('id')))->save(array($field=>I('state')))) - { - $this->ajaxReturn('编辑成功'); - } else { - $this->ajaxReturn('编辑失败或数据未改变', -100); - } - } - - /** - * [PowerCheck 权限校验] - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @datetime 2018-09-29T00:01:49+0800 - */ - private function PowerCheck() - { - // 主目录权限 - if(!is_writable(ROOT_PATH)) - { - $this->ajaxReturn('服务器用户没操作权限'.'['.ROOT_PATH.']', -3); - } - - // 插件权限 - if(!is_writable($this->payment_dir)) - { - $this->ajaxReturn('服务器用户没操作权限'.'['.$this->payment_dir.']', -3); - } + // 开始操作 + $ret = PaymentService::PaymentStatusUpdate(input()); + return json($ret); } /** @@ -323,50 +139,15 @@ class Payment extends Common */ public function Install() { + // 是否ajax请求 if(!IS_AJAX) { $this->error('非法访问'); } - // 权限 - $this->PowerCheck(); - - // 参数 - if(empty($_POST['id'])) - { - $this->ajaxReturn('参数错误', -1); - } - - // 数据处理 - $payment = I('id'); - $config = $this->GetPaymentConfig($payment); - if($config !== false) - { - $data = $this->DataAnalysis($config); - $data['payment'] = $payment; - $data['element'] = empty($data['element']) ? '' : json_encode($data['element']); - $data['apply_terminal'] = empty($data['apply_terminal']) ? '' : json_encode($data['apply_terminal']); - $data['add_time'] = time(); - - // 开始安装 - $m = D('Payment'); - if($m->create($data, 1)) - { - if($m->add($data)) - { - // 入口文件生成 - $this->PaymentEntranceCreated($payment); - - $this->ajaxReturn('安装成功'); - } else { - $this->ajaxReturn('安装失败', -100); - } - } else { - $this->ajaxReturn($m->getError(), -1); - } - } else { - $this->ajaxReturn('插件配置有误', -10); - } + // 开始操作 + $ret = PaymentService::Install(input()); + return json($ret); } /** @@ -379,28 +160,15 @@ class Payment extends Common */ public function Uninstall() { + // 是否ajax请求 if(!IS_AJAX) { $this->error('非法访问'); } - // 参数 - if(empty($_POST['id'])) - { - $this->ajaxReturn('参数错误', -1); - } - - // 开始卸载 - $payment = I('id'); - if(db('Payment')->where(['payment'=>$payment])->delete()) - { - // 删除入口文件 - $this->PaymentEntranceDelete($payment); - - $this->ajaxReturn('卸载成功'); - } else { - $this->ajaxReturn('卸载失败', -100); - } + // 开始操作 + $ret = PaymentService::Uninstall(input()); + return json($ret); } /** @@ -413,49 +181,15 @@ class Payment extends Common */ public function Delete() { + // 是否ajax请求 if(!IS_AJAX) { $this->error('非法访问'); } - // 权限 - $this->PowerCheck(); - - // 参数 - if(empty($_POST['id'])) - { - $this->ajaxReturn('参数错误', -1); - } - - // 是否禁止删除 - $payment = I('id'); - if(in_array($payment, $this->cannot_deleted_list)) - { - $this->ajaxReturn('该支付方式禁止删除', -10); - } - - // 是否存在 - $file = $this->payment_dir.$payment.'.class.php'; - if(!file_exists($file)) - { - $this->ajaxReturn('资源不存在或已被删除', -2); - } - // 权限 - if(!is_writable($file)) - { - $this->ajaxReturn('服务器用户没操作权限', -3); - } - - // 删除 - if(!@unlink($file)) - { - $this->ajaxReturn('删除失败或资源不存在', -100); - } - - // 删除入口文件 - $this->PaymentEntranceDelete($payment); - - $this->ajaxReturn('删除成功'); + // 开始操作 + $ret = PaymentService::Delete(input()); + return json($ret); } /** @@ -468,148 +202,15 @@ class Payment extends Common */ public function Upload() { - // 是否ajax + // 是否ajax请求 if(!IS_AJAX) { $this->error('非法访问'); } - // 权限 - $this->PowerCheck(); - - // 文件上传校验 - $error = FileUploadError('file'); - if($error !== true) - { - $this->ajaxReturn($error, -1); - } - - // 文件格式化校验 - $type = array('text/php'); - if(!in_array($_FILES['file']['type'], $type)) - { - $this->ajaxReturn('文件格式有误,必须php文件', -2); - } - - // 是否已有存在插件 - if(file_exists($this->payment_dir.$_FILES['file']['name'])) - { - $this->ajaxReturn('已存在相同插件', -3); - } - - // 存储文件 - if(!move_uploaded_file($_FILES['file']['tmp_name'], $this->payment_dir.$_FILES['file']['name'])) - { - $this->ajaxReturn('上传失败', -100); - } - - // 文件校验 - $payment = htmlentities(str_replace('.class.php', '', $_FILES['file']['name'])); - $config = $this->GetPaymentConfig($payment); - if($config === false) - { - @unlink($this->payment_dir.$_FILES['file']['name']); - $this->ajaxReturn('插件编写有误,请参考文档编写', -10); - } - $this->ajaxReturn('上传成功'); - } - - /** - * [PaymentEntranceCreated 入口文件创建] - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @datetime 2018-09-28T23:38:52+0800 - * @param [string] $payment [支付唯一标记] - */ - private function PaymentEntranceCreated($payment) - { - // 批量创建 - foreach($this->payment_business_type_all as $v) - { -// 异步 -$notify=<< -php; - -// 同步 -$respond=<< -php; - $name = strtolower($v['name']); - @file_put_contents(ROOT_PATH.'payment_'.$name.'_'.strtolower($payment).'_respond.php', $respond); - - // 线下支付不生成异步入口文件 - if(!in_array($payment, config('under_line_list'))) - { - @file_put_contents(ROOT_PATH.'payment_'.$name.'_'.strtolower($payment).'_notify.php', $notify); - } - } - } - - /** - * [PaymentEntranceDelete 入口文件删除] - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @datetime 2018-09-28T23:38:52+0800 - * @param [string] $payment [支付唯一标记] - */ - private function PaymentEntranceDelete($payment) - { - $payment = strtolower($payment); - foreach($this->payment_business_type_all as $v) - { - $name = strtolower($v['name']); - if(file_exists(ROOT_PATH.'payment_'.$name.'_'.$payment.'_notify.php')) - { - @unlink(ROOT_PATH.'payment_'.$name.'_'.$payment.'_notify.php'); - } - if(file_exists(ROOT_PATH.'payment_'.$name.'_'.$payment.'_respond.php')) - { - @unlink(ROOT_PATH.'payment_'.$name.'_'.$payment.'_respond.php'); - } - } + // 开始操作 + $ret = PaymentService::Upload(input()); + return json($ret); } } ?> \ No newline at end of file diff --git a/application/admin/view/default/payment/index.html b/application/admin/view/default/payment/index.html index 2e779600455ae20747ccf645abe73f8d009e7900..d2cbb728081d0df8bc557ebe09c2aa6bf76835c8 100755 --- a/application/admin/view/default/payment/index.html +++ b/application/admin/view/default/payment/index.html @@ -10,7 +10,7 @@ - @@ -25,9 +25,9 @@ - {{if !empty($list)}} - - class="am-active"{{/if}} > + {{if !empty($data_list)}} + {{foreach $data_list as $v}} + @@ -118,7 +118,7 @@
-
+

- + - 返回 + 支付方式编辑 + 返回
- value="{{$data.name}}"{{/if}} required /> +
@@ -25,36 +25,46 @@
- - value="{{$data.logo}}"{{/if}}" data-validation-message="请选择需要上传的图片" readonly="readonly" value="{{$data.logo}}"{{/if}} /> - -
+
    + {{if !empty($data['logo'])}} +
  • + + + × +
  • + {{/if}} +
+
+上传图片
- + {{if !empty($data['element'])}}

该区域为插件配置填写项,请按照插件文档填写相应的值。

- + {{foreach $data.element as $element}}
- - + {{switch element.element}} + {{case input}} {{if in_array($element['type'], ['radio', 'checkbox']) and !empty($element['element_data']) and is_array($element['element_data'])}} - - - + {{/case}} + {{case select}} {{if !empty($element['element_data']) and is_array($element['element_data'])}} {{/if}} - - + {{/case}} + {{case textarea}} - - + {{/case}} + {{/switch}}
{{/foreach}}
@@ -130,7 +152,7 @@
- value="{{$data.id}}"{{/if}} /> +
diff --git a/application/index/controller/Buy.php b/application/index/controller/Buy.php index 36c7568f5a81e3a387ac79c91090bb7f86970b89..c1209770a329afdbfafff4ced631df10585237c0 100755 --- a/application/index/controller/Buy.php +++ b/application/index/controller/Buy.php @@ -3,7 +3,7 @@ namespace app\index\controller; use app\service\GoodsService; use app\service\UserService; -use app\service\ResourcesService; +use app\service\PaymentService; use app\service\BuyService; /** @@ -57,7 +57,7 @@ class Buy extends Common $this->assign('user_address_list', UserService::UserAddressList(['user'=>$this->user])['data']); // 支付方式 - $this->assign('payment_list', ResourcesService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1])); + $this->assign('payment_list', PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1])); // 商品/基础信息 $base = [ diff --git a/application/index/controller/Order.php b/application/index/controller/Order.php index 2581c20d8149701fa6fc30a977639d1ebf77a715..53d540c7dd1e3270d7deed3d1d1c4b466b55b140 100755 --- a/application/index/controller/Order.php +++ b/application/index/controller/Order.php @@ -2,7 +2,7 @@ namespace app\index\controller; use app\service\OrderService; -use app\service\ResourcesService; +use app\service\PaymentService; /** * 订单管理 @@ -74,7 +74,7 @@ class Order extends Common $this->assign('data_list', $data['data']); // 支付方式 - $this->assign('payment_list', ResourcesService::PaymentList()); + $this->assign('payment_list', PaymentService::PaymentList()); // 订单状态 $this->assign('common_order_user_status', lang('common_order_user_status')); @@ -118,7 +118,7 @@ class Order extends Common if(!empty($data['data'][0])) { // 发起支付 - 支付方式 - $this->assign('buy_payment_list', ResourcesService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1])); + $this->assign('buy_payment_list', PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1])); $this->assign('data', $data['data'][0]); diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index 6373a8d43dca9a232134bb5f7f4d7b221c08530e..365a76487af59fdb250618872ff301f0a082cd7e 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -1461,7 +1461,7 @@ class GoodsService } /** - * 商品上下架状态更新 + * 商品状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/application/service/OrderService.php b/application/service/OrderService.php index 0465bd05472085ab9036b2b3d91325a6c5708c76..ad143c3a08ec21ec555865d58cdbf3da5f0c3982 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -3,7 +3,7 @@ namespace app\service; use think\Db; use app\service\GoodsService; -use app\service\ResourcesService; +use app\service\PaymentService; use app\service\BuyService; use app\service\IntegralService; use app\service\RegionService; @@ -67,7 +67,7 @@ class OrderService // 支付方式 $payment_id = empty($params['payment_id']) ? $order['payment_id'] : intval($params['payment_id']); - $payment = ResourcesService::PaymentList(['where'=>['id'=>$payment_id]]); + $payment = PaymentService::PaymentList(['where'=>['id'=>$payment_id]]); if(empty($payment[0])) { return DataReturn('支付方式有误', -1); @@ -170,7 +170,7 @@ class OrderService // 支付方式 $payment_id = empty($params['payment_id']) ? $order['payment_id'] : intval($params['payment_id']); - $payment = ResourcesService::PaymentList(['where'=>['id'=>$payment_id]]); + $payment = PaymentService::PaymentList(['where'=>['id'=>$payment_id]]); if(empty($payment[0])) { return DataReturn('支付方式有误', -1); @@ -242,7 +242,7 @@ class OrderService } // 支付方式 - $payment = ResourcesService::PaymentList(['where'=>['payment'=>PAYMENT_TYPE]]); + $payment = PaymentService::PaymentList(['where'=>['payment'=>PAYMENT_TYPE]]); if(empty($payment[0])) { return DataReturn('支付方式有误', -1); @@ -280,7 +280,7 @@ class OrderService public static function Notify($params = []) { // 支付方式 - $payment = ResourcesService::PaymentList(['where'=>['payment'=>PAYMENT_TYPE]]); + $payment = PaymentService::PaymentList(['where'=>['payment'=>PAYMENT_TYPE]]); if(empty($payment[0])) { return DataReturn('支付方式有误', -1); @@ -550,7 +550,7 @@ class OrderService $v['express_name'] = ExpressService::ExpressName($v['express_id']); // 支付方式 - $v['payment_name'] = ($v['status'] <= 1) ? null : ResourcesService::OrderPaymentName($v['id']); + $v['payment_name'] = ($v['status'] <= 1) ? null : PaymentService::OrderPaymentName($v['id']); // 收件人地址 $v['receive_province_name'] = RegionService::RegionName($v['receive_province']); diff --git a/application/service/PaymentService.php b/application/service/PaymentService.php new file mode 100644 index 0000000000000000000000000000000000000000..e1e0b737881318f25d267ea1ac26444bd966bb8c --- /dev/null +++ b/application/service/PaymentService.php @@ -0,0 +1,711 @@ +['payment'=>$payment]]); + if(!empty($db_config[0])) + { + $temp['is_install'] = 1; + $temp['id'] = $db_config[0]['id']; + $temp['name'] = $db_config[0]['name']; + $temp['logo'] = $db_config[0]['logo']; + $temp['apply_terminal'] = $db_config[0]['apply_terminal']; + $temp['config'] = $db_config[0]['config']; + $temp['is_enable'] = $db_config[0]['is_enable']; + $temp['is_open_user'] = $db_config[0]['is_open_user']; + } + $data[] = $temp; + } + } + } + closedir($dh); + } + } + return $data; + } + + /** + * 获取支付模块配置信息 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-17 + * @desc description + * @param [string] $payment [模块名称] + */ + private static function GetPaymentConfig($payment) + { + $payment = '\payment\\'.$payment; + if(class_exists($payment)) + { + $obj = new $payment(); + if(method_exists($obj, 'Config') && method_exists($obj, 'Pay') && method_exists($obj, 'Respond')) + { + return $obj->Config(); + } + } + return false; + } + + /** + * 数据解析 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-17 + * @desc description + * @param [array] $data [插件配置信息] + */ + private static function DataAnalysis($data) + { + return [ + 'name' => isset($data['base']['name']) ? htmlentities($data['base']['name']) : $payment, + 'version' => isset($data['base']['version']) ? htmlentities($data['base']['version']) : '', + 'apply_version' => isset($data['base']['apply_version']) ? htmlentities($data['base']['apply_version']) : '', + 'desc' => isset($data['base']['desc']) ? $data['base']['desc'] : '', + 'author' => isset($data['base']['author']) ? htmlentities($data['base']['author']) : '', + 'author_url' => isset($data['base']['author_url']) ? htmlentities($data['base']['author_url']) : '', + 'element' => isset($data['element']) ? $data['element'] : [], + + 'logo' => '', + 'is_enable' => 0, + 'is_open_user' => 0, + 'is_install' => 0, + 'apply_terminal'=> empty($data['base']['apply_terminal']) ? array_column(lang('common_platform_type'), 'value') : $data['base']['apply_terminal'], + 'config' => '', + ]; + } + + /** + * 支付方式列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-19 + * @desc description + * @param [array] $params [输入参数] + */ + public static function PaymentList($params = []) + { + $where = empty($params['where']) ? [] : $params['where']; + if(isset($params['is_enable'])) + { + $where['is_enable'] = intval($params['is_enable']); + } + if(isset($params['is_open_user'])) + { + $where['is_open_user'] = intval($params['is_open_user']); + } + + $data = Db::name('Payment')->where($where)->field('id,logo,name,sort,payment,config,apply_terminal,apply_terminal,element,is_enable,is_open_user')->order('sort asc')->select(); + if(!empty($data) && is_array($data)) + { + $images_host = config('IMAGE_HOST'); + foreach($data as &$v) + { + $v['logo_old'] = $v['logo']; + $v['logo'] = empty($v['logo']) ? null : $images_host.$v['logo']; + $v['element'] = empty($v['element']) ? '' : json_decode($v['element'], true); + $v['config'] = empty($v['config']) ? '' : json_decode($v['config'], true); + $v['apply_terminal'] = empty($v['apply_terminal']) ? '' : json_decode($v['apply_terminal'], true); + } + } + return $data; + } + + /** + * 获取支付方式列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-19 + * @desc 下订单根据终端自动筛选支付方式 + * @param [array] $params [输入参数] + */ + public static function BuyPaymentList($params = []) + { + $data = self::PaymentList($params); + + $result = []; + if(!empty($data)) + { + foreach($data as $v) + { + // 根据终端类型筛选 + if(in_array(APPLICATION_CLIENT_TYPE, $v['apply_terminal'])) + { + $result[] = $v; + } + } + } + return $result; + } + + /** + * 获取订单支付名称 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-19 + * @desc description + * @param [int] $order_id [订单id] + */ + public static function OrderPaymentName($order_id = 0) + { + return empty($order_id) ? null : Db::name('PayLog')->where(['order_id'=>intval($order_id)])->value('payment_name'); + } + + /** + * 数据更新 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-12-19 + * @desc description + * @param [array] $params [输入参数] + */ + public static function PaymentUpdate($params = []) + { + // 请求类型 + $p = [ + [ + 'checked_type' => 'empty', + 'key_name' => 'id', + 'error_msg' => '操作id有误', + ], + [ + 'checked_type' => 'length', + 'key_name' => 'name', + 'checked_data' => '2,60', + 'error_msg' => '名称长度 2~60 个字符', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'apply_terminal', + 'error_msg' => '至少选择一个适用终端', + ], + [ + 'checked_type' => 'length', + 'key_name' => 'sort', + 'checked_data' => '3', + 'error_msg' => '顺序 0~255 之间的数值', + ], + ]; + $ret = params_checked($params, $p); + if($ret !== true) + { + return DataReturn($ret, -1); + } + + // 附件 + $data_fields = ['logo']; + $attachment = ResourcesService::AttachmentParams($params, $data_fields); + + // 数据 + $data = [ + 'name' => $params['name'], + 'apply_terminal' => empty($params['apply_terminal']) ? '' : json_encode(explode(',', $params['apply_terminal'])), + 'logo' => $attachment['data']['logo'], + 'config' => json_encode(self::GetPlugConfig($params)), + 'sort' => intval($params['sort']), + 'is_enable' => isset($params['is_enable']) ? intval($params['is_enable']) : 0, + 'is_open_user' => isset($params['is_open_user']) ? intval($params['is_open_user']) : 0, + ]; + + $data['upd_time'] = time(); + if(Db::name('Payment')->where(['id'=>intval($params['id'])])->update($data)) + { + return DataReturn('编辑成功', 0); + } + return DataReturn('编辑失败', -100); + } + + /** + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-18 + * @desc description + * @param [array] $params [输入参数] + */ + private static function GetPlugConfig($params = []) + { + $data = []; + foreach($params as $k=>$v) + { + if(substr($k, 0, 8) == 'plugins_') + { + $data[substr($k, 8)] = $v; + } + } + return $data; + } + + /** + * 状态更新 + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + * @param [array] $params [输入参数] + */ + public static function PaymentStatusUpdate($params = []) + { + // 请求参数 + $p = [ + [ + 'checked_type' => 'empty', + 'key_name' => 'id', + 'error_msg' => '操作id有误', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'field', + 'error_msg' => '未指定操作字段', + ], + [ + 'checked_type' => 'in', + 'key_name' => 'state', + 'checked_data' => [0,1], + 'error_msg' => '状态有误', + ], + ]; + $ret = params_checked($params, $p); + if($ret !== true) + { + return DataReturn($ret, -1); + } + + // 数据更新 + if(Db::name('Payment')->where(['payment'=>$params['id']])->update([$params['field']=>intval($params['state']), 'upd_time'=>time()])) + { + return DataReturn('操作成功'); + } + return DataReturn('操作失败', -100); + } + + /** + * 权限校验 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-09-29T00:01:49+0800 + */ + private static function PowerCheck() + { + // 主目录权限 + $root_path = ROOT.'public'; + if(!is_writable($root_path)) + { + return DataReturn('目录没有操作权限'.'['.$root_path.']', -3); + } + + // 插件权限 + if(!is_writable(self::$payment_dir)) + { + return DataReturn('目录没有操作权限'.'['.self::$payment_dir.']', -3); + } + } + + /** + * 上传插件 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-17 + * @desc description + * @param [array] $params [输入参数] + */ + public static function Upload($params = []) + { + // 初始化 + self::Init(); + + // 权限 + $ret = self::PowerCheck(); + if($ret['code'] != 0) + { + return $ret; + } + + // 文件上传校验 + $error = FileUploadError('file'); + if($error !== true) + { + return DataReturn($error, -1); + } + + // 文件格式化校验 + $type = array('text/php'); + if(!in_array($_FILES['file']['type'], $type)) + { + return DataReturn('文件格式有误,必须php文件', -2); + } + + // 是否已有存在插件 + if(file_exists(self::$payment_dir.$_FILES['file']['name'])) + { + return DataReturn('已存在相同插件', -3); + } + + // 存储文件 + if(!move_uploaded_file($_FILES['file']['tmp_name'], self::$payment_dir.$_FILES['file']['name'])) + { + return DataReturn('上传失败', -100); + } + + // 文件校验 + $payment = htmlentities(str_replace('.php', '', $_FILES['file']['name'])); + $config = self::GetPaymentConfig($payment); + if($config === false) + { + @unlink(self::$payment_dir.$_FILES['file']['name']); + return DataReturn('插件编写有误,请参考文档编写', -10); + } + return DataReturn('上传成功'); + } + + /** + * 安装 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-17 + * @desc description + * @param [array] $params [输入参数] + */ + public static function Install($params = []) + { + // 初始化 + self::Init(); + + // 参数 + if(empty($params['id'])) + { + return DataReturn('参数错误', -1); + } + + // 数据处理 + $payment = $params['id']; + $config = self::GetPaymentConfig($payment); + if($config !== false) + { + $data = self::DataAnalysis($config); + $data['payment'] = $payment; + $data['element'] = empty($data['element']) ? '' : json_encode($data['element']); + $data['apply_terminal'] = empty($data['apply_terminal']) ? '' : json_encode($data['apply_terminal']); + $data['sort'] = 0; + $data['add_time'] = time(); + + // 移除多余的字段 + unset($data['is_install']); + + // 开启事务 + Db::startTrans(); + if(Db::name('Payment')->insertGetId($data) > 0) + { + // 入口文件生成 + $ret = self::PaymentEntranceCreated($payment); + if($ret['code'] == 'code') + { + // 提交事务 + Db::commit(); + + return DataReturn('安装成功'); + } else { + // 事务回滚 + Db::rollback(); + return $ret; + } + } else { + // 事务回滚 + Db::rollback(); + return DataReturn('安装失败', -100); + } + } else { + return DataReturn('插件配置有误', -10); + } + } + + /** + * 删除插件 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-17 + * @desc description + * @param [array] $params [输入参数] + */ + public static function Delete($params = []) + { + // 初始化 + self::Init(); + + // 权限 + $ret = self::PowerCheck(); + if($ret['code'] != 0) + { + return $ret; + } + + // 参数 + if(empty($params['id'])) + { + return DataReturn('参数错误', -1); + } + + // 是否禁止删除 + $payment = $params['id']; + if(in_array($payment, self::$cannot_deleted_list)) + { + return DataReturn('该支付方式禁止删除', -10); + } + + // 是否存在 + $file = self::$payment_dir.$payment.'.php'; + if(!file_exists($file)) + { + return DataReturn('资源不存在或已被删除', -2); + } + // 权限 + if(!is_writable($file)) + { + return DataReturn('没操作权限', -3); + } + + // 删除 + if(!@unlink($file)) + { + return DataReturn('删除失败', -100); + } + + // 删除入口文件 + self::PaymentEntranceDelete($payment); + + return DataReturn('删除成功'); + } + + /** + * 卸载 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-17 + * @desc description + * @param [array] $params [输入参数] + */ + public static function Uninstall($params = []) + { + // 参数 + if(empty($params['id'])) + { + return DataReturn('参数错误', -1); + } + + // 初始化 + self::Init(); + + // 开始卸载 + $payment = $params['id']; + if(db('Payment')->where(['payment'=>$payment])->delete()) + { + // 删除入口文件 + self::PaymentEntranceDelete($payment); + + return DataReturn('卸载成功', 0); + } + return DataReturn('卸载失败', -100); + } + + /** + * [PaymentEntranceCreated 入口文件创建] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-09-28T23:38:52+0800 + * @param [string] $payment [支付唯一标记] + */ + private static function PaymentEntranceCreated($payment) + { + // 权限 + $ret = self::PowerCheck(); + if($ret['code'] != 0) + { + return $ret; + } + + // 批量创建 + foreach(self::$payment_business_type_all as $v) + { +// 异步 +$notify=<< +php; + +// 同步 +$respond=<< +php; + $name = strtolower($v['name']); + @file_put_contents(ROOT.'public'.DS.'payment_'.$name.'_'.strtolower($payment).'_respond.php', $respond); + + // 线下支付不生成异步入口文件 + if(!in_array($payment, config('under_line_list'))) + { + @file_put_contents(ROOT.'public'.DS.'payment_'.$name.'_'.strtolower($payment).'_notify.php', $notify); + } + } + + return DataReturn('操作成功', 0); + } + + /** + * [PaymentEntranceDelete 入口文件删除] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-09-28T23:38:52+0800 + * @param [string] $payment [支付唯一标记] + */ + private static function PaymentEntranceDelete($payment) + { + // 权限 + $ret = self::PowerCheck(); + if($ret['code'] != 0) + { + return $ret; + } + + $payment = strtolower($payment); + foreach(self::$payment_business_type_all as $v) + { + $name = strtolower($v['name']); + if(file_exists(ROOT.'public'.DS.'payment_'.$name.'_'.$payment.'_notify.php')) + { + @unlink(ROOT.'public'.DS.'payment_'.$name.'_'.$payment.'_notify.php'); + } + if(file_exists(ROOT.'public'.DS.'payment_'.$name.'_'.$payment.'_respond.php')) + { + @unlink(ROOT.'public'.DS.'payment_'.$name.'_'.$payment.'_respond.php'); + } + } + + return DataReturn('操作成功', 0); + } +} +?> \ No newline at end of file diff --git a/application/service/ResourcesService.php b/application/service/ResourcesService.php index e0cdb711a13c1d7406d40a3f2f9c603aa1f98601..9521fd25f1f270a9cd12238ee75e9c47b966cd1b 100755 --- a/application/service/ResourcesService.php +++ b/application/service/ResourcesService.php @@ -12,85 +12,6 @@ use think\Db; */ class ResourcesService { - /** - * 获取订单支付名称 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-19 - * @desc description - * @param [int] $order_id [订单id] - */ - public static function OrderPaymentName($order_id = 0) - { - return empty($order_id) ? null : Db::name('PayLog')->where(['order_id'=>intval($order_id)])->value('payment_name'); - } - - /** - * 支付方式列表 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-19 - * @desc description - * @param [array] $params [输入参数] - */ - public static function PaymentList($params = []) - { - $where = empty($params['where']) ? [] : $params['where']; - if(isset($params['is_enable'])) - { - $where['is_enable'] = intval($params['is_enable']); - } - if(isset($params['is_open_user'])) - { - $where['is_open_user'] = intval($params['is_open_user']); - } - - $data = Db::name('Payment')->where($where)->field('id,logo,name,sort,payment,config,apply_terminal,apply_terminal,element,is_enable,is_open_user')->order('sort asc')->select(); - if(!empty($data) && is_array($data)) - { - $images_host = config('IMAGE_HOST'); - foreach($data as &$v) - { - $v['logo_old'] = $v['logo']; - $v['logo'] = empty($v['logo']) ? null : $images_host.$v['logo']; - $v['element'] = empty($v['element']) ? '' : json_decode($v['element'], true); - $v['config'] = empty($v['config']) ? '' : json_decode($v['config'], true); - $v['apply_terminal'] = empty($v['apply_terminal']) ? '' : json_decode($v['apply_terminal'], true); - } - } - return $data; - } - - /** - * 获取支付方式列表 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-19 - * @desc 下订单根据终端自动筛选支付方式 - * @param [array] $params [输入参数] - */ - public static function BuyPaymentList($params = []) - { - $data = self::PaymentList($params); - - $result = []; - if(!empty($data)) - { - foreach($data as $v) - { - // 根据终端类型筛选 - if(in_array(APPLICATION_CLIENT_TYPE, $v['apply_terminal'])) - { - $result[] = $v; - } - } - } - return $result; - } - /** * [ContentStaticReplace 编辑器中内容的静态资源替换] * @author Devil diff --git a/application/service/SlideService.php b/application/service/SlideService.php index 40380838c8602d5275cf8fea35453fb9e04236a3..c959f446762c688a509af573b0fadb3d88481c57 100644 --- a/application/service/SlideService.php +++ b/application/service/SlideService.php @@ -2,6 +2,7 @@ namespace app\service; use think\Db; +use app\service\ResourcesService; /** * 轮播图服务层 diff --git a/extend/payment/Alipay.php b/extend/payment/Alipay.php index 31a5a97b72470051f8cfd248c4b42a6cb75e1eb1..0fb014369fcf6530b0da595d81ad9a6acaf7ec5a 100755 --- a/extend/payment/Alipay.php +++ b/extend/payment/Alipay.php @@ -43,9 +43,10 @@ class Alipay 'name' => '支付宝', // 插件名称 'version' => '0.0.1', // 插件版本 'apply_version' => '1.0~1.3', // 适用系统版本描述 - 'desc' => '即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) + 'apply_terminal'=> ['pc','h5'], // 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu'] + 'desc' => '适用PC+H5,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) 'author' => 'Devil', // 开发者 - 'author_url' => 'http://gong.gg/', // 开发者主页 + 'author_url' => 'http://shopxo.net/', // 开发者主页 ]; // 配置信息 @@ -80,91 +81,91 @@ class Alipay 'is_required' => 1, 'message' => '请填写交易安全校验码 key', ], - [ - 'element' => 'input', // 表单标签 - 'type' => 'text', // input类型 - 'default' => '', // 默认值 - 'name' => 'testinput', // name名称 - 'placeholder' => '测试输入框不需要验证', // input默认显示文字 - 'title' => '测试输入框不需要验证', // 展示title名称 - 'is_required' => 0, // 是否需要强制填写/选择 - 'message' => '请填写测试输入框不需要验证', // 错误提示(is_required=1方可有效) - ], - [ - 'element' => 'textarea', - 'default' => '', - 'name' => 'rsa_private', - 'placeholder' => 'RSA证书', - 'title' => 'RSA证书', - 'is_required' => 0, - 'minlength' => 10, // 最小输入字符(is_required=1方可有效) - //'maxlength' => 300, // 最大输入字符, 填则不限(is_required=1方可有效) - 'rows' => 6, - ], - [ - 'element' => 'input', - 'type' => 'checkbox', - 'element_data' => [ - ['value'=>1, 'name'=>'选项1'], - ['value'=>2, 'name'=>'选项2', 'is_checked'=>1], - ['value'=>3, 'name'=>'选项3'], - ['value'=>4, 'name'=>'选项4'] - ], - 'is_block' => 1, // 是否每个选项行内展示(默认0) - 'minchecked' => 2, // 最小选项(默认以is_required=1至少一项,则0) - 'maxchecked' => 3, // 最大选项 - 'name' => 'checkbox', - 'title' => '多选项测试', // 展示title名称 - 'is_required' => 1, // 是否需要强制填写/选择 - 'message' => '请选择多选项测试选择 至少选择2项最多选择3项', // 错误提示信息 - ], - [ - 'element' => 'input', - 'type' => 'radio', - 'element_data' => [ - ['value'=>1, 'name'=>'选项1', 'is_checked'=>1], - ['value'=>2, 'name'=>'选项2'], - ['value'=>3, 'name'=>'选项3'], - ['value'=>4, 'name'=>'选项4'] - ], - 'is_block' => 1, // 是否每个选项行内展示(默认0) - 'name' => 'radio', - 'title' => '单选项测试', // 展示title名称 - 'is_required' => 1, // 是否需要强制填写/选择 - 'message' => '请选择单选项测试', - ], - [ - 'element' => 'select', - 'placeholder' => '选一个撒1', - 'is_multiple' => 0, // 是否开启多选(默认0 关闭) - 'element_data' => [ - ['value'=>1, 'name'=>'选项1'], - ['value'=>2, 'name'=>'选项2'], - ['value'=>3, 'name'=>'选项3'], - ['value'=>4, 'name'=>'选项4'] - ], - 'name' => 'select1', - 'title' => '下拉单选测试', // 展示title名称 - 'is_required' => 1, // 是否需要强制填写/选择 - 'message' => '请选择下拉单选测试', - ], - [ - 'element' => 'select', - 'placeholder' => '选一个撒2', - 'is_multiple' => 1, // 是否开启多选(默认0 关闭) - 'element_data' => [ - ['value'=>1, 'name'=>'选项1'], - ['value'=>2, 'name'=>'选项2'], - ['value'=>3, 'name'=>'选项3'], - ['value'=>4, 'name'=>'选项4'] - ], - 'minchecked' => 2, // 最小选项(默认以is_required=1至少一项,则0) - 'maxchecked' => 3, // 最大选项 - 'name' => 'select2', - 'title' => '下拉多选测试', // 展示title名称 - 'is_required' => 1, // 是否需要强制填写/选择 - 'message' => '请选择下拉多选测试 至少选择2项最多选择3项', - ], + // [ + // 'element' => 'input', // 表单标签 + // 'type' => 'text', // input类型 + // 'default' => '', // 默认值 + // 'name' => 'testinput', // name名称 + // 'placeholder' => '测试输入框不需要验证', // input默认显示文字 + // 'title' => '测试输入框不需要验证', // 展示title名称 + // 'is_required' => 0, // 是否需要强制填写/选择 + // 'message' => '请填写测试输入框不需要验证', // 错误提示(is_required=1方可有效) + // ], + // [ + // 'element' => 'textarea', + // 'default' => '', + // 'name' => 'rsa_private', + // 'placeholder' => 'RSA证书', + // 'title' => 'RSA证书', + // 'is_required' => 0, + // 'minlength' => 10, // 最小输入字符(is_required=1方可有效) + // //'maxlength' => 300, // 最大输入字符, 填则不限(is_required=1方可有效) + // 'rows' => 6, + // ], + // [ + // 'element' => 'input', + // 'type' => 'checkbox', + // 'element_data' => [ + // ['value'=>1, 'name'=>'选项1'], + // ['value'=>2, 'name'=>'选项2',], + // ['value'=>3, 'name'=>'选项3'], + // ['value'=>4, 'name'=>'选项4'] + // ], + // 'is_block' => 1, // 是否每个选项行内展示(默认0) + // 'minchecked' => 2, // 最小选项(默认以is_required=1至少一项,则0) + // 'maxchecked' => 3, // 最大选项 + // 'name' => 'checkbox', + // 'title' => '多选项测试', // 展示title名称 + // 'is_required' => 1, // 是否需要强制填写/选择 + // 'message' => '请选择多选项测试选择 至少选择2项最多选择3项', // 错误提示信息 + // ], + // [ + // 'element' => 'input', + // 'type' => 'radio', + // 'element_data' => [ + // ['value'=>1, 'name'=>'选项1',], + // ['value'=>2, 'name'=>'选项2'], + // ['value'=>3, 'name'=>'选项3'], + // ['value'=>4, 'name'=>'选项4'] + // ], + // 'is_block' => 1, // 是否每个选项行内展示(默认0) + // 'name' => 'radio', + // 'title' => '单选项测试', // 展示title名称 + // 'is_required' => 1, // 是否需要强制填写/选择 + // 'message' => '请选择单选项测试', + // ], + // [ + // 'element' => 'select', + // 'placeholder' => '选一个撒1', + // 'is_multiple' => 0, // 是否开启多选(默认0 关闭) + // 'element_data' => [ + // ['value'=>1, 'name'=>'选项1'], + // ['value'=>2, 'name'=>'选项2'], + // ['value'=>3, 'name'=>'选项3'], + // ['value'=>4, 'name'=>'选项4'] + // ], + // 'name' => 'select1', + // 'title' => '下拉单选测试', // 展示title名称 + // 'is_required' => 1, // 是否需要强制填写/选择 + // 'message' => '请选择下拉单选测试', + // ], + // [ + // 'element' => 'select', + // 'placeholder' => '选一个撒2', + // 'is_multiple' => 1, // 是否开启多选(默认0 关闭) + // 'element_data' => [ + // ['value'=>1, 'name'=>'选项1'], + // ['value'=>2, 'name'=>'选项2'], + // ['value'=>3, 'name'=>'选项3'], + // ['value'=>4, 'name'=>'选项4'] + // ], + // 'minchecked' => 2, // 最小选项(默认以is_required=1至少一项,则0) + // 'maxchecked' => 3, // 最大选项 + // 'name' => 'select2', + // 'title' => '下拉多选测试', // 展示title名称 + // 'is_required' => 1, // 是否需要强制填写/选择 + // 'message' => '请选择下拉多选测试 至少选择2项最多选择3项', + // ], ]; return [ diff --git a/extend/payment/AlipayMini.php b/extend/payment/AlipayMini.php index 06cbf41c345e3638c661f08144f295bc0054fd74..9f089817d6e7f9f4275e10d13bedb1624528dfca 100755 --- a/extend/payment/AlipayMini.php +++ b/extend/payment/AlipayMini.php @@ -43,7 +43,8 @@ class AlipayMini 'name' => '支付宝', // 插件名称 'version' => '0.0.1', // 插件版本 'apply_version' => '不限', // 适用系统版本描述 - 'desc' => '即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) + 'apply_terminal'=> ['alipay'], // 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu'] + 'desc' => '适用支付宝小程序,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) 'author' => 'Devil', // 开发者 'author_url' => 'http://shopxo.net/', // 开发者主页 ]; @@ -60,36 +61,6 @@ class AlipayMini 'is_required' => 1, 'message' => '请填写小程序appid', ], - [ - 'element' => 'input', - 'type' => 'text', - 'default' => '', - 'name' => 'account', - 'placeholder' => '支付宝账号', - 'title' => '支付宝账号', - 'is_required' => 1, - 'message' => '请填写支付宝账号', - ], - [ - 'element' => 'input', - 'type' => 'text', - 'default' => '', - 'name' => 'partner', - 'placeholder' => '合作者身份 partner ID', - 'title' => '合作者身份 partner ID', - 'is_required' => 1, - 'message' => '请填写合作者身份 partner ID', - ], - [ - 'element' => 'input', - 'type' => 'text', - 'default' => '', - 'name' => 'key', - 'placeholder' => '交易安全校验码 key', - 'title' => '交易安全校验码 key', - 'is_required' => 1, - 'message' => '请填写交易安全校验码 key', - ], [ 'element' => 'textarea', 'name' => 'rsa_public',
名称
{{$v.name}} {{if !empty($v['version'])}} @@ -40,7 +40,7 @@ {{else /}} - 暂无图片 + 暂无LOGO {{/if}} @@ -48,9 +48,9 @@ {{if !empty($v['apply_terminal'])}} - - {{:lang('common_platform_type')[$terminal_v]['name']}} - {{if $terminal_k LT count($v['apply_terminal'])-1)}}
{{/if}} + {{foreach $v.apply_terminal as $terminal_k=>$terminal_v}} + {{$common_platform_type[$terminal_v]['name']}} + {{if $terminal_k LT count($v['apply_terminal'])-1}}
{{/if}} {{/foreach}} {{else /}} 未填写 @@ -69,35 +69,35 @@ {{/if}}
- {{if empty($v['desc'])}}未填写{{else /}}{{$v.desc}}{{/if}} + {{if empty($v['desc'])}}未填写{{else /}}{{$v.desc||raw}}{{/if}} - {{if $v['is_install'] eq 1)}} - {{else /}} 未安装 {{/if}} - {{if $v['is_install'] eq 1)}} - + {{if $v['is_install'] eq 1}} + {{else /}} 未安装 {{/if}} - {{if $v['is_install'] eq 0)}} - + {{if $v['is_install'] eq 0}} + {{if !in_array($v['payment'], $cannot_deleted_list)}} - + {{/if}} {{else /}} - + - + {{/if}}