123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- /**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/7
- * Time: 上午10:10
- */
- namespace App\Modules\Trade\Services;
- use App\Modules\Trade\Models\PayMerchant;
- class PayMerchantService
- {
- /**
- * 查找微信支付配置信息
- */
- public static function findPayConfig(int $id)
- {
- $pay_merchant = PayMerchant::find($id);
- $pay_config = json_decode($pay_merchant->config_info);
- return [
- 'appid' => $pay_config->appid,
- 'merchant_id' => $pay_config->merchant_id,
- 'key' => $pay_config->key,
- ];
- }
- /**
- * 查找微信支付配置信息
- */
- public static function findAliPayConfig(int $id)
- {
- $pay_merchant = PayMerchant::find($id);
- $pay_config = json_decode($pay_merchant->config_info);
- return [
- 'app_id' => $pay_config->app_id,
- 'ali_pub_key' => $pay_config->ali_pub_key,
- 'pri_key' => $pay_config->pri_key,
- ];
- }
- /**
- * 根据ID查找
- * @param $id
- * @return mixed
- */
- public static function getPayMerchantSingle($id)
- {
- return PayMerchant::find($id);
- }
- /**
- * 查找所有的支付渠道通道
- * @return mixed
- */
- public static function getPayMerchantSourceList()
- {
- $result = PayMerchant::select('source')->distinct();
- return $result;
- }
- }
|