示例#1
0
 public function associate()
 {
     $words = $_POST['words'];
     $searchrule = searchrule_search::instance('search_associate');
     if ($searchrule && !empty($words)) {
         $result = $searchrule->get_woreds($words);
         return $result;
     } else {
         return array();
     }
 }
示例#2
0
 public function associate()
 {
     $words = $_POST['value'];
     $searchrule = searchrule_search::instance('search_associate');
     if ($searchrule && !empty($words)) {
         $result = $searchrule->get_woreds($words);
         echo json_encode($result);
         exit;
     } else {
         echo '';
         exit;
     }
 }
示例#3
0
 public function get_goods($filter, $page = 1, $orderby)
 {
     $goodsObject = kernel::single('b2c_goods_object');
     $goodsModel = app::get('b2c')->model('goods');
     $userObject = kernel::single('b2c_user_object');
     $member_id = $userObject->get_member_id();
     if (empty($member_id)) {
         $this->pagedata['login'] = '******';
     }
     $page = $page ? $page : 1;
     $pageLimit = $this->app->getConf('gallery.display.listnum');
     $pageLimit = $pageLimit ? $pageLimit : 20;
     $this->pagedata['pageLimit'] = $pageLimit;
     $goodsData = $goodsModel->getList('*', $filter, $pageLimit * ($page - 1), $pageLimit, $orderby, $total = false);
     if ($goodsData && $total === false) {
         $total = $goodsModel->count($filter);
     }
     $this->pagedata['total'] = $total;
     $pagetotal = $this->pagedata['total'] ? ceil($this->pagedata['total'] / $pageLimit) : 1;
     $max_pagetotal = $this->app->getConf('gallery.display.pagenum');
     $max_pagetotal = $max_pagetotal ? $max_pagetotal : 100;
     $this->pagedata['pagetotal'] = $pagetotal > $max_pagetotal ? $max_pagetotal : $pagetotal;
     $this->pagedata['page'] = $page;
     //分页
     $this->pagedata['pager'] = array('current' => $page, 'total' => $this->pagedata['pagetotal'], 'link' => $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_gallery', 'act' => 'ajax_get_goods')));
     $gfav = explode(',', $_COOKIE['S']['GFAV'][$member_id]);
     foreach ($goodsData as $key => $goods_row) {
         if (in_array($goods_row['goods_id'], $gfav)) {
             $goodsData[$key]['is_fav'] = 'true';
         }
         if ($goods_row['udfimg'] == 'true' && $goods_row['thumbnail_pic']) {
             $goodsData[$key]['image_default_id'] = $goods_row['thumbnail_pic'];
         }
         $gids[$key] = $goods_row['goods_id'];
     }
     if ($filter['search_keywords'] || $filter['virtual_cat_id']) {
         if (kernel::service('server.search_type.b2c_goods') && ($searchrule = searchrule_search::instance('b2c_goods'))) {
             if ($searchrule) {
                 $catCount = $searchrule->get_cat($filter);
             }
         } else {
             $sfilter = 'select cat_id,count(cat_id) as count from sdb_b2c_goods WHERE ';
             $sfilter .= $goodsModel->_filter($filter);
             $sfilter .= ' group by cat_id';
             $cats = $goodsModel->db->select($sfilter);
             if ($cats) {
                 foreach ($cats as $cat_row) {
                     $catCount[$cat_row['cat_id']] = $cat_row['count'];
                 }
             }
         }
     }
     //搜索时的分类
     if (!empty($catCount) && count($catCount) != 1) {
         arsort($catCount);
         $this->pagedata['show_cat_id'] = key($catCount);
         $this->pagedata['catArr'] = array_keys($catCount);
         $this->catCount = $catCount;
     } else {
         $this->pagedata['show_cat_id'] = key($catCount);
     }
     //货品
     $goodsData = $this->get_product($gids, $goodsData);
     //促销标签
     $goodsData = $this->get_goods_promotion($gids, $goodsData);
     //商品标签信息
     foreach (kernel::servicelist('tags_special.add') as $services) {
         if (is_object($services)) {
             if (method_exists($services, 'add')) {
                 $services->add($gids, $goodsData);
             }
         }
     }
     $goodsData = $this->get_goods_point($gids, $goodsData);
     return $goodsData;
 }
示例#4
0
 function pre_recycle($rows)
 {
     $obj_check_order = kernel::single('b2c_order_checkorder');
     $objProduct = $this->app->model('products');
     if (is_array($rows)) {
         foreach ($rows as $key => $val) {
             $product_id = $objProduct->getList('product_id', array('goods_id' => $val['goods_id']));
             foreach ($product_id as $pkey => $pval) {
                 $orderStatus = $obj_check_order->check_order_product(array('goods_id' => $val['goods_id'], 'product_id' => $pval['product_id']));
                 if (!$orderStatus) {
                     $this->recycle_msg = '该商品有订单未处理 商品名称:' . $val['name'];
                     return false;
                 }
                 #检测special活动是否存活,是否可删除
                 $service_sepcial_goods_check = kernel::service('sepcial_goods_check');
                 if ($service_sepcial_goods_check != null) {
                     if (!$service_sepcial_goods_check->check_product_delete($pval['product_id'], $msg)) {
                         $this->recycle_msg = $msg . $val['name'];
                         return false;
                     }
                 }
                 //                  $special_status = kernel::single('starbuy_special_goods')->check_special_product($pval['product_id'],$msg);
                 //                  if(!$special_status){
                 //                      $this->recycle_msg = $msg.$val['name'];
                 //                      return false;
                 //                  }
             }
             foreach (kernel::servicelist("b2c_allow_delete_goods") as $object) {
                 if (!method_exists($object, 'is_delete')) {
                     continue;
                 }
                 if (!$object->is_delete($val['goods_id'])) {
                     $this->recycle_msg = $object->error_msg;
                     return false;
                 }
             }
             $gids['goods_id'][] = $val['goods_id'];
         }
         if (kernel::single('b2c_search_goods')->is_search_status()) {
             searchrule_search::instance('b2c_goods')->update(array('disabled' => '1'), $gids);
         }
     }
     return true;
 }