123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- /**
- * GiftController.php UTF-8
- * H5 WAP 礼包
- *
- * @date : 2018/4/27 21:11
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : liuhongliang <lhl@huosdk.com>
- * @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);
- }
- }
|