GameController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * GameController.php UTF-8
  4. * 小程序游戏信息查询接口
  5. *
  6. * @date : 2019/8/19 11:52
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : dengcongshuai <dcs@huosdk.com>
  10. * @version : HuoMp 1.0
  11. */
  12. namespace mini\sdk\controller;
  13. use huo\controller\game\GameCache;
  14. use huolib\status\CommonStatus;
  15. use mini\common\controller\V2ApiBaseController;
  16. class GameController extends V2ApiBaseController {
  17. public function _initialize() {
  18. parent::_initialize();
  19. }
  20. /**
  21. * 小程序卡片信息
  22. * http://doc.1tsdk.com/159?page_id=8627
  23. * 【域名】/mp/game/minicard
  24. */
  25. public function miniCard() {
  26. $_app_id = get_val($this->rq_data, 'app_id', 0);
  27. $_game_ext_info = (new GameCache())->getInfoByAppId($_app_id);
  28. $_rdata = [
  29. 'title' => '',
  30. 'url' => '',
  31. 'picture' => '',
  32. ];
  33. if (!empty($_game_ext_info['ext_info'])) {
  34. $_ext = $_game_ext_info['ext_info'];
  35. $_rdata['title'] = !empty($_ext['mini_card_title']) ? $_ext['mini_card_title'] : '';
  36. $_rdata['url'] = !empty($_ext['mini_card_url']) ? $_ext['mini_card_url'] : '';
  37. $_rdata['picture'] = !empty($_ext['mini_card_pay_picture']) ? cmf_get_image_url(
  38. $_ext['mini_card_pay_picture']
  39. )
  40. : '';
  41. }
  42. $this->success(lang('SUCCESS'), $_rdata);
  43. }
  44. /**
  45. * 游戏停留时间上报
  46. * http://doc.1tsdk.com/159?page_id=9625
  47. * 【域名】/mp/game/heartbeat
  48. */
  49. public function heartbeat() {
  50. $_code = CommonStatus::NO_ERROR;
  51. $this->success(CommonStatus::getMsg($_code), [], $_code);
  52. /* END 2020/6/19 ISSUES:12563 */
  53. }
  54. }