Пример #1
0
 /**
  * 删除缓存数据
  */
 public function dropCache()
 {
     $this->cachedData = null;
     $this->gcForCacheModel = null;
     uk86_dkcache('gc_class');
     uk86_dkcache('all_categories');
 }
Пример #2
0
 /**
  * 清理缓存
  */
 public function clearOp()
 {
     if (!uk86_chksubmit()) {
         Tpl::showpage('cache.clear');
         return;
     }
     $lang = Uk86Language::uk86_getLangContent();
     // 清理所有缓存
     if ($_POST['cls_full'] == 1) {
         foreach ($this->cacheItems as $i) {
             uk86_dkcache($i);
         }
         // 表主键
         Model::dropTablePkArrayCache();
         // 商品分类
         uk86_dkcache('gc_class');
         uk86_dkcache('all_categories');
         uk86_dkcache('goods_class_seo');
         uk86_dkcache('class_tag');
         // 广告
         Model('adv')->makeApAllCache();
         // 首页
         Model('web_config')->getWebHtml('index', 1);
         uk86_delCacheFile('index');
     } else {
         $todo = (array) $_POST['cache'];
         foreach ($this->cacheItems as $i) {
             if (in_array($i, $todo)) {
                 uk86_dkcache($i);
             }
         }
         // 表主键
         if (in_array('table', $todo)) {
             Model::dropTablePkArrayCache();
         }
         // 商品分类
         if (in_array('goodsclass', $todo)) {
             uk86_dkcache('gc_class');
             uk86_dkcache('all_categories');
             uk86_dkcache('goods_class_seo');
             uk86_dkcache('class_tag');
         }
         // 广告
         if (in_array('adv', $todo)) {
             Model('adv')->makeApAllCache();
         }
         // 首页
         if (in_array('index', $todo)) {
             Model('web_config')->getWebHtml('index', 1);
             uk86_delCacheFile('index');
         }
     }
     $this->log(L('cache_cls_operate'));
     uk86_showMessage($lang['cache_cls_ok']);
 }
Пример #3
0
 /**
  * ajax操作
  */
 public function ajaxOp()
 {
     switch ($_GET['branch']) {
         case 'state':
             $model_brand = Model('express');
             $update_array = array();
             $update_array['id'] = intval($_GET['id']);
             $update_array[$_GET['column']] = trim($_GET['value']);
             $model_brand->update($update_array);
             uk86_dkcache('express');
             $this->log(L('nc_edit,express_name,express_state') . '[ID:' . intval($_GET['id']) . ']', 1);
             echo 'true';
             exit;
             break;
         case 'order':
             $_GET['value'] = $_GET['value'] == 0 ? 2 : 1;
             $model_brand = Model('express');
             $update_array = array();
             $update_array['id'] = intval($_GET['id']);
             $update_array[$_GET['column']] = trim($_GET['value']);
             $model_brand->update($update_array);
             uk86_dkcache('express');
             $this->log(L('nc_edit,express_name,express_state') . '[ID:' . intval($_GET['id']) . ']', 1);
             echo 'true';
             exit;
             break;
         case 'e_zt_state':
             $model_brand = Model('express');
             $update_array = array();
             $update_array['id'] = intval($_GET['id']);
             $update_array[$_GET['column']] = trim($_GET['value']);
             $model_brand->update($update_array);
             uk86_dkcache('express');
             $this->log(L('nc_edit,express_name,express_state') . '[ID:' . intval($_GET['id']) . ']', 1);
             echo 'true';
             exit;
             break;
     }
     uk86_dkcache('express');
 }
Пример #4
0
 /**
  * 幻灯片清空
  */
 public function slider_clearOp()
 {
     $model_setting = Model('setting');
     $update = array();
     $update['live_pic1'] = '';
     $update['live_link1'] = '';
     $update['live_pic2'] = '';
     $update['live_link2'] = '';
     $update['live_pic3'] = '';
     $update['live_link3'] = '';
     $update['live_pic4'] = '';
     $update['live_link4'] = '';
     $res = $model_setting->updateSetting($update);
     if ($res) {
         uk86_dkcache('setting');
         $this->log('清空抢购幻灯片设置', 1);
         echo json_encode(array('result' => 'true'));
     } else {
         echo json_encode(array('result' => 'false'));
     }
     exit;
 }
Пример #5
0
 /**
  * 删除缓存
  */
 public function dropApCacheByAdvIds($advIds)
 {
     $apIds = array_keys((array) Model()->table('adv')->field('ap_id')->where(array('adv_id' => array('in', (array) $advIds)))->key('ap_id')->select());
     foreach ($apIds as $apId) {
         $apId = (int) $apId;
         uk86_dkcache("adv/{$apId}");
     }
 }
