PayMerchantService.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. class PayMerchantService
  12. {
  13. /**
  14. * 查找微信支付配置信息
  15. */
  16. public static function findPayConfig(int $id)
  17. {
  18. $pay_merchant = PayMerchant::find($id);
  19. $pay_config = json_decode($pay_merchant->config_info);
  20. return [
  21. 'appid' => $pay_config->appid,
  22. 'merchant_id' => $pay_config->merchant_id,
  23. 'key' => $pay_config->key,
  24. ];
  25. }
  26. /**
  27. * 根据ID查找
  28. * @param $id
  29. * @return mixed
  30. */
  31. public static function getPayMerchantSingle($id)
  32. {
  33. return PayMerchant::find($id);
  34. }
  35. /**
  36. * 查找所有的支付渠道通道
  37. * @return mixed
  38. */
  39. public static function getPayMerchantSourceList()
  40. {
  41. $result = PayMerchant::select('source')->distinct();
  42. return $result;
  43. }
  44. }