Egame_team.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Support\Facades\DB;
  4. class Egame_team extends BaseModel {
  5. protected $table = "egame_team";
  6. public $timestamps = false;
  7. //获取赛事信息
  8. protected function getTeam($where,$list=10){
  9. $data=$this->orderBy('id','desc');
  10. if(is_array($where)&&count($where)>0){
  11. $data=$data->where($where);
  12. }
  13. $data=$data->paginate($list);
  14. return $data->toArray();
  15. }
  16. //一条关闭信息
  17. function getCloseOne($id){
  18. $data=$this->where('id',$id)->first();
  19. if(!$data){
  20. return -5040000622;
  21. }
  22. return $data->toArray();
  23. }
  24. //检测游戏名字
  25. function checkCopyGame($match_id){
  26. $data=$this->where('match_id',$match_id)->first();
  27. if(!$data){
  28. return 1;
  29. }
  30. return 5040451122;
  31. }
  32. //更新关闭信息
  33. function updateOne($data,$id){
  34. $res=$this->where('id',$id)->update($data);
  35. if(!$res){
  36. return -5040000122;
  37. }
  38. return 1;
  39. }
  40. //添加
  41. function addGame($data)
  42. {
  43. if(!isset($data['identity'])) {
  44. $data['identity'] = UUID();
  45. }
  46. if(!isset($data['create_time'])){
  47. $data['create_time'] = date('Y-m-d H:i:s');
  48. }
  49. $res = $this->insert($data);
  50. if (!$res) {
  51. return -5040001122;
  52. }
  53. return 1;
  54. }
  55. //获取
  56. protected function getInfoByID($id){
  57. $data=$this->where('identity',$id)->first();
  58. if(!$data){
  59. return -9040420322;
  60. }
  61. return $data->toArray();
  62. }
  63. //获取赛事参赛队伍
  64. protected function getMatchTeam($match_id){
  65. $data=$this->where('match_id',$match_id)->get();
  66. if(!$data){
  67. return -9040440422;
  68. }
  69. return $data->toArray();
  70. }
  71. }