123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- namespace box\api\controller;
- use box\common\controller\V2ApiBaseController;
- use huo\model\user\UserModel;
- use huolib\constant\CommonConst;
- use huolib\constant\DataConst;
- use huolib\constant\WalletConst;
- use huolib\status\CommonStatus;
- use huolib\tool\RateLimit;
- use huomp\controller\finance\IncomeOut;
- use huomp\logic\finance\IncomeListLogic;
- class IncomeController extends V2ApiBaseController {
- public function _initialize() {
- parent::_initialize();
- $this->checkLogin();
- $_rs = (new RateLimit())->rateLimit($this->mem_id);
- if (false == $_rs) {
- $_code = CommonStatus::TOO_MANY_REQUESTS;
- $this->error(CommonStatus::getMsg($_code));
- }
- }
-
- public function getRankIndex() {
- $_range = get_val($this->rq_data, 'range', DataConst::RANK_RANGE_WEEK);
- $_type = get_val($this->rq_data, 'type', WalletConst::WALLET_RP);
- $_page = get_val($this->rq_data, 'page', 1);
- $_offset = get_val($this->rq_data, 'offset', 10);
- if ($_page * $_offset > CommonConst::CONST_MAX_TASK_CNT) {
- $_code = CommonStatus::NO_ERROR;
- $this->success(CommonStatus::getMsg($_code), [], $_code);
- }
- $_param = [
- 'range' => $_range,
- 'type' => $_type
- ];
- $_page = $_page.','.$_offset;
- $_agent_id = (new UserModel())->getIdByMemId($this->mem_id);
- $_data = (new IncomeListLogic())->incomeRankList($_agent_id, $_param, $_page);
- $_code = CommonStatus::NO_ERROR;
- $this->success(CommonStatus::getMsg($_code), $_data, $_code);
- }
- public function getTestData() {
- return [
- 'my_integral' => 100,
- 'gain_integral' => 10,
- 'gain_amount' => 1,
- 'balance' => 0.1,
- ];
- }
-
- public function getSignMoney() {
- $_game_rq = $this->setGameData();
- $_rdata = (new IncomeOut())->getSignIncome($this->mem_id, $_game_rq->getHAppId());
- $this->returnData($_rdata);
- }
-
- public function getShareMoney() {
- $_game_rq = $this->setGameData();
- $_rdata = (new IncomeOut())->getShareIncome($this->mem_id, $_game_rq->getHAppId());
- $this->returnData($_rdata);
- }
-
- public function getPlayMoney() {
- $_game_rq = $this->setGameData();
- $_rdata = (new IncomeOut())->getPlayIncome($this->mem_id, $_game_rq->getHAppId());
- $this->returnData($_rdata);
- }
-
- public function getGameMoney() {
- $_rdata = (new IncomeOut())->getGameIncome($this->mem_id);
- $this->returnData($_rdata);
- }
-
- public function getFavorite() {
- $_game_rq = $this->setGameData();
- $_rdata = (new IncomeOut())->getFavoriteIncome($this->mem_id, $_game_rq->getHAppId());
- $this->returnData($_rdata);
- }
- }
|