PayWay.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\common\model\pay;
  15. use app\common\model\BaseModel;
  16. use app\common\service\FileService;
  17. class PayWay extends BaseModel
  18. {
  19. protected $name = 'dev_pay_way';
  20. public function getIconAttr($value,$data)
  21. {
  22. return FileService::getFileUrl($value);
  23. }
  24. /**
  25. * @notes 支付方式名称获取器
  26. * @param $value
  27. * @param $data
  28. * @return mixed
  29. * @author ljj
  30. * @date 2021/7/28 4:02 下午
  31. */
  32. public static function getPayWayNameAttr($value,$data)
  33. {
  34. return PayConfig::where('id',$data['pay_config_id'])->value('name');
  35. }
  36. /**
  37. * @notes 关联支配配置模型
  38. * @return \think\model\relation\HasOne
  39. * @author ljj
  40. * @date 2021/10/11 3:04 下午
  41. */
  42. public function payConfig()
  43. {
  44. return $this->hasOne(PayConfig::class,'id','pay_config_id');
  45. }
  46. }