/**
  * Updates an existing UcenterMember model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $siteRoot = str_replace('\\', '/', realpath(dirname(dirname(dirname(__FILE__))) . '/')) . "/www/web/upload/";
     if ($model->load(\App::$app->request->post()) && $model->save()) {
         $model->person_face = UploadedFile::getInstance($model, 'person_face');
         if ($model->person_face) {
             $contractName = mt_rand(1100, 9900) . time() . '.' . $model->person_face->extension;
             $model->person_face->saveAs($siteRoot . $contractName);
             $model->person_face = $contractName;
             UcenterMember::updateAll(['person_face' => $model->person_face], ['id' => $id]);
         }
         if (\App::$app->request->post()['UcenterMember']['lock'] == 0) {
             UcenterMember::updateAll(['error_num' => 0], ['id' => $id]);
         }
         $cattype = \App::$app->request->post()['UcenterMember']['type'];
         if ($cattype) {
             Catmiddle::deleteAll('uid = :uid ', [':uid' => $id]);
             foreach ($cattype as $k => $v) {
                 $catmiddle = new Catmiddle();
                 $catmiddle->uid = $model->id;
                 $catmiddle->cid = $v;
                 $catmiddle->save();
             }
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }