ProjectStatusService.php 756 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\common\service;
  3. use app\common\model\ProjectStatus;
  4. class ProjectStatusService extends Service
  5. {
  6. public function create($param = [])
  7. {
  8. $param = $this->autoParams($param);
  9. $key = $this->req('key');
  10. $status = (new ProjectStatus)->where('key', '=', $key)->findOrEmpty();
  11. if ($status->isExists()) {
  12. throw $this->exception("状态键($status->key)已存在,对应的值为$status->value");
  13. }
  14. return ProjectStatus::create($param);
  15. }
  16. public function update($param = [])
  17. {
  18. $param = $this->autoParams($param);
  19. return ProjectStatus::update($param);
  20. }
  21. public function list()
  22. {
  23. return (new ProjectStatus)->select();
  24. }
  25. }