Cash.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\common\model\plus\agent;
  3. use app\common\model\BaseModel;
  4. /**
  5. * 分销商提现明细模型
  6. */
  7. class Cash extends BaseModel
  8. {
  9. protected $name = 'agent_cash';
  10. protected $pk = 'id';
  11. /**
  12. * 打款方式
  13. * @var array
  14. */
  15. public $payType = [
  16. 10 => '微信',
  17. 20 => '支付宝',
  18. 30 => '银行卡',
  19. ];
  20. /**
  21. * 申请状态
  22. * @var array
  23. */
  24. public $applyStatus = [
  25. 10 => '待审核',
  26. 20 => '审核通过',
  27. 30 => '驳回',
  28. 40 => '已打款',
  29. ];
  30. /**
  31. * 关联分销商用户表
  32. */
  33. public function user()
  34. {
  35. return $this->belongsTo('User');
  36. }
  37. /**
  38. * 提现详情
  39. * @param $id
  40. * @return array|\think\Model|null
  41. * @throws \think\db\exception\DataNotFoundException
  42. * @throws \think\db\exception\DbException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. */
  45. public static function detail($id)
  46. {
  47. return (new static())->find($id);
  48. }
  49. /**
  50. * 审核状态
  51. * @param $value
  52. * @return array
  53. */
  54. public function getApplyStatusAttr($value)
  55. {
  56. $method = [10 => '待审核', 20 => '审核通过', 30 => '驳回', 40 => '已打款'];
  57. return ['text' => $method[$value], 'value' => $value];
  58. }
  59. }