* @version : HUOSDK 8.0 */ namespace api\wapapp\controller\v8; use api\common\controller\V2ApiBaseController; use huo\controller\gift\Gift; use huolib\status\CommonStatus; class GiftController extends V2ApiBaseController { public function __construct() { parent::__construct(); } /** * 礼包列表 * http://doc.1tsdk.com/138?page_id=2845 * 【域名】/gift/list */ public function index() { $_mem_id = $this->mem_id; $_page = $this->request->param('page/d', 1); $_offset = $this->request->param('offset/d', 10); $_app_id = $this->request->param('game_id/d', 0); $_type = $this->request->param('type/d', 0);/* 礼包类型 1 普通(不需要积分和加群) 2 需要积分 3 需要加群 */ $_map = []; !empty($_app_id) && $_map['app_id'] = $_app_id; !empty($_type) && $_map['gift_type'] = $_type; $_gift_class = new Gift(); $_rs = $_gift_class->getGifts($_mem_id, $_map, $_page.','.$_offset); if (CommonStatus::NO_ERROR != $_rs['code']) { $this->error($_rs['msg'], $_rs['data'], $_rs['code']); } $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']); } /** * 玩家礼包列表 * http://doc.1tsdk.com/138?page_id=2846 * 【域名】/v8/user/gift/list */ public function myIndex() { $_mem_id = $this->getMemId(); $_param = $this->request->param(); $result = $this->validate($_param, 'Gift.list'); if ($result !== true) { $this->error($result); } $_page = $this->request->param('page/d', 1); $_offset = $this->request->param('offset/d', 10); $_gift_class = new Gift(); $_rs = $_gift_class->getMemGifts($_mem_id, $_page.','.$_offset); if (CommonStatus::NO_ERROR != $_rs['code']) { $this->error($_rs['msg'], $_rs['data'], $_rs['code']); } $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']); } /** * 领取礼包 * http://doc.1tsdk.com/138?page_id=2847 * 【域名】/user/gift/add */ public function save() { $_mem_id = $this->getMemId(); $_param = $this->request->param(); $result = $this->validate($_param, 'Gift.detail'); if ($result !== true) { $this->error($result); } $_gift_class = new Gift(); $_rs = $_gift_class->setGift($_mem_id, $_param['gift_id']); if (CommonStatus::NO_ERROR != $_rs['code']) { $this->error($_rs['msg'], $_rs['data'], $_rs['code']); } $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']); } /** * 礼包详情 * http://doc.1tsdk.com/138?page_id=2848 * 【域名】/gift/detail */ public function read() { $_mem_id = $this->mem_id; $_param = $this->request->param(); $result = $this->validate($_param, 'Gift.detail'); if ($result !== true) { $this->error($result); } $_gift_class = new Gift(); $_gift_class->getGiftDetail($_param['gift_id'], $_mem_id); $_rs = $_gift_class->getGiftDetail($_param['gift_id'], $_mem_id); if (CommonStatus::NO_ERROR != $_rs['code']) { $this->error($_rs['msg'], $_rs['data'], $_rs['code']); } $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']); } /** * 游戏礼包 * http://doc.1tsdk.com/138?page_id=3107 * 【域名】/game/gift/list */ public function gameList() { return $this->index(); } /** * 玩家礼包列表 * http://doc.1tsdk.com/138?page_id=2846 * 【域名】/user/gift/list */ public function memList() { $_mem_id = $this->getMemId(); $_page = $this->request->param('page/d', 1); $_offset = $this->request->param('offset/d', 10); $_gift_class = new Gift(); $_rs = $_gift_class->getMemGifts($_mem_id, $_page.','.$_offset); if (CommonStatus::NO_ERROR != $_rs['code']) { $this->error($_rs['msg'], $_rs['data'], $_rs['code']); } $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']); } }