|
@@ -30,6 +30,9 @@ use Illuminate\Support\Facades\Redis;
|
|
|
|
|
|
|
|
class GlobalController extends Controller
|
|
class GlobalController extends Controller
|
|
|
{
|
|
{
|
|
|
|
|
+ const USER_RIGHT_FORCE_STOCKMODE1 = 0b00000001; // 强制使用普通控制模式
|
|
|
|
|
+ const USER_RIGHT_FORCE_STOCKMODE2 = 0b00000010; // 强制使用库存模式2
|
|
|
|
|
+ const USER_RIGHT_BLACKMAN = 0b00000100; // 拉黑
|
|
|
|
|
|
|
|
public function index(Request $request)
|
|
public function index(Request $request)
|
|
|
{
|
|
{
|
|
@@ -1973,12 +1976,9 @@ class GlobalController extends Controller
|
|
|
|
|
|
|
|
public function force_stock_mode(Request $request, $UserID)
|
|
public function force_stock_mode(Request $request, $UserID)
|
|
|
{
|
|
{
|
|
|
- // 常量定义
|
|
|
|
|
- $USER_RIGHT_FORCE_STOCKMODE1 = 0b00000001; // 强制使用普通控制模式
|
|
|
|
|
- $USER_RIGHT_FORCE_STOCKMODE2 = 0b00000010; // 强制使用库存模式2
|
|
|
|
|
-
|
|
|
|
|
if ($request->isMethod('post')) {
|
|
if ($request->isMethod('post')) {
|
|
|
$force_mode = (int)$request->force_mode;
|
|
$force_mode = (int)$request->force_mode;
|
|
|
|
|
+ $black_mode = (int)$request->input('black_mode', 0);
|
|
|
|
|
|
|
|
// 获取当前UserRight值
|
|
// 获取当前UserRight值
|
|
|
$gameScoreInfo = DB::table('QPTreasureDB.dbo.GameScoreInfo')
|
|
$gameScoreInfo = DB::table('QPTreasureDB.dbo.GameScoreInfo')
|
|
@@ -1993,15 +1993,15 @@ class GlobalController extends Controller
|
|
|
$currentUserRight = (int)($gameScoreInfo->UserRight ?? 0);
|
|
$currentUserRight = (int)($gameScoreInfo->UserRight ?? 0);
|
|
|
|
|
|
|
|
// 清除现有的强制模式标志
|
|
// 清除现有的强制模式标志
|
|
|
- $newUserRight = $currentUserRight & ~($USER_RIGHT_FORCE_STOCKMODE1 | $USER_RIGHT_FORCE_STOCKMODE2);
|
|
|
|
|
|
|
+ $newUserRight = $currentUserRight & ~(self::USER_RIGHT_FORCE_STOCKMODE1 | self::USER_RIGHT_FORCE_STOCKMODE2 | self::USER_RIGHT_BLACKMAN);
|
|
|
|
|
|
|
|
// 根据选择设置新的强制模式
|
|
// 根据选择设置新的强制模式
|
|
|
switch ($force_mode) {
|
|
switch ($force_mode) {
|
|
|
case 1: // 强制使用普通控制模式
|
|
case 1: // 强制使用普通控制模式
|
|
|
- $newUserRight |= $USER_RIGHT_FORCE_STOCKMODE1;
|
|
|
|
|
|
|
+ $newUserRight |= self::USER_RIGHT_FORCE_STOCKMODE1;
|
|
|
break;
|
|
break;
|
|
|
case 2: // 强制使用库存模式2
|
|
case 2: // 强制使用库存模式2
|
|
|
- $newUserRight |= $USER_RIGHT_FORCE_STOCKMODE2;
|
|
|
|
|
|
|
+ $newUserRight |= self::USER_RIGHT_FORCE_STOCKMODE2;
|
|
|
break;
|
|
break;
|
|
|
case 0: // 关闭所有强制模式
|
|
case 0: // 关闭所有强制模式
|
|
|
default:
|
|
default:
|
|
@@ -2009,6 +2009,10 @@ class GlobalController extends Controller
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if ($black_mode === 1) {
|
|
|
|
|
+ $newUserRight |= self::USER_RIGHT_BLACKMAN;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 更新UserRight
|
|
// 更新UserRight
|
|
|
DB::table('QPTreasureDB.dbo.GameScoreInfo')
|
|
DB::table('QPTreasureDB.dbo.GameScoreInfo')
|
|
|
->where('UserID', $UserID)
|
|
->where('UserID', $UserID)
|
|
@@ -2024,10 +2028,11 @@ class GlobalController extends Controller
|
|
|
->first();
|
|
->first();
|
|
|
|
|
|
|
|
$userRight = (int)($gameScoreInfo->UserRight ?? 0);
|
|
$userRight = (int)($gameScoreInfo->UserRight ?? 0);
|
|
|
- $isForceStockMode1 = ($userRight & $USER_RIGHT_FORCE_STOCKMODE1) !== 0;
|
|
|
|
|
- $isForceStockMode2 = ($userRight & $USER_RIGHT_FORCE_STOCKMODE2) !== 0;
|
|
|
|
|
|
|
+ $isForceStockMode1 = ($userRight & self::USER_RIGHT_FORCE_STOCKMODE1) !== 0;
|
|
|
|
|
+ $isForceStockMode2 = ($userRight & self::USER_RIGHT_FORCE_STOCKMODE2) !== 0;
|
|
|
|
|
+ $isBlackMode = ($userRight & self::USER_RIGHT_BLACKMAN) !== 0;
|
|
|
|
|
|
|
|
- return view('admin.global.force_stock_mode', compact('UserID', 'isForceStockMode1', 'isForceStockMode2'));
|
|
|
|
|
|
|
+ return view('admin.global.force_stock_mode', compact('UserID', 'isForceStockMode1', 'isForceStockMode2', 'isBlackMode'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|