ExtensionController.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Http\helper\Helper;
  4. use App\Http\helper\NumConfig;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Support\Facades\DB;
  7. class ExtensionController
  8. {
  9. // -----------------------------------------------------------------------邀请注册------------------------------------------------------------------------------
  10. // 推广奖金审核
  11. public function verify(Request $request)
  12. {
  13. $NickName = $request->NickName ?: '';
  14. $GameID = $request->GameID ?: '';
  15. $mobile = $request->mobile ?: '';
  16. $SpreaderID = $request->SpreaderID ?: '';
  17. $start_time = $request->start_time ?: '';
  18. $end_time = $request->end_time ?: '';
  19. $Type = $request->Type ?: '';
  20. $Sort = $request->Sort ?: '';
  21. $FinalScoreSort = $request->FinalScoreSort ?: '';
  22. if (!empty($SpreaderID)) {
  23. $getSpreaderID = DB::connection('read')->table('QPAccountsDB.dbo.AccountsInfo ')
  24. ->where('GameID', $SpreaderID)
  25. ->select('UserID')
  26. ->first()->UserID ?? '';
  27. }
  28. $where = [];
  29. !empty($NickName) && $where[] = ['ai.NickName', 'like', $NickName . '%'];
  30. !empty($GameID) && $where[] = ['ai.GameID', $GameID];
  31. !empty($getSpreaderID) && $where[] = ['ai.SpreaderID', $getSpreaderID];
  32. !empty($start_time) && $where[] = ['ai.RegisterDate', '>=', $start_time];
  33. !empty($end_time) && $where[] = ['ai.RegisterDate', '<=', $end_time];
  34. if (!empty($mobile)) {
  35. $PhoneNum = DB::connection('read')->table('QPAccountsDB.dbo.AccountPhone')
  36. ->where('PhoneNum', $mobile)
  37. ->pluck('UserID')->toArray();
  38. if (!empty($PhoneNum)) {
  39. $where[] = [function ($where) use ($PhoneNum) {
  40. $where->whereIn('vy.UserID', $PhoneNum);
  41. }];
  42. }
  43. }
  44. if (!empty($Type)) {
  45. $TypeData = explode(',', trim($Type, ','));
  46. if (!empty($TypeData)) {
  47. $where[] = [function ($where) use ($TypeData) {
  48. $where->whereIn('vy.Type', $TypeData);
  49. }];
  50. }
  51. }
  52. // 审核可见金额
  53. $visibleAmount = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  54. ->where('StatusName', 'VerifyScore')
  55. ->first();
  56. $UpperLimit = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  57. ->where('StatusName', 'UpperLimit')
  58. ->first();
  59. // 自动审核开关
  60. $AutoVerify = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  61. ->where('StatusName', 'AutoVerify')
  62. ->value('StatusValue');
  63. $where[] = ['TotalScore', '>=', $visibleAmount->StatusValue];
  64. $where[] = ['Status', 0];
  65. $field = ['vy.Remarks', 'vy.ReceivedScore', 'vy.OverLook', 'vy.id', 'ua.UserID', 'Higher1ID', 'Higher2ID', 'downCount1', 'downCount2', 'ai.GameID', 'ai.RegisterDate', 'FinalScore', 'TotalScore', 'vy.Type', 'ai.SpreaderID'];
  66. $SQL = DB::connection('write')->table('agent.dbo.extension_verify as vy')
  67. ->join('QPAccountsDB.dbo.AccountsInfo as ai', 'vy.UserID', 'ai.UserID')
  68. ->join('QPAccountsDB.dbo.UserAgent as ua', 'vy.UserID', 'ua.UserID')
  69. ->where($where)
  70. ->select($field)
  71. ->orderBy('OverLook', 'asc');
  72. // 历史通过审核金排序
  73. if (!empty($FinalScoreSort)) {
  74. $SQL = $SQL->orderBy("FinalScore", $FinalScoreSort);
  75. }
  76. // 待审金额排序
  77. if (!empty($Sort)) {
  78. $SQL = $SQL->orderBy("TotalScore", $Sort);
  79. }
  80. // 待审金额 默认排序 倒叙
  81. if (empty($Sort) && empty($FinalScoreSort)) {
  82. $SQL = $SQL->orderBy("TotalScore", 'desc');
  83. }
  84. $list = $SQL->paginate(10);
  85. $UserIDs = [];
  86. $SpreaderIDs = [];
  87. foreach ($list as $v) {
  88. $UserIDs[] = $v->UserID;
  89. $SpreaderIDs[] = $v->SpreaderID;
  90. }
  91. // 获取上级ID 'ai1.GameID as SpreaderID'
  92. $getSpreaderID = DB::connection('read')->table('QPAccountsDB.dbo.AccountsInfo')
  93. ->whereIn('UserID', $SpreaderIDs)
  94. ->select('GameID', 'UserID')
  95. ->pluck('GameID', 'UserID')->toArray();
  96. // 获取来源人数
  97. $user_profit_log = DB::connection('write')->table('agent.dbo.extension_user_profit_log')
  98. ->where('OrderID', 0)
  99. ->whereIn('UserID', $UserIDs)
  100. ->selectRaw('IsNull(sum(NoteCount),0) NoteCount,UserID,Type')
  101. ->where('Status', 1)
  102. ->groupBy('UserID', 'Type')
  103. ->get();
  104. foreach ($user_profit_log as &$value) {
  105. $InvitationUserIDs = DB::connection('write')->table('agent.dbo.extension_user_profit_log')
  106. ->where('UserID', $value->UserID)
  107. ->where('Status', 1)
  108. ->where('OrderID', 0)
  109. ->where('Type', $value->Type)
  110. ->select('InvitationUserIDs')
  111. ->pluck('InvitationUserIDs')->toArray();
  112. $value->InvitationUserIDs = implode(',', $InvitationUserIDs);
  113. }
  114. unset($value);
  115. $rewards = DB::connection('read')->table('QPRecordDB.dbo.RecordUserScoreStatisticsNew')
  116. ->where('ScoreType', 36)
  117. ->whereIn('UserID', $UserIDs)
  118. ->selectRaw('sum(Score) Score,UserID')
  119. ->groupBy('UserID')
  120. ->pluck('Score', 'UserID')->toArray();
  121. $service = new Extension();
  122. foreach ($list as &$value) {
  123. $value->count = $value->rechargeCount = $value->RechargeSum = 0;
  124. $value->TotalScore = number_float($value->TotalScore / NumConfig::NUM_VALUE);
  125. $value->ReceivedScore = number_float($value->ReceivedScore / NumConfig::NUM_VALUE);
  126. $value->SpreaderID = isset($getSpreaderID[$value->SpreaderID]) ? $getSpreaderID[$value->SpreaderID] : '';
  127. // 来源人数,充值金额,充值人数
  128. $service->sourcePlayer($user_profit_log, $value);
  129. $reward = isset($rewards[$value->UserID]) ? $rewards[$value->UserID] : 0;
  130. $TotalReward1 = DB::connection('read')->table('QPAccountsDB.dbo.UserAgent')
  131. ->where('Higher1ID', $value->UserID)
  132. ->selectRaw('IsNull(sum(TotalReward1),0) TotalReward')
  133. ->first()->TotalReward ?? 0;
  134. $TotalReward2 = DB::connection('read')->table('QPAccountsDB.dbo.UserAgent')
  135. ->Where('Higher2ID', $value->UserID)
  136. ->selectRaw('IsNull(sum(TotalReward2),0) TotalReward')
  137. ->first()->TotalReward ?? 0;
  138. $value->Total = number_float(($reward + $TotalReward1 + $TotalReward2 + $value->FinalScore) / NumConfig::NUM_VALUE);
  139. $value->FinalScore = number_float($value->FinalScore / NumConfig::NUM_VALUE);
  140. }
  141. unset($value);
  142. $visibleAmount->StatusValue /= NumConfig::NUM_VALUE;
  143. $UpperLimit->StatusValue /= NumConfig::NUM_VALUE;
  144. $start_time = Helper::timeChange($start_time);
  145. $end_time = Helper::timeChange($end_time);
  146. $data = compact('list', 'GameID', 'SpreaderID', 'start_time', 'end_time', 'mobile', 'NickName', 'Type', 'visibleAmount', 'Sort', 'UpperLimit', 'FinalScoreSort', 'AutoVerify');
  147. return view('admin.extension.verify', $data);
  148. }
  149. // 推广奖金审核 -- 修改状态
  150. public function verify_update(Request $request, $id)
  151. {
  152. $field = $request->field;
  153. $value = $request->value;
  154. $UserID = $request->UserID;
  155. $TotalScore = $request->TotalScore;
  156. $data[$field] = $value;
  157. if ($field == 'Status') {
  158. $first = DB::connection('write')->table('agent.dbo.extension_verify')
  159. ->where('id', $id)
  160. ->first();
  161. // 添加记录
  162. DB::connection('write')->table('agent.dbo.extension_verify_log')
  163. ->insert([
  164. 'UserID' => $UserID,
  165. 'AgreeScore' => $TotalScore * NumConfig::NUM_VALUE,
  166. 'CreateTime' => date('Y-m-d H:i:s'),
  167. 'Remarks' => $first->Remarks,
  168. 'Type' => $first->Type,
  169. ]);
  170. $data['Remarks'] = '';
  171. }
  172. DB::connection('write')->table('agent.dbo.extension_verify')
  173. ->where('id', $id)
  174. ->update($data);
  175. return apiReturnSuc();
  176. }
  177. // 注册奖金配置
  178. public function register_config()
  179. {
  180. $list = DB::connection('write')->table('agent.dbo.extension_config')
  181. ->where('type', 1)
  182. ->paginate(10);
  183. foreach ($list as &$value) {
  184. foreach ($value as $key => &$val) {
  185. if ($key != 'id' && $key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  186. $val /= NumConfig::NUM_VALUE;
  187. }
  188. }
  189. }
  190. return view('admin.extension.register_config', compact('list'));
  191. }
  192. // 注册奖金配置 -- 添加
  193. public function register_config_add(Request $request)
  194. {
  195. if ($request->isMethod('post')) {
  196. $post = $request->post();
  197. foreach ($post as $key => &$value) {
  198. if ($key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  199. $value *= NumConfig::NUM_VALUE;
  200. }
  201. }
  202. DB::connection('write')->table('agent.dbo.extension_config')->insert($post);
  203. return apiReturnSuc();
  204. }
  205. return view('admin.extension.register_config_add');
  206. }
  207. // 注册奖金配置 -- 修改
  208. public function register_config_update(Request $request, $id)
  209. {
  210. if ($request->isMethod('post')) {
  211. $post = $request->post();
  212. foreach ($post as $key => &$value) {
  213. if ($key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  214. $value *= NumConfig::NUM_VALUE;
  215. }
  216. }
  217. DB::connection('write')->table('agent.dbo.extension_config')
  218. ->where('id', $id)
  219. ->update($post);
  220. return apiReturnSuc();
  221. }
  222. $info = DB::connection('write')->table('agent.dbo.extension_config')
  223. ->where('id', $id)
  224. ->first();
  225. foreach ($info as $key => &$value) {
  226. if ($key != 'id' && $key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  227. $value /= NumConfig::NUM_VALUE;
  228. }
  229. }
  230. return view('admin.extension.register_config_update', compact('info'));
  231. }
  232. // 裂变可领额度上限配置
  233. public function upperLimit(Request $request)
  234. {
  235. if ($request->isMethod('post')) {
  236. $post = $request->post();
  237. $post['StatusValue'] *= NumConfig::NUM_VALUE;
  238. DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  239. ->where('StatusName', 'UpperLimit')
  240. ->update($post);
  241. return apiReturnSuc();
  242. }
  243. $info = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  244. ->where('StatusName', 'UpperLimit')
  245. ->first();
  246. $info->StatusValue /= NumConfig::NUM_VALUE;
  247. return view('admin.extension.upper_limit', compact('info'));
  248. }
  249. // 审核可见分数修改
  250. public function verifyScore(Request $request)
  251. {
  252. if ($request->isMethod('post')) {
  253. $post = $request->post();
  254. $post['StatusValue'] *= NumConfig::NUM_VALUE;
  255. DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  256. ->where('StatusName', 'VerifyScore')
  257. ->update($post);
  258. return apiReturnSuc();
  259. }
  260. $info = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  261. ->where('StatusName', 'VerifyScore')
  262. ->first();
  263. $info->StatusValue /= NumConfig::NUM_VALUE;
  264. return view('admin.extension.verify_score', compact('info'));
  265. }
  266. // 待审核页面的备注
  267. public function verifyRemarks(Request $request, $UserID)
  268. {
  269. $post = $request->post();
  270. DB::connection('write')->table('agent.dbo.extension_verify')
  271. ->where('UserID', $UserID)
  272. ->update($post);
  273. return apiReturnSuc();
  274. }
  275. // 奖励来源
  276. public function userSource(Request $request)
  277. {
  278. $UserID = $request->UserID ?: '';
  279. $Type = $request->Type ?: '';
  280. $GameID = $request->GameID ?: '';
  281. $OrderID = $request->OrderID ?: 0;
  282. if (!empty($OrderID) || $OrderID === 0) {
  283. $list = DB::connection('write')->table('agent.dbo.extension_user_profit_log')
  284. ->where('OrderID', $OrderID)
  285. ->where('UserID', $UserID)
  286. ->where('Type', $Type)
  287. ->where('Status', 1)
  288. ->paginate(10);
  289. } else {
  290. $list = DB::connection('write')->table('agent.dbo.extension_user_profit_log')
  291. ->where('UserID', $UserID)
  292. ->where('Type', $Type)
  293. ->where('OrderID', 0)
  294. ->where('Status', 1)
  295. ->paginate(10);
  296. }
  297. foreach ($list as &$value) {
  298. $value->toGold /= NumConfig::NUM_VALUE;
  299. }
  300. unset($value);
  301. return view('admin.extension.user_source', compact('list', 'UserID', 'Type', 'GameID'));
  302. }
  303. // 审核通过列表
  304. public function verifyFinal(Request $request)
  305. {
  306. $NickName = $request->NickName ?: '';
  307. $GameID = $request->GameID ?: '';
  308. $mobile = $request->mobile ?: '';
  309. $SpreaderID = $request->SpreaderID ?: '';
  310. $start_time = $request->start_time ?: '';
  311. $end_time = $request->end_time ?: '';
  312. $Type = $request->Type ?: '';
  313. $Sort = $request->Sort ?: '';
  314. $CreateTimeStart = $request->CreateTimeStart ?: '';
  315. $CreateTimeEnd = $request->CreateTimeEnd ?: '';
  316. if (!empty($SpreaderID)) {
  317. $getSpreaderID = DB::connection('read')->table('QPAccountsDB.dbo.AccountsInfo ')
  318. ->where('GameID', $SpreaderID)
  319. ->select('UserID')
  320. ->first()->UserID ?? '';
  321. }
  322. $where = [];
  323. !empty($NickName) && $where[] = ['ai.NickName', 'like', $NickName . '%'];
  324. !empty($GameID) && $where[] = ['ai.GameID', $GameID];
  325. !empty($getSpreaderID) && $where[] = ['ai.SpreaderID', $getSpreaderID];
  326. !empty($start_time) && $where[] = ['ai.RegisterDate', '>=', $start_time];
  327. !empty($end_time) && $where[] = ['ai.RegisterDate', '<=', $end_time];
  328. !empty($CreateTimeStart) && $where[] = ['log.CreateTime', '>=', $CreateTimeStart];
  329. !empty($CreateTimeEnd) && $where[] = ['log.CreateTime', '<=', $CreateTimeEnd];
  330. !empty($Type) && $where[] = ['vy.Type', $Type];
  331. if (!empty($mobile)) {
  332. $PhoneNum = DB::connection('read')->table('QPAccountsDB.dbo.AccountPhone')
  333. ->where('PhoneNum', $mobile)
  334. ->pluck('UserID')->toArray();
  335. if (!empty($PhoneNum)) {
  336. $where[] = [function ($where) use ($PhoneNum) {
  337. $where->whereIn('vy.UserID', $PhoneNum);
  338. }];
  339. }
  340. }
  341. // 审核可见金额
  342. $visibleAmount = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  343. ->where('StatusName', 'VerifyScore')
  344. ->first();
  345. $UpperLimit = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  346. ->where('StatusName', 'UpperLimit')
  347. ->first();
  348. $field = ['log.id', 'log.OrderID', 'log.CreateTime', 'log.UpdateTime', 'log.Remarks', 'AgreeScore', 'log.FinalScore as logFinalScore', 'vy.ReceivedScore', 'vy.OverLook', 'ua.UserID', 'Higher1ID', 'Higher2ID', 'downCount1', 'downCount2', 'ai.GameID', 'ai.RegisterDate', 'vy.FinalScore', 'TotalScore', 'log.Type', 'ai.SpreaderID'];
  349. $SQL = DB::connection('write')->table('agent.dbo.extension_verify_log as log')
  350. ->join('QPAccountsDB.dbo.AccountsInfo as ai', 'log.UserID', 'ai.UserID')
  351. ->leftjoin('agent.dbo.extension_verify as vy', function ($join) {
  352. $join->on('log.UserID', 'vy.UserID')->on('log.Type', 'vy.Type');
  353. })
  354. ->join('QPAccountsDB.dbo.UserAgent as ua', 'log.UserID', 'ua.UserID')
  355. ->where($where)
  356. ->select($field)
  357. ->orderBy('CreateTime', 'desc');
  358. if (!empty($Sort)) {
  359. $list = $SQL->orderBy("TotalScore", $Sort)->paginate(10);
  360. } else {
  361. $list = $SQL->orderBy('TotalScore', 'desc')->paginate(10);
  362. }
  363. $OrderIDs = [];
  364. $SpreaderIDs = [];
  365. $UserIDs = [];
  366. foreach ($list as $v) {
  367. $OrderIDs[] = $v->OrderID;
  368. $SpreaderIDs[] = $v->SpreaderID;
  369. $UserIDs[] = $v->UserID;
  370. }
  371. // 获取上级ID 'ai1.GameID as SpreaderID'
  372. $getSpreaderID = DB::connection('read')->table('QPAccountsDB.dbo.AccountsInfo')
  373. ->whereIn('UserID', $SpreaderIDs)
  374. ->select('GameID', 'UserID')
  375. ->pluck('GameID', 'UserID')->toArray();
  376. $user_profit_log = DB::connection('write')->table('agent.dbo.extension_user_profit_log')
  377. ->whereIn('OrderID', $OrderIDs)
  378. ->whereIn('UserID', $UserIDs)
  379. ->selectRaw('IsNull(sum(NoteCount),0) NoteCount,OrderID,UserID,Type')
  380. ->groupBy('OrderID', 'UserID', 'Type')
  381. ->get();
  382. $user_profit_log1 = DB::connection('write')->table('agent.dbo.extension_user_profit_log')
  383. ->whereIn('OrderID', $OrderIDs)
  384. ->whereIn('UserID', $UserIDs)
  385. ->selectRaw('count(distinct(InvitationUserIDs)) NoteCount,OrderID')
  386. ->groupBy('OrderID')
  387. ->pluck('NoteCount', 'OrderID')->toArray();
  388. foreach ($list as &$value) {
  389. $value->count = 0;
  390. $value->TotalScore = number_float($value->TotalScore / NumConfig::NUM_VALUE);
  391. $value->ReceivedScore = number_float($value->ReceivedScore / NumConfig::NUM_VALUE);
  392. $value->logFinalScore = !empty($value->logFinalScore) ? number_float($value->logFinalScore / NumConfig::NUM_VALUE) : '';
  393. $value->AgreeScore = number_float($value->AgreeScore / NumConfig::NUM_VALUE);
  394. // 来源人数
  395. if ($value->Type == 1) {
  396. foreach ($user_profit_log as $val) {
  397. if ($val->UserID == $value->UserID && $val->Type == $value->Type) {
  398. $value->count = $val->NoteCount;
  399. }
  400. }
  401. } else {
  402. $value->count = isset($user_profit_log1[$value->OrderID]) ? $user_profit_log1[$value->OrderID] : 0;
  403. }
  404. $value->SpreaderID = isset($getSpreaderID[$value->SpreaderID]) ? $getSpreaderID[$value->SpreaderID] : '';
  405. $reward = DB::connection('read')->table('QPRecordDB.dbo.RecordUserScoreStatisticsNew')
  406. ->where('ScoreType', 36)
  407. ->where('UserID', $value->UserID)
  408. ->selectRaw('sum(Score) Score')
  409. ->first()->Score ?? 0;
  410. $TotalReward1 = DB::connection('read')->table('QPAccountsDB.dbo.UserAgent')
  411. ->where('Higher1ID', $value->UserID)
  412. ->selectRaw('IsNull(sum(TotalReward1),0) TotalReward')
  413. ->first()->TotalReward ?? 0;
  414. $TotalReward2 = DB::connection('read')->table('QPAccountsDB.dbo.UserAgent')
  415. ->Where('Higher2ID', $value->UserID)
  416. ->selectRaw('IsNull(sum(TotalReward2),0) TotalReward')
  417. ->first()->TotalReward ?? 0;
  418. $value->Total = number_float(($reward + $TotalReward1 + $TotalReward2 + $value->FinalScore) / NumConfig::NUM_VALUE);
  419. $value->FinalScore = number_float($value->FinalScore / NumConfig::NUM_VALUE);
  420. }
  421. $visibleAmount->StatusValue /= NumConfig::NUM_VALUE;
  422. $UpperLimit->StatusValue /= NumConfig::NUM_VALUE;
  423. $start_time = Helper::timeChange($start_time);
  424. $end_time = Helper::timeChange($end_time);
  425. $CreateTimeStart = Helper::timeChange($CreateTimeStart);
  426. $CreateTimeEnd = Helper::timeChange($CreateTimeEnd);
  427. $data = compact('list', 'GameID', 'SpreaderID', 'start_time', 'end_time', 'mobile', 'NickName', 'Type', 'visibleAmount', 'Sort', 'UpperLimit', 'CreateTimeStart', 'CreateTimeEnd');
  428. return view('admin.extension.verify_final', $data);
  429. }
  430. // 审核通过列表页面的备注
  431. public function verifyFinalRemarks(Request $request, $ID)
  432. {
  433. $post = $request->post();
  434. DB::connection('write')->table('agent.dbo.extension_verify_log')
  435. ->where('id', $ID)
  436. ->update($post);
  437. return apiReturnSuc();
  438. }
  439. // -----------------------------------------------------------------------游戏对局------------------------------------------------------------------------------
  440. // 游戏对局 ---- 配置
  441. public function gameCountConfig(Request $request)
  442. {
  443. $list = DB::connection('write')->table('agent.dbo.extension_config')
  444. ->where('type', 2)
  445. ->paginate(10);
  446. foreach ($list as &$value) {
  447. foreach ($value as $key => &$val) {
  448. if ($key != 'id' && $key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  449. $val /= NumConfig::NUM_VALUE;
  450. }
  451. }
  452. }
  453. return view('admin.extension.gamecount_config', compact('list'));
  454. }
  455. // 注册奖金配置 -- 添加
  456. public function gameCountConfig_add(Request $request)
  457. {
  458. if ($request->isMethod('post')) {
  459. $post = $request->post();
  460. foreach ($post as $key => &$value) {
  461. if ($key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  462. $value *= NumConfig::NUM_VALUE;
  463. }
  464. }
  465. $post['type'] = 2;
  466. DB::connection('write')->table('agent.dbo.extension_config')->insert($post);
  467. return apiReturnSuc();
  468. }
  469. return view('admin.extension.gamecount_config_add');
  470. }
  471. // 注册奖金配置 -- 修改
  472. public function gameCountConfig_update(Request $request, $id)
  473. {
  474. if ($request->isMethod('post')) {
  475. $post = $request->post();
  476. foreach ($post as $key => &$value) {
  477. if ($key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  478. $value *= NumConfig::NUM_VALUE;
  479. }
  480. }
  481. DB::connection('write')->table('agent.dbo.extension_config')
  482. ->where('id', $id)
  483. ->update($post);
  484. return apiReturnSuc();
  485. }
  486. $info = DB::connection('write')->table('agent.dbo.extension_config')
  487. ->where('id', $id)
  488. ->first();
  489. foreach ($info as $key => &$value) {
  490. if ($key != 'id' && $key != 'name' && $key != 'level_quota_number' && $key != 'two_level_quota_number') {
  491. $value /= NumConfig::NUM_VALUE;
  492. }
  493. }
  494. return view('admin.extension.gamecount_config_update', compact('info'));
  495. }
  496. // 裂变可领额度上限配置
  497. public function gameCountLimit(Request $request)
  498. {
  499. if ($request->isMethod('post')) {
  500. $post = $request->post();
  501. $post['StatusValue'] *= NumConfig::NUM_VALUE;
  502. DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  503. ->where('StatusName', 'GameCountLimit')
  504. ->update($post);
  505. return apiReturnSuc();
  506. }
  507. $info = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  508. ->where('StatusName', 'GameCountLimit')
  509. ->first();
  510. $info->StatusValue /= NumConfig::NUM_VALUE;
  511. return view('admin.extension.gamecount_limit', compact('info'));
  512. }
  513. // 自动审核开关
  514. public function autoVerify(Request $request)
  515. {
  516. $StatusValue = $request->StatusValue;
  517. DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  518. ->where('StatusName', 'AutoVerify')
  519. ->update(['StatusValue' => $StatusValue]);
  520. return apiReturnSuc();
  521. }
  522. public function recharge_rate(Request $request)
  523. {
  524. if ($request->isMethod('post')) {
  525. $post = $request->post();
  526. if (is_array($post)) {
  527. foreach ($post as $key => $value) {
  528. DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  529. ->where('StatusName', $key)
  530. ->update(['StatusValue' => $value * NumConfig::NUM_VALUE]);
  531. }
  532. }
  533. return apiReturnSuc();
  534. }
  535. $list = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  536. ->where('StatusName', 'AgentRebateRatio1')
  537. ->orWhere('StatusName', 'AgentRebateRatio2')
  538. ->get();
  539. return view('admin.extension.recharge_rate',compact('list'));
  540. }
  541. }