AccidentCasesScoreCommentService.php 897 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace common\services;
  3. use common\components\AjaxException;
  4. use common\models\AccidentCasesScoreComment;
  5. use Exception;
  6. use yii\db\ActiveQuery;
  7. class AccidentCasesScoreCommentService
  8. {
  9. /**
  10. * @param $id
  11. * @return AccidentCasesScoreComment
  12. * @throws AjaxException
  13. */
  14. public static function getById($id): AccidentCasesScoreComment
  15. {
  16. /** @var AccidentCasesScoreComment $Rules */
  17. $Rules = self::getQuery()->andWhere(["id" => $id])->one();
  18. if (!$Rules) {
  19. throw new AjaxException("该评价用语不存在!");
  20. }
  21. return $Rules;
  22. }
  23. /**
  24. * @return ActiveQuery
  25. */
  26. public static function getQuery(): ActiveQuery
  27. {
  28. return AccidentCasesScoreComment::find()->where(["delete_time" => 0]);
  29. }
  30. public function add()
  31. {
  32. }
  33. public function update()
  34. {
  35. }
  36. }