SportsBase.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Jonlin
  5. * Date: 2019/3/28
  6. * Time: 9:05
  7. */
  8. namespace App\Models;
  9. use Illuminate\Support\Facades\DB;
  10. class SportsBase extends BaseModel {
  11. protected $table = "st_bq_competition";
  12. public $timestamps = false;
  13. function getInfos(){
  14. $data = DB::table('st_bq_competition')
  15. ->join('st_bq_league','st_bq_competition.lg_id','=','st_bq_league.id')
  16. ->select('st_bq_competition.id','st_bq_competition.lg_id','st_bq_league.name_chinese','st_bq_competition.home_team','st_bq_competition.guest_team','st_bq_competition.match_date','st_bq_competition.match_time')
  17. ->orderby('match_date','desc')
  18. ->orderby('match_time','desc')
  19. ->get();
  20. if(!$data){
  21. return -6010000122;
  22. }
  23. return $data->toArray();
  24. }
  25. //更新设置
  26. function updateInfos($data,$id){
  27. $res=$this->where('id',$id)->update($data);
  28. if(!$res) {
  29. return -7020050022;//更新失败
  30. }
  31. return 1;
  32. }
  33. }