123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class Activepeoplemodify extends Model
- {
-
-
- // 表名
- protected $name = 'active_people_modify';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'coupontype_text',
- 'is_free_text',
- 'is_self_text',
- 'status_text'
- ];
-
-
- public function getCoupontypeList()
- {
- return ['1' => __('Coupontype 1'), '2' => __('Coupontype 2')];
- }
- public function getIsFreeList()
- {
- return ['0' => __('Is_free 0'), '1' => __('Is_free 1')];
- }
- public function getIsSelfList()
- {
- return ['0' => __('Is_self 0'), '1' => __('Is_self 1')];
- }
- public function getStatusList()
- {
- return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')];
- }
- public function getCoupontypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['coupontype']) ? $data['coupontype'] : '');
- $list = $this->getCoupontypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getIsFreeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['is_free']) ? $data['is_free'] : '');
- $list = $this->getIsFreeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getIsSelfTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['is_self']) ? $data['is_self'] : '');
- $list = $this->getIsSelfList();
- 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 active()
- {
- return $this->belongsTo('Active', 'active_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function activeorder()
- {
- return $this->belongsTo('Activeorder', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function activepeople()
- {
- return $this->belongsTo('Activepeople', 'people_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function user()
- {
- return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- }
|