Пример #6
0
 /**
  * 删除表主键缓存
  */
 public static function dropTablePkArrayCache()
 {
     uk86_dkcache('field/_pk');
 }
Пример #7
0
 /**
  * 更新圈子成员等级缓存
  */
 public function update_cacheOp()
 {
     uk86_dkcache('circle_level');
     uk86_showMessage(L('nc_common_op_succ'), 'index.php?act=circle_memberlevel');
 }
Пример #8
0
 /**
  * 分类SEO保存
  *
  */
 public function seo_categoryOp()
 {
     if (uk86_chksubmit()) {
         $where = array('gc_id' => intval($_POST['category']));
         $input = array();
         $input['gc_title'] = $_POST['cate_title'];
         $input['gc_keywords'] = $_POST['cate_keywords'];
         $input['gc_description'] = $_POST['cate_description'];
         if (Model('goods_class')->editGoodsClass($input, $where)) {
             uk86_dkcache('goods_class_seo');
             uk86_showMessage(L('nc_common_save_succ'));
         }
     }
     uk86_showMessage(L('nc_common_save_fail'));
 }
Пример #9
0
 /**
  * 编辑频道模块
  */
 public function set_channelOp()
 {
     $model_class = Model('goods_class');
     $parent_goods_class = $model_class->getTreeClassList(2);
     //商品分类父类列表,只取到第二级
     $service_cities = Model("area")->getServiceGoodsCity();
     //获取开通本地化城市的列表
     $parent_class = array();
     if (is_array($parent_goods_class) && !empty($parent_goods_class)) {
         foreach ($parent_goods_class as $k => $v) {
             $gc_id = $v['gc_id'];
             $parent_class[$gc_id]['parent_name'] = $v['gc_name'];
             $parent_id = $v['gc_parent_id'];
             if ($parent_id > 0) {
                 $parent_class[$gc_id]['parent_name'] = $parent_class[$parent_id]['parent_name'] . ' > ' . $v['gc_name'];
             }
             $parent_goods_class[$k]['gc_name'] = str_repeat(" ", $v['deep'] * 2) . $v['gc_name'];
         }
     }
     Tpl::output('parent_goods_class', $parent_goods_class);
     Tpl::output('service_cities', $service_cities);
     //传递给前台页面
     $model_channel = Model('web_channel');
     $condition = array();
     $condition['channel_id'] = intval($_GET['channel_id']);
     $channel_list = $model_channel->getChannelList($condition);
     $channel = $channel_list[0];
     if (uk86_chksubmit()) {
         $channel_array = array();
         $gc_name = '';
         $area_name = '';
         $floor_ids = '';
         $gc_id = intval($_POST['gc_id']);
         $area_id = intval($_POST['area_id']);
         if ($gc_id > 0) {
             $gc_name = $parent_class[$gc_id]['parent_name'];
             $model_channel->editChannelGoodsClass($gc_id);
             //消除分类已绑定的频道
         } else {
             if ($area_id > 0) {
                 foreach ($service_cities as $key => $area) {
                     if ($area['area_id'] == $area_id) {
                         $area_name = $area['area_name'];
                     }
                 }
                 $model_channel->editChannelCityArea($area_id);
                 //消除分类已绑定的频道
             }
         }
         $channel_array['gc_id'] = $gc_id;
         $channel_array['gc_name'] = $gc_name;
         $channel_array['top_id'] = $_POST['top_id'];
         $channel_array['area_id'] = $area_id;
         $channel_array['area_name'] = $area_name;
         if (!empty($_POST['floor_ids']) && is_array($_POST['floor_ids'])) {
             $floor_ids = implode(',', $_POST['floor_ids']);
             $floor_ids = ',' . $floor_ids . ',';
         }
         $channel_array['floor_ids'] = $floor_ids;
         $channel_array['update_time'] = time();
         $state = $model_channel->editChannel($condition, $channel_array);
         //更新数据库
         if ($state) {
             $this->log('编辑商城频道,编号' . $condition['channel_id']);
             uk86_dkcache('channel');
             uk86_showMessage(Uk86Language::uk86_get('nc_common_save_succ'), 'index.php?act=web_channel&op=web_channel');
         } else {
             uk86_showMessage(Uk86Language::uk86_get('nc_common_save_fail'));
         }
     }
     Tpl::output('channel', $channel);
     Tpl::output('gc_id', $channel['gc_id']);
     Tpl::output('area_id', $channel['area_id']);
     Tpl::output('top_id', $channel['top_id']);
     $condition = array();
     $condition['web_page'] = 'channel_tp';
     $top_list = $model_channel->getFloorList($condition);
     Tpl::output('top_list', $top_list);
     $floor_list = $model_channel->getChannelFloor($channel['floor_ids']);
     Tpl::output('floor_list', $floor_list);
     Tpl::showpage('web_channel.set');
 }
