GiftController.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * GiftController.php UTF-8
  4. * 浮点礼包
  5. *
  6. * @date : 2018/5/3 11:12
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace api\float\controller;
  13. use api\common\controller\FloatBaseController;
  14. use huo\controller\gift\Gift;
  15. use huolib\status\GiftStatus;
  16. class GiftController extends FloatBaseController {
  17. public function _initialize() {
  18. parent::_initialize();
  19. }
  20. /**
  21. * H5浮点礼包首页
  22. * http://doc.1tsdk.com/138?page_id=3206
  23. * 【域名】/float/gift/list
  24. */
  25. public function index() {
  26. $_game_id = $this->game_id;
  27. $_mem_id = $this->mem_id;
  28. $_gift_class = new Gift();
  29. $_ng_page = '1,10';
  30. $_normal_gift = $_gift_class->getNormalGifts($_game_id, $_mem_id, $_ng_page, true);
  31. if (GiftStatus::NO_ERROR != $_normal_gift['code']) {
  32. $_normal_gift = null;
  33. }
  34. $_rdata['normal_gift'] = $_normal_gift['data'];
  35. $_ng_page = '1,10';
  36. $_integral_gift = $_gift_class->getIntegralGifts($_game_id, $_mem_id, $_ng_page, true);
  37. if (GiftStatus::NO_ERROR != $_integral_gift['code']) {
  38. $_integral_gift = null;
  39. }
  40. $_rdata['integral_gift'] = $_integral_gift['data'];
  41. $_code = GiftStatus::NO_ERROR;
  42. $this->success(GiftStatus::getMsg($_code), $_rdata, $_code);
  43. }
  44. /**
  45. * H5浮点领取礼包
  46. * http://doc.1tsdk.com/138?page_id=3208
  47. * 【域名】/float/user/gift/add
  48. */
  49. public function save() {
  50. $_mem_id = $this->mem_id;
  51. $_gift_id = $this->request->param('gift_id/d', 0);
  52. $_gift_class = new Gift();
  53. $_rs = $_gift_class->setGift($_mem_id, $_gift_id);
  54. if (GiftStatus::NO_ERROR != $_rs['code']) {
  55. $this->returnData($_rs);
  56. }
  57. $this->returnData($_rs);
  58. }
  59. }