本文整理汇总了PHP中XUtils::message方法的典型用法代码示例。如果您正苦于以下问题:PHP XUtils::message方法的具体用法?PHP XUtils::message怎么用?PHP XUtils::message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XUtils
的用法示例。
在下文中一共展示了XUtils::message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: actionOwnerUpdate
public function actionOwnerUpdate()
{
try {
$model = parent::_dataLoad(new StAdmin(), $this->_admini['userId']);
//首先从session中获取登录是的id号(yii框架自带)
$data = StAdmin::model()->findByPk($this->_admini['userId']);
//查询该用户并对该用户的密码进行更新
if (XUtils::method() == 'POST') {
$id = $data['id'];
$name = $data['name'];
$password = $_POST['password'];
$count = StAdmin::model()->updateByPk($id, array('name' => $name, 'password' => $password));
if ($count > 0) {
AdminLogger::_create(array('catalog' => 'update', 'intro' => '修改密码:' . CHtml::encode($data['name'])));
//日志
XUtils::message('success', '修改完成', $this->createUrl('adminLogin/index'));
} else {
XUtils::message('fail', '修改失败', $this->createUrl('adminLogin/ownerUpdate'));
}
}
$this->render('ownerUpdate', array('data' => $data));
} catch (Exception $e) {
echo var_dump($e);
}
}
示例3: 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));
}
示例4: 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;
}
}
示例5: _update
/**
* 更新基类
*
* @param $model 模块
* @param $field 字段
* @param $redirect 跳转
* @param $tpl 模板
* @param $pkField 主键id
*/
protected function _update($model, $redirect = 'index', $tpl = '', $id = 0, $pkField = 'id', $field = '')
{
$modelName = !$field ? get_class($model) : $field;
$data = $model->findByPk($id);
$data === null && XUtils::message('error', '记录不存在');
if (isset($_POST[$modelName])) {
$data->attributes = $_POST[$modelName];
if ($data->save()) {
self::_adminiLogger(array('catalog' => 'update', 'intro' => '调用基类更新数据,来自模块:' . $this->id . ',方法:' . $this->action->id));
//日志
$this->redirect($redirect);
}
}
$this->render($tpl, array('model' => $data));
}
示例6: _updateData
/**
* 更新数据表数据
*/
private function _updateData($data)
{
if (XUtils::method() == 'POST') {
if (!empty($_FILES['site_logo']['name'])) {
$this->_getLogo('site_logo', SITE_PATH . 'static/', $data['site_logo']);
} else {
unset($data['site_logo']);
}
foreach ((array) $data as $key => $row) {
$row = XUtils::addslashes($row);
Yii::app()->db->createCommand("REPLACE INTO {{config}}(`variable`, `value`) VALUES('{$key}', '{$row}') ")->execute();
}
XXcache::refresh('_config', 3600);
parent::_backendLogger(array('catalog' => 'update', 'intro' => '更新系统配置,模块:' . $this->action->id));
XUtils::message('success', '更新完成', $this->createUrl($this->action->id));
}
}
示例7: 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;
}
}
示例8: loadData
/**
* 根据cacheId取数据
*
*/
public static function loadData($cacheId, $time = 3600)
{
$config = self::get($cacheId);
if (empty($config)) {
//无则刷新
self::refresh($cacheId, $time);
$config = self::get($cacheId);
//刷新后无则报错
if (empty($config)) {
XUtils::message('error', 'no cacheId : ' . $cacheId);
}
}
return $config;
}
示例9: 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('house_delete');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除房源,ID:' . $ids));
parent::_delete(new House(), $ids, array('index'));
break;
case 'commend':
parent::_acl('house_recommend');
AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量推荐房源,ID:' . $ids));
parent::_recommend(new House(), 'recommend', $ids, array('index'));
break;
case 'unCommend':
parent::_acl('house_recommend');
AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量取消房源推荐,ID:' . $ids));
parent::_recommend(new House(), 'unRecommend', $ids, array('index'));
break;
default:
throw new CHttpException(404, '错误的操作类型:' . $command);
break;
}
}
示例10: 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数据');
}
}
empty($ids) && XUtils::message('error', '未选择记录');
switch ($command) {
case 'linkDelete':
parent::_acl('link_delete');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除链接,ID:' . $ids));
parent::_delete(new Link(), $ids, array('link'), array('attach_file'));
break;
case 'adDelete':
parent::_acl('ad_delete');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除广告,ID:' . $ids));
parent::_delete(new Ad(), $ids, array('ad'), array('attach_file'));
break;
case 'linkVerify':
parent::_acl('link_verify');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '链接状态变更为显示,ID:' . $ids));
parent::_verify(new Link(), 'verify', $ids, array('link'));
break;
case 'linkUnVerify':
parent::_acl('link_verify');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '链接状态变更为隐藏,ID:' . $ids));
parent::_verify(new Link(), 'unVerify', $ids, array('link'));
break;
case 'adVerify':
parent::_acl('ad_verify');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '广告状态变更为显示,ID:' . $ids));
parent::_verify(new Ad(), 'verify', $ids, array('ad'));
break;
case 'adUnVerify':
parent::_acl('ad_verify');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '广告状态变更为隐藏,ID:' . $ids));
parent::_verify(new Ad(), 'unVerify', $ids, array('ad'));
break;
default:
throw new CHttpException(404, '错误的操作类型:' . $command);
break;
}
}
示例11: actionTbAll
public function actionTbAll()
{
$make = reqPost('make');
$re = $crondArr = array();
$crond_json_file = SITE_BACKEND_PATH . 'protected/data/crond/crond.json';
if (!empty($make) && is_array($make)) {
if (!empty($make['crond'])) {
//这里生成crond地址
$check = reqPost('check');
$check['old'] = reqPost('old');
file_put_contents($crond_json_file, json_encode($check));
XUtils::message('success', '操作完成', $this->createUrl('links/tbAll'));
} else {
$type = array_keys($make);
// ppr($type[0],1);
switch ($type[0]) {
case 'header':
$min = 1000;
$max = 1999;
break;
case 'left':
$min = 2000;
$max = 2999;
break;
case 'main':
$min = 3000;
$max = 3999;
break;
case 'shop':
$min = 4000;
$max = 4999;
break;
case 'fun':
$min = 5000;
$max = 5999;
break;
case 'tools':
$min = 6000;
$max = 6999;
break;
case 'games':
$min = 7000;
$max = 7999;
break;
}
if (!empty($max) && !empty($min)) {
$catalog_arr = Catalog::model()->findAll(array('select' => 'id,tb_id', 'condition' => "t.tb_id>:min AND t.tb_id<:max", 'params' => array(':min' => $min, ':max' => $max)));
}
if (!empty($catalog_arr)) {
foreach ($catalog_arr as $info) {
$re[$info->id] = $this->doTb($info->tb_id, $info->id);
}
}
}
// XUtils::message('success', '操作完成', $this->createUrl('links/tbAll'));
// $this->redirect(array('links/tbAll'));
}
if (is_file($crond_json_file)) {
$arr = json_decode(file_get_contents($crond_json_file), TRUE);
if (empty($arr['old'])) {
unset($arr['old']);
}
$crondArr = array_keys($arr);
// ppr($arr);
}
$this->render('tb_all', array('catalog' => $re, 'crondArr' => $crondArr));
}
示例12: 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 = $this->_gets->getPost('id');
is_array($ids) && ($ids = implode(',', $ids));
} else {
XUtils::message('errorBack', '只支持POST,GET数据');
}
empty($ids) && XUtils::message('error', '未选择记录');
switch ($command) {
case 'adminDelete':
parent::_acl('admin_delete');
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除管理员,ID:' . $ids));
parent::_delete(new Admin(), $ids, array('index'));
break;
case 'groupDelete':
parent::_acl('admin_group_delete');
parent::_groupPrivate($ids);
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除管理员用户组,ID:' . $ids));
parent::_delete(new AdminGroup(), $ids, array('group'));
break;
default:
throw new CHttpException(404, '错误的操作类型:' . $command);
break;
}
}
示例13: groupEdite
private function groupEdite($data = null)
{
if (XUtils::method() == 'POST') {
if (!empty($_POST['gname']) && !empty($_POST['auth'])) {
$gid = reqPost('gid', null);
$auth = '|' . implode('|', array_keys($_POST['auth'])) . '|';
$sis = !empty($_POST['sis']) && $_POST['sis'] == 'Y' ? 'Y' : 'N';
$attr = array('group_name' => $_POST['gname'], 'acl' => $auth, 'status_is' => $_POST['sis']);
if (!empty($gid)) {
$attr['id'] = $gid;
} else {
$attr['create_time'] = time();
}
empty($data) && ($data = new AdminGroup());
$data->attributes = $attr;
// ppr($data);
// ppr($attr);
// ppr($_POST,1);
if ($data->save()) {
//更新权限缓存
!empty($gid) && cacheDelete('_backendAcl' . $gid, '');
parent::_backendLogger(array('catalog' => 'create', 'intro' => '编辑管理员组及权限' . $data->group_name));
XXcache::refresh('_adminGroup');
$this->redirect(array('group'));
}
} else {
$gid = reqPostNum('gid');
if ($gid > 0) {
XUtils::message('error', '发生错误,请正确填写各项', $this->createUrl('admin/groupCreate', array('id' => $gid)));
} else {
XUtils::message('error', '发生错误,请正确填写各项', $this->createUrl('admin/group'));
}
}
}
}
示例14: actionOperate
/**
* 批处理
*/
public function actionOperate()
{
$command = trim($this->_gets->getParam('command'));
switch ($command) {
case 'deleteFile':
parent::_acl('database_delete');
$filenames = $this->_gets->getParam('sqlfile');
if ($filenames) {
if (is_array($filenames)) {
foreach ($filenames as $filename) {
if (CFileHelper::getExtension($filename) == 'sql') {
@unlink($this->_bakupPath . $filename);
}
}
XUtils::message('success', '删除完成', $this->createUrl('database/import'));
} else {
if (CFileHelper::getExtension($filenames) == 'sql') {
@unlink($this->_bakupPath . $filename);
XUtils::message('success', '删除完成', $this->createUrl('database/import'));
}
}
} else {
XUtils::message('error', '请选择要删除的文件', $this->createUrl('database/import'));
}
break;
case 'downloadFile':
parent::_acl('database_download');
$sqlfile = $this->_gets->getParam('sqlfile');
XHttp::download($this->_bakupPath . $sqlfile, '', '', 3600);
break;
default:
throw new CHttpException(404, '未找到操作');
break;
}
}
示例15: actionBatch
/**
* 批量操作
*
*/
public function actionBatch()
{
$command = trim($this->_gets->getParam('command'));
switch ($command) {
case 'deleteFile':
parent::_acl('template_delete');
$fileName = trim($this->_gets->getParam('fileName'));
empty($fileName) && XUtils::message('error', '未选择记录');
$filePath = $this->_themePath . DS . 'views' . DS . XUtils::b64decode($fileName);
@unlink($filePath);
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除模板:' . XUtils::b64decode($fileName)));
$this->redirect(array('index'));
break;
case 'deleteFolder':
parent::_acl('template_folder_delete');
$folderName = trim($this->_gets->getParam('folderName'));
empty($folderName) && XUtils::message('error', '未选择记录');
$folderPath = $this->_themePath . DS . 'views' . DS . $folderName;
if (is_dir($folderPath)) {
$fileList = XUtils::getFile($folderPath);
foreach ((array) $fileList as $row) {
@unlink($folderPath . DS . $row);
}
}
if (rmdir($folderPath)) {
AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除文件夹:' . $folderName));
XUtils::message('success', '目录 ' . $folderName . ' 删除完成', $this->createUrl('index'));
} else {
XUtils::message('errorBack', '目录删除失败,请删除此目录下所有文件再删除此目录');
}
break;
default:
throw new CHttpException(404, '错误的操作类型:' . $command);
break;
}
}