123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?php
- /**
- * Rebate.php UTF-8
- * 返利模块API
- *
- * @date : 2018/7/27 11:23
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : Huosdk 8.0
- */
- namespace api\rebate\controller;
- use api\common\controller\V2ApiBaseController;
- use huolib\constant\CommonConst;
- use huolib\status\AccountStatus;
- use huolib\status\GameStatus;
- use huolib\status\MemberStatus;
- use huolib\tool\StrUtils;
- use huoRebate\controller\RebateOut;
- class RebateController extends V2ApiBaseController {
- public function _initialize() {
- parent::_initialize();
- $this->checkLogin();
- }
- /**
- * 可返利游戏列表
- * http://doc.huosdk.com/138?page_id=3722
- * 【域名】/user/rebate/list
- */
- public function getGameList() {
- $_page = $this->request->param('page/d', 1); /* 页码 默认为1 代表第一页 1 */
- $_offset = $this->request->param('offset/d', 10); /* 每页显示数量 默认为10 */
- $_rdata = (new RebateOut())->getGameList($this->mem_id, $_page, $_offset);
- $this->returnData($_rdata);
- }
- /**
- * 提交返利申请
- * http://doc.huosdk.com/138?page_id=3727
- * 【域名】/user/rebate/add
- */
- public function add() {
- $_param['app_id'] = $this->request->param('game_id', 0);
- $_param['server_id'] = $this->request->param('server_id', '');
- $_param['server_name'] = $this->request->param('server_name', '');
- $_param['role_id'] = $this->request->param('role_id', '');
- $_param['role_name'] = $this->request->param('role_name', '');
- $_param['mobile'] = $this->request->param('mobile', '');
- $_param['remark'] = $this->request->param('remark', '');
- $_param['mg_mem_id'] = $this->request->param('mg_mem_id/d', 0);
- $_start_date = $this->request->param('start_date', '');
- $_end_date = $this->request->param('end_date', '');
- if (empty($_param['app_id']) || !is_numeric($_param['app_id'])) {
- $_code = GameStatus::GAME_ID_EMPTY;
- $this->error(GameStatus::getMsg($_code), [], $_code);
- }
- if (empty($_param['server_id']) || !is_numeric($_param['server_id'])) {
- $_code = GameStatus::SERVER_ID_EMPTY;
- $this->error(GameStatus::getMsg($_code), [], $_code);
- }
- if (empty($_param['role_id']) || !is_numeric($_param['role_id'])) {
- $_code = GameStatus::ROLE_ID_EMPTY;
- $this->error(GameStatus::getMsg($_code), [], $_code);
- }
- if (empty($_param['mg_mem_id']) || !is_numeric($_param['mg_mem_id'])) {
- $_code = AccountStatus::MEM_GAME_NOT_EXISTS;
- $this->error(AccountStatus::getMsg($_code), [], $_code);
- }
- if (empty($_param['mobile'])) {
- $_code = MemberStatus::PHONE_EMPTY;
- $this->error(MemberStatus::getMsg($_code), [], $_code);
- }
- if (true != StrUtils::checkPhone($_param['mobile'])) {
- $_code = MemberStatus::PHONE_ERROR;
- $this->error(MemberStatus::getMsg($_code), [], $_code);
- }
- $_start_time = 0;
- $_end_time = 0;
- if (!empty($_start_date)) {
- $_start_time = strtotime($_start_date);
- }
- if (!empty($_end_date)) {
- $_end_time = strtotime($_end_date) + CommonConst::CONST_DAY_SECONDS;
- }
- $_param['start_time'] = $_start_time;
- $_param['end_time'] = $_end_time;
- $_rdata = (new RebateOut())->addRebate($this->mem_id, $_param);
- $this->returnData($_rdata);
- }
- /**
- * 申请记录
- * http://doc.huosdk.com/138?page_id=3724
- * 【域名】/user/gratelist
- * 【域名】/user/rebate/rlist
- */
- public function getApplyList() {
- $_page = $this->request->param('page/d', 1); /* 页码 默认为1 代表第一页 1 */
- $_offset = $this->request->param('offset/d', 10); /* 每页显示数量 默认为10 */
- $_page = $_page.','.$_offset;
- $_rdata = (new RebateOut())->getRebateList($this->mem_id, [], $_page);
- $this->returnData($_rdata);
- }
- /**
- * 获取游戏区服列表
- * http://doc.huosdk.com/138?page_id=3725
- * 【域名】/user/rebate/roles_info
- */
- public function getRolesInfo() {
- $_app_id = $this->request->param('game_id/d', 0); /* 游戏ID */
- $_rdata = (new RebateOut())->getServerRoles($this->mem_id, $_app_id);
- $this->returnData($_rdata);
- }
- /**
- * 获取充值金额
- * http://doc.huosdk.com/138?page_id=3728
- * 【域名】/user/rebate/get_amount
- */
- public function getAmount() {
- $_app_id = $this->request->param('game_id/d', 0); /* 游戏ID */
- $_start_date = $this->request->param('start_date/s', ''); /* 开始日期 */
- $_end_date = $this->request->param('end_date/s', ''); /* 结束日期 */
- $_start_time = 0;
- $_end_time = 0;
- if (!empty($_start_date)) {
- $_start_time = strtotime($_start_date);
- }
- if (!empty($_end_date)) {
- $_end_time = strtotime($_end_date) + CommonConst::CONST_DAY_SECONDS;
- }
- $_rdata = (new RebateOut())->getAmount($this->mem_id, $_app_id, $_start_time, $_end_time);
- $this->returnData($_rdata);
- }
- /**
- * 返利详情
- * http://doc.huosdk.com/138?page_id=3800
- * 【域名】/user/rebate/orderdetail
- */
- public function getOrderDetail() {
- $_ro_id = $this->request->param('rebate_id/d', 0);
- if (empty($_ro_id)) {
- $this->success(lang('SUCCESS'));
- }
- $_rdata = (new RebateOut())->getRoDetail($this->mem_id, $_ro_id);
- $this->returnData($_rdata);
- }
- }
|