<?php

namespace App\Models;

class User_buyModel extends BaseModel {
	protected $table = 'money_buy';
	protected function getType() {
		return array(
			'all' => trans('user_buy.all'), 'unclear' => trans('user_buy.unclear'), 'cleared' => trans('user_buy.cleared'),
			// 'rubish' => trans('user_buy.rubish'),
		);
	}

	function getTakelist($list = 20) {
		$data = $this->select('account_name', 'order_id', 'game_name', 'game_no', 'prize_note', 'money', 'prize_money', 'status', 'codes', 'water_status', 'money_time', 'get_money', 'prize', 'game_status')->orderBy('money_time', 'desc')->groupBy('account_name')->paginate($list);
		if (!$data) {
			return -7010100102; //没有列表数据
		}
		return $data->toArray();
	}
	function getAllBetAccount($where) {

		$model = $this->select('account_name');
		if (isset($where['in'])) {
			$model->whereIn('status', $where['in']);
			unset($where['in']);
		}
		if (!empty($where)) {
			$model->where($where);
		}
		$data = $model->groupBy('account_name')->get();
		if (!$data) {
			return -7010100202;
		}
		return $data->toArray();
	}

	//字段对应值
	private function getFeild($num) {
		$data = array(
			'1' => 'type',
			'2' => 'account_name',
			'3' => 'game_name',
			'4' => 'num',
			'5' => 'money',
			'6' => 'prize_money',
			'7' => 'get_money',
		);
		return $data[$num];
	}
}