* @version : Mp 1.0 */ namespace box\api\controller; use box\common\controller\V2ApiBaseController; use huo\controller\lottery\Lottery; use huolib\constant\NewsConst; use huolib\status\CommonStatus; use huolib\tool\RateLimit; use huomp\controller\member\MemberOut; use huomp\controller\share\ShareOut; class LotteryController extends V2ApiBaseController { public function _initialize() { parent::_initialize(); } /** * 金币抽奖详情920 * http://doc.1tsdk.com/159?page_id=4664 * 【域名】/lottery/detail */ public function index() { $this->checkLogin(); $_game_rq = $this->setGameData(); $_act_id = $this->request->param('act_id/d', NewsConst::MP_DRAW_ACT_ID); if (empty($_act_id)) { $_data['code'] = CommonStatus::INVALID_PARAMS; $_data['msg'] = CommonStatus::getMsg(CommonStatus::INVALID_PARAMS); $_data['data'] = null; $this->returnData($_data); } //查出抽奖详情 $_activity_draw = (new Lottery())->getDetail($this->mem_id, $_act_id); if (CommonStatus::NO_ERROR != $_activity_draw['code']) { $this->returnData($_activity_draw); } $_rdata = $_activity_draw['data']; $_rdata['balance'] = (new MemberOut())->getBalance($this->mem_id); $_rdata['share_rule_img'] = (new ShareOut())->getShareRuleImg($_game_rq->getHAppId()); $_code = CommonStatus::NO_ERROR; $this->success(CommonStatus::getMsg($_code), $_rdata, $_code); } /** * 金币抽奖920 * http://doc.1tsdk.com/159?page_id=4663 * 【域名】/lottery/draw */ public function draw() { $this->checkLogin(); $_rs = (new RateLimit())->rateLimit($this->mem_id); if (false == $_rs) { $_code = CommonStatus::TOO_MANY_REQUESTS; $this->error(CommonStatus::getMsg($_code), [], $_code); } $_mem_id = $this->mem_id; //默认取积分商城抽奖活动id $_act_id = $this->request->param('act_id/d', NewsConst::MP_DRAW_ACT_ID); $_lottery_class = new Lottery(); $_rs = $_lottery_class->draw($_mem_id, $_act_id); $_rs['data']['balance'] = (new MemberOut())->getBalance($this->mem_id); $this->returnData($_rs); } }