diff --git a/service/Application/Home/Controller/BuyController.class.php b/service/Application/Home/Controller/BuyController.class.php index 436f19b2e..6df71c103 100644 --- a/service/Application/Home/Controller/BuyController.class.php +++ b/service/Application/Home/Controller/BuyController.class.php @@ -58,7 +58,7 @@ class BuyController extends CommonController $this->assign('express_list', ResourcesService::ExpressList()); // 支付方式 - $this->assign('payment_list', ResourcesService::PaymentList()); + $this->assign('payment_list', ResourcesService::BuyPaymentList()); // 商品/基础信息 $base = [ diff --git a/service/Application/Service/ResourcesService.class.php b/service/Application/Service/ResourcesService.class.php index 812da2215..b9d0561dd 100644 --- a/service/Application/Service/ResourcesService.class.php +++ b/service/Application/Service/ResourcesService.class.php @@ -78,6 +78,56 @@ class ResourcesService 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) + { + // 根据终端类型筛选 + switch(APPLICATION) + { + // pc, wap + case 'web' : + if(IsMobile()) + { + if(in_array('wap', $v['apply_terminal'])) + { + $result[] = $v; + } + } else { + if(in_array('pc', $v['apply_terminal'])) + { + $result[] = $v; + } + } + break; + + // app + case 'app' : + if(in_array('app', $v['apply_terminal'])) + { + $result[] = $v; + } + break; + } + } + } + return $result; + } + /** * 获取地区节点数据 * @author Devil