当前位置: 首页>>代码示例>>PHP>>正文


PHP XUtils::method方法代码示例

本文整理汇总了PHP中XUtils::method方法的典型用法代码示例。如果您正苦于以下问题:PHP XUtils::method方法的具体用法?PHP XUtils::method怎么用?PHP XUtils::method使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XUtils的用法示例。


在下文中一共展示了XUtils::method方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionLogin

 /**
  * 会员登录
  */
 public function actionLogin()
 {
     $model = new Admin('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['Admin'];
         if ($model->validate()) {
             $data = $model->find('username=:username', array('username' => $model->username));
             if ($data === null) {
                 $model->addError('username', '用户不存在');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->username), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->username) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } elseif ($data->group_id == 2) {
                 $model->addError('username', '用户被锁定,请联系网站管理');
             } else {
                 parent::_stateWrite(array('userId' => $data->id, 'userName' => $data->username, 'groupId' => $data->group_id, 'super' => $data->group_id == 1 ? 1 : 0), array('prefix' => '_admini'));
                 $data->last_login_ip = XUtils::getClientIP();
                 $data->last_login_time = time();
                 $data->login_count = $data->login_count + 1;
                 $data->save();
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '用户登录成功:' . CHtml::encode($model->username)));
                 $this->redirect(array('default/index'));
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:31,代码来源:PublicController.php

示例2: actionBatch

 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('position_delete');
             $cityModel = new Position();
             $cityModel->deleteAll('id IN(' . $ids . ')');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除内容,ID:' . $ids));
             parent::_delete(new Position(), $ids, array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
开发者ID:zywh,项目名称:maplecity,代码行数:30,代码来源:PositionController.php

示例3: actionBatch

 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('attr_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '属性删除,ID:' . $ids));
             $attrModel = Attr::model()->findByPk($ids);
             Attr::clear(array('attrId' => $attrModel->id, 'attrName' => $attrModel->attr_name_alias, 'oldScope' => 'all'));
             parent::_delete(new Attr(), $ids, array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
开发者ID:bigbol,项目名称:ziiwo,代码行数:30,代码来源:AttrController.php

示例4: actionLogin

 /**
  * 会员登录
  */
 public function actionLogin()
 {
     try {
         $model = new EnergyAdmin('login');
         if (XUtils::method() == 'POST') {
             $model->id = $_POST['id'];
             $model->password = $_POST['password'];
             $data = $model->find('id=:id', array('id' => $model->id));
             if ($data === null) {
                 $model->addError('id', '用户不存在');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->id), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->id) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } else {
                 parent::_stateWrite(array('userId' => $data->id, 'userName' => $data->name), array('prefix' => '_admini'));
                 // $data->save();
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '用户登录成功:' . CHtml::encode($model->id)));
                 $this->redirect(array('energy/index'));
             }
         }
         $this->render('login', array('model' => $model));
     } catch (Exception $e) {
         echo var_dump($e);
     }
 }
开发者ID:jiahongwei,项目名称:newland-project,代码行数:29,代码来源:publicController.php

示例5: actionBasicExecute

 /**
  * 上传
  */
 public function actionBasicExecute()
 {
     if (XUtils::method() == 'POST') {
         $adminiUserId = self::_sessionGet('adminiUserId');
         $file = XUpload::upload($_FILES['imgFile']);
         if (is_array($file)) {
             $model = new Upload();
             $model->user_id = intval($accountUserId);
             $model->file_name = $file['pathname'];
             $model->thumb_name = $file['paththumbname'];
             $model->real_name = $file['name'];
             $model->file_ext = $file['extension'];
             $model->file_mime = $file['type'];
             $model->file_size = $file['size'];
             $model->save_path = $file['savepath'];
             $model->hash = $file['hash'];
             $model->save_name = $file['savename'];
             $model->create_time = time();
             if ($model->save()) {
                 exit(CJSON::encode(array('state' => 'success', 'fileId' => $model->id, 'realFile' => $model->real_name, 'message' => '上传成功', 'file' => $file['pathname'])));
             } else {
                 @unlink($file['pathname']);
                 exit(CJSON::encode(array('state' => 'error', 'message' => '数据写入失败,上传错误')));
             }
         } else {
             exit(CJSON::encode(array('error' => 1, 'message' => '上传错误')));
         }
     }
 }
