PayMerchantService.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: tandunzhao
  5. * Date: 2017/12/7
  6. * Time: 上午10:10
  7. */
  8. namespace App\Modules\Trade\Services;
  9. use App\Modules\BaseService;
  10. use App\Modules\Trade\Models\PayMerchant;
  11. /**
  12. * @method static array getPayConfigByNameStatic(string $name) 获取微信支付配置信息
  13. */
  14. class PayMerchantService
  15. {
  16. use BaseService;
  17. public function getPayConfigByName(string $name)
  18. {
  19. $pay_merchant = PayMerchant::where('name', $name)->first();
  20. $pay_config = json_decode($pay_merchant->config_info);
  21. return [
  22. 'appid' => $pay_config->appid,
  23. 'merchant_id' => $pay_config->merchant_id,
  24. 'key' => $pay_config->key,
  25. ];
  26. }
  27. /**
  28. * 根据ID查找
  29. * @param $id
  30. * @return mixed
  31. */
  32. public static function getPayMerchantSingle($id)
  33. {
  34. return PayMerchant::getPayMerchantSingle($id);
  35. }
  36. /**
  37. * 查找所有的支付渠道通道
  38. * @return mixed
  39. */
  40. public static function getPayMerchantSourceList()
  41. {
  42. return PayMerchant::getPayMerchantSourceList();
  43. }
  44. }