123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class Giftusertyping extends Model
- {
-
-
- // 表名
- protected $name = 'gift_user_typing';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = false;
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'wallettype_text'
- ];
-
-
- public function getWallettypeList()
- {
- return ['1' => __('Wallettype 1'), '2' => __('Wallettype 2')];
- }
- public function getWallettypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['wallettype']) ? $data['wallettype'] : '');
- $list = $this->getWallettypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function user()
- {
- return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function touser()
- {
- return $this->belongsTo('User', 'user_to_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- }
|