开发者ID:zywh,项目名称:maplecity,代码行数:32,代码来源:UploadifyController.php

示例6: actionBatch

 /**
  * 批量操作
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($this->_gets->getParam('command'));
         $ids = intval($this->_gets->getParam('id'));
     } elseif (XUtils::method() == 'POST') {
         $command = $this->_gets->getPost('command');
         $ids = $this->_gets->getPost('id');
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         throw new CHttpException(404, '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'attachDelete':
             parent::_acl('attach_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除附件,ID:' . $ids));
             //日志
             parent::_delete(new Upload(), $ids, array('attach'), array('file_name'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
开发者ID:bigbol,项目名称:ziiwo,代码行数:28,代码来源:OtherController.php

示例7: actionLogin

 public function actionLogin()
 {
     $model = new Admin('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['Admin'];
         if ($model->validate()) {
             $data = $model->find('username=:username', array('username' => $model->username));
             if ($data === null) {
                 $model->addError('username', '用户不存在');
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->username), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->username) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } elseif ($data->group_id == 2) {
                 $model->addError('username', '用户已经锁定,请联系管理');
             } else {
                 $this->_sessionSet('_backendGroupId', $data->group_id);
                 if (isset($data->group_id) && $data->group_id == 1) {
                     $this->_sessionSet('_backendPermission', 'backendstrator');
                 }
                 $data->last_login_ip = XUtils::getClientIP();
                 $data->last_login_time = time();
                 $data->login_count = $data->login_count + 1;
                 $data->save();
                 parent::_sessionSet('uid', $data->id);
                 parent::_sessionSet('uname', $data->username);
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '用户登录成功:' . $data->username));
                 $this->redirect(array('default/index'));
                 XUtils::message('success', '登录成功', $this->createUrl('default/index'), 2);
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
开发者ID:lp19851119,项目名称:114la,代码行数:34,代码来源:PublicController.php

示例8: actionUpload

 /**
  * 编辑器文件上传
  */
 public function actionUpload()
 {
     if (XUtils::method() == 'POST') {
         $file = XUpload::upload($_FILES['imgFile']);
         if (is_array($file)) {
             $model = new Upload();
             $model->user_id = intval($admini['userId']);
             $model->file_name = CHtml::encode($file['pathname']);
             $model->thumb_name = CHtml::encode($file['paththumbname']);
             $model->real_name = CHtml::encode($file['name']);
             $model->file_ext = $file['extension'];
             $model->file_mime = $file['type'];
             $model->file_size = $file['size'];
             $model->save_path = $file['savepath'];
             $model->hash = $file['hash'];
             $model->save_name = $file['savename'];
             $model->create_time = time();
             if ($model->save()) {
                 exit(CJSON::encode(array('error' => 0, 'url' => Yii::app()->baseUrl . '/' . $file['pathname'])));
             } else {
                 @unlink($file['pathname']);
                 @unlink($file['paththumbname']);
                 exit(CJSON::encode(array('error' => 1, 'message' => '上传错误')));
             }
         } else {
             exit(CJSON::encode(array('error' => 1, 'message' => '上传错误:' . $file)));
         }
     }
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:32,代码来源:XUserBase.php

示例9: actionExecute

 /**
  * 执行sql
  */
 public function actionExecute()
 {
     if (XUtils::method() == 'POST') {
         parent::_acl('database_query', array('response' => 'text'));
         parent::_configParams(array('action' => 'allowExecuteSql', 'val' => 'Y', 'message' => '不允许执行SQL,请在 protected/config/params.php 中配置 allowExecuteSql 为 Y', 'response' => 'text'));
         $sql = $this->_gets->getParam('command');
         $sqls = self::_sqlSplit($sql);
         foreach ($sqls as $execute) {
             self::_execute($execute);
         }
     }
 }
开发者ID:zywh,项目名称:maplecity,代码行数:15,代码来源:DatabaseController.php

示例10: actionIndex

 /**
  * 外借资产查询
  *
  * @author 张钰 徐晨阳
  * 该模块主要负责对申请资产进行显示,删除
  */
 public function actionIndex()
 {
     // 分页取数据
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     if (XUtils::method() == 'POST') {
         // 查询按钮
         if (isset($_POST['subQuery'])) {
             // 判断是否获取content中的内容,内容为空是显示全部申请
             if (isset($_POST['queryType']) && isset($_POST['content']) && $_POST['content'] != null) {
                 $queryType = $_POST['queryType'];
                 if ($queryType == 'ByApplyId') {
                     $criteria->addCondition('applyId=:applyId');
                     // 查询条件,即where id = 1
                     $criteria->params[':applyId'] = $_POST['content'];
                 } else {
                     if ($queryType == 'ByStuId') {
                         $criteria->addCondition('stuId=:stuId');
                         // 查询条件,即where id = 1
                         $criteria->params[':stuId'] = $_POST['content'];
                     } else {
                         if ($queryType == 'ByAssetName') {
                             $criteria->addCondition('assetName=:assetName');
                             // 查询条件,即where id = 1
                             $criteria->params[':assetName'] = $_POST['content'];
                         } else {
                             echo "ERROR";
                         }
                     }
                 }
             }
         }
     }
     //分页获取
     $count = AsApply::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = PAGESIZE;
     $pages->applyLimit($criteria);
     //echo var_dump($pages);
     $data = AsApply::model()->findAll($criteria);
     $data = json_decode(CJSON::encode($data), TRUE);
     is_array($data) ? null : ($data = array());
     // 防止空数组
     $this->render('index', array('data' => $data, 'pages' => $pages));
     // $this->render ( 'index' );
 }
开发者ID:jiahongwei,项目名称:newland-project,代码行数:52,代码来源:AssetApplyController.php

示例11: actionUpdate

 public function actionUpdate($stuId)
 {
     if (XUtils::method() == 'POST') {
         $student = new StStudent();
         $student->stuId = $stuId;
         $student->stuName = $_POST['stuName'];
         $student->profession = $_POST['profession'];
         $student->grade = $_POST['grade'];
         $student->phone = $_POST['phone'];
         $student->classId = $_POST['classId'];
         $count = AsAsset::model()->updateByPk($stuId, array('stuName' => $student->stuName, 'profession' => $student->profession, 'grade' => $student->grade, 'phone' => $student->phone, 'classId' => $student->classId));
         if ($count > 0) {
             echo "<script language=\"JavaScript\">alert(\"更新成功\");</script>";
         } else {
             echo "<script language=\"JavaScript\">alert(\"更新失败\");</script>";
         }
     }
     $data = StStudent::model()->findByPk($stuId);
     $data = json_decode(CJSON::encode($data), TRUE);
     is_array($data) ? null : ($data = array());
     // 防止空数组
     $this->render('update', array('data' => $data));
 }
开发者ID:jiahongwei,项目名称:newland-project,代码行数:23,代码来源:StudentManageController.php

示例12: actionCache

 function actionCache()
 {
     $dataList = array('pageCache' => '页面缓存', 'dataCache' => '数据缓存', 'allCache' => '全部缓存');
     //        ppr($dataList);
     $notice = '选择缓存类型';
     if (XUtils::method() == 'POST') {
         $cacheType = reqPost('cacheType', NULL);
         $path = SITE_BACKEND_PATH . 'assets';
         switch ($cacheType) {
             case 'pageCache':
                 XUtils::delDirAndFile($path);
                 break;
             case 'dataCache':
                 cacheFlush();
                 break;
             case 'allCache':
                 cacheFlush();
                 XUtils::delDirAndFile($path);
                 break;
         }
         $notice .= '<br />清空完成!';
     }
     $this->render('cache', array('dataList' => $dataList, 'notice' => $notice));
 }
开发者ID:lp19851119,项目名称:114la,代码行数:24,代码来源:ConfigController.php

示例13: actionCustom

 /**
  * 自定义字段
  */
 public function actionCustom()
 {
     parent::_acl();
     if (XUtils::method() == 'POST') {
         foreach ((array) $_POST['attr'] as $key => $row) {
             $val = is_array($row['val']) ? implode(',', $row['val']) : $row['val'];
             $var = $row["name"];
             $config = Config::model()->find('scope=:scope AND variable=:variable', array('scope' => 'custom', 'variable' => $var));
             if ($config) {
                 Config::model()->updateAll(array('value' => $val), 'scope=:scope AND variable=:variable', array('scope' => 'custom', 'variable' => $var));
             } else {
                 $config = new Config();
                 $config->scope = 'custom';
                 $config->variable = $var;
                 $config->value = $val;
                 $config->save();
             }
         }
         XXcache::refresh('_config', 3600);
         AdminLogger::_create(array('catalog' => 'update', 'intro' => '更新系统配置,模块:' . $this->action->id));
         XUtils::message('success', '更新完成', $this->createUrl($this->action->id));
     }
     $attrModel = Attr::lists(0, 'config');
     $this->render('custom', array('attrData' => self::loadData(), 'attrModel' => $attrModel));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:28,代码来源:ConfigController.php

示例14: actionIndex

 public function actionIndex()
 {
     if (XUtils::method() == 'POST') {
         if (isset($_POST['analyseType'])) {
             // echo  var_dump( $_POST ['analyseType']);
             // echo var_dump($_SESSION["name"].".......");
             HDraw::deletePic();
             //删除历史图片
             $analyseType = $_POST['analyseType'];
             if ($analyseType == "1") {
                 $sql = "SELECT assetName,COUNT(*) as c1 from as_analyse WHERE borrowTime>='" . $_POST['inTime'] . "' AND borrowTime<='" . $_POST['outTime'] . "' GROUP BY assetName ORDER BY COUNT(*) DESC LIMIT 0,10";
                 $data = Yii::app()->db->createCommand($sql)->queryAll();
                 $data = json_decode(CJSON::encode($data), TRUE);
                 $data_x = array();
                 $data_y = array();
                 foreach ($data as $key => $value) {
                     $data_x[] = $value['assetName'];
                     $data_y[] = $value['c1'];
                 }
                 // echo var_dump($data);
                 $x_title = x_name;
                 // $y_title = "                            数次出借";
                 $graph_title = "借出次数排序图前十(单位:次)";
                 // echo var_dump($data_x);
                 // echo var_dump($data_y);
                 // echo var_dump(empty($data_x));
                 if (empty($data_x)) {
                     // 数据库表类的函数save(),存储是否成功,来自yii框架
                     echo "<script language=\"JavaScript\">alert(\"该段时间没有记录!\");</script>";
                 } else {
                     $max_y = max($data_y);
                     $name = HDraw::HistogramShow($data_x, $data_y, $x_title, $y_title, $graph_title, $max_y);
                 }
             } elseif ($analyseType == "2") {
                 $sql = "SELECT assetName,COUNT(*) as c1 from as_analyse WHERE borrowTime>='" . $_POST['inTime'] . "' AND borrowTime<='" . $_POST['outTime'] . "' GROUP BY assetName ORDER BY COUNT(*) ASC LIMIT 10";
                 $data = Yii::app()->db->createCommand($sql)->queryAll();
                 $data = json_decode(CJSON::encode($data), TRUE);
                 $data_x = array();
                 $data_y = array();
                 foreach ($data as $key => $value) {
                     $data_x[] = $value['assetName'];
                     $data_y[] = $value['c1'];
                 }
                 // echo var_dump($data);
                 $x_title = x_name;
                 // $y_title = "                            数次出借";
                 $graph_title = "借出次数排序图后十(单位:次)";
                 // echo var_dump($data_x);
                 // echo var_dump($data_y);
                 // echo var_dump(empty($data_x));
                 if (empty($data_x)) {
                     // 数据库表类的函数save(),存储是否成功,来自yii框架
                     echo "<script language=\"JavaScript\">alert(\"该段时间没有记录!\");</script>";
                 } else {
                     $max_y = max($data_y);
                     $name = HDraw::HistogramShow($data_x, $data_y, $x_title, $y_title, $graph_title, $max_y);
                 }
             } elseif ($analyseType == "3") {
                 $sql = "SELECT assetName,COUNT(*) as c1 from as_asset WHERE assetName in(SELECT assetName from as_analyse) GROUP BY assetName";
                 $sql_ast = "SELECT assetName,borrowTime,returnTime from as_analyse WHERE borrowTime>='" . $_POST['inTime'] . "' AND borrowTime<='" . $_POST['outTime'] . "'";
                 $data1 = Yii::app()->db->createCommand($sql_ast)->queryAll();
                 $data1 = json_decode(CJSON::encode($data1), TRUE);
                 // echo var_dump($data1);
                 $data_x = array();
                 $data_y = array();
                 $data_name = array();
                 $data_num = array();
                 $date_each = array();
                 $date_sum = array();
                 if (empty($data1)) {
                     // 数据库表类的函数save(),存储是否成功,来自yii框架
                     echo "<script language=\"JavaScript\">alert(\"该段时间没有记录!\");</script>";
                 } else {
                     foreach ($data1 as $key => $value) {
                         $data_name[] = $value['assetName'];
                         if ($value['returnTime'] < $_POST['outTime']) {
                             $date_each[] = (strtotime($value['returnTime']) - strtotime($value['borrowTime'])) / time + 1;
                         } else {
                             $date_each[] = (strtotime($_POST['outTime']) - strtotime($value['borrowTime'])) / time + 1;
                         }
                     }
                     // echo var_dump($data_name);
                     // echo var_dump($date_each);
                     $date = strtotime($_POST['outTime']) - strtotime($_POST['inTime']);
                     $date = $date / time;
                     // echo var_dump($date);
                     $flog = 0;
                     $data2 = Yii::app()->db->createCommand($sql)->queryAll();
                     $data2 = json_decode(CJSON::encode($data2), TRUE);
                     // echo var_dump($data2);
                     foreach ($data2 as $key => $value) {
                         if (in_array($value['assetName'], $data_name)) {
                             $data_x[] = $value['assetName'];
                             $data_num[] = $value['c1'];
                             foreach ($data1 as $key1 => $value1) {
                                 // echo var_dump($date_each[$key]);
                                 if ($value1['assetName'] == $data_x[$flog]) {
                                     // echo var_dump($key1);
                                     // echo var_dump($flog);
                                     $date_sum[$flog] += $date_each[$key1];
//.........这里部分代码省略.........
开发者ID:jiahongwei,项目名称:newland-project,代码行数:101,代码来源:AssetStatisticController.php

示例15: actionBatch

 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } else {
         if (XUtils::method() == 'POST') {
             $command = trim($_POST['command']);
             $ids = $_POST['id'];
             is_array($ids) && ($ids = implode(',', $ids));
         } else {
             XUtils::message('errorBack', '只支持POST,GET数据');
         }
     }
     switch ($command) {
         case 'delete':
             parent::_acl('catalog_delete');
             empty($ids) && XUtils::message('error', '未选择记录');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除全局分类,ID:' . $ids));
             parent::_delete(new Catalog(), $ids, array('index'));
             break;
         case 'sortOrder':
             parent::_acl('catalog_sort_order');
             $sortOrder = $this->_gets->getParam('sortOrder');
             foreach ((array) $sortOrder as $id => $val) {
                 $catalogModel = Catalog::model()->findByPk($id);
                 if ($catalogModel) {
                     $catalogModel->sort_order = $val;
                     $catalogModel->save();
                 }
             }
             $this->redirect(array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
开发者ID:zywh,项目名称:maplecity,代码行数:42,代码来源:CatalogController.php


注:本文中的XUtils::method方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。