OaGameModel.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * OaGameModel.php UTF-8
  4. * 游戏oa扩展 model
  5. *
  6. * @date : 2018/07/13 22:44
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : guxiannong <gxn@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\model\oa;
  13. use huo\model\common\CommonModel;
  14. use huo\model\game\GameModel;
  15. class OaGameModel extends CommonModel {
  16. protected $name = 'oa_game';
  17. /**
  18. * @return \think\model\relation\BelongsTo
  19. */
  20. public function game() {
  21. return $this->belongsTo(GameModel::className(), 'app_id', 'id')->field('id,name');
  22. }
  23. /**
  24. * 更新游戏
  25. *
  26. * @param array $ge_data
  27. * @param string $app_id
  28. *
  29. * @return bool
  30. */
  31. public function updateData($ge_data, $app_id) {
  32. $_map['app_id'] = $app_id;
  33. $_data = $ge_data;
  34. $_rs = self::update($_data, $_map, true);
  35. if (false == $_rs) {
  36. return false;
  37. } else {
  38. $_game_model=new GameModel();
  39. $_game_model->updateOaGame($app_id,$_data);
  40. return true;
  41. }
  42. }
  43. /**
  44. * 获取游戏扩信息
  45. *
  46. * @param int $app_id
  47. *
  48. * @return false|array
  49. */
  50. public function getDetail($app_id) {
  51. $_map['app_id'] = $app_id;
  52. $_data = $this->where($_map)->find();
  53. if (is_object($_data)) {
  54. $_data = $_data->toArray();
  55. }
  56. if (false == $_data) {
  57. return false;
  58. }
  59. return $_data;
  60. }
  61. }