<?php

namespace App\Models;
use Illuminate\Support\Facades\DB;
class Matchcode extends BaseModel
{
	protected $table = 'st_odds_code';
	public $timestamps = false;

    function matchcodelist($list = 10, $page, $where = '')
    {
    	if (is_array ($where) && count ($where) > 0) { 
        	$data = $this->where($where)->orderBy('id', 'desc')->paginate($list);
        } else {
        	$data = $this->orderBy('id', 'desc')->paginate($list);
        }

        for($i=0;$i<count($data);$i++){
            if($data[$i]->type==0){
                $data[$i]->type = '常规';
            }else{
                $data[$i]->type = '手动添加特殊';
            }
        }

    	return $data->toArray ();
    }

    //
    function djlist(){
    	$data = $this->select('id','odds_name')->where("p_id",0)->orderBy ('p_id', 'desc')->get();
        if (!$data) {
			return -5040000102; //无相关信息
		}
		return $data->toArray();

    }


}