* @version : HUOSDK 8.0 */ namespace api\float\controller; use api\common\controller\FloatBaseController; use huo\controller\gift\Gift; use huolib\status\GiftStatus; class GiftController extends FloatBaseController { public function _initialize() { parent::_initialize(); } /** * H5浮点礼包首页 * http://doc.1tsdk.com/138?page_id=3206 * 【域名】/float/gift/list */ public function index() { $_game_id = $this->game_id; $_mem_id = $this->mem_id; $_gift_class = new Gift(); $_ng_page = '1,10'; $_normal_gift = $_gift_class->getNormalGifts($_game_id, $_mem_id, $_ng_page, true); if (GiftStatus::NO_ERROR != $_normal_gift['code']) { $_normal_gift = null; } $_rdata['normal_gift'] = $_normal_gift['data']; $_ng_page = '1,10'; $_integral_gift = $_gift_class->getIntegralGifts($_game_id, $_mem_id, $_ng_page, true); if (GiftStatus::NO_ERROR != $_integral_gift['code']) { $_integral_gift = null; } $_rdata['integral_gift'] = $_integral_gift['data']; $_code = GiftStatus::NO_ERROR; $this->success(GiftStatus::getMsg($_code), $_rdata, $_code); } /** * H5浮点领取礼包 * http://doc.1tsdk.com/138?page_id=3208 * 【域名】/float/user/gift/add */ public function save() { $_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); } }