<?php
namespace Biz\Record;
/**
 * 购彩记录
 */
class BuyQuery {
	private $game_type = 'game_type';
	/**
	 * 资金记录表
	 * @var string
	 */
	private $fund_detailed = 'fund_detailed';
	/**
	 * 游戏记录表
	 * @var string
	 */
	private $game_table = 'game_type';

	public function getList($account_identity) {
		//获取投注记录
		$res = lm($this->fund_detailed, 'Commons')
			->where('account_identity', $account_identity)
			->where('money_type', 1)
			->orWhere('money_type', 2)
			->get()
			->toArray();
		//获取游戏名
		if (is_array($res)) {
			foreach ($res as $k => $v) {
				$res['name'] = $this->getGameName($v['game_type']);
			}
		}
		return $res;
	}

    /**
     * 通过游戏id获取游戏名字
     * @param  [int] $gmae_id 游戏id
     * @return  [type]          [descr5
     * iption]
     */
	public function getGameName($game_id) {
		$res = lm($this->game_type, 'Commons')->where('identity', $game_id)->first()->name;
		return $res;
	}

}
?>