コード例 #1
0
 public function actionOrder()
 {
     $result = new stdClass();
     $post = $this->getRequestBody();
     if ($post === null) {
         $result->status = "request is empty";
     } else {
         //$order = json_decode($post);
         $pollId = null;
         foreach ($post as $item) {
             $question = Question::findById($item->id);
             $question->weight = $item->weight;
             $pollId = $question->poll->id;
         }
         Variant::flush();
         $poll = Poll::findById($pollId);
         $result->status = 'ok';
         $result->data = $poll->formStdObject()->questions;
     }
     echo json_encode($result);
     exit;
 }