IncomeController.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * InComeController.php UTF-8
  4. * 收入
  5. *
  6. * @date : 2018/9/13 10:24
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HuoMp 1.0
  11. */
  12. namespace box\api\controller;
  13. use box\common\controller\V2ApiBaseController;
  14. use huo\model\user\UserModel;
  15. use huolib\constant\CommonConst;
  16. use huolib\constant\DataConst;
  17. use huolib\constant\WalletConst;
  18. use huolib\status\CommonStatus;
  19. use huolib\tool\RateLimit;
  20. use huomp\controller\finance\IncomeOut;
  21. use huomp\logic\finance\IncomeListLogic;
  22. class IncomeController extends V2ApiBaseController {
  23. public function _initialize() {
  24. parent::_initialize();
  25. $this->checkLogin();
  26. $_rs = (new RateLimit())->rateLimit($this->mem_id);
  27. if (false == $_rs) {
  28. $_code = CommonStatus::TOO_MANY_REQUESTS;
  29. $this->error(CommonStatus::getMsg($_code));
  30. }
  31. }
  32. /**
  33. * 分享收益排行912
  34. * http://doc.1tsdk.com/159?page_id=4640
  35. * 【域名】/share/income/rank
  36. */
  37. public function getRankIndex() {
  38. $_range = get_val($this->rq_data, 'range', DataConst::RANK_RANGE_WEEK);
  39. $_type = get_val($this->rq_data, 'type', WalletConst::WALLET_RP);
  40. $_page = get_val($this->rq_data, 'page', 1);
  41. $_offset = get_val($this->rq_data, 'offset', 10);
  42. if ($_page * $_offset > CommonConst::CONST_MAX_TASK_CNT) { //最多查找100个数据
  43. $_code = CommonStatus::NO_ERROR;
  44. $this->success(CommonStatus::getMsg($_code), [], $_code);
  45. }
  46. $_param = [
  47. 'range' => $_range,
  48. 'type' => $_type
  49. ];
  50. $_page = $_page.','.$_offset;
  51. $_agent_id = (new UserModel())->getIdByMemId($this->mem_id);
  52. $_data = (new IncomeListLogic())->incomeRankList($_agent_id, $_param, $_page);
  53. $_code = CommonStatus::NO_ERROR;
  54. $this->success(CommonStatus::getMsg($_code), $_data, $_code);
  55. }
  56. public function getTestData() {
  57. return [
  58. 'my_integral' => 100,
  59. 'gain_integral' => 10,
  60. 'gain_amount' => 1,
  61. 'balance' => 0.1,
  62. ];
  63. }
  64. /**
  65. * 领取签到奖励0912
  66. * http://doc.1tsdk.com/159?page_id=4641
  67. * 【域名】/sign/income/add
  68. */
  69. public function getSignMoney() {
  70. $_game_rq = $this->setGameData();
  71. $_rdata = (new IncomeOut())->getSignIncome($this->mem_id, $_game_rq->getHAppId());
  72. $this->returnData($_rdata);
  73. }
  74. /**
  75. * 领取分享奖励0912
  76. * http://doc.1tsdk.com/159?page_id=4642
  77. * 【域名】/share/income/get
  78. */
  79. public function getShareMoney() {
  80. $_game_rq = $this->setGameData();
  81. $_rdata = (new IncomeOut())->getShareIncome($this->mem_id, $_game_rq->getHAppId());
  82. $this->returnData($_rdata);
  83. }
  84. /**
  85. * 领取试玩奖励0912
  86. * http://doc.1tsdk.com/159?page_id=4643
  87. * 【域名】/play/income/get
  88. */
  89. public function getPlayMoney() {
  90. $_game_rq = $this->setGameData();
  91. $_rdata = (new IncomeOut())->getPlayIncome($this->mem_id, $_game_rq->getHAppId());
  92. $this->returnData($_rdata);
  93. }
  94. /**
  95. * 领取游戏奖励0912
  96. * http://doc.1tsdk.com/159?page_id=4644
  97. * 【域名】/game/income/get
  98. */
  99. public function getGameMoney() {
  100. $_rdata = (new IncomeOut())->getGameIncome($this->mem_id);
  101. $this->returnData($_rdata);
  102. }
  103. /**
  104. * 安卓桌面打开小程序奖励915
  105. * http://doc.1tsdk.com/159?page_id=4652
  106. * 域名】/favorite/reward/get
  107. */
  108. public function getFavorite() {
  109. $_game_rq = $this->setGameData();
  110. $_rdata = (new IncomeOut())->getFavoriteIncome($this->mem_id, $_game_rq->getHAppId());
  111. $this->returnData($_rdata);
  112. }
  113. }