|
@@ -9,12 +9,14 @@
|
|
|
//use Shopnc\Tpl;
|
|
|
|
|
|
defined('InShopNC') or exit('Access Invalid!');
|
|
|
+
|
|
|
class indexControl extends mobileHomeControl
|
|
|
{
|
|
|
private $mb_special;
|
|
|
const HomeSpecialID = 0;
|
|
|
|
|
|
- public function __construct() {
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
parent::__construct();
|
|
|
$this->mb_special = Model('mb_special');
|
|
|
}
|
|
@@ -22,9 +24,9 @@ class indexControl extends mobileHomeControl
|
|
|
/**
|
|
|
* 首页
|
|
|
*/
|
|
|
- public function indexOp()
|
|
|
+ public function indexOp()
|
|
|
{
|
|
|
- if($_GET['type'] == 'html') {
|
|
|
+ if ($_GET['type'] == 'html') {
|
|
|
$model_mb_special = Model('mb_special');
|
|
|
$data = $model_mb_special->getMbSpecialIndex();
|
|
|
$this->_output_special($data, $_GET['type']);
|
|
@@ -32,29 +34,30 @@ class indexControl extends mobileHomeControl
|
|
|
$special_list = $this->mb_special->getMbSpecialItemUsableListByIDEx(self::HomeSpecialID);
|
|
|
$sale_list = $this->sale_list();
|
|
|
|
|
|
- $this->_output_special(array('special_list' => $special_list,'sale_list' => $sale_list),$_GET['type']);
|
|
|
+ $this->_output_special(array('special_list' => $special_list, 'sale_list' => $sale_list), $_GET['type']);
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 专题
|
|
|
*/
|
|
|
- public function specialOp() {
|
|
|
+ public function specialOp()
|
|
|
+ {
|
|
|
$model_mb_special = Model('mb_special');
|
|
|
$special_list = $model_mb_special->getMbSpecialItemUsableListByIDEx($_GET['special_id']);
|
|
|
- $this->_output_special(array('special_list' => $special_list),$_GET['type'], $_GET['special_id']);
|
|
|
+ $this->_output_special(array('special_list' => $special_list), $_GET['type'], $_GET['special_id']);
|
|
|
}
|
|
|
|
|
|
- static private function validate_type($type,$data)
|
|
|
+ static private function validate_type($type, $data)
|
|
|
{
|
|
|
- $types = array('keyword','special','goods','url');
|
|
|
- if (empty($type) || !in_array($type,$types)) {
|
|
|
- joutput_error(errcode::ErrSpecial,'error type.');
|
|
|
+ $types = array('keyword', 'special', 'goods', 'url');
|
|
|
+ if (empty($type) || !in_array($type, $types)) {
|
|
|
+ joutput_error(errcode::ErrSpecial, 'error type.');
|
|
|
return false;
|
|
|
}
|
|
|
$validator = new Validate();
|
|
|
- if($type === 'special') {
|
|
|
- $validator->setValidate(Validate::verify_number($data,'special data error.'));
|
|
|
+ if ($type === 'special') {
|
|
|
+ $validator->setValidate(Validate::verify_number($data, 'special data error.'));
|
|
|
} elseif ($type === 'keyword') {
|
|
|
|
|
|
} elseif ($type === 'goods') {
|
|
@@ -65,7 +68,7 @@ class indexControl extends mobileHomeControl
|
|
|
|
|
|
$err = $validator->validate();
|
|
|
if ($err != '') {
|
|
|
- joutput_error(errcode::ErrSpecial,$err);
|
|
|
+ joutput_error(errcode::ErrSpecial, $err);
|
|
|
return false;
|
|
|
} else {
|
|
|
return true;
|
|
@@ -77,9 +80,9 @@ class indexControl extends mobileHomeControl
|
|
|
$type = $_GET['type'];
|
|
|
$data = $_GET['data'];
|
|
|
|
|
|
- if(self::validate_type($type,$data) == false) return;
|
|
|
+ if (self::validate_type($type, $data) == false) return;
|
|
|
|
|
|
- if($type === 'special') {
|
|
|
+ if ($type === 'special') {
|
|
|
$ret = $this->mb_special->getMbSpecialItemUsableListByID($data);
|
|
|
} elseif ($type === 'keyword') {
|
|
|
|
|
@@ -92,41 +95,39 @@ class indexControl extends mobileHomeControl
|
|
|
joutput_data($ret);
|
|
|
}
|
|
|
|
|
|
- public function sale_listOp(){
|
|
|
+ public function sale_listOp()
|
|
|
+ {
|
|
|
$prefix = 'mb_salelist_content';
|
|
|
$codeid = 122;
|
|
|
|
|
|
$ret = rcache($codeid, $prefix);
|
|
|
- if(empty($ret))
|
|
|
- {
|
|
|
+ if (empty($ret)) {
|
|
|
$web_code = Model('web_code');
|
|
|
- $result = $web_code->where(array('code_id' => 122,'web_id' => 122))->select();
|
|
|
- if(!empty($result)) {
|
|
|
+ $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;
|
|
|
+ if (empty($tops)) return NULL;
|
|
|
$ret = array();
|
|
|
- foreach($tops as $id => $val){
|
|
|
+ foreach ($tops as $id => $val) {
|
|
|
$item['id'] = $id;
|
|
|
// $item['image'] = UPLOAD_SITE_URL. DS.substr($val['img_name'],0,-4);
|
|
|
- $item['image'] = UPLOAD_SITE_URL. DS.$val['img_name'];
|
|
|
+ $item['image'] = UPLOAD_SITE_URL . DS . $val['img_name'];
|
|
|
$item['title'] = $val['recommend']['name'];
|
|
|
- $goods_list = $val['goods_list'];
|
|
|
+ $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'];
|
|
|
+ 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
|
|
|
- {
|
|
|
+ wcache($codeid, array("salelist_content" => serialize($ret)), $prefix);
|
|
|
+ } else {
|
|
|
$ret = unserialize($ret['salelist_content']);
|
|
|
}
|
|
|
- joutput_data(array('sale_list'=>$ret));
|
|
|
+ joutput_data(array('sale_list' => $ret));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -138,32 +139,28 @@ class indexControl extends mobileHomeControl
|
|
|
$codeid = 122;
|
|
|
|
|
|
$ret = rcache($codeid, $prefix);
|
|
|
- if(empty($ret))
|
|
|
- {
|
|
|
+ if (empty($ret)) {
|
|
|
$web_code = Model('web_code');
|
|
|
- $result = $web_code->where(array('code_id' => 122,'web_id' => 122))->select();
|
|
|
- if(!empty($result)) {
|
|
|
+ $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;
|
|
|
+ if (empty($tops)) return NULL;
|
|
|
$ret = array();
|
|
|
- foreach($tops as $id => $val)
|
|
|
- {
|
|
|
+ foreach ($tops as $id => $val) {
|
|
|
$item = array();
|
|
|
$item['id'] = $id;
|
|
|
$img = $val['img_name'];
|
|
|
- if(!empty($img)) {
|
|
|
+ if (!empty($img)) {
|
|
|
// $item['image'] = UPLOAD_SITE_URL. DS. substr($img,0,-4);
|
|
|
- $item['image'] = UPLOAD_SITE_URL. DS. $img;
|
|
|
+ $item['image'] = UPLOAD_SITE_URL . DS . $img;
|
|
|
$item['title'] = $val['recommend']['name'];
|
|
|
- array_push($ret,$item);
|
|
|
+ array_push($ret, $item);
|
|
|
}
|
|
|
}
|
|
|
- wcache($codeid,array("salelist"=>serialize($ret)),$prefix);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ wcache($codeid, array("salelist" => serialize($ret)), $prefix);
|
|
|
+ } else {
|
|
|
$ret = unserialize($ret['salelist']);
|
|
|
}
|
|
|
|
|
@@ -173,25 +170,22 @@ class indexControl extends mobileHomeControl
|
|
|
/**
|
|
|
* 输出专题
|
|
|
*/
|
|
|
- private function _output_special($data,$type = 'json', $special_id = 0)
|
|
|
+ private function _output_special($data, $type = 'json', $special_id = 0)
|
|
|
{
|
|
|
//$model_special = Model('mb_special');
|
|
|
- if($type == 'html')
|
|
|
- {
|
|
|
+ if ($type == 'html') {
|
|
|
//$html_path = $model_special->getMbSpecialHtmlPath($special_id);
|
|
|
//if(!is_file($html_path)) {
|
|
|
- //ob_start();
|
|
|
- Tpl::output('list', $data['special_list']);
|
|
|
- Tpl::showpage('mb_special');
|
|
|
- //file_put_contents($html_path, ob_get_clean());
|
|
|
- // }
|
|
|
+ //ob_start();
|
|
|
+ Tpl::output('list', $data['special_list']);
|
|
|
+ Tpl::showpage('mb_special');
|
|
|
+ //file_put_contents($html_path, ob_get_clean());
|
|
|
+ // }
|
|
|
//header('Location: ' . $model_special->getMbSpecialHtmlUrl($special_id));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(empty($data)) {
|
|
|
- $data=array();
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ if (empty($data)) {
|
|
|
+ $data = array();
|
|
|
+ }
|
|
|
joutput_data($data);
|
|
|
}
|
|
|
}
|
|
@@ -199,13 +193,14 @@ class indexControl extends mobileHomeControl
|
|
|
/**
|
|
|
* android客户端版本号
|
|
|
*/
|
|
|
- public function apk_versionOp() {
|
|
|
- $version = C('mobile_apk_version');
|
|
|
- $url = C('mobile_apk');
|
|
|
- if(empty($version)) {
|
|
|
- $version = '';
|
|
|
+ public function apk_versionOp()
|
|
|
+ {
|
|
|
+ $version = C('mobile_apk_version');
|
|
|
+ $url = C('mobile_apk');
|
|
|
+ if (empty($version)) {
|
|
|
+ $version = '';
|
|
|
}
|
|
|
- if(empty($url)) {
|
|
|
+ if (empty($url)) {
|
|
|
$url = '';
|
|
|
}
|
|
|
|