* @version : HUOSDK 8.0 */ namespace h5wap\wap\controller; use h5wap\common\controller\V2BaseController; use huo\controller\gift\Gift; use huo\controller\member\Member; use huo\controller\sign\Sign; use huo\controller\wap\Option; use huolib\constant\GameConst; use huolib\status\GiftStatus; class GiftController extends V2BaseController { protected $from; public function _initialize() { parent::_initialize(); $this->from = GameConst::GAME_H5; } /** * h5wap礼包首页 * http://doc.1tsdk.com/138?page_id=3110 * * 【域名】/wap/gift/index * * @return mixed * @throws \think\Exception */ public function index() { $_user_info = (new Member())->getMemInfo($this->mem_id); $this->assign('userinfo', $_user_info); $_from = $this->from; $_page = '1,10'; $_game_gifts = (new Gift())->getGameGifts($this->mem_id, $_from, $_page); $this->assign('gamegift', $_game_gifts['data']); $_sign_conf = (new Sign())->getSignConf(); $_sign_list['count'] = count($_sign_conf); $_sign_list['list'] = $_sign_conf; $this->assign('sign_list', $_sign_list); //添加seo优化信息 $_seo_data = Option::ins()->getSeoValue('h5_wap_giftindex_seo'); $this->assign('seo', $_seo_data); return $this->fetch('gift/index'); } /** * 礼包详情页 * http://doc.1tsdk.com/138?page_id=3110 * 【域名】/wap/gift/detail * * @return mixed * @throws \think\Exception */ public function read() { $_mem_id = $this->mem_id; $_gift_id = $this->request->param('gift_id/d', 0); $_gift_class = new Gift(); $_rdata = $_gift_class->getGiftDetail($_gift_id, $_mem_id); if (GiftStatus::NO_ERROR != $_rdata['code']) { $this->returnData($_rdata); } $this->assign('gift', $_rdata['data']); //添加seo优化信息 $_seo_data = Option::ins()->getSeoValue('h5_wap_giftdetails_seo', 0, $_gift_id); $this->assign('seo', $_seo_data); return $this->fetch('gift/detail'); } /** * 游戏礼包列表 * http://doc.1tsdk.com/138?page_id=3234 * 【域名】/wap/game/gift/list * * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function game() { $_mem_id = $this->mem_id; $_from = $this->from; $_page = $this->request->param('page/d', 1); $_offset = $this->request->param('offset/d', 10); $_page = $_page.','.$_offset; $_game_gifts = (new Gift())->getGameGifts($_mem_id, $_from, $_page); if (GiftStatus::NO_ERROR != $_game_gifts['code']) { $this->returnData($_game_gifts); } $this->returnData($_game_gifts); } /** * 礼包领取 * http://doc.1tsdk.com/138?page_id=3218 * 【域名】/wap/user/gift/add * */ public function save() { $this->checkLogin(); $_mem_id = $this->mem_id; $_gift_id = $this->request->param('gift_id/d', 0); $_gift_class = new Gift(); $_rs = $_gift_class->setGift($_mem_id, $_gift_id); if (GiftStatus::NO_ERROR != $_rs['code']) { $this->returnData($_rs); } $this->returnData($_rs); } }