|
|
@@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use App\Http\helper\NumConfig;
|
|
|
-use stdClass;
|
|
|
|
|
|
class ProtectLevelController extends Controller
|
|
|
{
|
|
|
@@ -19,7 +18,15 @@ class ProtectLevelController extends Controller
|
|
|
->orderBy('VIP')
|
|
|
->get();
|
|
|
|
|
|
- return view('admin.protect_level.index', compact('list'));
|
|
|
+ // 获取配置值(合并查询)
|
|
|
+ $statusInfo = DB::connection('read')->table('QPAccountsDB.dbo.SystemStatusInfo')
|
|
|
+ ->whereIn('StatusName', ['ProtectLevelDownDays', 'ProtectLevelExpireDays'])
|
|
|
+ ->pluck('StatusValue', 'StatusName');
|
|
|
+
|
|
|
+ $downDays = $statusInfo['ProtectLevelDownDays'] ?? null;
|
|
|
+ $expireDays = $statusInfo['ProtectLevelExpireDays'] ?? null;
|
|
|
+
|
|
|
+ return view('admin.protect_level.index', compact('list', 'downDays', 'expireDays'));
|
|
|
}
|
|
|
|
|
|
// 增加
|
|
|
@@ -30,31 +37,26 @@ class ProtectLevelController extends Controller
|
|
|
}
|
|
|
|
|
|
$data = $request->only([
|
|
|
- 'ID','Recharge','GrantNum','VIP','LevelUpBonus',
|
|
|
- 'MinRecharge','WithdrawLimit','DailyWithdraws',
|
|
|
- 'WithdrawFeeRate','SignAlpha','CustomServiceType',
|
|
|
- 'RechargeExtraSendRate','SuperballNum','BirthdayValue',
|
|
|
+ 'ID', 'Recharge', 'VIP', 'LevelUpBonus',
|
|
|
+ 'MinRecharge', 'WithdrawLimit', 'DailyWithdraws',
|
|
|
+ 'WithdrawFeeRate', 'Alpha', 'CustomServiceType',
|
|
|
+ 'RechargeExtraSendRate', 'SuperballNum', 'BirthdayValue',
|
|
|
]);
|
|
|
- // 将 GrantNum 存储为原值 * NumConfig::NUM_VALUE
|
|
|
- if (isset($data['GrantNum'])) {
|
|
|
- $data['GrantNum'] = intval($data['GrantNum'] * NumConfig::NUM_VALUE);
|
|
|
- }
|
|
|
|
|
|
// 简单验证(ID唯一性后面手动检查)
|
|
|
$this->validate($request, [
|
|
|
- 'ID' => 'required|integer',
|
|
|
- 'Recharge' => 'required|numeric|min:0',
|
|
|
- 'GrantNum' => 'required|integer|min:0',
|
|
|
- 'VIP' => 'required|integer|min:0',
|
|
|
- 'LevelUpBonus' => 'required|integer|min:0',
|
|
|
- 'MinRecharge' => 'required|integer|min:0',
|
|
|
+ 'ID' => 'required|integer',
|
|
|
+ 'Recharge' => 'required|numeric|min:0',
|
|
|
+ 'VIP' => 'required|integer|min:0',
|
|
|
+ 'LevelUpBonus' => 'required|integer|min:0',
|
|
|
+ 'MinRecharge' => 'required|integer|min:0',
|
|
|
'WithdrawLimit' => 'required|integer|min:0',
|
|
|
- 'DailyWithdraws'=> 'required|integer|min:0|max:255',
|
|
|
- 'WithdrawFeeRate'=> 'required|numeric|min:0',
|
|
|
- 'SignAlpha' => 'required|integer|min:0',
|
|
|
+ 'DailyWithdraws' => 'required|integer|min:0|max:255',
|
|
|
+ 'WithdrawFeeRate' => 'required|numeric|min:0',
|
|
|
+ 'Alpha' => 'required|numeric|min:0',
|
|
|
'CustomServiceType' => 'required|integer|in:1,2',
|
|
|
'RechargeExtraSendRate' => 'required|numeric|min:0',
|
|
|
- 'SuperballNum' => 'required|integer|min:0',
|
|
|
+ 'SuperballNum' => 'required|integer|min:0',
|
|
|
'BirthdayValue' => 'required|integer|min:0',
|
|
|
]);
|
|
|
// 唯一性检查
|
|
|
@@ -77,30 +79,25 @@ class ProtectLevelController extends Controller
|
|
|
}
|
|
|
|
|
|
$post = $request->only([
|
|
|
- 'Recharge','GrantNum','VIP','LevelUpBonus',
|
|
|
- 'MinRecharge','WithdrawLimit','DailyWithdraws',
|
|
|
- 'WithdrawFeeRate','SignAlpha','CustomServiceType',
|
|
|
- 'RechargeExtraSendRate','SuperballNum','BirthdayValue',
|
|
|
+ 'Recharge', 'VIP', 'LevelUpBonus',
|
|
|
+ 'MinRecharge', 'WithdrawLimit', 'DailyWithdraws',
|
|
|
+ 'WithdrawFeeRate', 'Alpha', 'CustomServiceType',
|
|
|
+ 'RechargeExtraSendRate', 'SuperballNum', 'BirthdayValue',
|
|
|
]);
|
|
|
- // GrantNum 乘以系数保存
|
|
|
- if (isset($post['GrantNum'])) {
|
|
|
- $post['GrantNum'] = intval($post['GrantNum'] * NumConfig::NUM_VALUE);
|
|
|
- }
|
|
|
|
|
|
// 字段校验
|
|
|
$this->validate($request, [
|
|
|
- 'Recharge' => 'required|numeric|min:0',
|
|
|
- 'GrantNum' => 'required|integer|min:0',
|
|
|
- 'VIP' => 'required|integer|min:0',
|
|
|
- 'LevelUpBonus' => 'required|integer|min:0',
|
|
|
- 'MinRecharge' => 'required|integer|min:0',
|
|
|
+ 'Recharge' => 'required|numeric|min:0',
|
|
|
+ 'VIP' => 'required|integer|min:0',
|
|
|
+ 'LevelUpBonus' => 'required|integer|min:0',
|
|
|
+ 'MinRecharge' => 'required|integer|min:0',
|
|
|
'WithdrawLimit' => 'required|integer|min:0',
|
|
|
- 'DailyWithdraws'=> 'required|integer|min:0|max:255',
|
|
|
- 'WithdrawFeeRate'=> 'required|numeric|min:0',
|
|
|
- 'SignAlpha' => 'required|integer|min:0',
|
|
|
+ 'DailyWithdraws' => 'required|integer|min:0|max:255',
|
|
|
+ 'WithdrawFeeRate' => 'required|numeric|min:0',
|
|
|
+ 'Alpha' => 'required|numeric|min:0',
|
|
|
'CustomServiceType' => 'required|integer|in:1,2',
|
|
|
'RechargeExtraSendRate' => 'required|numeric|min:0',
|
|
|
- 'SuperballNum' => 'required|integer|min:0',
|
|
|
+ 'SuperballNum' => 'required|integer|min:0',
|
|
|
'BirthdayValue' => 'required|integer|min:0',
|
|
|
]);
|
|
|
$post['BirthdayValue'] = $post['BirthdayValue'] * NumConfig::NUM_VALUE;
|
|
|
@@ -120,4 +117,32 @@ class ProtectLevelController extends Controller
|
|
|
|
|
|
return apiReturnSuc();
|
|
|
}
|
|
|
+
|
|
|
+ // 保存配置
|
|
|
+ public function saveConfig(Request $request)
|
|
|
+ {
|
|
|
+ $this->validate($request, [
|
|
|
+ 'down_days' => 'required|integer|min:1',
|
|
|
+ 'expire_days' => 'required|integer|min:1',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $downDays = $request->input('down_days');
|
|
|
+ $expireDays = $request->input('expire_days');
|
|
|
+
|
|
|
+ // 更新或创建 ProtectLevelDownDays 配置
|
|
|
+ DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
|
|
|
+ ->updateOrInsert(
|
|
|
+ ['StatusName' => 'ProtectLevelDownDays'],
|
|
|
+ ['StatusValue' => $downDays]
|
|
|
+ );
|
|
|
+
|
|
|
+ // 更新或创建 ProtectLevelExpireDays 配置
|
|
|
+ DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
|
|
|
+ ->updateOrInsert(
|
|
|
+ ['StatusName' => 'ProtectLevelExpireDays'],
|
|
|
+ ['StatusValue' => $expireDays]
|
|
|
+ );
|
|
|
+
|
|
|
+ return apiReturnSuc();
|
|
|
+ }
|
|
|
}
|