本文整理汇总了PHP中Util::showMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::showMessage方法的具体用法?PHP Util::showMessage怎么用?PHP Util::showMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util::showMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* @brief 商家登录动作
*/
public function login()
{
$seller_name = IFilter::act(IReq::get('username'));
$password = IReq::get('password');
$message = '';
if ($seller_name == '') {
$message = '登录名不能为空';
} else {
if ($password == '') {
$message = '密码不能为空';
} else {
$sellerObj = new IModel('seller');
$sellerRow = $sellerObj->getObj('seller_name = "' . $seller_name . '" and is_del = 0 and is_lock = 0');
if ($sellerRow && $sellerRow['password'] == md5($password)) {
$dataArray = array('login_time' => ITime::getDateTime());
$sellerObj->setData($dataArray);
$where = 'id = ' . $sellerRow["id"];
$sellerObj->update($where);
//存入私密数据
ISafe::set('seller_id', $sellerRow['id']);
ISafe::set('seller_name', $sellerRow['seller_name']);
ISafe::set('seller_pwd', $sellerRow['password']);
$this->redirect('/seller/index');
} else {
$message = '用户名与密码不匹配';
}
}
}
if ($message != '') {
$this->redirect('index', false);
Util::showMessage($message);
}
}
示例2: uploadFile
function uploadFile()
{
//上传状态
$state = false;
//规格索引值
$specIndex = IReq::get('specIndex');
if ($specIndex === null) {
$message = '没有找到规格索引值';
} else {
//本地上传方式
if (isset($_FILES['attach']) && $_FILES['attach']['name'][0] != '') {
$photoInfo = $this->upload();
if ($photoInfo['flag'] == 1) {
$fileName = $photoInfo['dir'] . $photoInfo['name'];
$state = true;
}
} else {
if ($fileName = IReq::get('outerSrc', 'post')) {
$state = true;
} else {
if ($fileName = IReq::get('selectPhoto', 'post')) {
$state = true;
}
}
}
}
//根据状态值进行
if ($state == true) {
$this->actJs($specIndex, $fileName);
} else {
$message = '添加图片失败';
$this->redirect('/block/pic', false);
Util::showMessage($message);
}
}
示例3: login_act
function login_act()
{
$admin_name = IFilter::act(IReq::get('admin_name'));
$password = IReq::get('password');
$captcha = IReq::get('captcha', 'post');
$message = '';
if ($admin_name == '') {
$message = '登录名不能为空';
} else {
if ($password == '') {
$message = '密码不能为空';
} else {
if ($captcha != ISafe::get('Captcha')) {
$message = '验证码输入不正确';
} else {
$adminObj = new IModel('admin');
$adminRow = $adminObj->getObj('admin_name = "' . $admin_name . '"');
if (!empty($adminRow) && $adminRow['password'] == md5($password) && $adminRow['is_del'] == 0) {
$dataArray = array('last_ip' => IClient::getIp(), 'last_time' => ITime::getDateTime());
$adminObj->setData($dataArray);
$where = 'id = ' . $adminRow["id"];
$adminObj->update($where);
//根据角色分配权限
if ($adminRow['role_id'] == 0) {
ISafe::set('admin_right', 'administrator');
ISafe::set('admin_role_name', '超级管理员');
} else {
$roleObj = new IModel('admin_role');
$where = 'id = ' . $adminRow["role_id"] . ' and is_del = 0';
$roleRow = $roleObj->getObj($where);
ISafe::set('admin_right', $roleRow['rights']);
ISafe::set('admin_role_name', $roleRow['name']);
}
ISafe::set('admin_id', $adminRow['id']);
ISafe::set('admin_name', $adminRow['admin_name']);
ISafe::set('admin_pwd', $adminRow['password']);
$this->redirect('/system/default');
} else {
$message = '用户名与密码不匹配';
}
}
}
}
if ($message != '') {
$this->admin_name = $admin_name;
$this->redirect('index', false);
Util::showMessage($message);
}
}
示例4: registry_del
function registry_del()
{
$ids = IFilter::act(IReq::get('id'), 'int');
if (empty($ids)) {
$this->redirect('registry_list', false);
Util::showMessage('请选择要删除的邮箱');
exit;
}
if (is_array($ids)) {
$ids = join(',', $ids);
}
$registryObj = new IModel('email_registry');
$registryObj->del('id in (' . $ids . ')');
$this->redirect('registry_list');
}
示例5: trade_ticket
function trade_ticket()
{
$ticketId = IFilter::act(IReq::get('ticket_id', 'post'), 'int');
$message = '';
if (intval($ticketId) == 0) {
$message = '请选择要兑换的代金券';
} else {
$nowTime = ITime::getDateTime();
$ticketObj = new IModel('ticket');
$ticketRow = $ticketObj->getObj('id = ' . $ticketId . ' and point > 0 and start_time <= "' . $nowTime . '" and end_time > "' . $nowTime . '"');
if (empty($ticketRow)) {
$message = '对不起,此代金券不能兑换';
} else {
$memberObj = new IModel('member');
$where = 'user_id = ' . $this->user['user_id'];
$memberRow = $memberObj->getObj($where, 'point');
if ($ticketRow['point'] > $memberRow['point']) {
$message = '对不起,您的积分不足,不能兑换此类代金券';
} else {
//生成红包
$dataArray = array('condition' => $ticketRow['id'], 'name' => $ticketRow['name'], 'card_name' => 'T' . IHash::random(8), 'card_pwd' => IHash::random(8), 'value' => $ticketRow['value'], 'start_time' => $ticketRow['start_time'], 'end_time' => $ticketRow['end_time'], 'is_send' => 1);
$propObj = new IModel('prop');
$propObj->setData($dataArray);
$insert_id = $propObj->add();
//用户prop字段值null时
$memberArray = array('prop' => ',' . $insert_id . ',');
$memberObj->setData($memberArray);
$result = $memberObj->update('user_id = ' . $this->user["user_id"] . ' and ( prop is NULL or prop = "" )');
//用户prop字段值非null时
if (!$result) {
$memberArray = array('prop' => 'concat(prop,"' . $insert_id . ',")');
$memberObj->setData($memberArray);
$result = $memberObj->update('user_id = ' . $this->user["user_id"], 'prop');
}
//代金券成功
if ($result) {
$pointConfig = array('user_id' => $this->user['user_id'], 'point' => '-' . $ticketRow['point'], 'log' => '积分兑换代金券,扣除了 -' . $ticketRow['point'] . '积分');
$pointObj = new Point();
$pointObj->update($pointConfig);
}
}
}
}
//展示
if ($message != '') {
$this->integral();
Util::showMessage($message);
} else {
$this->redirect('redpacket');
}
}
示例6: refer_edit
/**
* @brief 显示咨询信息
*/
function refer_edit()
{
$rid = intval(IReq::get('rid'));
if (!$rid) {
$this->refer_list();
$msg = '没有找到相关记录!';
Util::showMessage($msg);
return false;
}
$tb_refer = new IModel('refer');
$items = $tb_refer->query("id=" . $rid);
if (is_array($items) && ($item = $items[0])) {
if ($item['goods_id']) {
$tb_goods = new IModel('goods');
$data_goods = $tb_goods->query("id=" . $item['goods_id']);
if ($data_goods && is_array($data_goods) && ($info = $data_goods[0])) {
$item['goods_name'] = $info['name'];
}
}
if ($item['user_id']) {
$tb_user = new IModel('user');
$data_user = $tb_user->query("id=" . $item['user_id']);
if ($data_user && is_array($data_user) && ($info = $data_user[0])) {
$item['user_name'] = $info['username'];
}
}
if ($item['admin_id']) {
$tb_admin = new IModel('admin');
$data_admin = $tb_admin->query("id=" . $item['admin_id']);
if ($data_admin && is_array($data_admin) && ($info = $data_admin[0])) {
$item['admin_name'] = $info['admin_name'];
}
}
$this->refer = $item;
$this->redirect('refer_edit');
} else {
$this->refer_list();
$msg = '没有找到相关记录!';
Util::showMessage($msg);
return false;
}
}
示例7: discussion_edit
/**
* @brief 显示讨论信息
*/
function discussion_edit()
{
$did = intval(IReq::get('did'));
if (!$did) {
$this->discussion_list();
return false;
}
$query = new IQuery("discussion as d");
$query->join = "right join goods as goods on d.goods_id = goods.id left join user as u on d.user_id = u.id";
$query->fields = "d.id,d.time,d.contents,u.id as userid,u.username,goods.id as goods_id,goods.name as goods_name";
$query->where = "d.id=" . $did;
$items = $query->find();
if ($items) {
$this->discussion = $items[0];
$this->redirect('discussion_edit');
} else {
$this->discussion_list();
$msg = '没有找到相关记录!';
Util::showMessage($msg);
}
}
示例8: comment_edit
/**
* @brief 显示评论信息
*/
function comment_edit()
{
$cid = IFilter::act(IReq::get('cid'), 'int');
if (!$cid) {
$this->comment_list();
return false;
}
$query = new IQuery("comment as c");
$query->join = "left join goods as goods on c.goods_id = goods.id left join user as u on c.user_id = u.id";
$query->fields = "c.*,u.username,goods.name,goods.seller_id";
$query->where = "c.id=" . $cid . " and goods.seller_id = " . $this->seller['seller_id'];
$items = $query->find();
if ($items) {
$this->comment = current($items);
$this->redirect('comment_edit');
} else {
$this->comment_list();
$msg = '没有找到相关记录!';
Util::showMessage($msg);
}
}
示例9: group_save
/**
* @brief 保存用户组修改
*/
function group_save()
{
$maxexp = IReq::get('maxexp');
$minexp = IReq::get('minexp');
if ($maxexp <= $minexp) {
$errorMsg = '最大经验值必须大于最小经验值';
}
$group_id = (int) IReq::get('group_id', 'post');
$form_array = array('user_group' => array(array('name' => 'group_name', 'field' => 'group_name', 'rules' => 'required'), array('name' => 'discount', 'field' => 'discount'), array('name' => 'minexp', 'field' => 'minexp'), array('name' => 'maxexp', 'field' => 'maxexp')));
//验证表单
$validationObj = new Formvalidation($form_array);
$form_data = $validationObj->run();
foreach ($form_data as $key => $value) {
foreach ($value as $v) {
$group[$v['name']] = $v['postdate'];
$tb_model[$v['field']] = $v['postdate'];
}
}
if ($validationObj->isError() || isset($errorMsg)) {
//验证失败
$this->data['group'] = $group;
$this->setRenderData($this->data);
//加载视图
$this->redirect('group_edit', false);
$errorMsg = isset($errorMsg) ? $errorMsg : $validationObj->getError();
Util::showMessage($errorMsg);
} else {
//验证成功
$tb_user_group = new IModel("user_group");
$tb_user_group->setData($tb_model);
if ($group_id) {
$affected_rows = $tb_user_group->update("id=" . $group_id);
if ($affected_rows) {
$this->redirect('group_list', false);
Util::showMessage('更新用户组成功!');
return;
}
$this->redirect('group_list', false);
} else {
$gid = $tb_user_group->add();
$this->redirect('group_list', false);
if ($gid) {
Util::showMessage('添加用户组成功!');
} else {
Util::showMessage('添加用户组失败!');
}
}
}
}
示例10: brand_del
/**
* @brief 删除品牌
*/
function brand_del()
{
$brand_id = (int) IReq::get('bid');
if ($brand_id) {
$tb_brand = new IModel('brand');
$where = "id=" . $brand_id;
if ($tb_brand->del($where)) {
$this->brand_list();
} else {
$this->brand_list();
$msg = "没有找到相关分类记录!";
Util::showMessage($msg);
}
} else {
$this->brand_list();
$msg = "没有找到相关品牌记录!";
Util::showMessage($msg);
}
}
示例11: oauth_edit_act
public function oauth_edit_act()
{
$id = IFilter::act(IReq::get('id'));
if ($id == 0) {
$this->redirect('oauth_list', false);
Util::showMessage('请选择要修改的登录平台');
exit;
}
$oauthDBObj = new IModel('oauth');
$oauthRow = $oauthDBObj->getObj('id = ' . $id);
if (empty($oauthRow)) {
$this->redirect('oauth_list', false);
Util::showMessage('请选择要修改的登录平台');
exit;
}
$dataArray = array('name' => IFilter::act(IReq::get('name')), 'is_close' => IFilter::act(IReq::get('is_close')), 'description' => IFilter::act(IReq::get('description')), 'config' => array());
//获取字段数据
$oauthObj = new Oauth($id);
$oauthFields = $oauthObj->getFields();
if (!empty($oauthFields)) {
$parmsArray = array_keys($oauthFields);
foreach ($parmsArray as $val) {
$dataArray['config'][$val] = IFilter::act(IReq::get($val));
}
}
$dataArray['config'] = serialize($dataArray['config']);
$oauthDBObj->setData($dataArray);
$oauthDBObj->update('id = ' . $id);
$this->redirect('oauth_list');
}
示例12: admin_repwd_act
/**
*修改管理员密码
*/
function admin_repwd_act()
{
//提取密码 [ 密码设置 ]
$password = IReq::get('password', 'post');
$repassword = IReq::get('repassword', 'post');
if ($password && $password === $repassword) {
$passwordMd5 = md5($password);
$adminObj = new IModel('admin');
$adminObj->setData(array('password' => $passwordMd5));
$adminObj->update('id = ' . $this->admin['admin_id']);
//同步更新safe
ISafe::set('admin_pwd', $passwordMd5);
$this->redirect('default');
} else {
$message = '密码不能为空,并且二次输入的必须一致';
$this->redirect('admin_repwd', false);
Util::showMessage($message);
}
}
示例13: reg_act
function reg_act()
{
$email = IFilter::act(IReq::get('email', 'post'));
$username = IFilter::act(IReq::get('username', 'post'));
$password = IFilter::act(IReq::get('password', 'post'));
$repassword = IFilter::act(IReq::get('repassword', 'post'));
$captcha = IReq::get('captcha', 'post');
$message = '';
/*注册信息校验*/
if (IValidate::email($email) == false) {
$message = '邮箱格式不正确';
} else {
if (!Util::is_username($username)) {
$message = '用户名必须是由2-20个字符,可以为字数,数字下划线和中文';
} else {
if (!preg_match('|\\S{6,32}|', $password)) {
$message = '密码必须是字母,数字,下划线组成的6-32个字符';
} else {
if ($password != $repassword) {
$message = '2次密码输入不一致';
} else {
if ($captcha != ISafe::get('Captcha')) {
$message = '验证码输入不正确';
} else {
$userObj = new IModel('user');
$where = 'email = "' . $email . '" or username = "' . $email . '" or username = "' . $username . '"';
$userRow = $userObj->getObj($where);
if (!empty($userRow)) {
if ($email == $userRow['email']) {
$message = '此邮箱已经被注册过,请重新更换';
} else {
$message = "此用户名已经被注册过,请重新更换";
}
}
}
}
}
}
}
//校验通过
if ($message == '') {
//user表
$userArray = array('username' => $username, 'password' => md5($password), 'email' => $email);
$userObj->setData($userArray);
$user_id = $userObj->add();
if ($user_id) {
//member表
$memberArray = array('user_id' => $user_id, 'time' => ITime::getDateTime());
$memberObj = new IModel('member');
$memberObj->setData($memberArray);
$memberObj->add();
//用户私密数据
ISafe::set('username', $username);
ISafe::set('user_id', $user_id);
ISafe::set('user_pwd', $userArray['password']);
//自定义跳转页面
$callback = IReq::get('callback') ? urlencode(IReq::get('callback')) : '';
$this->redirect('/simple/success_info?callback=' . $callback);
} else {
$message = '注册失败';
}
}
//出错信息展示
if ($message != '') {
$this->email = $email;
$this->username = $username;
$this->redirect('reg', false);
Util::showMessage($message);
}
}
示例14: deposit_cart_clear
function deposit_cart_clear()
{
//必须为登录用户
if ($this->user['user_id'] == null) {
$this->redirect('/simple/login?callback=/simple/cart');
}
$goodsCarObj = new IModel('goods_car');
$goodsCarObj->del('user_id = ' . $this->user['user_id']);
$this->cart();
Util::showMessage('操作成功');
}
示例15: favorite_del
function favorite_del()
{
$user_id = $this->user['user_id'];
$id = IReq::get('id');
if (!empty($id)) {
$id = Util::intval_value($id);
$favoriteObj = new IModel('favorite');
if (is_array($id)) {
$idStr = join(',', $id);
$where = 'user_id = ' . $user_id . ' and id in (' . $idStr . ')';
} else {
$where = 'user_id = ' . $user_id . ' and id = ' . $id;
}
$favoriteObj->del($where);
$this->redirect('favorite');
} else {
$this->redirect('favorite', false);
Util::showMessage('请选择要删除的数据');
}
}