public function index() { $thisItem = $this->item; $game = new game(); $link = $game->getLink($thisItem, $this->wechat_id); return array(array(array($thisItem['title'], $thisItem['intro'], $thisItem['picurl'], $link)), 'news'); }
function index(){ if (!$this->sub){ return array( 'name'=>'微游戏', 'subkeywords'=>1, 'sublinks'=>1, ); }else { $game=new game(); $items=M('Games')->where(array('token'=>$this->token))->select(); $arr=array( 'name'=>'微游戏', 'subkeywords'=>array( ), 'sublinks'=>array( ), ); if ($items){ foreach ($items as $v){ $link=$game->getLink($v,'{wechat_id}'); $arr['subkeywords'][$v['id']]=array('name'=>$v['title'],'keyword'=>$v['keyword']); $arr['sublinks'][$v['id']]=array('name'=>$v['title'],'link'=>$link); } } return $arr; } }
public function link() { $id = $this->_get("id"); $wecha_id = $this->wecha_id; $siteUrl = $this->_get("siteurl"); $item = M("Games")->where(array("id" => $id))->find(); if ($item) { $game = new game(); $url = $game->getLink($item, $wecha_id, $siteUrl); header("Location:" . $url); } }