Example #1
0
 /**
  * 删除关联数据1.0
  * @return $this|ResponseResult
  */
 public function questionUserSetStateAction()
 {
     $req = $this->request;
     if ($req->isPost()) {
         $id = intval($req->getPost('id', null, 0));
         $state = intval($req->getPost('state', null, 0));
         if (!in_array($state, [-1, 0, 1])) {
             return (new ResponseResult())->sendError(ResponseResultStatus::PARAM_CANNOT_EMPTY, '请求异常');
         }
         $info = OmQuestionAnswerUser::findFirst('qau_id=' . $id);
         if ($info) {
             $info->delete();
         }
         return (new ResponseResult())->sendResult('ok');
     } else {
         return (new ResponseResult())->sendError(ResponseResultStatus::PARAM_CANNOT_EMPTY, '请求异常');
     }
 }