Process.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\common\service\system;
  13. use app\common\service\BaseService;
  14. use app\common\model\system\Process as SystemProcessModel;
  15. /**
  16. * 系统进程服务类
  17. * Class Process
  18. * @package app\common\service\system
  19. */
  20. class Process extends BaseService
  21. {
  22. /**
  23. * 获取指定进程最后运行时间
  24. * @param string $key
  25. * @return mixed
  26. */
  27. public static function getLastWorkingTime(string $key)
  28. {
  29. return (new SystemProcessModel)->where('key', '=', $key)->value('last_working_time');
  30. }
  31. /**
  32. * 记录指定进程最后运行时间
  33. * @param string $key
  34. * @return bool
  35. */
  36. public static function setLastWorkingTime(string $key): bool
  37. {
  38. return SystemProcessModel::updateBase(['last_working_time' => \time()], ['key' => $key]);
  39. }
  40. }