<?php

namespace App\Models;
class SettlementMiddleDetail extends BaseModel
{
    protected $table = "settlement_middle_detail";
    public $timestamps = false;

    public function getSettledatas($gametype, $matchid, $bettype, $order_idsArr = [])
    {
        $ret = [];
        if (empty($order_idsArr)) {
            $his = $this->where([
                'game_code' => $gametype,
                'match_id' => $matchid,
                'bet_type' => $bettype
            ])->get();
        } else {
            if ($bettype == 1) {
                $his = $this->where([
                    'game_code' => $gametype,
                    'match_id' => $matchid,
                    'bet_type' => $bettype
                ])->whereIn('order_id', $order_idsArr)->get();
            } else {
                $his = $this->where([
                    'game_code' => $gametype,
                    'bet_type' => $bettype
                ])->whereIn('order_id', $order_idsArr)->get();
            }
        }

        if (count($his) > 0) {
            foreach ($his as $val) {
                $ret[$val->order_id] = $val;
            }
        }
        return $ret;
    }


}
