コード例 #1
0
 /**
  * Updates an existing Wxconfig model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate()
 {
     $model = $this->findModel(Yii::$app->user->getId());
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         UHelper::alert('设置修改成功', 'success');
         return $this->redirect(['update']);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }
コード例 #2
0
 public function actionIndex()
 {
     if (time() > \Yii::$app->user->identity->expire) {
         UHelper::alert('帐号已过期', 'error');
     } else {
         $day = (int) floor((\Yii::$app->user->identity->expire - time()) / (24 * 3600));
         UHelper::alert('您的帐号有效期还有' . $day . '天', 'success');
     }
     return $this->render('index');
 }
コード例 #3
0
 /**
  * Creates a new Menu model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Menu();
     $request = Yii::$app->request;
     $plugModel = new Plug();
     $plugList = $plugModel::find();
     UHelper::output($plugList);
     if ($request->isPost) {
         $model->load($request->post());
         $model->menu_images = JquploadHelper::jqformat();
         if ($model->save()) {
             return $this->redirect(['update', 'id' => $model->menu_id]);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #4
0
 public function actionCroppic()
 {
     //        echo Yii::$app->user->isGuest;
     //        echo Yii::$app->member->isGuest;
     //        UHelper::output('123');
     $userAuth = new \app\models\table\User();
     $identity = $userAuth->findIdentity(3);
     if ($a = Yii::$app->member->login($identity, 3600 * 24 * 7)) {
         echo $a . '******';
     } else {
         echo '13&&&&&&';
     }
     echo Yii::$app->member->Identity->user_role;
     UHelper::output($identity);
     echo 123;
     die;
     return $this->render('croppic');
 }
コード例 #5
0
 /**
  * Updates an existing Plug 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);
     $RQ = \Yii::$app->request;
     if (empty($model->images)) {
         $model->images = [['label' => '示例图片', 'width' => 200, 'height' => 200]];
     } else {
         $model->images = JquploadHelper::jqunformat($model->images);
     }
     if ($RQ->isPost) {
         $model->load($RQ->post());
         $model->images = JquploadHelper::jqformat();
         if ($model->save()) {
             UHelper::alert('修改成功!', 'success');
             return $this->redirect(['update', 'id' => $model->id]);
         } else {
             UHelper::alert('修改失败', 'error');
         }
     }
     return $this->render('update', ['model' => $model]);
 }
コード例 #6
0
 /**
  * Updates an existing Tmp 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);
     if (!Yii::$app->request->get('typeid')) {
         UHelper::alert('参数缺失,无法添加模板', 'error');
         return $this->redirect(['plug/index']);
     }
     if ($model->load(Yii::$app->request->post())) {
         $model->images = JquploadHelper::jqformat();
         $model->configs = ArrayHelper::mulitinput(['tmpc_name', 'tmpc_value', 'tmpc_key']);
         $model->imgconfigs = ArrayHelper::mulitinput(['tmpimg_name', 'tmpimg_width', 'tmpimg_height']);
         if ($model->save()) {
             UHelper::alert('更新成功!', 'success');
             return $this->redirect(['index', 'typeid' => Yii::$app->request->get('typeid')]);
         } else {
             UHelper::alert('更新失败!', 'error');
             return $this->redirect(['update', 'id' => $id, 'typeid' => Yii::$app->request->get('typeid')]);
         }
     } else {
         $model->images = JquploadHelper::jqunformat($model->images);
         $model->configs = ['configs' => [['属性名', 'tmpc_name'], ['默认值', 'tmpc_value'], ['键值', 'tmpc_key']], 'data' => Json::decode($model->configs, 1)];
         $model->imgconfigs = ['configs' => [['图片名', 'tmpimg_name'], ['宽度', 'tmpimg_width'], ['高度', 'tmpimg_height']], 'data' => Json::decode($model->imgconfigs, 1)];
         //            UHelper::output($model->configs);
         return $this->render('update', ['model' => $model]);
     }
 }
コード例 #7
0
 /**
  * Deletes an existing Menu model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $row = $this->findModel($id);
     $count = Menu::find()->where(['parentId' => $row['id']])->count();
     if ($count > 0) {
         UHelper::alert('菜单下有子菜单,无法删除!');
     } else {
         JquploadHelper::jqdelimages($row['images']);
         $row->delete();
     }
     return $this->redirect(['index']);
 }
コード例 #8
0
 /**
  * Deletes an existing User model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     if (Yii::$app->user->identity->user_role == "ADMIN") {
         $model = $this->findModel($id);
         unlink('./' . $model->user_portrait);
         $model->delete();
         return $this->redirect(['index']);
     } else {
         UHelper::alert('对不起,你没有删除的权限', 'error');
         return $this->redirect(['index']);
     }
 }