|
@@ -12,6 +12,8 @@ defined('InShopNC') or exit('Access Invalid!');
|
|
|
class indexControl extends mobileHomeControl
|
|
|
{
|
|
|
private $mb_special;
|
|
|
+ const HomeSpecialID = 0;
|
|
|
+
|
|
|
public function __construct() {
|
|
|
parent::__construct();
|
|
|
$this->mb_special = Model('mb_special');
|
|
@@ -22,15 +24,72 @@ class indexControl extends mobileHomeControl
|
|
|
*/
|
|
|
public function indexOp()
|
|
|
{
|
|
|
- $data = $this->mb_special->getMbSpecialIndex();
|
|
|
- $tops = $this->toplist();
|
|
|
- $data['sale_list'] = $tops;
|
|
|
- $this->_output_special($data, $_GET['type']);
|
|
|
+ $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']);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 专题
|
|
|
+ */
|
|
|
+ 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']);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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.');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $validator = new Validate();
|
|
|
+ if($type === 'special') {
|
|
|
+ $validator->setValidate(Validate::verify_number($data,'special data error.'));
|
|
|
+ } elseif ($type === 'keyword') {
|
|
|
+
|
|
|
+ } elseif ($type === 'goods') {
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $err = $validator->validate();
|
|
|
+ if ($err != '') {
|
|
|
+ joutput_error(errcode::ErrSpecial,$err);
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function advOp()
|
|
|
+ {
|
|
|
+ $type = $_GET['type'];
|
|
|
+ $data = $_GET['data'];
|
|
|
+
|
|
|
+ if(self::validate_type($type,$data) == false) return;
|
|
|
+
|
|
|
+ if($type === 'special') {
|
|
|
+ $ret = $this->mb_special->getMbSpecialItemUsableListByID($data);
|
|
|
+ } elseif ($type === 'keyword') {
|
|
|
+
|
|
|
+ } elseif ($type === 'goods') {
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ joutput_data($ret);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取打赏接口数据
|
|
|
*/
|
|
|
- private function toplist()
|
|
|
+ private function sale_list()
|
|
|
{
|
|
|
$prefix = 'mb_salelist';
|
|
|
$codeid = 122;
|
|
@@ -71,27 +130,20 @@ class indexControl extends mobileHomeControl
|
|
|
{
|
|
|
|
|
|
}
|
|
|
- /**
|
|
|
- * 专题
|
|
|
- */
|
|
|
- public function specialOp() {
|
|
|
- $model_mb_special = Model('mb_special');
|
|
|
- $data = $model_mb_special->getMbSpecialItemUsableListByID($_GET['special_id']);
|
|
|
- $this->_output_special($data, $_GET['type'], $_GET['special_id']);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 输出专题
|
|
|
*/
|
|
|
- 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($_GET['type'] == 'html')
|
|
|
+ if($type == 'html')
|
|
|
{
|
|
|
$html_path = $model_special->getMbSpecialHtmlPath($special_id);
|
|
|
if(!is_file($html_path)) {
|
|
|
ob_start();
|
|
|
- Tpl::output('list', $data);
|
|
|
+ Tpl::output('list', $data['special_list']);
|
|
|
Tpl::showpage('mb_special');
|
|
|
file_put_contents($html_path, ob_get_clean());
|
|
|
}
|
|
@@ -102,8 +154,6 @@ class indexControl extends mobileHomeControl
|
|
|
if(empty($data)) {
|
|
|
$data=array();
|
|
|
}
|
|
|
- //$data['site_mobile_logo']=array(C('site_mobile_logo'));
|
|
|
- //print_r($data);
|
|
|
joutput_data($data);
|
|
|
}
|
|
|
}
|