Matchcode.php 943 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Support\Facades\DB;
  4. class Matchcode extends BaseModel
  5. {
  6. protected $table = 'st_odds_code';
  7. public $timestamps = false;
  8. function matchcodelist($list = 10, $page, $where = '')
  9. {
  10. if (is_array ($where) && count ($where) > 0) {
  11. $data = $this->where($where)->orderBy('id', 'desc')->paginate($list);
  12. } else {
  13. $data = $this->orderBy('id', 'desc')->paginate($list);
  14. }
  15. for($i=0;$i<count($data);$i++){
  16. if($data[$i]->type==0){
  17. $data[$i]->type = '常规';
  18. }else{
  19. $data[$i]->type = '手动添加特殊';
  20. }
  21. }
  22. return $data->toArray ();
  23. }
  24. //
  25. function djlist(){
  26. $data = $this->select('id','odds_name')->where("p_id",0)->orderBy ('p_id', 'desc')->get();
  27. if (!$data) {
  28. return -5040000102; //无相关信息
  29. }
  30. return $data->toArray();
  31. }
  32. }