| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826 |
- <?php
- namespace App\Http\Controllers\Admin;
- // 渠道管理
- use App\Facade\TableName;
- use App\Game\WebChannelConfig;
- use App\Http\helper\Helper;
- use App\Http\logic\admin\ChannelLogic;
- use App\Http\logic\admin\RechargeLogic;
- use App\Jobs\ClearCache;
- use App\Models\AppSwitch;
- use App\Models\SystemStatusInfo;
- use App\Models\WithdrawalChannelPositionConfig;
- use App\Models\WithdrawalPositionConfig;
- use App\Services\GameRoomInfo;
- use App\Util;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Redis;
- use Illuminate\Support\Facades\Validator;
- class ChannelController
- {
- public function index(Request $request)
- {
- $where = [];
- $name = $request->Name ?: '';
- !empty($name) && $where[] = ['Name', 'like', $name . '%'];
- // $notIn = [1, 2, 3, 4, 5, 7, 10, 13, 14, 15, 16, 17];
- $list = DB::connection('write')->table('QPPlatformDB.dbo.ChannelConfig')
- // ->whereNotIn('ChannelIndex', $notIn)
- ->where($where)
- ->paginate(10);
- return view('admin.channel.index', ['list' => $list, 'Name' => $name]);
- }
- public function channelAdd(Request $request)
- {
- if ($request->isMethod('post')) {
- $post = $request->post();
- $Channel = $post['Channel'];
- $post['ChannelType'] = 100;
- $post['ChannelIndex'] = $Channel - $post['ChannelType'];
- $post['ReviewState'] = 1;
- unset($post['Channel']);
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelConfig')
- ->insert($post);
- // 同步添加渠道包
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelRechargeGameOpen')
- ->insert(['ChannelPackageName' => $post['Name'], 'Channel' => $Channel]);
- return apiReturnSuc();
- } else {
- return view('admin.channel.channel_add');
- }
- }
- public function channelNew(Request $request)
- {
- if ($request->isMethod('post')) {
- $post = $request->post();
- $post['Remarks'] = $post['AliasName'];
- $post['AppKey']= Util::generateRandomString();
- while(DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')->where('AppKey', $post['AppKey'])->exists()) {
- $post['AppKey'] = Util::generateRandomString();
- }
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->insert($post);
- $channel = @$post['Channel'];
- if($channel){
- $createConfig = function () use($channel) {
- $config = new WithdrawalChannelPositionConfig();
- $config->channel = $channel;
- return $config;
- };
- $config = WithdrawalChannelPositionConfig::query()->where('channel', $channel)->first() ?: $createConfig();
- $config->save();
- }
- return apiReturnSuc();
- } else {
- return view('admin.channel.channel_new');
- }
- }
- public function channelEdit(Request $request, $id)
- {
- $ChannelIndex = $request->ChannelIndex;
- $AndroidVersion = $request->AndroidVersion;
- $where = [
- ['ChannelType', '=', $id],
- ['ChannelIndex', '=', $ChannelIndex],
- ['AndroidVersion', '=', $AndroidVersion],
- ];
- if ($request->isMethod('post')) {
- $post = $request->post();
- //$post['ChannelIndex'] = $post['Channel'] - $post['ChannelType'];
- unset($post['Channel']);
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelConfig')
- ->where($where)
- ->update($post);
- // 同步修改渠道包
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelRechargeGameOpen')
- ->where('Channel', ($id + $ChannelIndex))
- ->update(['ChannelPackageName' => $post['Name']]);
- return apiReturnSuc();
- } else {
- $info = DB::connection('write')->table('QPPlatformDB.dbo.ChannelConfig')
- ->where($where)
- ->first();
- return view('admin.channel.channel_edit', compact('info', 'id', 'ChannelIndex', 'AndroidVersion'));
- }
- }
- public function switch_control(Request $request, $id)
- {
- $type = $request->type;
- $ChannelIndex = $request->ChannelIndex;
- $AndroidVersion = $request->AndroidVersion;
- $logic = new ChannelLogic();
- $res = $logic->switch_control($id, $ChannelIndex, $AndroidVersion, $type);
- if ($res === false) {
- return apiReturnFail($logic->getError());
- }
- return apiReturnSuc();
- }
- public function update(Request $request, $ChannelType)
- {
- $ChannelIndex = $request->ChannelIndex ?: '';
- $ChannelName = $request->ChannelName ?: '';
- $AndroidVersion = $request->AndroidVersion;
- $data = $request->data ?: '';
- $where[] = ['ChannelIndex', '=', $ChannelIndex];
- $where[] = ['ChannelType', '=', $ChannelType];
- $where[] = ['AndroidVersion', '=', $AndroidVersion];
- if ($request->isMethod('POST')) {
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelConfig')
- ->where($where)
- ->updateOrInsert($where, $data);
- return apiReturnSuc();
- } else {
- $info = DB::connection('read')->table('QPPlatformDB.dbo.ChannelConfig')
- ->where($where)
- ->first();
- return view('admin.channel.update', [
- 'info' => $info,
- 'ChannelName' => $ChannelName
- ]);
- }
- }
- public function ChannelSaveLog()
- {
- $list = DB::connection('read')->table('agent.dbo.ChannelSaveLog as log')
- ->join('agent.dbo.admin_users as au', 'log.admin_id', '=', 'au.id')
- ->select('au.account', 'log.*')
- ->paginate(10);
- foreach ($list as &$val) {
- $ChannelName = '';
- switch ($val->channel) {
- case 0:
- $ChannelName = '官方';
- break;
- case 100: // 谷歌渠道
- switch ($val->ChannelIndex) {
- case 0:
- $ChannelName = '谷歌渠道';
- break;
- case 1:
- $ChannelName = 'Teenpatti Royal';
- break;
- case 2:
- $ChannelName = 'teenpatti club';
- break;
- case 3:
- $ChannelName = 'Teenpatti.Champion';
- break;
- case 4:
- $ChannelName = 'com.teempatti.Victory';
- break;
- case 5:
- $ChannelName = 'com.teempatti.fun';
- break;
- case 6:
- $ChannelName = 'teenpatti Exceed';
- break;
- case 7:
- $ChannelName = 'com.teempatti.reward';
- break;
- case 8:
- $ChannelName = 'com.teempatti.qplayer';
- break;
- case 9:
- $ChannelName = 'com.teempatti.q3acard';
- break;
- case 10:
- $ChannelName = 'com.teempatti.qnobles';
- break;
- case 11:
- $ChannelName = 'com.teempatti.qgrandparty';
- break;
- case 12:
- $ChannelName = 'com.teempatti.queen';
- break;
- case 13:
- $ChannelName = 'com.teempatti.royalclub';
- break;
- case 14:
- $ChannelName = 'com.teempatti.queencard';
- break;
- case 15:
- $ChannelName = 'com.teempatti.queensnice';
- break;
- case 16:
- $ChannelName = 'com.teempatti.queensplay';
- break;
- case 17:
- $ChannelName = 'com.teempatti.queensclub';
- break;
- }
- }
- $val->ChannelName = $ChannelName;
- }
- return view('admin.channel.ChannelSaveLog', ['list' => $list]);
- }
- // 渠道审核屏蔽ID白名单
- public function ChannelShieldIDWhite()
- {
- // $list = DB::connection('write')->table('QPPlatformDB.dbo.ChannelShieldIDWhite')->paginate(10);
- $list = DB::connection('read')->table('QPAccountsDB.dbo.IDWhiteUser as white')
- ->join('QPAccountsDB.dbo.AccountsInfo as acc', 'acc.UserID', '=', 'white.UserID')
- ->select('acc.GameID', 'acc.UserID','white.Remarks')
- ->paginate(100);
- // print_r($list);die;
- return view('admin.channel.channel_shield_id_white', compact('list'));
- }
- // 渠道审核屏蔽ID白名单 -- 添加ID
- public function add(Request $request)
- {
- if ($request->isMethod('post')) {
- $post = $request->post();
- $userid = DB::connection('write')->table('QPAccountsDB.dbo.AccountsInfo')
- ->where('GameID', $post['GameID'])
- ->select('UserID')
- ->first()->UserID;
- if (!$userid) {
- return apiReturnFail('用户ID不存在');
- }
- $first = DB::connection('write')->table('QPAccountsDB.dbo.IDWhiteUser')
- ->where('UserID', $userid)
- ->first();
- if ($first) {
- return apiReturnFail('用户已经存在');
- }
- DB::connection('write')->table('QPAccountsDB.dbo.IDWhiteUser')
- ->insert(['UserID'=>$userid,'Remarks'=>$post['Remarks']]);
- return apiReturnSuc();
- }
- return view('admin.channel.channel_shield_id_white_add');
- }
- // 渠道审核屏蔽ID白名单 -- 修改ID
- public function edit(Request $request, $ID)
- {
- if ($request->isMethod('post')) {
- $post = $request->post();
- DB::connection('write')->table('QPAccountsDB.dbo.IDWhiteUser')
- ->where('UserID', $ID)
- ->update($post);
- return apiReturnSuc();
- }
- $info = DB::connection('write')->table('QPAccountsDB.dbo.IDWhiteUser')
- ->where('UserID', $ID)
- ->first();
- return view('admin.channel.channel_shield_id_white_add', compact('info'));
- }
- // 渠道审核屏蔽ID白名单 -- 删除ID
- public function del($ID)
- {
- DB::connection('write')->table('QPAccountsDB.dbo.IDWhiteUser')
- ->where('UserID', $ID)
- ->delete();
- return apiReturnSuc();
- }
- // 渠道审核屏蔽ID白名单 -- 修改状态
- public function updateState(Request $request)
- {
- $State = (int)$request->State;
- $State = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
- ->where('StatusName', 'ChannelShieldIDWhite')
- ->update(['StatusValue' => $State]);
- return apiReturnSuc();
- }
- // 渠道包配置充值和游戏
- public function rechargeGame(Request $request)
- {
- $ChannelPackageName = $request->ChannelPackageName ?: '';
- $list = (new ChannelLogic())->rechargeGame($ChannelPackageName);
- return view('admin.channel.recharge_game', compact('list'));
- }
- // 开放游戏配置修改 $Channel == -1 默认游戏配置
- // 开放游戏配置修改 $Channel == -1 默认游戏配置
- public function OpenGames(Request $request, $Channel)
- {
- $ChannelPackageName = $request->ChannelPackageName ?: '';
- if ($request->isMethod('post')) {
- $post = $request->all();
- $GameShareUrl = $post['ShareUrl'] ?? '';
- unset($post['ShareUrl']);
- $arr = [];
- if (isset($post['KindID'])) {
- for ($i = 0; $i < count($post['KindID']); $i++) {
- if (isset($post['KindID'][$i]) && $post['KindID'][$i] >= 0) {
- $arr[$i]['KindID'] = $post['KindID'][$i];
- $arr[$i]['Status'] = $post['Status'][$i] ?? 1;
- $arr[$i]['Sort'] = $post['Sort'][$i] ?? 0;
- $arr[$i]['SecondStageStatus'] = $post['SecondStageStatus'][$i] ?? 0;
- $arr[$i]['SecondStageSort'] = $post['SecondStageSort'][$i] ?? 0;
- $arr[$i]['IconType'] = $post['IconType'][$i] ?? 1;
- $arr[$i]['Channel'] = $Channel;
- $arr[$i]['LimitCV'] = $post['LimitCV'][$i]??0;
- $arr[$i]['VIP'] = $post['VIP'][$i]??0;
- }
- }
- }
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelGameOpen')
- ->where('Channel', $Channel)
- ->delete();
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelGameOpen')
- ->insert($arr);
- // 修改默认游戏分享链接
- if (!empty($GameShareUrl)) {
- DB::table(TableName::QPAccountsDB() . 'SystemStatusInfo')
- ->where('StatusName', 'GameShareUrl')
- ->update(['StatusString' => $GameShareUrl]);
- }
- // ted提现开关
- if ($request->input('ted_switch', null) !== null) {
- $tedSwitch = AppSwitch::query()->firstOrNew(['name' => 'ted', 'scene' => 1, 'channel' => $Channel]);
- $tedSwitch->status = $request->input('ted_switch');
- $tedSwitch->save();
- }
- return apiReturnSuc();
- }
- $openGames = config('games.openKGame');
- $list = DB::connection('write')->table('QPPlatformDB.dbo.GameKindItem as gi')
- ->leftJoin('QPPlatformDB.dbo.ChannelGameOpen as cg', function ($join) use ($Channel) {
- $join->on('gi.KindID', 'cg.KindID');
- $join->where('Channel', $Channel);
- })
- ->whereIn('gi.KindID', $openGames)
- ->selectRaw('IsNull(Status,2) Status,KindName,gi.KindID,cg.Sort,SecondStageStatus,SecondStageSort,IconType,LimitCV,VIP')
- ->orderByDesc('Sort')
- ->get();
- // 游戏默认分享链接
- $GameShareUrl = DB::table(TableName::QPAccountsDB() . 'SystemStatusInfo')
- ->where('StatusName', 'GameShareUrl')
- ->value('StatusString');
- $tedSwitch = AppSwitch::query()->where([
- 'name' => 'ted',
- 'channel' => $Channel
- ])->first();
- return view(
- 'admin.channel.open_games',
- compact('list', 'ChannelPackageName', 'Channel', 'GameShareUrl', 'tedSwitch')
- );
- }
- public function payMethods($channel, Request $request)
- {
- $list = DB::connection('write')->table('agent.dbo.admin_configs as ac')
- ->leftJoin('QPPlatformDB.dbo.ChannelOpenRecharge as oc', function ($join) use ($channel) {
- $join->on('ac.id', '=', 'oc.ConfigID');
- $join->where('Channel', $channel);
- })
- ->where('type', 'pay_method')
- ->selectRaw('IsNull(oc.Status,2) Status,name,ac.id,oc.Sort, ac.config_key')
- ->get();
- foreach ($list as $k => $v) {
- $channels = DB::table('agent.dbo.admin_configs as ac')->where([
- 'type' => 'pay',
- 'new_pay_type' => $v->config_key
- ])
- ->leftJoin('QPPlatformDB.dbo.ChannelOpenRecharge as oc', function ($join) use ($channel) {
- $join->on('ac.id', '=', 'oc.ConfigID');
- $join->where('Channel', $channel);
- })
- ->selectRaw('IsNull(oc.Status,2) Status,name,ac.id,oc.Sort, ac.config_key')
- ->get();
- $list[$k]->channels = $channels;
- }
- $switch = intval(Redis::get("recharge_config_switch_{$channel}"));
- return view('admin.channel.pay_methods', [
- 'list' => $list,
- 'channel' => $channel,
- 'switch' => $switch
- ]);
- }
- public function updatePayConfig($channel, Request $request)
- {
- $switch = $request->input('switch', 0);
- Redis::set("recharge_config_switch_{$channel}", $switch);
- $switchOpened = DB::table('agent.dbo.admin_configs')->where([
- 'type' => 'pay',
- 'status' => 1,
- ])->pluck('id');
- $payMethodOpened = DB::table('agent.dbo.admin_configs')->where([
- 'type' => 'pay_method',
- 'status' => 1,
- ])->pluck('id');
- $inserts = [];
- foreach ($request->input('items') as $k => $v) {
- if (!in_array($v['id'], $payMethodOpened->toArray()) && $v['status'] == 1) {
- return apiReturnFail($v['id'] . '总开关已关闭,无法开启');
- }
- $inserts[] = [
- 'ConfigID' => $v['id'],
- 'Status' => $v['status'],
- 'Sort' => $v['sort'],
- 'Channel' => $channel
- ];
- $percent = 0;
- foreach ($v['channels'] ?? [] as $k1 => $v1) {
- if (!in_array($v1['id'], $switchOpened->toArray()) && $v1['status'] == 1) {
- return apiReturnFail($v1['id'] . '总开关已关闭,无法开启');
- }
- $inserts[] = [
- 'ConfigID' => $v1['id'],
- 'Status' => $v1['status'],
- 'Sort' => $v1['sort'],
- 'Channel' => $channel
- ];
- $percent += $v1['sort'];
- }
- if ($percent != 100 && $v['status'] == 1) {
- return apiReturnFail('权重值分配不正确');
- }
- }
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelOpenRecharge')
- ->where('Channel', $channel)
- ->delete();
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelOpenRecharge')
- ->insert($inserts);
- ClearCache::dispatch();
- return apiReturnSuc();
- }
- // 充值配置修改
- public function OpenRecharge(Request $request, $Channel)
- {
- $ChannelPackageName = $request->ChannelPackageName ?: '';
- if ($request->isMethod('post')) {
- $post = $request->all();
- $arr = [];
- if (isset($post['id'])) {
- for ($i = 0; $i < count($post['id']); $i++) {
- $arr[$i]['ConfigID'] = $post['id'][$i] ?? 0;
- $arr[$i]['Status'] = $post['Status'][$i] ?? 1;
- $arr[$i]['Sort'] = $post['Sort'][$i] ?? 0;
- $arr[$i]['Channel'] = $Channel;
- }
- }
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelOpenRecharge')
- ->where('Channel', $Channel)
- ->delete();
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelOpenRecharge')
- ->insert($arr);
- ClearCache::dispatch();
- return apiReturnSuc();
- }
- $list = DB::connection('write')->table('agent.dbo.admin_configs as ac')
- ->leftJoin('QPPlatformDB.dbo.ChannelOpenRecharge as oc', function ($join) use ($Channel) {
- $join->on('ac.id', '=', 'oc.ConfigID');
- $join->where('Channel', $Channel);
- })
- ->where('ac.status', 1)
- ->where('type', 'pay')
- ->selectRaw('IsNull(oc.Status,2) Status,name,ac.id,oc.Sort')
- ->get();
- return view('admin.channel.open_recharge', compact('list', 'ChannelPackageName', 'Channel'));
- }
- // 修改备注
- public function appkey(Request $request, $id)
- {
- $app=DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)->first();
- if(empty($app->AppKey)) {
- $AppKey=Util::generateRandomString(random_int(6,12));
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)
- ->update(['AppKey' => $AppKey]);
- }else{
- $AppKey=$app->AppKey;
- }
- return apiReturnSuc($AppKey);
- }
- // 修改备注
- public function app_key_set(Request $request, $id)
- {
- $config = DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('ID', $id)->first();
- if ($request->method() == 'GET') {
- return view('admin.channel.app_key_set', [
- 'config' => $config,
- ]);
- }
- $data=$request->all();
- $data['AdjustConfig']=$data['AdjustConfig']??"";
- DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('ID', $id)->update($data);
- return apiReturnSuc();
- }
- // 修改备注
- public function review(Request $request, $id)
- {
- $review=$request->status?:0;
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)
- ->update(['InReview' => $review]);
- $app=DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)->first();
- Redis::del("InReview_{$id}");
- Redis::del("InReview_{$app->PackageName}");
- return apiReturnSuc($review);
- }
- // 修改备注
- public function remarks(Request $request, $id)
- {
- $remarks = $request->remark ?: '';
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)
- ->update(['Remarks' => $remarks,'AliasName'=>$remarks]);
- $cp=DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)->select('Channel','PackageName')->first();
- $Channel=$cp->Channel;
- $PackageName=$cp->PackageName;
- if(WebChannelConfig::where('Channel', $Channel)->exists()) {
- WebChannelConfig::where('Channel', $Channel)->update(['Remarks' => $remarks]);
- }else{
- $config=WebChannelConfig::getByChannel(50)->toArray();
- $config['Remarks']=$remarks;
- $config['Channel']=$Channel;
- $config['PackageName']=$PackageName;
- unset($config['ID']);
- WebChannelConfig::insert($config);
- }
- $dcatChannel=DB::connection('mysql')->table('dcat-admin.channel')->where('channel',$Channel);
- if($dcatChannel->exists()){
- $dcatChannel->update(['channel_name'=>$remarks]);
- }else{
- DB::connection('mysql')->table('dcat-admin.channel')->insert(['channel'=>$Channel,'channel_name'=>$remarks,'package_name'=>'','remark'=>'']);
- }
- $dcatChannel=DB::connection('mysql')->table('dcat-admin.channel_ownership')->where('channel',$Channel);
- if($dcatChannel->exists()){
- $dcatChannel->update(['name'=>$remarks]);
- }else{
- DB::connection('mysql')->table('dcat-admin.channel_ownership')->insert(['channel'=>$Channel,'name'=>$remarks]);
- }
- return apiReturnSuc();
- }
- // 分享url
- public function shareUrl(Request $request, $id, $field)
- {
- $ShareUrl = $request->ShareUrl ?: '';
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)
- ->update([$field => $ShareUrl]);
- return apiReturnSuc();
- }
- // 修改minScore
- public function minScore(Request $request, $id)
- {
- $MinScore = $request->MinScore ?: 0;
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)
- ->update(['MinScore' => $MinScore]);
- return apiReturnSuc();
- }
- // 修改ContrlScore
- public function contrlScore(Request $request, $id)
- {
- $ContrlScore = $request->ContrlScore ?: 0;
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)
- ->update(['ContrlScore' => $ContrlScore]);
- return apiReturnSuc();
- }
- // 修改Rate
- public function rateN(Request $request, $id)
- {
- $Rate = $request->Rate ?: 0;
- DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')
- ->where('ID', $id)
- ->update(['Rate' => $Rate]);
- return apiReturnSuc();
- }
- public function shareConfig(Request $request, $id)
- {
- $config = DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('ID', $id)->first();
- if ($request->method() == 'GET') {
- return view('admin.channel.share_config', [
- 'config' => $config,
- ]);
- }
- $validator = Validator::make($request->all(), [
- 'UrlStatus' => 'required|in:0,1',
- 'UrlSelect' => 'required|in:1,2',
- 'ShareUrl' => 'nullable|url',
- 'SpreadShareUrl' => 'nullable|url',
- ]);
- if ($validator->fails()) {
- return apiReturnFail($validator->errors()->first());
- }
- $data = $request->only(['UrlStatus', 'UrlSelect']);
- $data['ShareUrl'] = strval($request->input('ShareUrl'));
- $data['SpreadShareUrl'] = strval($request->input('SpreadShareUrl'));
- DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('ID', $id)->update($data);
- return apiReturnSuc();
- }
- // 提现免审配置
- public function withdrawalConfigAll(Request $request)
- {
- $createConfig = function () {
- $config = new WithdrawalChannelPositionConfig();
- $config->channel = 100;
- return $config;
- };
- $config = WithdrawalChannelPositionConfig::query()->where('channel', 100)->first() ?: $createConfig();
- if ($request->method() == 'GET') {
- $agent = DB::table('agent.dbo.admin_configs')
- ->where('type', 'cash')
- ->where('status', 1)
- ->get();
- return view('admin.channel.channel_withdrawal_configall', [
- 'config' => $config,
- 'agent' => $agent,
- ]);
- }
- $data = array_filter($request->all(), function ($item) {
- return $item !== null && $item !== '';
- });
- $validator = Validator::make($data, [
- 'status' => 'required|in:1,2',
- 'agent' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return apiReturnFail($validator->errors()->first());
- }
- // $configs=WithdrawalChannelPositionConfig::query()->where('channel','<>',103)->get() ;
- $configs=WithdrawalChannelPositionConfig::query()->get() ;
- foreach ($configs as $config) {
- // if($config->channel==103)continue;
- $config->status = $request->input('status', 0);
- $config->agent = $request->input('agent', 0);
- $config->limit_manual_review_show = $request->input('limit_manual_review_show', 0);
- $config->save();
- //$config->update(['status'=>$request->input('status', 0),'agent'=>$request->input('agent', 0),'limit_manual_review_show'=>$request->input('limit_manual_review_show', 0)]);
- }
- return apiReturnSuc();
- }
- // 提现免审配置
- public function withdrawalSwitch(Request $request)
- {
- $key="WithDrawSwitch";
- if ($request->method() == 'GET') {
- $info=SystemStatusInfo::CacheValue($key);
- return view('admin.channel.channel_withdrawal_switch', [
- 'State' => $info->StatusValue,
- ]);
- }
- $State = (int)$request->State;
- SystemStatusInfo::CacheValue($key,$State);
- return apiReturnSuc();
- }
- // 提现免审配置
- public function withdrawalConfig($channel, Request $request)
- {
- $createConfig = function () use($channel) {
- $config = new WithdrawalChannelPositionConfig();
- $config->channel = $channel;
- return $config;
- };
- $config = WithdrawalChannelPositionConfig::query()->where('channel', $channel)->first() ?: $createConfig();
- if ($request->method() == 'GET') {
- $agent = DB::table('agent.dbo.admin_configs')
- ->where('type', 'cash')
- ->where('status', 1)
- ->get();
- return view('admin.channel.channel_withdrawal_config', [
- 'config' => $config,
- 'agent' => $agent,
- ]);
- }
- $data = array_filter($request->all(), function ($item) {
- return $item !== null && $item !== '';
- });
- $validator = Validator::make($data, [
- 'status' => 'required|in:1,2',
- 'agent' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return apiReturnFail($validator->errors()->first());
- }
- $config->status = $request->input('status', 0);
- $config->agent = $request->input('agent', 0);
- $config->limit_manual_review_show = $request->input('limit_manual_review_show', 0);
- $config->save();
- return apiReturnSuc();
- }
- }
|