123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- 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();
- }
-
- 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);
- }
-
- 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;
-
- $_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);
- }
- }
|