| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | 
							- <?php
 
- namespace app\common\model;
 
- use think\Model;
 
- class UserIntegral extends Model
 
- {
 
- 	// 设置字段信息
 
-     protected $schema = [
 
-         'id'          		=> 'int',
 
- 		'userid'			=> 'int',
 
- 		'title'				=> 'string',
 
- 		'intvalue'			=> 'int',
 
- 		'intmoney'			=> 'float',
 
- 		'onlycontent'		=> 'string',
 
- 		'remark'			=> 'string',
 
- 		'itype'				=> 'tinyint',
 
- 		'status'			=> 'tinyint',
 
- 		'createtime'  		=> 'int',
 
- 		'yeartime'			=> 'int',
 
- 		'monthtime'			=> 'int'
 
-     ];
 
- 	
 
- 	// 设置字段自动转换类型
 
- 	protected $type = [
 
- 		'createtime'  => 'timestamp:Y-m-d H:i:s'
 
-     ];
 
- 	
 
- 	public function getItypeTextAttr($value,$data)
 
- 	{
 
- 		$itype = [1=>'推荐奖励', 2=>'积分充值', 3=>'积分兑现', 4=>'招聘相关', 5=>'订单相关', 6=>'供人相关', 7=>'兑购消费', 8=>'其他'];
 
- 		return $itype[$data['itype']];
 
- 	}
 
- 	
 
- 	public function getStatusTextAttr($value,$data)
 
- 	{
 
- 		$status = [1=>'待处理', 2=>'已处理'];
 
- 		return $status[$data['status']];
 
- 	}
 
- 	// 关联User
 
- 	public function user()
 
- 	{
 
- 	    return $this->hasOne(User::class, "id", "userid");
 
- 	}
 
- 	
 
- 	
 
- }
 
 
  |