RechargeOrder.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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\recharge;
  15. use app\common\enum\PayEnum;
  16. use app\common\model\BaseModel;
  17. use app\common\model\dict\DictData;
  18. use app\common\model\works\ServiceWork;
  19. use think\model\concern\SoftDelete;
  20. /**
  21. * 订单模型
  22. * Class RechargeOrder
  23. * @package app\common\model
  24. */
  25. class RechargeOrder extends BaseModel
  26. {
  27. use SoftDelete;
  28. protected $deleteTime = 'delete_time';
  29. /**
  30. * @notes 支付方式
  31. * @param $value
  32. * @return string|string[]
  33. * @author 段誉
  34. * @date 2023/2/23 18:32
  35. */
  36. public function getPayWayTextAttr($value, $data)
  37. {
  38. return PayEnum::getPayDesc($data['pay_way']);
  39. }
  40. /**
  41. * @notes 支付状态
  42. * @param $value
  43. * @return string|string[]
  44. * @author 段誉
  45. * @date 2023/2/23 18:32
  46. */
  47. public function getPayStatusTextAttr($value, $data)
  48. {
  49. return PayEnum::getPayStatusDesc($data['pay_status']);
  50. }
  51. public function serviceWork()
  52. {
  53. return $this->belongsTo(ServiceWork::class, 'work_id', 'id');
  54. }
  55. public function orderGoods()
  56. {
  57. return $this->hasMany(OrderGoods::class, 'sn', 'sn');
  58. }
  59. public function getPaymentTypeTextAttr($value, $data)
  60. {
  61. $payment_type_data = DictData::where('type_value','payment_type')->column('name','value');
  62. return $payment_type_data[$data['payment_type']];
  63. }
  64. }