<?php


namespace frontend\modules\api\controllers;


use common\components\AjaxException;
use common\services\AccidentCasesScoreConfigService;
use common\services\AccidentCasesScoreService;
use frontend\modules\api\components\BaseAdminController;
use yii\base\InvalidConfigException;
use yii\web\Response;

class AccidentCasesScoreController extends BaseAdminController
{
    /**
     * 评价打分
     * @param $id
     * @return Response
     * @throws AjaxException
     * @throws InvalidConfigException
     */
    public function actionUpdate($id)
    {
        if (AccidentCasesScoreConfigService::getAccidentCasesScoreConfigUpdate()) {
            throw new AjaxException("打分配置正在更新中，请稍后打分！");
        }
        AccidentCasesScoreService::updateById($id, $this->getAllParams(), $this->userInfo);
        return $this->asJson();
    }
}