本文整理汇总了PHP中Helper::show_message方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::show_message方法的具体用法?PHP Helper::show_message怎么用?PHP Helper::show_message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper::show_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload_file
public static function upload_file($input_name, $file_path = './', $type = 'image', $allow_size = 2)
{
// 上传的文件
$file = $_FILES[$input_name];
// 错误信息
$error = '';
// 允许上传的文件类型数组
$allow_type = array('image' => array('jpg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif'));
// 检查上传文件的类型是否在允许的文件类型数组里
if (!in_array($file['type'], $allow_type[$type])) {
$error = "请上传" . implode('、', array_keys($allow_type[$type])) . "格式的文件";
Helper::show_message($error);
die;
}
// 检查上传文件的大小是否超过指定大小
$size = $allow_size * 1024 * 1024;
if ($file['size'] > $size) {
$error = "你上传的文件大小请不要超过{$allow_size}MB";
Helper::show_message($error);
die;
}
// 错误状态
switch ($file['error']) {
case 1:
$error = '你所上传的文件大小超过了服务器配置的大小';
Helper::show_message($error);
die;
case 2:
$error = '你所上传的文件大小超过了表单设置的大小';
Helper::show_message($error);
die;
case 3:
$error = '网络出现问题,请检查你的网络是否连接?';
Helper::show_message($error);
die;
case 4:
$error = '请选择你要上传的文件';
Helper::show_message($error);
die;
}
// 自动生成目录
if (!file_exists($file_path)) {
mkdir($file_path, 0777, true);
}
if ($error) {
return array('error' => 1, 'warning' => $error);
}
// 生成保存到服务器的文件名
$filename = date('YmdHis') . mt_rand(1000, 9999) . "." . array_search($file['type'], $allow_type[$type]);
// 保存上传文件到本地目录
if (move_uploaded_file($file['tmp_name'], $file_path . "/" . $filename)) {
return array('error' => 0, 'filename' => $filename);
}
}
示例2: actionActivity_category_edit
/**
* 编辑活动分类*
*/
public function actionActivity_category_edit()
{
$this->setauth();
// 检查有无权限
$p_db = Yii::app()->p_db;
$id = $_GET['id'];
$activity_category = VcosActivityCategory::model()->findByPk($id);
if ($_POST) {
$activity = isset($_POST['activity']) ? $_POST['activity'] : 0;
$name = isset($_POST['name']) ? $_POST['name'] : '';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$state = isset($_POST['state']) ? $_POST['state'] : '0';
// 事务处理
$transaction = $p_db->beginTransaction();
try {
$activity_category->activity_id = $activity;
$activity_category->activity_category_name = $name;
$activity_category->sort_order = $sort;
$activity_category->status = $state;
$activity_category->save();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Activity/activity_category_list"));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'));
}
}
$sql = "SELECT activity_id,activity_name FROM `vcos_activity` WHERE status=1";
$activity = Yii::app()->p_db->createCommand($sql)->queryAll();
$this->render('activity_category_edit', array('activity_category' => $activity_category, 'activity' => $activity));
}
示例3: actionActivity_product_edit
public function actionActivity_product_edit()
{
$this->setauth();
//检查有无权限
$p_db = Yii::app()->p_db;
$id = $_GET['id'];
$layer_cat = '';
$layer_cat2 = '';
$layer_1 = '';
$layer_2 = '';
$layer_3 = '';
$product_sel = '';
$category_code = '';
$activity_product = VcosActivityProduct::model()->findByPk($id);
if ($_POST) {
$activicty = isset($_POST['activity']) ? $_POST['activity'] : 0;
$product = isset($_POST['product']) ? $_POST['product'] : 0;
$shop = isset($_POST['shop']) ? $_POST['shop'] : 0;
$activity_child = isset($_POST['activity_child']) ? $_POST['activity_child'] : 0;
$activity_category = isset($_POST['activity_category']) ? $_POST['activity_category'] : 0;
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$product_type = isset($_POST['product_type']) ? $_POST['product_type'] : 0;
$time = explode(" - ", $_POST['time']);
$s_time = $time[0] . ' ' . $_POST['stime'];
$e_time = $time[1] . ' ' . $_POST['etime'];
$stime = date('Y/m/d H:i:s', strtotime($s_time));
$etime = date('Y/m/d H:i:s', strtotime($e_time));
if ($product_type == 3) {
$product_shop = $shop;
$activity_category = '';
} elseif ($product_type == 6) {
$product_shop = $product;
$activity_category = $activity_category;
} elseif ($product_type == 4) {
$product_shop = $activity_child;
$activity_category = '';
}
//事务处理
$transaction = $p_db->beginTransaction();
try {
$activity_product->activity_id = $activicty;
$activity_product->product_id = $product_shop;
$activity_product->activity_cid = $activity_category;
$activity_product->sort_order = $sort;
$activity_product->start_show_time = $stime;
$activity_product->end_show_time = $etime;
$activity_product->product_type = $product_type;
$activity_product->save();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Activity/activity_product_list"));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'));
}
}
$sql = "SELECT activity_id,activity_name FROM `vcos_activity` WHERE status=1";
$activity = Yii::app()->p_db->createCommand($sql)->queryAll();
//$sql = "SELECT product_id,product_name FROM `vcos_product` WHERE status=1";
//$product = Yii::app()->p_db->createCommand($sql)->queryAll();
$sql = "SELECT activity_cid,activity_category_name FROM `vcos_activity_category` WHERE status=1 AND activity_id = " . $activity_product['activity_id'];
$activity_category = Yii::app()->p_db->createCommand($sql)->queryAll();
$sql = "SELECT shop_id,shop_title FROM `vcos_shop` ";
$shop = Yii::app()->p_db->createCommand($sql)->queryAll();
$sql = "SELECT activity_id,activity_name FROM `vcos_activity` WHERE activity_id !=" . $activity[0]['activity_id'];
$activity_child = Yii::app()->p_db->createCommand($sql)->queryAll();
if ($activity_product['product_type'] == 6) {
$sql = "SELECT category_code FROM `vcos_product` WHERE product_id=" . $activity_product['product_id'];
$category_code = Yii::app()->p_db->createCommand($sql)->queryRow();
$category_code = $category_code['category_code'];
$sql = "SELECT parent_cid FROM `vcos_category` WHERE category_code =" . $category_code;
$layer_cat_2 = $p_db->createCommand($sql)->queryRow();
$sql = "SELECT parent_cid FROM `vcos_category` WHERE category_code =" . $layer_cat_2['parent_cid'];
$layer_cat_1 = $p_db->createCommand($sql)->queryRow();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=0";
$layer_1 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=" . $layer_cat_1['parent_cid'];
$layer_2 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=" . $layer_cat_2['parent_cid'];
$layer_3 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT product_id,product_name FROM `vcos_product` WHERE category_code=" . $category_code;
$product = $p_db->createCommand($sql)->queryAll();
$layer_cat = $layer_cat_1['parent_cid'];
$layer_cat2 = $layer_cat_2['parent_cid'];
} else {
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=0";
$layer_1 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=" . $layer_1[0]['category_code'];
$layer_2 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=" . $layer_2[0]['category_code'];
$layer_3 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT product_id,product_name,category_code FROM `vcos_product` WHERE status=1 AND category_code=" . $layer_3[0]['category_code'];
$product = Yii::app()->p_db->createCommand($sql)->queryAll();
}
$this->render('activity_product_edit', array('activity_child' => $activity_child, 'shop' => $shop, 'activity' => $activity, 'product' => $product, 'activity_category' => $activity_category, 'activity_product' => $activity_product, 'layer_cat' => $layer_cat, 'layer_cat2' => $layer_cat2, 'layer_1' => $layer_1, 'layer_2' => $layer_2, 'layer_3' => $layer_3, 'category_code' => $category_code));
}
示例4: actionProduct_country_edit
public function actionProduct_country_edit()
{
$this->setauth();
//检查有无权限
$p_db = Yii::app()->p_db;
$id = $_GET['id'];
$country = VcosCountry::model()->findByPk($id);
if ($_POST) {
$name = isset($_POST['name']) ? $_POST['name'] : '';
$name_en = isset($_POST['name_en']) ? $_POST['name_en'] : '';
$photo = '';
if ($_FILES['photo']['error'] != 4) {
$result = Helper::upload_file('photo', Yii::app()->params['img_save_url'] . 'basic_images/' . Yii::app()->params['month'], 'image', 3);
$photo = $result['filename'];
}
$photo_url = 'basic_images/' . Yii::app()->params['month'] . '/' . $photo;
$state = isset($_POST['state']) ? $_POST['state'] : '0';
// var_dump($_POST);exit;
//事务处理
$transaction = $p_db->beginTransaction();
try {
$country->country_cn_name = $name;
$country->country_en_name = $name_en;
if ($photo) {
$country->country_logo = $photo_url;
}
$country->status = $state;
$country->save();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Basic/product_country_list"));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'));
}
}
$this->render('product_country_edit', array('country' => $country));
}
示例5: actionNav_product_category_add
public function actionNav_product_category_add()
{
$this->setauth();
//检查有无权限
$p_db = Yii::app()->p_db;
$group = new VcosNavigationGroup();
$group_category = new VcosNavigationGroupCategory();
$nav = isset($_POST['nav']) ? $_POST['nav'] : 0;
$val = isset($_POST['val']) ? $_POST['val'] : 0;
$parent = isset($_POST['parent']) ? $_POST['parent'] : 0;
$name = isset($_POST['name']) ? $_POST['name'] : '';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$img_name = isset($_POST['img_name']) ? $_POST['img_name'] : '';
$cat_name = isset($_POST['cat_name']) ? $_POST['cat_name'] : '';
$highlight = isset($_POST['highlight']) ? $_POST['highlight'] : 0;
//var_dump($_POST);exit;
if ($val == 0 || $val == '') {
//新增
if ($parent == 0) {
$photo = '';
if ($_FILES[$img_name]['error'] != 4) {
$result = Helper::upload_file($img_name, Yii::app()->params['img_save_url'] . 'navigation_images/' . Yii::app()->params['month'], 'image', 3);
$photo = $result['filename'];
}
$photo_url = 'navigation_images/' . Yii::app()->params['month'] . '/' . $photo;
//事务处理
$transaction = $p_db->beginTransaction();
try {
$group->navigation_id = $nav;
$group->navigation_group_name = $name;
$group->sort_order = $sort;
$group->img_url = $photo_url;
$group->save();
//$id = $group->attributes['navigation_group_id'];
$transaction->commit();
Helper::show_message(yii::t('vcos', '添加成功。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '添加失败。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
}
} else {
//事务处理
$transaction = $p_db->beginTransaction();
try {
$group_category->navigation_group_id = $parent;
$group_category->navigation_category_name = $name;
$group_category->sort_order = $sort;
$group_category->is_highlight = $highlight;
$group_category->category_type = 1;
$group_category->mapping_id = $cat_name;
$group_category->save();
//$id = $group->attributes['navigation_group_id'];
$transaction->commit();
Helper::show_message(yii::t('vcos', '添加成功。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '添加失败。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
}
}
} else {
//修改
if ($parent == 0) {
$photo = '';
if ($_FILES[$img_name]['error'] != 4) {
$result = Helper::upload_file($img_name, Yii::app()->params['img_save_url'] . 'navigation_images/' . Yii::app()->params['month'], 'image', 3);
$photo = $result['filename'];
}
$photo_url = 'navigation_images/' . Yii::app()->params['month'] . '/' . $photo;
//事务处理
$transaction = $p_db->beginTransaction();
try {
if ($photo == '') {
$sql = "UPDATE `vcos_navigation_group` SET navigation_group_name='{$name}' WHERE navigation_group_id='{$val}'";
} else {
$sql = "UPDATE `vcos_navigation_group` SET navigation_group_name='{$name}',img_url='{$photo_url}' WHERE navigation_group_id='{$val}'";
}
Yii::app()->p_db->createCommand($sql)->execute();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
}
} else {
//事务处理
$transaction = $p_db->beginTransaction();
try {
$sql = "UPDATE `vcos_navigation_group_category` SET navigation_category_name='{$name}',mapping_id='{$cat_name}',is_highlight='{$highlight}' WHERE navigation_group_cid='{$val}'";
Yii::app()->p_db->createCommand($sql)->execute();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'), Yii::app()->createUrl("Navigation/nav_column_set", array('nav' => $nav, 'act' => 'category', 'op' => 1)));
}
}
}
}
示例6: actionShop_operation
public function actionShop_operation()
{
$this->setauth();
//检查有无权限
$p_db = Yii::app()->p_db;
if ($_POST) {
$str_sql = '';
$str_cat2 = array();
$str_cat1 = array();
$shop = $_POST['shop'];
$data = $_POST['code'];
//分区一二三级
$cat1 = '';
$cat2 = '';
$cat3 = '';
foreach ($data as $row) {
if (strlen($row) == 2) {
$cat1 .= $row . ',';
} else {
if (strlen($row) == 4) {
$cat2 .= $row . ',';
} else {
if (strlen($row)) {
$cat3 .= $row . ',';
}
}
}
}
$cat1 = trim($cat1, ',');
$cat2 = trim($cat2, ',');
$cat3 = trim($cat3, ',');
$cat1 = explode(',', $cat1);
$cat2 = explode(',', $cat2);
$cat3 = explode(',', $cat3);
//连接三级sql,并判断父类存在否
if (!empty($cat3)) {
foreach ($cat3 as $row) {
$parent_1 = substr($row, 0, 2);
$parent_2 = substr($row, 0, 4);
if (!in_array($parent_1, $cat1) && !in_array($parent_1, $str_cat1)) {
$str_cat1[] = $parent_1;
}
if (!in_array($parent_2, $cat2) && !in_array($parent_2, $str_cat2)) {
$str_cat2[] = $parent_2;
}
$str_sql .= "('{$shop}','{$row}','3','1','1','{$parent_2}'),";
}
}
//连接二级,全选状态
if (!empty($cat2)) {
foreach ($cat2 as $row) {
$parent_1 = substr($row, 0, 2);
if ($row != '') {
$str_sql .= "('{$shop}','{$row}','2','1','1','{$parent_1}'),";
}
}
}
//连接二级不选中状态
if (!empty($str_cat2)) {
foreach ($str_cat2 as $row) {
$parent_1 = substr($row, 0, 2);
if ($row != '') {
$str_sql .= "('{$shop}','{$row}','2','0','1','{$parent_1}'),";
}
}
}
//连接一级,全选状态
if (!empty($cat1)) {
foreach ($cat1 as $row) {
if ($row != '') {
$str_sql .= "('{$shop}','{$row}','1','1','1','0'),";
}
}
}
//连接一级不选中状态
if (!empty($str_cat1)) {
foreach ($str_cat1 as $row) {
if ($row != '') {
$str_sql .= "('{$shop}','{$row}','1','0','1','0'),";
}
}
}
$str_sql = trim($str_sql, ',');
$transaction = $p_db->beginTransaction();
try {
$sql = "INSERT INTO `vcos_shop_operation_category`(shop_id,category_code,tree_type,is_sub_all,status,parent_catogory_code) VALUES" . $str_sql;
$result = $p_db->createCommand($sql)->execute();
$transaction->commit();
Helper::show_message(yii::t('vcos', '添加成功。'), Yii::app()->createUrl("Shop/Shop_operation"));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '添加失败。'));
}
}
$sql = "SELECT shop_id,shop_title FROM `vcos_shop` WHERE shop_status=1";
$shop = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE status=1 AND parent_cid=0";
$cat1_sel = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE status=1 AND length(category_code)=4 ORDER BY parent_cid";
$cat2_sel = $p_db->createCommand($sql)->queryAll();
//.........这里部分代码省略.........
示例7: actionProduct_graphic_edit
public function actionProduct_graphic_edit()
{
$this->setauth();
//检查有无权限
$p_db = Yii::app()->p_db;
$id = $_GET['id'];
$product_graphic = VcosProductGraphic::model()->findByPk($id);
if ($_POST) {
$product = isset($_POST['product']) ? $_POST['product'] : 0;
$desc = isset($_POST['desc']) ? $_POST['desc'] : '';
$sort = isset($_POST['sort']) ? $_POST['sort'] : 0;
$photo = '';
if ($_FILES['photo']['error'] != 4) {
$result = Helper::upload_file('photo', Yii::app()->params['img_save_url'] . 'product_images/' . Yii::app()->params['month'], 'image', 3);
$photo = $result['filename'];
}
$photo_url = 'product_images/' . Yii::app()->params['month'] . '/' . $photo;
//事务处理
$transaction = $p_db->beginTransaction();
try {
$product_graphic->product_id = $product;
if ($desc != '') {
$product_graphic->graphic_desc = $desc;
}
if ($photo) {
$product_graphic->img_url = $photo_url;
}
$product_graphic->sort_order = $sort;
$product_graphic->save();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Product/product_graphic_list"));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'));
}
}
$sql = "SELECT category_code FROM `vcos_product` WHERE product_id=" . $product_graphic['product_id'];
$category_code = Yii::app()->p_db->createCommand($sql)->queryRow();
$category_code = $category_code['category_code'];
$sql = "SELECT parent_cid FROM `vcos_category` WHERE category_code =" . $category_code;
$layer_cat_2 = $p_db->createCommand($sql)->queryRow();
$sql = "SELECT parent_cid FROM `vcos_category` WHERE category_code =" . $layer_cat_2['parent_cid'];
$layer_cat_1 = $p_db->createCommand($sql)->queryRow();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=0";
$layer_1 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=" . $layer_cat_1['parent_cid'];
$layer_2 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT category_code,name,parent_cid FROM `vcos_category` WHERE parent_cid=" . $layer_cat_2['parent_cid'];
$layer_3 = $p_db->createCommand($sql)->queryAll();
$sql = "SELECT product_id,product_name FROM `vcos_product` WHERE category_code=" . $category_code;
$product = $p_db->createCommand($sql)->queryAll();
$layer_cat = $layer_cat_1['parent_cid'];
$layer_cat2 = $layer_cat_2['parent_cid'];
$this->render('product_graphic_edit', array('product_graphic' => $product_graphic, 'product' => $product, 'layer_cat' => $layer_cat, 'layer_cat2' => $layer_cat2, 'layer_1' => $layer_1, 'layer_2' => $layer_2, 'layer_3' => $layer_3, 'category_code' => $category_code));
}
示例8: actionWifi_config_edit
public function actionWifi_config_edit()
{
$this->setauth();
//检查有无权限
$id = $_GET['id'];
$wifi = VcosWifiConfig::model()->findByPk($id);
if ($_POST) {
if ($_POST['describe'] != '' && $_POST['loginurl'] != '' && $_POST['logouturl'] != '' && $_POST['change'] != '' && $_POST['notice'] != '' && $_POST['policy'] != '' && $_POST['ssid'] != '' && $_POST['acip'] != '' && $_POST['apmac'] != '') {
$wifi->config_id = $id;
$wifi->config_describe = $_POST['describe'];
$wifi->config_login_url = $_POST['loginurl'];
$wifi->config_logout_url = $_POST['logouturl'];
$wifi->config_change_url = $_POST['change'];
$wifi->config_notice = $_POST['notice'];
$wifi->config_policy = $_POST['policy'];
$wifi->config_ssid = $_POST['ssid'];
$wifi->config_acip = $_POST['acip'];
$wifi->config_apmac = $_POST['apmac'];
if ($wifi->save() > 0) {
Helper::show_message(yii::t('vcos', '修改成功'), Yii::app()->createUrl("Wifisetting/wifi_config_list"));
} else {
Helper::show_message(yii::t('vcos', '修改失败'));
}
} else {
Helper::show_message(yii::t('vcos', '修改失败'));
}
}
$this->render('wifi_config_edit', array('wifi' => $wifi));
}
示例9: actionHelp_category_edit
public function actionHelp_category_edit()
{
$this->setauth();
//检查有无权限
$id = $_GET['id'];
$help_category = VcosHelpCategory::model()->findByPk($id);
$sql = "SELECT b.id FROM vcos_help_category a LEFT JOIN vcos_help_category_language b ON a.id = b.category_id WHERE a.id = {$id} AND b.iso ='" . Yii::app()->params['language'] . "'";
$id2 = Yii::app()->m_db->createCommand($sql)->queryRow();
$help_category_language = VcosHelpCategoryLanguage::model()->findByPk($id2['id']);
if ($_POST) {
$state = isset($_POST['state']) ? $_POST['state'] : '0';
//事务处理
$db = Yii::app()->m_db;
$transaction = $db->beginTransaction();
try {
if (isset($_POST['language']) && $_POST['language'] != '') {
//编辑系统语言和外语状态下
//编辑主表
$db->createCommand()->update('vcos_help_category', array('state' => $state), 'id = :id', array(':id' => $id));
//编辑系统语言
$category_columns = array('category_name' => $_POST['title']);
//编辑系统语言
$db->createCommand()->update('vcos_help_category_language', $category_columns, 'id=:id', array(':id' => $id2['id']));
//判断外语是新增OR编辑
if ($_POST['judge'] == 'add') {
//新增外语
$db->createCommand()->insert('vcos_help_category_language', array('category_id' => $id, 'iso' => $_POST['language'], 'category_name' => $_POST['title_iso']));
} else {
//编辑外语
$columns = array('category_name' => $_POST['title_iso']);
$db->createCommand()->update('vcos_help_category_language', $columns, 'id=:id', array(':id' => $_POST['judge']));
}
//事务提交
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Commentandhelp/help_category"));
} else {
//只编辑系统语言状态下
$help_category->id = $id;
$help_category->state = $state;
$help_category->save();
$help_category_language->id = $id2['id'];
$help_category_language->category_name = $_POST['title'];
$help_category_language->save();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Commentandhelp/help_category"));
}
} catch (Exception $e) {
$transaction->rollBack();
}
}
$this->render('help_category_edit', array('help_category' => $help_category, 'help_category_language' => $help_category_language));
}
示例10: actionUpdateProductCheckInventory
public function actionUpdateProductCheckInventory()
{
$this->setauth();
//检查有无权限
$p_db = Yii::app()->p_db;
$code = isset($_POST['code']) ? $_POST['code'] : '';
$name = isset($_POST['name']) ? $_POST['name'] : '';
$status = isset($_POST['status']) ? $_POST['status'] : '';
$inventory_old = isset($_POST['inventory_old']) ? $_POST['inventory_old'] : '';
$inventory = isset($_POST['inventory']) ? $_POST['inventory'] : '';
$time = date('Y-m-d H:i:s', time());
$this_user_name = Yii::app()->user->name;
$flag = 0;
if ($code != '') {
$transaction = $p_db->beginTransaction();
try {
$check_code = OrderService::createOrderno();
//新增盘点记录
$sql = "INSERT INTO `vcos_product_check` (check_code,check_time,check_type,check_people) VALUES ('{$check_code}','{$time}','{$status[0]}','{$this_user_name}')";
Yii::app()->p_db->createCommand($sql)->execute();
for ($i = 0; $i < count($code); $i++) {
$sql = "INSERT INTO `vcos_product_check_detail` (check_code,product_name,inventory_num,check_num,product_code) VALUES ('{$check_code}','{$name[$i]}','{$inventory_old[$i]}','{$inventory[$i]}','{$code[$i]}')";
Yii::app()->p_db->createCommand($sql)->execute();
$sql = "UPDATE `vcos_product` SET inventory_num='{$inventory[$i]}' WHERE product_code='{$code[$i]}'";
Yii::app()->p_db->createCommand($sql)->execute();
}
$transaction->commit();
$flag = 1;
} catch (Exception $e) {
$transaction->rollBack();
$flag = 0;
}
}
if ($flag == 1) {
Helper::show_message(yii::t('vcos', '提交成功。'), Yii::app()->createUrl("Product/product_check"));
} else {
Helper::show_message(yii::t('vcos', '提交失败。'), Yii::app()->createUrl("Product/product_check"));
}
}
示例11: actionRestaurant_img_edit
public function actionRestaurant_img_edit()
{
$this->setauth();
//检查有无权限
$id = $_GET['id'];
$restaurant_img = VcosRestaurantImg::model()->findByPk($id);
if ($_POST) {
$photo = '';
if ($_FILES['photo']['error'] != 4) {
$result = Helper::upload_file('photo', Yii::app()->params['img_save_url'] . 'restaurant_images/' . Yii::app()->params['month'], 'image', 3);
$photo = $result['filename'];
}
$state = isset($_POST['state']) ? $_POST['state'] : '0';
$iso = isset($_POST['language']) ? $_POST['language'] : 'zh_cn';
/*
if($state == '0'){
$result = VcosRestaurantImg::model()->count('id=:id',array(':id'=>$id));
if($result>0){
die(Helper::show_message(yii::t('vcos', '此分类正在使用,不能禁用')));
}
}*/
//事务处理
$db = Yii::app()->m_db;
$transaction = $db->beginTransaction();
try {
$restaurant_img->id = $id;
$restaurant_img->restaurant_id = $_POST['restaurant'];
$restaurant_img->state = $state;
$restaurant_img->iso = $iso;
if ($photo) {
$restaurant_img->img_url = 'restaurant_images/' . Yii::app()->params['month'] . '/' . $photo;
}
$restaurant_img->save();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Restaurant/Restaurant_img_list"));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'), '#');
}
}
$res_sql = "SELECT a.restaurant_id,b.restaurant_name FROM vcos_restaurant a LEFT JOIN vcos_restaurant_language b ON a.restaurant_id = b.restaurant_id WHERE b.iso = '" . Yii::app()->language . "' AND a.restaurant_state = '1'";
$restaurant_sel = Yii::app()->m_db->createCommand($res_sql)->queryAll();
$this->render('restaurant_img_edit', array('restaurant_sel' => $restaurant_sel, 'restaurant_img' => $restaurant_img));
}
示例12: actionGoods_order_edit
public function actionGoods_order_edit()
{
$this->setauth();
//检查有无权限
$id = $_GET['id'];
$detail = VcosMemberOrder::model()->findByPk($id);
if ($_POST) {
$detail->order_id = $id;
$detail->order_remark = $_POST['remark'];
$detail->order_status = $_POST['state'];
$detail->is_read = '1';
if ($detail->save() > 0) {
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Dutyfreegoods/goods_order_list"));
} else {
Helper::show_message(yii::t('vcos', '修改失败。'));
}
}
$sql = "SELECT *\r\n FROM vcos_member_order_detail\r\n WHERE order_serial_num = '{$detail->order_serial_num}'";
$sub_detail = Yii::app()->m_db->createCommand($sql)->queryAll();
$sql = "SELECT cn_name FROM vcos_member WHERE member_code = {$detail->membership_code}";
$user = Yii::app()->db->createCommand($sql)->queryRow();
$this->render('goods_order_edit', array('detail' => $detail, 'sub_detail' => $sub_detail, 'user' => $user));
}
示例13: actionGoods_order_edit
public function actionGoods_order_edit()
{
$this->setauth();
//检查有无权限
$id = $_GET['id'];
$detail = VcosGoodsOrder::model()->findByPk($id);
if ($_POST) {
$detail->order_id = $id;
$detail->order_remark = $_POST['remark'];
$detail->order_state = $_POST['state'];
$detail->is_read = '1';
if ($detail->save() > 0) {
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Dutyfreegoods/goods_order_list"));
} else {
Helper::show_message(yii::t('vcos', '修改失败。'));
}
}
$sql = "SELECT a.*, c.goods_name, b.goods_img_url \r\n FROM vcos_goods_order_detail a, vcos_dutyfree_goods b, vcos_dutyfree_goods_language c\r\n WHERE a.goods_id=b.goods_id AND a.order_serial_num = {$detail->order_serial_num} AND b.goods_id = c.goods_id AND c.iso = '" . Yii::app()->language . "'";
$sub_detail = Yii::app()->m_db->createCommand($sql)->queryAll();
$user = VcosMember::model()->findByPk($detail->membership_id);
$this->render('goods_order_edit', array('detail' => $detail, 'sub_detail' => $sub_detail, 'user' => $user));
}
示例14: actionResetpassword
public function actionResetpassword()
{
$id = $_GET['id'];
$admin = VcosAdmin::model()->findByPk($id);
$admin->admin_id = $id;
$admin->admin_password = md5('12345678');
if ($admin->save() > 0) {
Helper::show_message(yii::t('vcos', '重设成功,密码为12345678。'), Yii::app()->createUrl("Auth/admin"));
} else {
Helper::show_message(yii::t('vcos', '重设失败。'));
}
}
示例15: actionNavigation_group_brand_edit
public function actionNavigation_group_brand_edit()
{
$this->setauth();
//检查有无权限
$p_db = Yii::app()->p_db;
$id = $_GET['id'];
$navigation_group_brand = VcosNavigationGroupBrand::model()->findByPk($id);
if ($_POST) {
$navigation = isset($_POST['navigation']) ? $_POST['navigation'] : 0;
$brand = isset($_POST['brand']) ? $_POST['brand'] : 0;
$sort = isset($_POST['sort']) ? $_POST['sort'] : '0';
$state = isset($_POST['state']) ? $_POST['state'] : '0';
//事务处理
$transaction = $p_db->beginTransaction();
try {
$navigation_group_brand->navigation_group_id = $navigation;
$navigation_group_brand->brand_id = $brand;
$navigation_group_brand->sort_order = $sort;
$navigation_group_brand->status = $state;
$navigation_group_brand->save();
$transaction->commit();
Helper::show_message(yii::t('vcos', '修改成功。'), Yii::app()->createUrl("Navigation/navigation_group_brand_list"));
} catch (Exception $e) {
$transaction->rollBack();
Helper::show_message(yii::t('vcos', '修改失败。'));
}
}
$sql = "SELECT navigation_group_id,navigation_group_name FROM `vcos_navigation_group` WHERE status=1";
$navigation_group = Yii::app()->p_db->createCommand($sql)->queryAll();
$sql = "SELECT brand_id,brand_cn_name FROM `vcos_brand` WHERE brand_status=1";
$brand = Yii::app()->p_db->createCommand($sql)->queryAll();
$this->render('navigation_group_brand_edit', array('brand' => $brand, 'navigation_group' => $navigation_group, 'navigation_group_brand' => $navigation_group_brand));
}