| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Jonlin
- * Date: 2019/4/9
- * Time: 9:18
- */
- namespace App\Models;
- use Illuminate\Support\Facades\DB;
- class SportsNoteList extends BaseModel {
- protected $table = "st_zq_bet";
- public $timestamps = false;
- function getinfo($list = 10, $page, $where = '',$type)
- {
- if (is_array ($where) && count ($where) > 0) {
- $data = $this
- ->join('st_zq_competition','st_zq_competition.match_id','=','st_zq_bet.match_id')
- ->join('account_detailed','account_detailed.account_identity','=','st_zq_bet.account_identity')
- ->where($where)
- ->where('st_zq_bet.game_name', 'zq')
- ->where('st_zq_bet.type', $type)
- ->orderby('money_time','desc')
- ->paginate ($list);
- } else {
- $data = $this
- ->join('st_zq_competition','st_zq_competition.match_id','=','st_zq_bet.match_id')
- ->join('account_detailed','account_detailed.account_identity','=','st_zq_bet.account_identity')
- ->where('st_zq_bet.game_name', 'zq')
- ->where('st_zq_bet.type', $type)
- ->orderby('money_time','desc')
- ->paginate ($list);
- }
- if (!$data < 0) {
- return -2021052003; //
- }
- for($i=0;$i<count($data);$i++){
- if($data[$i]->status==1){
- $data[$i]->status = '投注';
- }else if($data[$i]->status==2){
- $data[$i]->status = '追号';
- }else if($data[$i]->status==4){
- $data[$i]->status = '撤单';
- }
- if($data[$i]->water_status==1){
- $data[$i]->water_status = '未回水';
- }else if($data[$i]->water_status==2){
- $data[$i]->water_status = '已回水';
- }
- if($data[$i]->settle_status==1){
- $data[$i]->settle_status = '未结算';
- }else if($data[$i]->settle_status==2){
- $data[$i]->settle_status = '已结算';
- }
- if($data[$i]->game_status==0){
- $data[$i]->game_status = '待开奖';
- }else if($data[$i]->game_status==1){
- $data[$i]->game_status = '中奖';
- }else if($data[$i]->game_status==2){
- $data[$i]->game_status = '未中奖';
- }
- if($data[$i]->member_type==1){
- $data[$i]->member_type = '普通会员';
- }else if($data[$i]->member_type==2){
- $data[$i]->member_type = '超级会员';
- }
- $data[$i]->match_id_order = '<span>'.$data[$i]->match_id.'</span><br>'.$data[$i]->order_id;
- $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
- $data[$i]->match_time = '开赛:'.$data[$i]->match_date.' '.$data[$i]->match_time;
- $data[$i]->money_match_time = '投注:'.$data[$i]->money_time.'<br>'.$data[$i]->match_time;
- $league = DB::table('st_zq_league')->where('lg_id',$data[$i]->lg_id)->first();
- if(!empty($league)){
- $data[$i]->league = $league->name_chinese;
- }else{
- $data[$i]->league = $data[$i]->lg_id;
- }
- $data[$i]->frozen_cash = $data[$i]->available_cash-$data[$i]->money.'.00';
- $data[$i]->account = $data[$i]->available_cash.'<br><span>'.$data[$i]->account_name.'</span><br>'.$data[$i]->frozen_cash;
- $codes = json_decode($data[$i]->codes, true);
- $data[$i]->content = '';
- for($j=0;$j<count($codes);$j++){
- $odds_code = $codes[$j]['odds_code'];
- $result = DB::table('st_odds_code')->where('odds_code',$odds_code)->first();
- if(!empty($result)){
- $odds_name = $result->odds_name;
- }else{
- $odds_name = $odds_code;
- }
- $game = DB::table('st_game_type')->where('game_code',$data[$i]->game_name)->first();
- $data[$i]->content = $data[$i]->content.$odds_name. '¥'.$codes[$j]['bet_amount'].'<br>';
- $data[$i]->game = $game->game_name;
- }
- }
- return $data->toArray();
- }
- //投注金额汇总统计
- function MoneyCount($where = '',$type) {
- $data = array();
- $data['all_money'] = $this->where('type',$type)->sum('money');
- $data['all_prize_money'] = $this->where('type',$type)->sum('prize_money');
- $data['alraedy_prize_money'] = $this->where('game_status','1')->where('type',$type)->sum('prize_money');
- if (!empty($where) && is_array($where)) {
- $data['all_money'] = $this->where($where)->where('type',$type)->sum('money');
- $data['all_prize_money'] = $this->where($where)->where('type',$type)->sum('prize_money');
- $data['alraedy_prize_money'] = $this->where($where)->where('game_status','1')->where('type',$type)->sum('prize_money');
- }
- return $data;
- }
- }
|