|
@@ -6,6 +6,7 @@ use App\Models\Config;
|
|
|
use App\Models\Rebate;
|
|
use App\Models\Rebate;
|
|
|
use App\Models\Rebate as RebateModel;
|
|
use App\Models\Rebate as RebateModel;
|
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
|
|
|
+use Illuminate\Database\Eloquent\Collection;
|
|
|
|
|
|
|
|
class RebateService extends BaseService
|
|
class RebateService extends BaseService
|
|
|
{
|
|
{
|
|
@@ -14,8 +15,8 @@ class RebateService extends BaseService
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @description: 获取查询条件
|
|
* @description: 获取查询条件
|
|
|
- * @param {array} $search 查询内容
|
|
|
|
|
- * @return {array}
|
|
|
|
|
|
|
+ * @param array $search
|
|
|
|
|
+ * @return array
|
|
|
*/
|
|
*/
|
|
|
public static function getWhere(array $search = []): array
|
|
public static function getWhere(array $search = []): array
|
|
|
{
|
|
{
|
|
@@ -51,7 +52,7 @@ class RebateService extends BaseService
|
|
|
/**
|
|
/**
|
|
|
* @description: 查询单条数据
|
|
* @description: 查询单条数据
|
|
|
* @param array $search
|
|
* @param array $search
|
|
|
- * @return \App\Models\Rebate|null
|
|
|
|
|
|
|
+ * @return RebateModel|null
|
|
|
*/
|
|
*/
|
|
|
public static function findOne(array $search): ?Rebate
|
|
public static function findOne(array $search): ?Rebate
|
|
|
{
|
|
{
|
|
@@ -61,9 +62,9 @@ class RebateService extends BaseService
|
|
|
/**
|
|
/**
|
|
|
* @description: 查询所有数据
|
|
* @description: 查询所有数据
|
|
|
* @param array $search
|
|
* @param array $search
|
|
|
- * @return \Illuminate\Database\Eloquent\Collection
|
|
|
|
|
|
|
+ * @return Collection
|
|
|
*/
|
|
*/
|
|
|
- public static function findAll(array $search = [])
|
|
|
|
|
|
|
+ public static function findAll(array $search = []): Collection
|
|
|
{
|
|
{
|
|
|
return self::$MODEL::where(self::getWhere($search))->get();
|
|
return self::$MODEL::where(self::getWhere($search))->get();
|
|
|
}
|
|
}
|
|
@@ -75,9 +76,8 @@ class RebateService extends BaseService
|
|
|
*/
|
|
*/
|
|
|
public static function paginate(array $search = []): array
|
|
public static function paginate(array $search = []): array
|
|
|
{
|
|
{
|
|
|
- $limit = isset($search['limit']) ? $search['limit'] : 15;
|
|
|
|
|
|
|
+ $limit = $search['limit'] ?? 15;
|
|
|
$date = Carbon::now('America/New_York')->format('Y-m-d');
|
|
$date = Carbon::now('America/New_York')->format('Y-m-d');
|
|
|
-
|
|
|
|
|
$paginator = static::$MODEL::where(self::getWhere($search))
|
|
$paginator = static::$MODEL::where(self::getWhere($search))
|
|
|
// ->where('date', '<', $date)
|
|
// ->where('date', '<', $date)
|
|
|
->orderByDesc('date')
|
|
->orderByDesc('date')
|
|
@@ -106,7 +106,7 @@ class RebateService extends BaseService
|
|
|
$rebateAmount = floatval($rebateAmount);
|
|
$rebateAmount = floatval($rebateAmount);
|
|
|
if ($rebateAmount > 0) {
|
|
if ($rebateAmount > 0) {
|
|
|
$res = WalletService::updateBalance($rebate->member_id, $rebateAmount);
|
|
$res = WalletService::updateBalance($rebate->member_id, $rebateAmount);
|
|
|
- BalanceLogService::addLog($rebate->member_id, $rebateAmount, $res['before_balance'], $res['after_balance'], "笔笔返", $rebate->id, "日期:{$rebate->date};有效投注:{$amount};比例:{$percentage}%");
|
|
|
|
|
|
|
+ BalanceLogService::addLog($rebate->member_id, $rebateAmount, $res['before_balance'], $res['after_balance'], "笔笔返", $rebate->id, "日期:$rebate->date;有效投注:{$amount};比例:$percentage%");
|
|
|
}
|
|
}
|
|
|
$rebate->rebate_ratio = $rebate_ratio;
|
|
$rebate->rebate_ratio = $rebate_ratio;
|
|
|
$rebate->status = RebateModel::STATUS_FAN_YONG;
|
|
$rebate->status = RebateModel::STATUS_FAN_YONG;
|