|
@@ -106,254 +106,6 @@ class indexControl extends specialControl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public function homeOp()
|
|
|
- {
|
|
|
- if($this->cur_page == 1) {
|
|
|
- $start = microtime(true);
|
|
|
- $ret = $this->pub_special(self::HomeSpecialID);
|
|
|
- $ret['mobile_page'] = mobile_page(2);
|
|
|
- perfor_period("home",$start,"index");
|
|
|
-
|
|
|
- return self::outsuccess($ret,"shop/home");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $goods_ids = activity_helper::recomoned_goodsids();
|
|
|
-
|
|
|
- $ret = array_chunk($goods_ids,$this->page_size());
|
|
|
- $pages = count($ret);
|
|
|
- $page_no = $pages >= $this->page_no() ? $this->page_no() : $pages;
|
|
|
- $goods_ids = $ret[$page_no - 1];
|
|
|
-
|
|
|
- $helper = new goods_helper();
|
|
|
- $ret = $helper->online_summary($goods_ids,$other_goods);
|
|
|
-
|
|
|
- $blocks = [];
|
|
|
- $blocks[] = special_formater::format_goods($goods_ids,"热门推荐",$ret['sort_summary']);
|
|
|
-
|
|
|
- self::outsuccess(array('special_list' => $blocks,
|
|
|
- 'summary' => $ret['summary'],
|
|
|
- 'groupbuy' => $ret['groupbuy'],
|
|
|
- 'limitime' => $ret['limitime'],
|
|
|
- 'bundling' => $ret['bundling'],
|
|
|
- 'mobile_page' => mobile_page($pages + 1)));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- private function old_homeid()
|
|
|
- {
|
|
|
- if(is_publish()) {
|
|
|
- return 61;
|
|
|
- } else {
|
|
|
- return 36;
|
|
|
- }
|
|
|
- }
|
|
|
- public function indexOp()
|
|
|
- {
|
|
|
- $mb_special = Model('mb_special');
|
|
|
- $special_list = $mb_special->getMbSpecialItemUsableListByIDEx($this->old_homeid());
|
|
|
- $sale_list = $this->sale_list();
|
|
|
- return self::outsuccess(array('special_list' => $special_list, 'sale_list' => $sale_list));
|
|
|
- }
|
|
|
-
|
|
|
- public function indexexOp()
|
|
|
- {
|
|
|
- $helper = new special_formater($this->old_homeid());
|
|
|
- $ret = $helper->format($goods_ids);
|
|
|
- $sale_list = $this->sale_list();
|
|
|
- $helper = new goods_helper();
|
|
|
- $goods_list = $helper->get_infos($goods_ids);
|
|
|
- return self::outsuccess(array('special_list' => $ret,'goods_list' =>$goods_list, 'sale_list' => $sale_list));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 专题
|
|
|
- */
|
|
|
- public function specialOp()
|
|
|
- {
|
|
|
- if(!isset($_GET['special_id']) || empty($_GET['special_id'])) {
|
|
|
- return self::outerr(errcode::ErrParamter);
|
|
|
- }
|
|
|
- $mb_special = Model('mb_special');
|
|
|
- $special_list = $mb_special->getMbSpecialItemUsableListByIDEx($_GET['special_id']);
|
|
|
- return self::outsuccess(array('special_list' => $special_list));
|
|
|
- }
|
|
|
-
|
|
|
- public function specialexOp()
|
|
|
- {
|
|
|
- if(!isset($_GET['special_id']) || empty($_GET['special_id'])) {
|
|
|
- return self::outerr(errcode::ErrParamter);
|
|
|
- }
|
|
|
- $special_id = intval($_GET['special_id']);
|
|
|
-
|
|
|
- $helper = new special_formater($special_id);
|
|
|
- $ret = $helper->format($goods_ids);
|
|
|
-
|
|
|
- $mod_goods = Model('goods');
|
|
|
- $items = $mod_goods->field('goods_commonid')->where(array('goods_id' => array('in',$goods_ids)))->limit(false)->select();
|
|
|
- $goods_commonids = array();
|
|
|
- foreach ($items as $val) {
|
|
|
- array_push($goods_commonids,intval($val['goods_commonid']));
|
|
|
- }
|
|
|
- $helper = new goods_helper();
|
|
|
- $goods_list = $helper->get_distinct($goods_commonids);
|
|
|
- return self::outsuccess(array('special_list' => $ret,'goods_list' =>$goods_list));
|
|
|
- }
|
|
|
-
|
|
|
- static private function validate_type($type, $data)
|
|
|
- {
|
|
|
- $types = array('keyword', 'special', 'goods', 'url');
|
|
|
- if (empty($type) || !in_array($type, $types)) {
|
|
|
- return array('code' => errcode::ErrSpecial, 'msg' => '错误的参数.');
|
|
|
- }
|
|
|
- $validator = new Validator();
|
|
|
- if ($type === 'special') {
|
|
|
- $validator->setValidate(Validator::verify_number($data, 'special data error.'));
|
|
|
- } elseif ($type === 'keyword') {
|
|
|
-
|
|
|
- } elseif ($type === 'goods') {
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- $err = $validator->validate();
|
|
|
- if ($err != '') {
|
|
|
- return array('code' => errcode::ErrSpecial,'msg' => $err);
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function advOp()
|
|
|
- {
|
|
|
- $type = $_GET['type'];
|
|
|
- $data = $_GET['data'];
|
|
|
- $ret = self::validate_type($type, $data);
|
|
|
- if ($ret != true) {
|
|
|
- return self::outerr($ret['code'],$ret['msg']);
|
|
|
- }
|
|
|
-
|
|
|
- if ($type === 'special') {
|
|
|
- $mb_special = Model('mb_special');
|
|
|
- $ret = $mb_special->getMbSpecialItemUsableListByID($data);
|
|
|
- } elseif ($type === 'keyword') {
|
|
|
-
|
|
|
- } elseif ($type === 'goods') {
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- self::outsuccess($ret);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取打赏接口数据
|
|
|
- */
|
|
|
- private function sale_list()
|
|
|
- {
|
|
|
- $prefix = 'mb_salelist';
|
|
|
- $codeid = 122;
|
|
|
-
|
|
|
- $ret = rcache($codeid, $prefix);
|
|
|
- if (empty($ret))
|
|
|
- {
|
|
|
- $web_code = Model('web_code');
|
|
|
- $result = $web_code->where(array('code_id' => 122, 'web_id' => 122))->select();
|
|
|
- if (!empty($result)) {
|
|
|
- $top = $result[0];
|
|
|
- $tops = unserialize($top['code_info']);
|
|
|
- }
|
|
|
- if (empty($tops)) return array();
|
|
|
-
|
|
|
- $ret = array();
|
|
|
- foreach ($tops as $id => $val) {
|
|
|
- $item = array();
|
|
|
- $item['id'] = $id;
|
|
|
- $img = $val['img_name'];
|
|
|
- if (!empty($img)) {
|
|
|
- $item['image'] = UPLOAD_SITE_URL . DS . $img;
|
|
|
- $item['title'] = $val['recommend']['name'];
|
|
|
- array_push($ret, $item);
|
|
|
- }
|
|
|
- }
|
|
|
- wcache($codeid, array("salelist" => serialize($ret)), $prefix);
|
|
|
- } else {
|
|
|
- $ret = unserialize($ret['salelist']);
|
|
|
- }
|
|
|
-
|
|
|
- return $ret;
|
|
|
- }
|
|
|
-
|
|
|
- public function sale_listOp()
|
|
|
- {
|
|
|
- $prefix = 'mb_salelist_content';
|
|
|
- $codeid = 122;
|
|
|
-
|
|
|
- $ret = rcache($codeid, $prefix);
|
|
|
- if (empty($ret))
|
|
|
- {
|
|
|
- $web_code = Model('web_code');
|
|
|
- $result = $web_code->where(array('code_id' => 122, 'web_id' => 122))->select();
|
|
|
- if (!empty($result)) {
|
|
|
- $top = $result[0];
|
|
|
- $tops = unserialize($top['code_info']);
|
|
|
- }
|
|
|
- if (empty($tops)) return NULL;
|
|
|
- $ret = array();
|
|
|
- foreach ($tops as $id => $val) {
|
|
|
- $item['id'] = $id;
|
|
|
- $item['image'] = UPLOAD_SITE_URL . DS . $val['img_name'];
|
|
|
- $item['title'] = $val['recommend']['name'];
|
|
|
- $goods_list = $val['goods_list'];
|
|
|
- $item['goods_list'] = array();
|
|
|
- foreach ($goods_list as $goods_val) {
|
|
|
- $goods_val['goods_pic'] = UPLOAD_SITE_URL . DS . $goods_val['goods_pic'];
|
|
|
- array_push($item['goods_list'], $goods_val);
|
|
|
- }
|
|
|
- array_push($ret, $item);
|
|
|
- }
|
|
|
- wcache($codeid, array("salelist_content" => serialize($ret)), $prefix);
|
|
|
- } else {
|
|
|
- $ret = unserialize($ret['salelist_content']);
|
|
|
- }
|
|
|
-
|
|
|
- self::outsuccess(array('sale_list' => $ret));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * android客户端版本号
|
|
|
- */
|
|
|
- public function apk_versionOp()
|
|
|
- {
|
|
|
- $version = C('mobile_apk_version');
|
|
|
- $url = C('mobile_apk');
|
|
|
- if (empty($version)) {
|
|
|
- $version = '';
|
|
|
- }
|
|
|
- if (empty($url)) {
|
|
|
- $url = '';
|
|
|
- }
|
|
|
-
|
|
|
- return self::outsuccess(array('version' => $version, 'url' => $url));
|
|
|
- }
|
|
|
-
|
|
|
- public function show_goodsOp()
|
|
|
- {
|
|
|
- $goods_ids = activity_helper::recomoned_goodsids();
|
|
|
- $ret = array_chunk($goods_ids,$this->page_size());
|
|
|
- $pages = count($ret);
|
|
|
- $page_no = $pages >= $this->page_no() ? $this->page_no() : $pages;
|
|
|
- $goods_ids = $ret[$page_no - 1];
|
|
|
-
|
|
|
- $helper = new goods_helper();
|
|
|
- $goods_list = $helper->get_infos($goods_ids);
|
|
|
- self::outsuccess(array('goods_list' => $goods_list, 'mobile_page' => mobile_page($pages)));
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class tpl_member
|