/**
  * Creates a new Character model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Character();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->sid]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 private function insertCharList($uid, $data, $akey, $vkey)
 {
     $flag = false;
     foreach ($data as $char) {
         $flag = true;
         $character_id = Character::where('uid', $uid)->where("char_id", "=", $char['characterID'])->first();
         if (!empty($character_id)) {
             $row = $character_id;
         } else {
             $row = new Character();
         }
         $row->char_id = $char['characterID'];
         $row->uid = $uid;
         $row->apikey = $akey;
         $row->vkey = $vkey;
         $row->status = 1;
         $row->save();
         $this->updateCharacterProfile($uid, $char);
     }
     return $flag;
 }