cron.model.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * 任务队列
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class cronModel extends Model {
  11. public function __construct() {
  12. parent::__construct('cron');
  13. }
  14. /**
  15. * 取单条任务信息
  16. * @param array $condition
  17. */
  18. public function getCronInfo($condition = array()) {
  19. return $this->where($condition)->find();
  20. }
  21. /**
  22. * 任务队列列表
  23. * @param array $condition
  24. * @param number $limit
  25. * @return array
  26. */
  27. public function getCronList($condition, $limit = 100) {
  28. return $this->where($condition)->limit($limit)->select();
  29. }
  30. /**
  31. * 保存任务队列
  32. *
  33. * @param unknown $insert
  34. * @return array
  35. */
  36. public function addCronAll($insert) {
  37. return $this->insertAll($insert);
  38. }
  39. /**
  40. * 保存任务队列
  41. *
  42. * @param array $insert
  43. * @return boolean
  44. */
  45. public function addCron($insert) {
  46. return $this->insert($insert);
  47. }
  48. /**
  49. * 删除任务队列
  50. *
  51. * @param array $condition
  52. * @return array
  53. */
  54. public function delCron($condition) {
  55. return $this->where($condition)->delete();
  56. }
  57. }