| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- namespace app\admin\model\deposit;
- use app\admin\model\User;
- use think\Model;
- class Record extends Model
- {
-
-
- // 表名
- protected $name = 'deposit_record';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'platform_text',
- 'identity_type_text',
- 'apply_status_text',
- 'deposit_status_text'
- ];
-
-
- public function getPlatformList()
- {
- return ['ali' => __('Ali'), 'wechat' => __('Wechat')];
- }
- public function getIdentityTypeList()
- {
- return ['agency' => __('Agency'), 'store' => __('Store'), 'massager' => __('Massager'), 'user' => __('User')];
- }
- public function getApplyStatusList()
- {
- return ['default' => __('Default'), 'reject' => __('Reject'), 'pass' => __('Pass')];
- }
- public function getDepositStatusList()
- {
- return ['default' => __('Default'), 'success' => __('Success'), 'fail' => __('Fail')];
- }
- public function getPlatformTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['platform']) ? $data['platform'] : '');
- $list = $this->getPlatformList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getIdentityTypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['identity_type']) ? $data['identity_type'] : '');
- $list = $this->getIdentityTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getApplyStatusTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['apply_status']) ? $data['apply_status'] : '');
- $list = $this->getApplyStatusList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getDepositStatusTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['deposit_status']) ? $data['deposit_status'] : '');
- $list = $this->getDepositStatusList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function store()
- {
- return $this->belongsTo('app\admin\model\Store', 'store_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function massager()
- {
- return $this->belongsTo('app\admin\model\Massager', 'massager_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function admin()
- {
- return $this->belongsTo('app\admin\model\Admin', 'agency_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function user()
- {
- return $this->belongsTo(User::class, 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- }
|