Пример #10
0
 /**
  * 更新信息
  *
  * @param array $param 更新数据
  * @return bool 布尔类型的返回结果
  */
 public function updateSetting($param)
 {
     if (empty($param)) {
         return false;
     }
     if (is_array($param)) {
         foreach ($param as $k => $v) {
             $tmp = array();
             $specialkeys_arr = array('statistics_code');
             $tmp['value'] = in_array($k, $specialkeys_arr) ? htmlentities($v, ENT_QUOTES) : $v;
             $where = " name = '" . $k . "'";
             $result = Db::update('setting', $tmp, $where);
             if ($result !== true) {
                 return $result;
             }
         }
         uk86_dkcache('setting');
         // @unlink(BASE_DATA_PATH.DS.'cache'.DS.'setting.php');
         return true;
     } else {
         return false;
     }
 }
Пример #11
0
 /**
  * 删除等级
  */
 public function store_grade_delOp()
 {
     /**
      * 读取语言包
      */
     $lang = Uk86Language::uk86_getLangContent();
     $model_grade = Model('store_grade');
     if (intval($_GET['sg_id']) > 0) {
         //判断是否默认等级,默认等级不能删除
         if ($_GET['sg_id'] == 1) {
             //uk86_showMessage('默认等级不能删除 ','index.php?act=store_grade&op=store_grade');
             uk86_showMessage($lang['default_store_grade_no_del'], 'index.php?act=store_grade&op=store_grade');
         }
         //判断该等级下是否存在店铺,存在的话不能删除
         if (!$this->isable_delGrade(intval($_GET['sg_id']))) {
             uk86_showMessage($lang['del_gradehavestore'], 'index.php?act=store_grade&op=store_grade');
         }
         /**
          * 删除分类
          */
         $model_grade->del(intval($_GET['sg_id']));
         uk86_dkcache('store_grade');
         $this->log(L('nc_del,store_grade') . '[ID:' . intval($_GET['sg_id']) . ']', 1);
         uk86_showMessage($lang['nc_common_del_succ'], 'index.php?act=store_grade&op=store_grade');
     } else {
         uk86_showMessage($lang['nc_common_del_fail'], 'index.php?act=store_grade&op=store_grade');
     }
 }
