ProductTimer.php 835 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\common\model\product;
  3. use app\common\model\BaseModel;
  4. /**
  5. * 商品上下架定时器模型
  6. */
  7. class ProductTimer extends BaseModel
  8. {
  9. protected $name = 'product_timer';
  10. protected $pk = 'id';
  11. /**
  12. * 查询
  13. */
  14. public static function detail($productId)
  15. {
  16. return (new static())->where('product_id', '=', $productId)->find();
  17. }
  18. /**
  19. * 删除
  20. * @param $productId
  21. * @return bool
  22. */
  23. public static function deleteTimer($productId): bool
  24. {
  25. return (new static())->where('product_id', '=', $productId)->delete();
  26. }
  27. /**
  28. * 删除
  29. * @param $taskId
  30. * @return bool
  31. */
  32. public static function deleteTimerByTaskId($taskId): bool
  33. {
  34. return (new static())->where('task_id', '=', $taskId)->delete();
  35. }
  36. }