| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\admin\model\massager;
- use think\Model;
- class Bill extends Model
- {
-
-
- // 表名
- protected $name = 'massager_bill';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = false;
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'currency_type_text'
- ];
-
-
- public function getCurrencyTypeList()
- {
- return ['money' => __('Money'), 'score' => __('Score')];
- }
- public function getCurrencyTypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['currency_type']) ? $data['currency_type'] : '');
- $list = $this->getCurrencyTypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function massager()
- {
- return $this->belongsTo('app\admin\model\Massager', 'massager_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- }
|