ScoreLog.php 587 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\common\model;
  3. use think\db\Query;
  4. use think\Model;
  5. /**
  6. * 会员积分日志模型
  7. * @method Query type($type)
  8. */
  9. class ScoreLog Extends Model
  10. {
  11. protected $table='user_score_log';
  12. // 开启自动写入时间戳字段
  13. protected $autoWriteTimestamp = 'int';
  14. // 定义时间戳字段名
  15. protected $createTime = 'createtime';
  16. protected $updateTime = '';
  17. public function user(){
  18. return $this->belongsTo(User::class);
  19. }
  20. public function scopeType(Query $query,$type){
  21. $query->where('type',$type);
  22. }
  23. }