GoodsSeckillModel.php 737 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020-09-12
  6. * Time: 13:54
  7. */
  8. namespace api\js\model;
  9. use think\Model;
  10. use think\model\concern\SoftDelete;
  11. class GoodsSeckillModel extends Model
  12. {
  13. use SoftDelete;
  14. protected $deleteTime = 'delete_time';
  15. public function goods()
  16. {
  17. return $this->belongsToMany('GoodsModel','goods_seckill_goods','goods_id','seckill_id');
  18. }
  19. public function getlist()
  20. {
  21. $list = $this::with('goods')->where('end_time','>',time())->order('start_time','asc')->select();
  22. return $list;
  23. }
  24. }