123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\common\model;
- use think\Model;
- class MobileFollow extends Model
- {
- // 设置字段信息
- protected $schema = [
- 'id' => 'int',
- 'agent_id' => 'int',
- 'mobile' => 'string',
- 'content' => 'string',
- 'receive_time' => 'int',
- 'status' => 'int',
- ];
- // 设置字段自动转换类型
- protected $type = [
- 'receive_time' => 'timestamp:Y-m-d H:i:s',
- ];
- // 关联User
- public function user()
- {
- return $this->hasOne(User::class, "mobile", "mobile");
- }
- public static $statusText = [1 => '待跟进', 2 => '跟进中', 3 => '跟进完成'];
- public function getStatusTextAttr($value, $data)
- {
- return self::$statusText[$data['status']];
- }
- }
|