| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 | 
							- <?php
 
- /**
 
-  * GiftController.php UTF-8
 
-  * 
 
-  *
 
-  * @date    : 2018/5/28 16:48
 
-  *
 
-  * @license 这不是一个自由软件,未经授权不许任何使用和传播。
 
-  * @author  : luowei <lw@huosdk.com>
 
-  * @version : HUOSDK 8.0
 
-  */
 
- namespace api\cfloat\controller;
 
- use api\common\controller\CFloatBaseController;
 
- use huo\controller\gift\Gift;
 
- use huolib\status\CommonStatus;
 
- use think\Lang;
 
- class GiftController extends CFloatBaseController {
 
-     public function _initialize() {
 
-         parent::_initialize();
 
-         $langSet = $this->request->langset();
 
-         Lang::load([APP_PATH.'cfloat'.DS.'lang'.DS.$langSet.DS.'gift'.EXT,]);
 
-         $this->checkLogin();
 
-     }
 
-     /**
 
-      * Client浮点获取礼包列表
 
-      * http://doc.1tsdk.com/138?page_id=3276
 
-      * 【域名】/cfloat/gift/list
 
-      */
 
-     public function index() {
 
-         $_mem_id = $this->mem_id;
 
-         $_param = $this->request->param();
 
-         $result = $this->validate($_param, 'Gift.list');
 
-         if ($result !== true) {
 
-             $this->error($result);
 
-         }
 
-         $_app_id = $this->request->param('game_id/d', 0);
 
-         $_page = $this->request->param('page/d', 1);
 
-         $_offset = $this->request->param('offset/d', 10);
 
-         $_is_get = $this->request->param('is_get/d', 0);  //是否已经领取过的,2表示领取过的,不传表示请求全部
 
-         $_is_received = $this->request->param('is_received/d', 0);  //2 只获取已领取的礼包 其他表示请求全部
 
-         $_gift_class = new Gift();
 
-         $_map = [];
 
-         if (!empty($_app_id)) {
 
-             $_map['app_id'] = $_app_id;
 
-         }
 
-         $_inc_me = $_received = false;
 
-         if (2 == $_is_get) {
 
-             $_inc_me = true;
 
-         }
 
-         if (2 == $_is_received) {
 
-             $_received = true;
 
-         }
 
-         if ($_received) {
 
-             $_rs = $_gift_class->getMemGifts($_mem_id, $_page.','.$_offset);
 
-         } else {
 
-             $_rs = $_gift_class->getGifts($_mem_id, $_map, $_page.','.$_offset, $_inc_me);
 
-         }
 
-         if (CommonStatus::NO_ERROR != $_rs['code']) {
 
-             $this->error($_rs['msg'], $_rs['data'], $_rs['code']);
 
-         }
 
-         $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']);
 
-     }
 
-     /**
 
-      * Client浮点获取礼包详情页
 
-      * http://doc.1tsdk.com/138?page_id=3277
 
-      * 【域名】/cfloat/gift/detail
 
-      */
 
-     public function detail() {
 
-         $_mem_id = $this->mem_id;
 
-         $_param = $this->request->param();
 
-         $result = $this->validate($_param, 'Gift.detail');
 
-         if ($result !== true) {
 
-             $this->error($result);
 
-         }
 
-         $_gift_class = new Gift();
 
-         $_rs = $_gift_class->getGiftDetail($_param['gift_id'], $_mem_id);
 
-         if (CommonStatus::NO_ERROR != $_rs['code']) {
 
-             $this->error($_rs['msg'], $_rs['data'], $_rs['code']);
 
-         }
 
-         $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']);
 
-     }
 
-     /**
 
-      * Client浮点获取礼包领取
 
-      * http://doc.1tsdk.com/138?page_id=3278
 
-      * 【域名】/cfloat/user/gift/add
 
-      */
 
-     public function add() {
 
-         $_mem_id = $this->mem_id;
 
-         $_param = $this->request->param();
 
-         $result = $this->validate($_param, 'Gift.detail');
 
-         if ($result !== true) {
 
-             $this->error($result);
 
-         }
 
-         $_gift_class = new Gift();
 
-         $_rs = $_gift_class->setGift($_mem_id, $_param['gift_id']);
 
-         if (CommonStatus::NO_ERROR != $_rs['code']) {
 
-             $this->error($_rs['msg'], $_rs['data'], $_rs['code']);
 
-         }
 
-         $this->success(lang('SUCCESS'), $_rs['data'], $_rs['code']);
 
-     }
 
- }
 
 
  |