LotteryController.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * LotteryController.php UTF-8
  4. * 积分抽奖
  5. *
  6. * @date : 2018/5/10 20:13
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace h5wap\wap\controller;
  13. use h5wap\common\controller\V2BaseController;
  14. use huo\controller\lottery\Lottery;
  15. use huo\controller\member\Member;
  16. use huo\controller\posts\Posts;
  17. use huo\controller\shop\Award;
  18. use huolib\constant\MemItgConst;
  19. use huolib\constant\NewsConst;
  20. use huolib\status\CommonStatus;
  21. use think\Session;
  22. class LotteryController extends V2BaseController {
  23. public function _initialize() {
  24. parent::_initialize();
  25. }
  26. /**
  27. * WAP-积分抽奖页面
  28. * http://doc.1tsdk.com/138?page_id=3305
  29. *
  30. * 【域名】/wap/lottery/index
  31. */
  32. public function index() {
  33. // $this->checkLogin();
  34. // $_user_info = (new Member())->getMemInfo($this->mem_id);
  35. // $this->assign('userinfo', $_user_info);
  36. // $_my_integral = $_user_info['my_integral'];
  37. // $_act_id = $this->request->param('act_id/d', 0);
  38. // $_act_info = (new Posts())->getDetail($_act_id, NewsConst::NEWS_TYPE_AWARD);
  39. //
  40. // $_cost_integral = $_act_info['data']['cost_integral'];
  41. // $_rdata['my_integral'] = $_my_integral;
  42. // $_rdata['cost_integral'] = intval($_cost_integral);
  43. // $_rdata['award'] = Award::ins()->getAwards($_act_id);
  44. // $this->assign($_rdata);
  45. //
  46. // return $this->fetch('lottery/index');
  47. // $this->checkLogin();
  48. $_act_id = $this->request->param('act_id/d', 0);
  49. if (empty($_act_id)) {
  50. $_data['code'] = CommonStatus::INVALID_PARAMS;
  51. $_data['msg'] = CommonStatus::getMsg(CommonStatus::INVALID_PARAMS);
  52. $_data['data'] = null;
  53. return $this->returnData($_data);
  54. }
  55. $_user_info = (new Member())->getMemInfo($this->mem_id);
  56. $this->assign('userinfo', $_user_info);
  57. //查出抽奖详情
  58. $_activity_draw = (new Lottery())->getDetail($this->mem_id, $_act_id);
  59. $this->assign('activity_draw', $_activity_draw['data']);
  60. return $this->fetch('lottery/index');
  61. }
  62. /**
  63. * 抽奖
  64. * http://doc.1tsdk.com/138?page_id=3306
  65. * 【域名】/wap/lottery/draw
  66. */
  67. public function draw() {
  68. $this->checkLogin();
  69. $_mem_id = $this->mem_id;
  70. //默认取积分商城抽奖活动id
  71. $_act_id = $this->request->param('act_id/d', NewsConst::SHOP_DRAW_ACT_ID);
  72. // $_act_info = (new Posts())->getDetail($_act_id, NewsConst::NEWS_TYPE_AWARD);
  73. // $_cost_integral =intval($_act_info['data']['cost_integral']);
  74. $_lottery_class = new Lottery();
  75. $_rs = $_lottery_class->draw($_mem_id, $_act_id);
  76. $this->returnData($_rs);
  77. }
  78. }