first(); } /** * @description: 查询所有数据 * @param array $search * @return Collection */ public static function findAll(array $search = []): Collection { return self::$MODEL::where(self::getWhere($search))->get(); } /** * @description: 分页查询 * @param array $search * @return array */ public static function paginate(array $search = []): array { $limit = $search['limit'] ?? 15; $date = Carbon::now('America/New_York')->format('Y-m-d'); $paginator = static::$MODEL::where(self::getWhere($search)) ->where('date', '<', $date) ->with(['member']) ->orderByDesc('date') ->orderBy('status') ->orderByDesc('betting_amount') ->paginate($limit); return ['total' => $paginator->total(), 'data' => $paginator->items()]; } //更新有效投注额 public static function updateEffectiveBettingAmount($rebate, $amount): void { if ($rebate) { // Never change the basis of an already paid daily rebate. Rebate::whereKey($rebate->id)->where('status', Rebate::STATUS_WEI_FAN_YONG) ->increment('effective_betting_amount', $amount); } } //笔笔返 根据某天的有效投注额,和反水比例,进行笔笔返 public static function BibiReturn(Rebate $rebate, $amount): bool { // Read the current effective amount under lock rather than paying the supplied stale snapshot. return RewardGrantService::grant('rebate', (int) $rebate->id, (string) (request()->user->username ?? 'system')); } }