12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\admin\model\user;
- use think\Model;
- class Rechargelog extends Model
- {
-
-
- // 表名
- protected $name = 'user_recharge_log';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = false;
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'away_text',
- 'platform_text'
- ];
-
-
- public function getAwayList()
- {
- return ['1' => __('Away 1'), '2' => __('Away 2'), '3' => __('Away 3'), '4' => __('Away 4')];
- }
- public function getPlatformList()
- {
- return ['1' => __('Platform 1'), '2' => __('Platform 2'), '3' => __('Platform 3')];
- }
- public function getAwayTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['away']) ? $data['away'] : '');
- $list = $this->getAwayList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getPlatformTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['platform']) ? $data['platform'] : '');
- $list = $this->getPlatformList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function user()
- {
- return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- }
|