Пример #12
0
 /**
  * 编辑保存推荐位
  *
  */
 public function rec_edit_saveOp()
 {
     if (!is_numeric($_POST['rec_id'])) {
         uk86_showMessage(Uk86Language::uk86_get('param_error'));
     }
     $array = array();
     $data = array();
     $pattern = "/^http:\\/\\/[A-Za-z0-9]+[A-Za-z0-9.]+\\.[A-Za-z0-9]+/i";
     //文字类型
     if ($_POST['rec_type'] == 1) {
         if (is_array($_POST['txt']) && is_array($_POST['urltxt'])) {
             foreach ($_POST['txt'] as $k => $v) {
                 if (trim($v) == '') {
                     continue;
                 }
                 $c = count($array['body']);
                 $array['body'][$c]['title'] = $v;
                 $array['body'][$c]['url'] = preg_match($pattern, $_POST['urltxt'][$k]) ? $_POST['urltxt'][$k] : '';
                 $data['pic_type'] = 0;
             }
         } else {
             uk86_showMessage(Uk86Language::uk86_get('param_error'));
         }
     } elseif ($_POST['rec_type'] == 2 && $_POST['pic_type'] == 1) {
         //本地图片上传
         if (is_array($_FILES['pic']['tmp_name'])) {
             foreach ($_FILES['pic']['tmp_name'] as $k => $v) {
                 //未上传新图的,还用老图
                 if (empty($v) && !empty($_POST['opic'][$k])) {
                     $array['body'][$k]['title'] = str_ireplace(UPLOAD_SITE_URL . '/', '', $_POST['opic'][$k]);
                     $array['body'][$k]['url'] = preg_match($pattern, $_POST['urlup'][$k]) ? $_POST['urlup'][$k] : '';
                 }
                 $ext = strtolower(pathinfo($_FILES['pic']['name'][$k], PATHINFO_EXTENSION));
                 if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) {
                     $filename = substr(md5(microtime(true)), 0, 16) . rand(100, 999) . $k . '.' . $ext;
                     if ($_FILES['pic']['size'][$k] < 1024 * 1024) {
                         move_uploaded_file($v, BASE_UPLOAD_PATH . '/' . ATTACH_REC_POSITION . '/' . $filename);
                     }
                     if ($_FILES['pic']['error'][$k] != 0) {
                         uk86_showMessage(Uk86Language::uk86_get('nc_common_save_fail'));
                     }
                     //删除老图
                     $old_file = str_ireplace(array(UPLOAD_SITE_URL, '..'), array(BASE_UPLOAD_PATH, ''), $_POST['opic'][$k]);
                     if (is_file($old_file)) {
                         @unlink($old_file);
                     }
                     $array['body'][$k]['title'] = ATTACH_REC_POSITION . '/' . $filename;
                     $array['body'][$k]['url'] = preg_match($pattern, $_POST['urlup'][$k]) ? $_POST['urlup'][$k] : '';
                     $data['pic_type'] = 1;
                 }
             }
             //最后删除数据库里有但没有POST过来的图片
             $model = Model('rec_position');
             $oinfo = $model->where(array('rec_id' => $_POST['rec_id']))->find();
             $oinfo = unserialize($oinfo['content']);
             foreach ($oinfo['body'] as $k => $v) {
                 if (!in_array(UPLOAD_SITE_URL . '/' . $v['title'], (array) $_POST['opic'])) {
                     if (is_file(BASE_UPLOAD_PATH . '/' . $v['title'])) {
                         @unlink(BASE_UPLOAD_PATH . '/' . $v['title']);
                     }
                 }
             }
             unset($oinfo);
         }
         //如果是上传图片,则取原图片地址
         if (empty($array)) {
             if (is_array($_POST['opic'])) {
                 foreach ($_POST['opic'] as $k => $v) {
                     $array['body'][$k]['title'] = $v;
                     $array['body'][$k]['url'] = preg_match($pattern, $_POST['urlup'][$k]) ? $_POST['urlup'][$k] : '';
                 }
             }
         }
     } elseif ($_POST['rec_type'] == 2 && $_POST['pic_type'] == 2) {
         //远程图片
         if (is_array($_POST['pic'])) {
             foreach ($_POST['pic'] as $k => $v) {
                 if (!preg_match("/^(http\\:\\/\\/)/i", $v)) {
                     continue;
                 }
                 $ext = strtolower(pathinfo($v, PATHINFO_EXTENSION));
                 if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) {
                     $c = count($array['body']);
                     $array['body'][$c]['title'] = $v;
                     $array['body'][$c]['url'] = preg_match($pattern, $_POST['urlremote'][$k]) ? $_POST['urlremote'][$k] : '';
                     $data['pic_type'] = 2;
                 }
             }
         }
     } else {
         uk86_showMessage(Uk86Language::uk86_get('param_error'));
     }
     if ($_POST['rec_type'] != 1) {
         $array['width'] = is_numeric($_POST['rwidth']) ? $_POST['rwidth'] : '';
         $array['height'] = is_numeric($_POST['rheight']) ? $_POST['rheight'] : '';
     }
     $array['target'] = intval($_POST['rtarget']);
     $data['title'] = $_POST['rtitle'];
     $data['content'] = serialize($array);
     $model = Model('rec_position');
     //如果是把本地上传类型改为文字或远程,则先取出原来上传的图片路径,待update成功后,再删除这些图片
     if ($_POST['opic_type'] == 1 && ($_POST['pic_type'] == 2 || $_POST['rec_type'] == 1)) {
         $oinfo = $model->where(array('rec_id' => $_POST['rec_id']))->find();
         $oinfo = unserialize($oinfo['content']);
     }
     $result = $model->where(array('rec_id' => $_POST['rec_id']))->update($data);
     if ($result) {
         if ($oinfo) {
             foreach ($oinfo['body'] as $v) {
                 if (is_file(BASE_UPLOAD_PATH . '/' . $v['title'])) {
                     @unlink(BASE_UPLOAD_PATH . '/' . $v['title']);
                 }
             }
         }
         uk86_dkcache("rec_position/{$_POST['rec_id']}");
         uk86_showMessage(Uk86Language::uk86_get('nc_common_save_succ'), 'index.php?act=rec_position&op=rec_list');
     } else {
         uk86_showMessage(Uk86Language::uk86_get('nc_common_save_fail'), 'index.php?act=rec_position&op=rec_list');
     }
 }
Пример #13
0
 /**
  * ajax操作
  */
 public function ajaxOp()
 {
     switch ($_GET['branch']) {
         /**
          * 页面导航 排序
          */
         case 'nav_sort':
             $model_navigation = Model('navigation');
             $update_array = array();
             $update_array['nav_id'] = intval($_GET['id']);
             $update_array[$_GET['column']] = trim($_GET['value']);
             $result = $model_navigation->update($update_array);
             uk86_dkcache('nav');
             echo 'true';
             exit;
             break;
     }
 }
Пример #14
0
 /**
  * 删除缓存
  *
  * @param string $key 缓存键
  */
 public function dropCachedData($key)
 {
     unset($this->cachedData[$key]);
     uk86_dkcache($key);
 }
Пример #15
0
 /**
  * 删除缓存自营店铺的ID
  */
 public function dropCachedOwnShopIds()
 {
     $this->ownShopIds = null;
     uk86_dkcache('own_shop_ids');
 }