public function foreverdelete()
 {
     //彻底删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         $rel_data = M(MODULE_NAME)->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['name'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $list = M(MODULE_NAME)->where($condition)->delete();
         if ($list !== false) {
             clear_auto_cache("cache_shop_cate");
             save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
             $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
         } else {
             save_log($info . l("FOREVER_DELETE_FAILED"), 0);
             $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
Example #2
0
 public function update()
 {
     $conf_res = M("Conf")->where("is_effect = 1 and is_conf = 1")->findAll();
     foreach ($conf_res as $k => $v) {
         conf($v['name'], $_REQUEST[$v['name']]);
         if ($v['name'] == 'URL_MODEL' && $v['value'] != $_REQUEST[$v['name']]) {
             clear_auto_cache("byouhui_filter_nav_cache");
             clear_auto_cache("cache_shop_acate_tree");
             clear_auto_cache("cache_shop_cate_tree");
             clear_auto_cache("cache_youhui_cate_tree");
             clear_auto_cache("city_list_result");
             clear_auto_cache("fyouhui_filter_nav_cache");
             clear_auto_cache("get_help_cache");
             clear_auto_cache("page_image");
             clear_auto_cache("tuan_filter_nav_cache");
             clear_auto_cache("youhui_page_recommend_youhui_list");
             clear_auto_cache("ytuan_filter_nav_cache");
             clear_auto_cache("store_filter_nav_cache");
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
             clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
             clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
             clear_dir_file(get_real_path() . "public/runtime/data/page_static_cache/");
             clear_dir_file(get_real_path() . "public/runtime/data/dynamic_avatar_cache/");
         }
     }
     //开始写入配置文件
     $sys_configs = M("Conf")->findAll();
     $config_str = "<?php\n";
     $config_str .= "return array(\n";
     foreach ($sys_configs as $k => $v) {
         $config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n";
     }
     $config_str .= ");\n ?>";
     $filename = get_real_path() . "public/sys_config.php";
     if (!($handle = fopen($filename, 'w'))) {
         $this->error(l("OPEN_FILE_ERROR") . $filename);
     }
     if (fwrite($handle, $config_str) === FALSE) {
         $this->error(l("WRITE_FILE_ERROR") . $filename);
     }
     fclose($handle);
     save_log(l("CONF_UPDATED"), 1);
     //clear_cache();
     write_timezone();
     $this->success(L("UPDATE_SUCCESS"));
 }
 private function clear_data_file()
 {
     @unlink(get_real_path() . "public/runtime/app/deal_cate_conf.js");
     clear_dir_file(get_real_path() . "public/runtime/app/deal_region_conf/");
     if (intval($_REQUEST['is_all']) == 0) {
         //数据缓存
         clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/db_caches/");
         clear_dir_file(get_real_path() . "public/runtime/mapi/data_caches/");
         $GLOBALS['cache']->clear();
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
         clear_dir_file(get_real_path() . "public/runtime/wap/tpl_caches/");
         clear_dir_file(get_real_path() . "public/runtime/wap/tpl_compiled/");
         @unlink(get_real_path() . "public/runtime/app/lang.js");
         //删除相关未自动清空的数据缓存
         clear_auto_cache("page_image");
     } else {
         clear_dir_file(get_real_path() . "public/runtime/data/");
         clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/db_caches/");
         clear_dir_file(get_real_path() . "public/runtime/mapi/data_caches/");
         $GLOBALS['cache']->clear();
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
         clear_dir_file(get_real_path() . "public/runtime/wap/tpl_caches/");
         clear_dir_file(get_real_path() . "public/runtime/wap/tpl_compiled/");
         @unlink(get_real_path() . "public/runtime/app/lang.js");
         //后台
         clear_dir_file(get_real_path() . "public/runtime/admin/Cache/");
         clear_dir_file(get_real_path() . "public/runtime/admin/Data/_fields/");
         clear_dir_file(get_real_path() . "public/runtime/admin/Temp/");
         clear_dir_file(get_real_path() . "public/runtime/admin/Logs/");
         @unlink(get_real_path() . "public/runtime/admin/~app.php");
         @unlink(get_real_path() . "public/runtime/admin/~runtime.php");
         @unlink(get_real_path() . "public/runtime/admin/lang.js");
         @unlink(get_real_path() . "public/runtime/app/config_cache.php");
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_log set comment_data_cache = '',deal_info_cache=''");
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal set deal_extra_cache = ''");
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_comment set deal_info_cache=''");
     }
 }
Example #4
0
 public function clear_data()
 {
     set_time_limit(0);
     es_session::close();
     @unlink(get_real_path() . "public/runtime/app/deal_cate_conf.js");
     clear_dir_file(get_real_path() . "public/runtime/app/deal_region_conf/");
     if (intval($_REQUEST['is_all']) == 0) {
         //数据缓存
         clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/db_caches/");
         $GLOBALS['cache']->clear();
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
         @unlink(get_real_path() . "public/runtime/app/lang.js");
         //删除相关未自动清空的数据缓存
         clear_auto_cache("page_image");
     } else {
         clear_dir_file(get_real_path() . "public/runtime/data/");
         clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/db_caches/");
         $GLOBALS['cache']->clear();
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
         clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
         @unlink(get_real_path() . "public/runtime/app/lang.js");
         //后台
         clear_dir_file(get_real_path() . "public/runtime/admin/Cache/");
         clear_dir_file(get_real_path() . "public/runtime/admin/Data/_fields/");
         clear_dir_file(get_real_path() . "public/runtime/admin/Temp/");
         clear_dir_file(get_real_path() . "public/runtime/admin/Logs/");
         @unlink(get_real_path() . "public/runtime/admin/~app.php");
         @unlink(get_real_path() . "public/runtime/admin/~runtime.php");
         @unlink(get_real_path() . "public/runtime/admin/lang.js");
         @unlink(get_real_path() . "public/runtime/app/config_cache.php");
     }
     header("Content-Type:text/html; charset=utf-8");
     exit("<div style='line-height:50px; text-align:center; color:#f30;'>" . L('CLEAR_SUCCESS') . "</div><div style='text-align:center;'><input type='button' onclick='\$.weeboxs.close();' class='button' value='关闭' /></div>");
 }
 public function syn_data()
 {
     set_time_limit(0);
     es_session::close();
     //同步,supplier_location表, deal表, youhui表, event表 , supplier 表
     //总数
     $page = intval($_REQUEST['p']) == 0 ? 1 : intval($_REQUEST['p']);
     if ($page == 1) {
         syn_dealing();
     }
     $page_size = 5;
     $location_total = M("SupplierLocation")->count();
     $deal_total = M("Deal")->count();
     $youhui_total = M("Youhui")->count();
     $event_total = M("Event")->count();
     $supplier_total = M("Supplier")->count();
     $rebid_total = M("Rebid_submit")->where("status=1")->count();
     $count = max(array($location_total, $deal_total, $youhui_total, $event_total, $supplier_total, $rebid_total));
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $location_list = M("SupplierLocation")->limit($limit)->findAll();
     foreach ($location_list as $v) {
         syn_supplier_location_match($v['id']);
     }
     $supplier_list = M("Supplier")->limit($limit)->findAll();
     foreach ($supplier_list as $v) {
         syn_supplier_match($v['id']);
     }
     $deal_list = M("Deal")->limit($limit)->findAll();
     foreach ($deal_list as $v) {
         syn_deal_match($v['id']);
     }
     $youhui_list = M("Youhui")->limit($limit)->findAll();
     foreach ($youhui_list as $v) {
         syn_youhui_match($v['id']);
     }
     $event_list = M("Event")->limit($limit)->findAll();
     foreach ($youhui_list as $v) {
         syn_event_match($v['id']);
     }
     $rebid_list = M("Rebid_submit")->where("status=1")->limit($limit)->findAll();
     foreach ($rebid_list as $v) {
         syn_rebid_match($v['id']);
     }
     if ($page * $page_size >= $count) {
         $this->assign("jumpUrl", U("Cache/index"));
         $ajax = intval($_REQUEST['ajax']);
         clear_auto_cache("cache_deal_cart");
         $data['status'] = 1;
         $data['info'] = "<div style='line-height:50px; text-align:center; color:#f30;'>同步成功</div><div style='text-align:center;'><input type='button' onclick='\$.weeboxs.close();' class='button' value='关闭' /></div>";
         header("Content-Type:text/html; charset=utf-8");
         exit(json_encode($data));
     } else {
         $total_page = ceil($count / $page_size);
         $data['status'] = 0;
         $data['info'] = "共" . $total_page . "页,当前第" . $page . "页,等待更新下一页记录";
         $data['url'] = U("Cache/syn_data", array("p" => $page + 1));
         header("Content-Type:text/html; charset=utf-8");
         exit(json_encode($data));
     }
 }
 public function set_default()
 {
     $id = intval($_REQUEST['id']);
     $info = M(MODULE_NAME)->where("id=" . $id)->getField("name");
     M(MODULE_NAME)->setField("is_default", 0);
     M(MODULE_NAME)->where("id=" . $id)->setField("is_default", 1);
     clear_auto_cache("city_list_result");
     save_log($info . l("SET_DEFAULT"), 1);
     $this->success(L("UPDATE_SUCCESS"));
 }
 public function insert()
 {
     B('FilterString');
     $ajax = intval($_REQUEST['ajax']);
     $data = M("RegionConf")->create();
     //开始验证有效性
     $this->assign("jumpUrl", u("RegionConf" . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("CITY_NAME_EMPTY_TIP"));
     }
     if (!check_empty($data['py'])) {
         $this->error("请输入拼音");
     }
     // 更新数据
     $log_info = $data['name'];
     $list = M("RegionConf")->add($data);
     if (false !== $list) {
         //成功提示
         $this->updateRegionJS();
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         clear_auto_cache("city_list_result");
         clear_auto_cache("deal_city_belone_ids");
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         $DBerr = M()->getDbError();
         save_log($log_info . L("INSERT_FAILED") . $DBerr, 0);
         $this->error(L("INSERT_FAILED") . $DBerr);
     }
 }
 public function foreverdelete()
 {
     //删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         $rel_data = M(MODULE_NAME)->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['name'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $list = M(MODULE_NAME)->where($condition)->delete();
         if ($list !== false) {
             M("SupplierLocationBrandLink")->where(array('brand_id' => array('in', explode(',', $id))))->delete();
             M("Deal")->where(array('brand_id' => array('in', explode(',', $id))))->setField("brand_id", 0);
             M("Youhui")->where(array('brand_id' => array('in', explode(',', $id))))->setField("brand_id", 0);
             clear_auto_cache("static_goods_info");
             save_log($info . l("DELETE_SUCCESS"), 1);
             $this->success(l("DELETE_SUCCESS"), $ajax);
         } else {
             save_log($info . l("DELETE_FAILED"), 0);
             $this->error(l("DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
 public function set_sort()
 {
     $id = intval($_REQUEST['id']);
     $sort = intval($_REQUEST['sort']);
     $log_info = M(MODULE_NAME)->where("id=" . $id)->getField("field_name");
     if (!check_sort($sort)) {
         $this->error(l("SORT_FAILED"), 1);
     }
     M(MODULE_NAME)->where("id=" . $id)->setField("sort", $sort);
     clear_auto_cache("user_field_list");
     save_log($log_info . l("SORT_SUCCESS"), 1);
     $this->success(l("SORT_SUCCESS"), 1);
 }
 public function youhui_insert()
 {
     B('FilterString');
     $ajax = intval($_REQUEST['ajax']);
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/youhui_add"));
     if (!check_empty($data['name'])) {
         $this->error(L("DEAL_YOUHUI_NAME_EMPTY_TIP"));
     }
     if (!check_empty($data['sub_name'])) {
         $this->error(L("DEAL_YOUHUI_SUB_NAME_EMPTY_TIP"));
     }
     if ($data['cate_id'] == 0) {
         $this->error(L("DEAL_YOUHUI_CATE_EMPTY_TIP"));
     }
     if ($data['city_id'] == 0) {
         $this->error(L("DEAL_YOUHUI_CITY_EMPTY_TIP"));
     }
     if ($data['max_bought'] < 0) {
         $this->error(L("DEAL_YOUHUI_MAX_BOUGHT_ERROR_TIP"));
     }
     if ($data['user_min_bought'] < 0) {
         $this->error(L("DEAL_USER_MIN_BOUGHT_ERROR_TIP"));
     }
     if ($data['user_max_bought'] < 0) {
         $this->error(L("DEAL_USER_MAX_BOUGHT_ERROR_TIP"));
     }
     if ($data['user_max_bought'] < $data['user_min_bought'] && $data['user_max_bought'] > 0) {
         $this->error(L("DEAL_USER_MAX_MIN_BOUGHT_ERROR_TIP"));
     }
     // 更新数据
     $data['is_shop'] = 2;
     $data['is_coupon'] = 1;
     if (intval($data['is_coupon']) == 1 && intval($data['is_refund']) == 1) {
         $data['expire_refund'] = intval($_REQUEST['expire_refund']);
         $data['any_refund'] = intval($_REQUEST['any_refund']);
     } else {
         $data['expire_refund'] = 0;
         $data['any_refund'] = 0;
     }
     $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']);
     $data['coupon_begin_time'] = trim($data['coupon_begin_time']) == '' ? 0 : to_timespan($data['coupon_begin_time']);
     $data['coupon_end_time'] = trim($data['coupon_end_time']) == '' ? 0 : to_timespan($data['coupon_end_time']);
     //将第一张图片设为团购图片
     $imgs = $_REQUEST['img'];
     foreach ($imgs as $k => $v) {
         if ($v != '') {
             $data['img'] = $v;
             break;
         }
     }
     $log_info = $data['name'];
     $data['create_time'] = get_gmtime();
     $data['update_time'] = get_gmtime();
     $list = M(MODULE_NAME)->add($data);
     if (false !== $list) {
         //开始处理图片
         $imgs = $_REQUEST['img'];
         foreach ($imgs as $k => $v) {
             if ($v != '') {
                 $img_data['deal_id'] = $list;
                 $img_data['img'] = $v;
                 $img_data['sort'] = $k;
                 M("DealGallery")->add($img_data);
             }
         }
         //end 处理图片
         //开始处理属性
         $deal_attr = $_REQUEST['deal_attr'];
         $deal_attr_price = $_REQUEST['deal_attr_price'];
         $deal_attr_stock_hd = $_REQUEST['deal_attr_stock_hd'];
         foreach ($deal_attr as $goods_type_attr_id => $arr) {
             foreach ($arr as $k => $v) {
                 if ($v != '') {
                     $deal_attr_item['deal_id'] = $list;
                     $deal_attr_item['goods_type_attr_id'] = $goods_type_attr_id;
                     $deal_attr_item['name'] = $v;
                     $deal_attr_item['price'] = $deal_attr_price[$goods_type_attr_id][$k];
                     $deal_attr_item['is_checked'] = intval($deal_attr_stock_hd[$goods_type_attr_id][$k]);
                     M("DealAttr")->add($deal_attr_item);
                 }
             }
         }
         //开始创建属性库存
         $stock_cfg = $_REQUEST['stock_cfg_num'];
         $attr_cfg = $_REQUEST['stock_attr'];
         $attr_str = $_REQUEST['stock_cfg'];
         foreach ($stock_cfg as $row => $v) {
             $stock_data = array();
             $stock_data['deal_id'] = $list;
             $stock_data['stock_cfg'] = $v;
             $stock_data['attr_str'] = $attr_str[$row];
             $attr_cfg_data = array();
             foreach ($attr_cfg as $attr_id => $cfg) {
                 $attr_cfg_data[$attr_id] = $cfg[$row];
             }
             $stock_data['attr_cfg'] = serialize($attr_cfg_data);
             M("AttrStock")->add($stock_data);
         }
         if (intval($_REQUEST['free_delivery']) == 1) {
             $delivery_ids = $_REQUEST['delivery_id'];
             $free_counts = $_REQUEST['free_count'];
             foreach ($delivery_ids as $k => $v) {
                 $free_conf = array();
                 $free_conf['delivery_id'] = $delivery_ids[$k];
                 $free_conf['free_count'] = $free_counts[$k];
                 $free_conf['deal_id'] = $list;
                 M("FreeDelivery")->add($free_conf);
             }
         }
         if (intval($_REQUEST['define_payment']) == 1) {
             $payment_ids = $_REQUEST['payment_id'];
             foreach ($payment_ids as $k => $v) {
                 $payment_conf = array();
                 $payment_conf['payment_id'] = $payment_ids[$k];
                 $payment_conf['deal_id'] = $list;
                 M("DealPayment")->add($payment_conf);
             }
         }
         $delivery_ids = $_REQUEST['forbid_delivery_id'];
         foreach ($delivery_ids as $k => $v) {
             $delivery_conf = array();
             $delivery_conf['delivery_id'] = $delivery_ids[$k];
             $delivery_conf['deal_id'] = $list;
             M("DealDelivery")->add($delivery_conf);
         }
         //开始创建筛选项
         $filter = $_REQUEST['filter'];
         foreach ($filter as $filter_group_id => $filter_value) {
             $filter_data = array();
             $filter_data['filter'] = $filter_value;
             $filter_data['filter_group_id'] = $filter_group_id;
             $filter_data['deal_id'] = $list;
             M("DealFilter")->add($filter_data);
             $filter_array = preg_split("/[ ,]/i", $filter_value);
             foreach ($filter_array as $filter_item) {
                 $filter_row = M("Filter")->where("filter_group_id = " . $filter_group_id . " and name = '" . $filter_item . "'")->find();
                 if (!$filter_row) {
                     $filter_row = array();
                     $filter_row['name'] = $filter_item;
                     $filter_row['filter_group_id'] = $filter_group_id;
                     M("Filter")->add($filter_row);
                 }
             }
         }
         foreach ($_REQUEST['deal_cate_type_id'] as $type_id) {
             $link_data = array();
             $link_data['deal_cate_type_id'] = $type_id;
             $link_data['deal_id'] = $list;
             M("DealCateTypeDealLink")->add($link_data);
         }
         foreach ($_REQUEST['location_id'] as $location_id) {
             $link_data = array();
             $link_data['location_id'] = $location_id;
             $link_data['deal_id'] = $list;
             M("DealLocationLink")->add($link_data);
         }
         //成功提示
         syn_deal_status($list);
         foreach ($_REQUEST['location_id'] as $location_id) {
             recount_supplier_data_count($location_id, "daijin");
         }
         syn_deal_match($list);
         clear_auto_cache("byouhui_filter_nav_cache");
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         $dbErr = M()->getDbError();
         save_log($log_info . L("INSERT_FAILED") . $dbErr, 0);
         $this->error(L("INSERT_FAILED") . $dbErr);
     }
 }
 public function foreverdelete()
 {
     //彻底删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         if (M("SupplierLocationDp")->where(array('supplier_location_id' => array('in', explode(',', $id))))->count() > 0) {
             $this->error("请先清空商户的点评", $ajax);
         }
         $rel_data = M(MODULE_NAME)->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['name'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $list = M(MODULE_NAME)->where($condition)->delete();
         //删除相关预览图
         //				foreach($rel_data as $data)
         //				{
         //					@unlink(get_real_path().$data['preview']);
         //				}
         if ($list !== false) {
             clear_auto_cache("store_filter_nav_cache");
             M("SupplierTagGroupPreset")->where(array('supplier_location_id' => array('in', explode(',', $id))))->delete();
             M("SupplierTag")->where(array('supplier_location_id' => array('in', explode(',', $id))))->delete();
             M("SupplierLocationPointResult")->where(array('supplier_location_id' => array('in', explode(',', $id))))->delete();
             M("DealLocationLink")->where(array('location_id' => array('in', explode(',', $id))))->delete();
             M("YouhuiLocationLink")->where(array('location_id' => array('in', explode(',', $id))))->delete();
             M("DealCateTypeLocationLink")->where(array('location_id' => array('in', explode(',', $id))))->delete();
             M("SupplierAccountLocationLink")->where(array('location_id' => array('in', explode(',', $id))))->delete();
             M("TagUserVote")->where(array('location_id' => array('in', explode(',', $id))))->delete();
             M("SupplierLocationImages")->where(array('supplier_location_id' => array('in', explode(',', $id))))->delete();
             M("SupplierLocationAreaLink")->where(array('location_id' => array('in', explode(',', $id))))->delete();
             M("SupplierLocationBrandLink")->where(array('location_id' => array('in', explode(',', $id))))->delete();
             clear_auto_cache("static_goods_info");
             save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
             $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
         } else {
             save_log($info . l("FOREVER_DELETE_FAILED"), 0);
             $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
 public function uninstall()
 {
     $ajax = intval($_REQUEST['ajax']);
     $id = intval($_REQUEST['id']);
     $data = M(MODULE_NAME)->getById($id);
     if ($data) {
         $info = $data['name'];
         $list = M(MODULE_NAME)->where(array('id' => $data['id']))->delete();
         if ($list !== false) {
             save_log($info . l("UNINSTALL_SUCCESS"), 1);
             clear_auto_cache("group_array_cache");
             $this->success(l("UNINSTALL_SUCCESS"), $ajax);
         } else {
             save_log($info . l("UNINSTALL_FAILED"), 0);
             $this->error(l("UNINSTALL_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
 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"));
     }
 }
 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 set_effect()
 {
     $id = intval($_REQUEST['id']);
     $ajax = intval($_REQUEST['ajax']);
     $info = M(MODULE_NAME)->where("id=" . $id)->getField("title");
     $c_is_effect = M(MODULE_NAME)->where("id=" . $id)->getField("is_effect");
     //当前状态
     $n_is_effect = $c_is_effect == 0 ? 1 : 0;
     //需设置的状态
     M(MODULE_NAME)->where("id=" . $id)->setField("is_effect", $n_is_effect);
     save_log($info . l("SET_EFFECT_" . $n_is_effect), 1);
     clear_auto_cache("get_help_cache");
     $this->ajaxReturn($n_is_effect, l("SET_EFFECT_" . $n_is_effect), 1);
 }
 public function foreverdelete()
 {
     //彻底删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         if (M("Article")->where(array('cate_id' => array('in', explode(',', $id))))->count() > 0) {
             $this->error(l("SUB_ARTICLE_EXIST"), $ajax);
         }
         $rel_data = M(MODULE_NAME)->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['title'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $list = M(MODULE_NAME)->where($condition)->delete();
         if ($list !== false) {
             save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
             clear_auto_cache("cache_shop_acate_tree");
             clear_auto_cache("deal_shop_acate_belone_ids");
             clear_auto_cache("get_help_cache");
             $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
         } else {
             save_log($info . l("FOREVER_DELETE_FAILED"), 0);
             $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
Example #17
0
 public function foreverdelete()
 {
     //彻底删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         $rel_data = M("licai")->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['title'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $list = M("licai")->where($condition)->delete();
         //删除相关预览图
         //				foreach($rel_data as $data)
         //				{
         //					@unlink(get_real_path().$data['preview']);
         //				}
         if ($list !== false) {
             save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
             clear_auto_cache("get_help_cache");
             $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
         } else {
             save_log($info . l("FOREVER_DELETE_FAILED"), 0);
             $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
 public function foreverdelete()
 {
     //彻底删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         if (M("DealCate")->where(array('pid' => array('in', explode(',', $id))))->count() > 0) {
             $this->error(l("SUB_DEALCATE_EXIST"), $ajax);
         }
         if (M("Deal")->where(array('cate_id' => array('in', explode(',', $id))))->count() > 0) {
             $this->error(l("SUB_DEAL_EXIST"), $ajax);
         }
         $rel_data = M(MODULE_NAME)->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['name'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $list = M(MODULE_NAME)->where($condition)->delete();
         if ($list !== false) {
             save_log($info . l("FOREVER_DELETE_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("FOREVER_DELETE_SUCCESS"), $ajax);
         } else {
             save_log($info . l("FOREVER_DELETE_FAILED"), 0);
             $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
Example #19
0
 public function foreverdelete()
 {
     //彻底删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         $rel_data = M(MODULE_NAME)->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['user_name'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $ids = explode(',', $id);
         foreach ($ids as $uid) {
             delete_user($uid);
         }
         save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
         clear_auto_cache("consignee_info");
         $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
 public function foreverdelete()
 {
     //删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         $rel_data = M(MODULE_NAME)->where($condition)->findAll();
         foreach ($rel_data as $data) {
             $info[] = $data['name'];
         }
         if ($info) {
             $info = implode(",", $info);
         }
         $list = M(MODULE_NAME)->where($condition)->delete();
         if ($list !== false) {
             clear_auto_cache("fyouhui_filter_nav_cache");
             $locations = M("YouhuiLocationLink")->where(array('youhui_id' => array('in', explode(',', $id))))->findAll();
             M("DealCateTypeYouhuiLink")->where(array('youhui_id' => array('in', explode(',', $id))))->delete();
             M("YouhuiLocationLink")->where(array('youhui_id' => array('in', explode(',', $id))))->delete();
             foreach ($locations as $location) {
                 recount_supplier_data_count($location['location_id'], "youhui");
             }
             save_log($info . l("DELETE_SUCCESS"), 1);
             $this->success(l("DELETE_SUCCESS"), $ajax);
         } else {
             save_log($info . l("DELETE_FAILED"), 0);
             $this->error(l("DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }