* @version : HUOSDK 8.0 */ namespace h5wap\wap\controller; use h5wap\common\controller\V2BaseController; use huo\controller\lottery\Lottery; use huo\controller\member\Member; use huo\controller\posts\Posts; use huo\controller\shop\Award; use huolib\constant\MemItgConst; use huolib\constant\NewsConst; use huolib\status\CommonStatus; use think\Session; class LotteryController extends V2BaseController { public function _initialize() { parent::_initialize(); } /** * WAP-积分抽奖页面 * http://doc.1tsdk.com/138?page_id=3305 * * 【域名】/wap/lottery/index */ public function index() { // $this->checkLogin(); // $_user_info = (new Member())->getMemInfo($this->mem_id); // $this->assign('userinfo', $_user_info); // $_my_integral = $_user_info['my_integral']; // $_act_id = $this->request->param('act_id/d', 0); // $_act_info = (new Posts())->getDetail($_act_id, NewsConst::NEWS_TYPE_AWARD); // // $_cost_integral = $_act_info['data']['cost_integral']; // $_rdata['my_integral'] = $_my_integral; // $_rdata['cost_integral'] = intval($_cost_integral); // $_rdata['award'] = Award::ins()->getAwards($_act_id); // $this->assign($_rdata); // // return $this->fetch('lottery/index'); // $this->checkLogin(); $_act_id = $this->request->param('act_id/d', 0); if (empty($_act_id)) { $_data['code'] = CommonStatus::INVALID_PARAMS; $_data['msg'] = CommonStatus::getMsg(CommonStatus::INVALID_PARAMS); $_data['data'] = null; return $this->returnData($_data); } $_user_info = (new Member())->getMemInfo($this->mem_id); $this->assign('userinfo', $_user_info); //查出抽奖详情 $_activity_draw = (new Lottery())->getDetail($this->mem_id, $_act_id); $this->assign('activity_draw', $_activity_draw['data']); return $this->fetch('lottery/index'); } /** * 抽奖 * http://doc.1tsdk.com/138?page_id=3306 * 【域名】/wap/lottery/draw */ public function draw() { $this->checkLogin(); $_mem_id = $this->mem_id; //默认取积分商城抽奖活动id $_act_id = $this->request->param('act_id/d', NewsConst::SHOP_DRAW_ACT_ID); // $_act_info = (new Posts())->getDetail($_act_id, NewsConst::NEWS_TYPE_AWARD); // $_cost_integral =intval($_act_info['data']['cost_integral']); $_lottery_class = new Lottery(); $_rs = $_lottery_class->draw($_mem_id, $_act_id); $this->returnData($_rs); } }