GameversionModel.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * GameversionModel.php UTF-8
  4. * web
  5. *
  6. * @date : 2020/9/15 9:39
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : chenbingling <cbl@huosdk.com>
  10. * @version : H5IOS 1.0
  11. */
  12. namespace huosdk\h5ios\core\model;
  13. use huosdk\h5ios\core\constant\CommonConst;
  14. class GameversionModel extends \huo\model\game\GameversionModel {
  15. /**
  16. * 获取默认版本ID
  17. *
  18. * @param int $app_id 应用ID
  19. *
  20. * @return int
  21. */
  22. public function getDefaultIdByAppId($app_id) {
  23. if (empty($app_id)) {
  24. return 0;
  25. }
  26. if (!empty($_id)) {
  27. return $_id;
  28. }
  29. /* 取默认 */
  30. $_map = [
  31. 'app_id' => $app_id,
  32. 'is_default' => CommonConst::CONST_DEFAULT,
  33. 'is_delete' => CommonConst::CONST_NOT_DELETE
  34. ];
  35. $_id = $this->where($_map)->value('id');
  36. if (empty($_id)) {
  37. return 0;
  38. }
  39. return $_id;
  40. }
  41. /**
  42. * 根据游戏ID获取默认信息
  43. *
  44. * @param int $app_id 应用ID
  45. *
  46. * @return array|bool|false
  47. */
  48. public function getDefaultInfoByAppId($app_id) {
  49. $_id = $this->getDefaultIdByAppId($app_id);
  50. if (empty($_id)) {
  51. return false;
  52. }
  53. $_data = $this->getInfoById($_id);
  54. return $_data;
  55. }
  56. }