| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace app\admin\model\system;
- use think\Model;
- class Feedback extends Model
- {
-
-
- // 表名
- protected $name = 'system_feedback';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'type_text',
- 'relation_type_text',
- 'status_text'
- ];
-
-
- public function getTypeList()
- {
- return ['feedback' => __('Feedback'), 'complaint' => __('Complaint')];
- }
- public function getRelationTypeList()
- {
- return ['platform' => __('Platform'), 'agency' => __('Agency'), 'store' => __('Store'), 'massager' => __('Massager'), 'user' => __('User'), 'other' => __('Other')];
- }
- public function getStatusList()
- {
- return ['default' => __('Default'), 'dispose' => __('Dispose'), 'refuse' => __('Refuse')];
- }
- public function getTypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
- $list = $this->getTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getRelationTypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['relation_type']) ? $data['relation_type'] : '');
- $list = $this->getRelationTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getStatusTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
- $list = $this->getStatusList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function user()
- {
- return $this->belongsTo('app\admin\model\User', 'user_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);
- }
- }
|