Withdraw.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class Withdraw extends Model
  5. {
  6. // 表名
  7. protected $name = 'withdraw';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'int';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. protected $deleteTime = false;
  14. // 追加属性
  15. protected $append = [
  16. 'status_text',
  17. 'type_text',
  18. ];
  19. public function getStatusList()
  20. {
  21. return ['created'=>'申请中', 'successed'=>'成功', 'rejected'=>'已拒绝'];
  22. }
  23. public function getStatusTextAttr($value, $data)
  24. {
  25. $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
  26. $list = $this->getStatusList();
  27. return isset($list[$value]) ? $list[$value] : '';
  28. }
  29. public function getTypeList()
  30. {
  31. return ['wechat'=>'微信', 'alipay'=>'支付宝', 'bank'=> '银行'];
  32. }
  33. public function getTypeTextAttr($value, $data)
  34. {
  35. $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
  36. $list = $this->getTypeList();
  37. return isset($list[$value]) ? $list[$value] : '';
  38. }
  39. }