public function update()
 {
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("levelname");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['levelname'])) {
         $this->error("请填写星级名称");
     }
     if (!preg_match('/^[0-9]*[1-9][0-9]*$/', $data['level'])) {
         $this->error("请填写级别");
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         $dbErr = M()->getDbError();
         save_log($log_info . L("UPDATE_FAILED") . $dbErr, 0);
         $this->error(L("UPDATE_FAILED") . $dbErr);
     }
 }
 public function insert()
 {
     B('FilterString');
     $ajax = intval($_REQUEST['ajax']);
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("ADV_NAME_EMPTY_TIP"));
     }
     if (!check_empty($data['code'])) {
         $this->error(L("ADV_CODE_EMPTY_TIP"));
     }
     if ($data['tmpl'] == '') {
         $this->error(L("ADV_TMPL_EMPTY_TIP"));
     }
     if ($data['adv_id'] == '') {
         $this->error(L("ADV_IDS_EMPTY_TIP"));
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
 public function insert()
 {
     B('FilterString');
     $ajax = intval($_REQUEST['ajax']);
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error("请输入分类名称");
     }
     $user_level_list = M(MODULE_NAME)->where("point=" . intval($data['point']))->find();
     if ($user_level_list) {
         $this->error('已有相同的"所需信用值"');
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
Exemplo n.º 4
0
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("ATTR_NAME_EMPTY_TIP"));
     }
     if (!check_empty($data['preset_value']) && $data['input_type'] == 1) {
         $this->error(L("PRESET_VALUE_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $user_names = preg_split("/[ ,]/i", $data['user_names']);
     $user_ids = "";
     foreach ($user_names as $k => $v) {
         $uid = M("User")->where("user_name = '" . $v . "'")->getField("id");
         if ($uid) {
             $user_ids .= $uid . "|";
         }
     }
     $data['user_ids'] = $user_ids;
     $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['title'])) {
         $this->error(L("MSY_TITLE_EMPTY_TIP"));
     }
     if (!check_empty($data['content'])) {
         $this->error(L("MSY_CONTENT_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Exemplo n.º 6
0
 public function update()
 {
     B('FilterString');
     $data = M("ApnsMessages")->create();
     $log_info = $data['id'];
     //开始验证有效性
     $this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id'])));
     if (!check_empty($data['content'])) {
         $this->error(L("CONTENT_EMPTY_TIP"));
     }
     if ($data['send_time'] == '') {
         $data['send_time'] = get_gmtime();
     }
     $data['send_time'] = to_timespan($data['send_time']);
     if (intval($_REQUEST['resend']) == 1) {
         $data['status'] = 0;
     }
     $list = M("ApnsMessages")->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Exemplo n.º 7
0
 public function insert()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("DEALCATE_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         clear_auto_cache("cache_shop_cate_tree");
         clear_auto_cache("shop_sub_cate_ids");
         clear_auto_cache("shop_sub_parent_cate_ids");
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
Exemplo n.º 8
0
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("VOUCHER_NAME_EMPTY_TIP"));
     }
     if (doubleval($data['money']) <= 0) {
         $this->error(L("VOUCHER_MONEY_ERROR_TIP"));
     }
     $data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
     $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("use_limit", $data['use_limit']);
         //同步可用次数
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("begin_time", $data['begin_time']);
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("end_time", $data['end_time']);
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("money", $data['money']);
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
 public function update()
 {
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("TAGNAME_EMPTY_TIP"));
     }
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     $log_info = $data['name'];
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         M("TagGroupLink")->where("tag_group_id=" . $data['id'])->delete();
         foreach ($_REQUEST['cate_id'] as $cate_id) {
             if (intval($cate_id) > 0) {
                 $link_data = array();
                 $link_data['category_id'] = intval($cate_id);
                 $link_data['tag_group_id'] = $data['id'];
                 M("TagGroupLink")->add($link_data);
             }
         }
         clear_auto_cache("store_filter_nav_cache");
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
 public function update()
 {
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit"));
     if (!check_empty($data['name'])) {
         $this->error(L("POINTNAME_EMPTY_TIP"));
     }
     if (M(MODULE_NAME)->where("id<>" . $data['id'] . " and `name`='" . $data['name'] . "'")->count() > 0) {
         $this->error(L("HAD_POINTGROUP"));
     }
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     $log_info = $data['name'];
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Exemplo n.º 11
0
 public function get()
 {
     $key_word = check_empty($this->input->get('keyword'), '');
     $city_id = input_int($this->input->cookie('cityid'), 100000, FALSE, '530700');
     //默认丽江
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, 20, 10);
     $category = input_int($this->input->get('cid'), 0, FALSE, 0);
     $category_id = input_int($this->input->get('ccid'), 0, FALSE, 0);
     $dest_id = input_int($this->input->get('dest'), 0, FALSE, 0);
     $local_id = input_int($this->input->get('local'), 0, FALSE, 0);
     $sort = input_string($this->input->get('sort'), array('time', 'local', 'highp', 'lowp'), 'time');
     $today = input_int($this->input->get('today'), 0, 2, 0);
     $order_by = array('time' => 'update_time DESC', 'local' => 'local', 'highp' => 'bought_count DESC', 'lowp' => 'price ASC');
     $type = input_string($this->input->get('type'), array('item', 'inn'), 'item');
     $search = array('category' => $category, 'category_id' => $category_id, 'city_id' => $city_id, 'local_id' => $local_id, 'dest_id' => $dest_id, 'state' => 'T', 'today' => $today, 'type' => $type, 'key_word' => $key_word);
     if ($order_by[$sort] == 'local') {
         $search['lat'] = $this->get_current_data('lat');
         $search['lon'] = $this->get_current_data('lon');
     }
     if ($type == 'item') {
         $data = $this->model->get_products($search, $order_by[$sort], build_limit($page, $perpage));
     } else {
         $data = $this->model->get_inns($search, $order_by[$sort], build_limit($page, $perpage));
     }
     response_row($data);
 }
Exemplo n.º 12
0
 public function insert()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     if ($data['pid'] > 0) {
         $data['recommend'] = 0;
     }
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("DEALCATE_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
Exemplo n.º 13
0
 public function insert()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/index"));
     if (!check_empty($data['name'])) {
         $this->error(L("DEALCATE_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //标签分组
         $tag_group = $_REQUEST['tag_group'];
         foreach ($tag_group as $group_id) {
             if ($group_id > 0) {
                 $tag_group_link['tag_group_id'] = intval($group_id);
                 $tag_group_link['category_id'] = intval($list);
                 M("TagGroupLink")->add($tag_group_link);
             }
         }
         //图片分组
         $images_group = $_REQUEST['images_group'];
         foreach ($images_group as $images_id) {
             if ($images_id > 0) {
                 $images_group_link['images_group_id'] = intval($images_id);
                 $images_group_link['category_id'] = intval($list);
                 M("ImagesGroupLink")->add($images_group_link);
             }
         }
         //点评评分分组
         $point_group = $_REQUEST['point_group'];
         foreach ($point_group as $group_id) {
             if ($group_id > 0) {
                 $point_group_link['point_group_id'] = intval($group_id);
                 $point_group_link['category_id'] = intval($list);
                 M("PointGroupLink")->add($point_group_link);
             }
         }
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         clear_auto_cache("cache_youhui_cate_tree");
         clear_auto_cache("deal_sub_cate_ids");
         clear_auto_cache("deal_sub_parent_cate_ids");
         clear_auto_cache("store_image_group_list");
         clear_auto_cache("byouhui_filter_nav_cache");
         clear_auto_cache("fyouhui_filter_nav_cache");
         clear_auto_cache("tuan_filter_nav_cache");
         clear_auto_cache("ytuan_filter_nav_cache");
         clear_auto_cache("store_filter_nav_cache");
         clear_auto_cache("cache_deal_cate");
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
Exemplo n.º 14
0
 public function insert()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("DEALCATE_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         // 			//标签分组
         // 			$tag_group = $_REQUEST['tag_group'];
         // 			foreach($tag_group as $group_id)
         // 			{
         // 				if($group_id>0)
         // 				{
         // 					$tag_group_link['tag_group_id'] = intval($group_id);
         // 					$tag_group_link['category_id'] = intval($list);
         // 					M("TagGroupLink")->add($tag_group_link);
         // 				}
         // 			}
         // 			//图片分组
         // 			$images_group = $_REQUEST['images_group'];
         // 			foreach($images_group as $images_id)
         // 			{
         // 				if($images_id>0)
         // 				{
         // 					$images_group_link['images_group_id'] = intval($images_id);
         // 					$images_group_link['category_id'] = intval($list);
         // 					M("ImagesGroupLink")->add($images_group_link);
         // 				}
         // 			}
         // 			//点评评分分组
         // 			$point_group = $_REQUEST['point_group'];
         // 			foreach($point_group as $group_id)
         // 			{
         // 				if($group_id>0)
         // 				{
         // 					$point_group_link['point_group_id'] = intval($group_id);
         // 					$point_group_link['category_id'] = intval($list);
         // 					M("PointGroupLink")->add($point_group_link);
         // 				}
         // 			}
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
Exemplo n.º 15
0
function check_forms($data)
{
    if (!check_empty($data)) {
        return array('passed' => false, "error" => "empty ");
    }
    if (!check_phone($data["phone_num"])) {
        return array('passed' => false, "error" => "phone_num");
    }
    if (!check_is_num($data["empiid"])) {
        return array('passed' => false, "error" => "empiid");
    }
    if (!check_ferpa($data["ferpa_score"])) {
        return array('passed' => false, "error" => "ferpa");
    }
    return array('passed' => true, "error" => '');
}
Exemplo n.º 16
0
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("REGION_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $GLOBALS['db']->autoExecute(DB_PREFIX . "delivery_region", $data, "UPDATE", "id=" . $data['id']);
     $rs = $GLOBALS['db']->affected_rows();
     if ($rs) {
         $this->updateRegionJS();
     }
     save_log($log_info . L("UPDATE_SUCCESS"), 1);
     $this->success(L("UPDATE_SUCCESS"));
 }
Exemplo n.º 17
0
 public function do_change_password()
 {
     $adm_id = intval($_REQUEST['adm_id']);
     if (!check_empty($_REQUEST['adm_password'])) {
         $this->error(L("ADM_PASSWORD_EMPTY_TIP"));
     }
     if (!check_empty($_REQUEST['adm_new_password'])) {
         $this->error(L("ADM_NEW_PASSWORD_EMPTY_TIP"));
     }
     if ($_REQUEST['adm_confirm_password'] != $_REQUEST['adm_new_password']) {
         $this->error(L("ADM_NEW_PASSWORD_NOT_MATCH_TIP"));
     }
     if (M("Admin")->where("id=" . $adm_id)->getField("adm_password") != md5($_REQUEST['adm_password'])) {
         $this->error(L("ADM_PASSWORD_ERROR"));
     }
     M("Admin")->where("id=" . $adm_id)->setField("adm_password", md5($_REQUEST['adm_new_password']));
     save_log(M("Admin")->where("id=" . $adm_id)->getField("adm_name") . L("CHANGE_SUCCESS"), 1);
     $this->success(L("CHANGE_SUCCESS"));
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['title'])) {
         $this->error("请输入标题");
     }
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Exemplo n.º 19
0
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = $data['id'] . l("TOPIC_REPLY_DATA");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['content'])) {
         $this->error(L("TOPIC_CONTENT_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Exemplo n.º 20
0
 public function update()
 {
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("USER_GROUP_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         $dbErr = M()->getDbError();
         save_log($log_info . L("UPDATE_FAILED") . $dbErr, 0);
         $this->error(L("UPDATE_FAILED") . $dbErr);
     }
 }
 public function insert()
 {
     // var_dump($_REQUEST);
     // array(4) { ["icon"]=> string(50) "./public/attachment/201408/09/16/53e5dcccb1a70.jpg" ["id"]=> string(3) "257" ["m"]=> string(13) "ShopCateImage" ["a"]=> string(6) "insert" }
     B('FilterString');
     $data['id'] = $_REQUEST['id'];
     $data['icon'] = $_REQUEST['icon'];
     $log_info = M("ShopCate")->where("id=" . intval($data['id']))->getField("name");
     if (!check_empty($data['id'])) {
         $this->error(L("请选择分类再上传"));
     }
     $sql = "update " . DB_PREFIX . "shop_cate set icon='" . $data['icon'] . "' where id = " . $data['id'];
     $list = $GLOBALS['db']->query($sql);
     if (false !== $list) {
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Exemplo n.º 22
0
 public function insert()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error("节日名称不能为空!");
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         rm_auto_cache("cache_vip_festivals");
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
 public function insert()
 {
     B('FilterString');
     $data = M("UserCreditType")->create();
     //开始验证有效性
     $this->assign("jumpUrl", u("Credit" . "/add"));
     if (!check_empty($data['type_name'])) {
         $this->error(L("DEALCATE_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M("UserCreditType")->add($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         rm_auto_cache("credit_type");
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
Exemplo n.º 24
0
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $data['update_time'] = TIME_UTC;
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("content");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['admin_reply'])) {
         $this->error(L("ADMIN_REPLY_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
 public function insert()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("DEALCATE_NAME_EMPTY_TIP"));
     }
     $data['credits'] = serialize($_REQUEST['credits']);
     // 更新数据
     $log_info = $data['name'];
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         rm_auto_cache("deal_loan_type_list");
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("INSERT_FAILED"), 0);
         $this->error(L("INSERT_FAILED"));
     }
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("VOTE_NAME_EMPTY_TIP"));
     }
     $data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
     $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Exemplo n.º 27
0
 public function agencies_update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("user_name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/agencies_edit", array("id" => $data['id'])));
     if (!check_empty($data['user_pwd']) && $data['user_pwd'] != $_REQUEST['user_confirm_pwd']) {
         $this->error(L("USER_PWD_CONFIRM_ERROR"));
     }
     if (!check_empty($data['idno'])) {
         $this->error(sprintf(L("USER_EMPTY_ERROR"), L("IPS_IDENT_TYPE_1")));
     }
     if (!check_empty($data['real_name'])) {
         $this->error(sprintf(L("USER_EMPTY_ERROR"), L("REAL_NAME")));
     }
     $_REQUEST["user_type"] = 3;
     $_REQUEST["idcardpassed"] = 1;
     $_REQUEST["idcardpassed_time"] = TIME_UTC;
     $res = save_user($_REQUEST, 'UPDATE');
     if ($res['status'] == 0) {
         $error_field = $res['data'];
         if ($error_field['error'] == EMPTY_ERROR) {
             if ($error_field['field_name'] == 'user_name') {
                 $this->error(L("USER_NAME_EMPTY_TIP"));
             } elseif ($error_field['field_name'] == 'email') {
                 $this->error(L("USER_EMAIL_EMPTY_TIP"));
             } else {
                 $this->error(sprintf(L("USER_EMPTY_ERROR"), $error_field['field_show_name']));
             }
         }
         if ($error_field['error'] == FORMAT_ERROR) {
             if ($error_field['field_name'] == 'email') {
                 $this->error(L("USER_EMAIL_FORMAT_TIP"));
             }
             if ($error_field['field_name'] == 'mobile') {
                 $this->error(L("USER_MOBILE_FORMAT_TIP"));
             }
             if ($error_field['field_name'] == 'idno') {
                 $this->error(L("USER_IDNO_FORMAT_TIP"));
             }
         }
         if ($error_field['error'] == EXIST_ERROR) {
             if ($error_field['field_name'] == 'user_name') {
                 $this->error(L("USER_NAME_EXIST_TIP"));
             }
             if ($error_field['field_name'] == 'email') {
                 $this->error(L("USER_EMAIL_EXIST_TIP"));
             }
             if ($error_field['field_name'] == 'mobile') {
                 $this->error(L("USER_MOBILE_EXIST_TIP"));
             }
             if ($error_field['field_name'] == 'idno') {
                 $this->error(L("USER_IDNO_EXIST_TIP"));
             }
         }
     }
     //更新权限
     M("UserAuth")->where("user_id=" . $data['id'] . " and rel_id = 0")->delete();
     foreach ($_REQUEST['auth'] as $k => $v) {
         foreach ($v as $item) {
             $auth_data = array();
             $auth_data['m_name'] = $k;
             $auth_data['a_name'] = $item;
             $auth_data['user_id'] = $data['id'];
             M("UserAuth")->add($auth_data);
         }
     }
     //开始更新is_effect状态
     M("User")->where("id=" . intval($_REQUEST['id']))->setField("is_effect", intval($_REQUEST['is_effect']));
     $user_id = intval($_REQUEST['id']);
     M("UserCateLink")->where("user_id=" . $user_id)->delete();
     foreach ($_REQUEST['cate_id'] as $cate_id) {
         $link_data = array();
         $link_data['user_id'] = $user_id;
         $link_data['cate_id'] = $cate_id;
         M("UserCateLink")->add($link_data);
     }
     save_log($log_info . L("UPDATE_SUCCESS"), 1);
     $this->success(L("UPDATE_SUCCESS"));
 }
Exemplo n.º 28
0
 private function check_group_info_value($type = 'edit')
 {
     $group_name = $this->input->post('groupname', TRUE);
     $group_img = $this->input->post('groupimg', TRUE);
     $note = $this->input->post('note', TRUE);
     $join_method = $this->input->post('joinmethod');
     $group = array();
     if ($type == 'edit') {
         if ($group_name) {
             $group['group_name'] = check_empty(trimall(strip_tags($group_name)), FALSE, '6020');
         }
         if ($group_img) {
             $group['group_img'] = check_empty(trimall(strip_tags($group_img)), FALSE, '6021');
         }
         if ($note) {
             $group['note'] = check_empty(trimall(strip_tags($note)), FALSE, '6022');
         }
         if ($join_method) {
             $group['join_method'] = input_string($join_method, array('able', 'verify', 'noable'), FALSE, '6023');
         }
     } else {
         $group['group_name'] = check_empty(trimall(strip_tags($group_name)), FALSE, '6020');
         $group['group_img'] = check_empty(trimall(strip_tags($group_img)), FALSE, '6021');
         $group['note'] = check_empty(trimall(strip_tags($note)), FALSE, '6022');
         $group['join_method'] = input_string($join_method, array('able', 'verify', 'noable'), FALSE, '6023');
     }
     return $group;
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("ROLE_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         $role_id = $data['id'];
         M("RoleAccess")->where("role_id=" . $role_id)->delete();
         //开始关联节点
         $role_access = $_REQUEST['role_access'];
         foreach ($role_access as $k => $v) {
             //开始提交关联
             $item = explode("_", $v);
             if ($item[1] == 0) {
                 //模块授权
                 M("RoleAccess")->where("role_id=" . $role_id . " and module_id=" . $item[0])->delete();
             } else {
                 //节点授权
                 M("RoleAccess")->where("role_id=" . $role_id . " and module_id=" . $item[0] . " and node_id=" . $item[1])->delete();
             }
             $access_item['role_id'] = $role_id;
             $access_item['node_id'] = $item[1];
             $access_item['module_id'] = $item[0];
             M("RoleAccess")->add($access_item);
         }
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"));
     }
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("SUPPLIER_NAME_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         syn_supplier_match($data['id']);
         clear_auto_cache("static_goods_info");
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }