RoutineFormId.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\admin\model\routine;
  3. use basic\ModelBasic;
  4. use traits\ModelTrait;
  5. /**
  6. * 表单ID表
  7. * Class RoutineFormId
  8. * @package app\routine\model\routine
  9. */
  10. class RoutineFormId extends ModelBasic {
  11. use ModelTrait;
  12. /**
  13. * 删除已失效的formID
  14. * @return int
  15. */
  16. public static function delStatusInvalid(){
  17. return self::where('status',2)->where('stop_time','LT',time())->delete();
  18. }
  19. /**
  20. * 获取一个可以使用的formId
  21. * @return bool|mixed
  22. */
  23. public static function getFormIdOne($uid = 0){
  24. $formId = self::where('status',1)->where('stop_time','GT',time())->where('uid',$uid)->order('id asc')->find();
  25. if($formId) return $formId['form_id'];
  26. else return false;
  27. }
  28. /**
  29. * 修改一个FormID为已使用
  30. * @param string $formId
  31. * @return $this|bool
  32. */
  33. public static function delFormIdOne($formId = ''){
  34. if($formId == '') return true;
  35. return self::where('form_id',$formId)->update(['status'=>2]);
  36. }
  37. }