| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Models;
- use DB;
- class Egame_buy extends BaseModel {
- protected $table = "egame_buy";
- public $timestamps = false;
- function EgameBuyInfo($game, $list = 10, $fild = 'money_time', $order = 'desc', $where = '',$page=1){
-
- $model = $this->select($this->table . '.id', 'account_name', 'order_id', $this->table .'.game_name','info_name', 'info_no','sub_title', 'money_time', 'money', 'prize_money', 'get_money',$this->table . '.codes', $this->table . '.buy_status', $this->table.'.status', 'game_egame.codes as prize_code')
- ->leftjoin('game_egame', 'game_egame.identity', 'game_identity')
- ->where($this->table .'.game_name', $game)
- ->where($where)
- ->orderBy('money_time', $order);
-
- $model=$model->paginate($list);
- if (!$model) {
- return -5030000122; //没有数据
- }
- return $model->toArray();
- }
- //总投注
- function totalBet($where) {
- if (count($where)>0) {
- return $this->where($where)->sum('money');
- } else {
- return $this->sum('money');
- }
- }
- //总赢取
- function totalGetMoney($where) {
- if (count($where)>0) {
- $res = $this->where($where)->sum('get_money');
- } else {
- $res = $this->sum('money');
- }
- return -$res;
- }
- //获取投注信息
- function getInfoByID($id){
- $data=$this->where('id',$id)->first();
- if(!$data){
- return -5030000122; //没有数据
- }
- return $data->toArray();
- }
-
- }
|