SystemStoreRecord.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\system\store;
  12. use think\Model;
  13. /**
  14. * 门店申请记录模型
  15. * Class SystemStoreRecord
  16. * @package app\model\system\store
  17. */
  18. class SystemStoreRecord extends Model
  19. {
  20. /**
  21. * 表名
  22. * @var string
  23. */
  24. protected $name = 'system_store_record';
  25. /**
  26. * 自动写入时间戳
  27. * @var bool
  28. */
  29. protected $autoWriteTimestamp = 'int';
  30. /**
  31. * 创建时间字段
  32. * @var string
  33. */
  34. protected $createTime = 'add_time';
  35. /**
  36. * 更新时间字段
  37. * @var string
  38. */
  39. protected $updateTime = 'update_time';
  40. /**
  41. * 获取状态文本
  42. * @param $value
  43. * @param $data
  44. * @return string
  45. */
  46. public function getStatusTextAttr($value, $data)
  47. {
  48. $status = [
  49. 0 => '待审核',
  50. 1 => '已通过',
  51. 2 => '已拒绝',
  52. ];
  53. return $status[$value] ?? '未知';
  54. }
  55. /**
  56. * 关联用户表
  57. * @return \think\model\relation\BelongsTo
  58. */
  59. public function user()
  60. {
  61. return $this->belongsTo(\app\model\user\User::class, 'uid', 'uid')->field('uid,nickname,avatar,phone');
  62. }
  63. }