瀏覽代碼

修改参数配置

郑晓宇 6 年之前
父節點
當前提交
07e8ad14b0

+ 8 - 0
.env.example

@@ -33,3 +33,11 @@ PUSHER_APP_ID=
 PUSHER_APP_KEY=
 PUSHER_APP_SECRET=
 PUSHER_APP_CLUSTER=mt1
+
+YANSHI=false
+
+PLATFORM_GET_USERINFO_URL=http://211.139.191.175:38083/hgs/uc/queryusergameinfo
+PLATFORM_UPLOAD_SCORE_URL=http://211.139.191.175:38083/hgs/uc/pktaskresult
+
+WS_REGEDIT_ADDR=127.0.0.1:1238
+WS_CONNECT_ADDR=183.234.61.252:8282

+ 2 - 2
app/Console/Commands/gamematch.php

@@ -47,7 +47,7 @@ class gamematch extends Command
     public function handle()
     {
         //注册地址
-        Gateway::$registerAddress = '127.0.0.1:1238';
+        Gateway::$registerAddress = env("WS_REGEDIT_ADDR");
         $match_times = 0;
         //循环匹配
         while (1) {
@@ -230,7 +230,7 @@ class gamematch extends Command
     public function get_free_room()
     {
         //注册地址
-        Gateway::$registerAddress = '127.0.0.1:1238';
+        Gateway::$registerAddress = env("WS_REGEDIT_ADDR");
         while (1) {
             $room = Room::select("room_id")->where("is_full",0)->where("is_end","<>",1)->first();
             if($room){

+ 4 - 3
app/Console/Commands/robot.php

@@ -70,7 +70,7 @@ class robot extends Command
         $worker = new Worker();
         $worker->onWorkerStart = function($worker) use($user, $room_id, $client_id){
             //定义基本信息
-            $http_addr = 'http://183.234.61.252:8090/';
+            $http_addr =  env("APP_URL") . '/';
             // $http_addr = 'http://www.dt.com/';
             $client = new Client([
                 'cookies' => true,
@@ -84,13 +84,14 @@ class robot extends Command
                 ]
             ]);
             // $robot = $response->getBody()->getContents();
-            $con = new AsyncTcpConnection('ws://183.234.61.252:8282');
+            $ws_connect_addr = env("WS_CONNECT_ADDR");
+            $con = new AsyncTcpConnection("ws://{$ws_connect_addr}");
             // $con = new AsyncTcpConnection('ws://127.0.0.1:8282');
             $con->onConnect = function($con) use($client, $worker) {
             };
             $con->onMessage = function($con, $data) use($client, &$room_id, &$client_id, $user, $http_addr, $worker){
                 //注册地址
-                Gateway::$registerAddress = '127.0.0.1:1238';
+                Gateway::$registerAddress = env("WS_REGEDIT_ADDR");
                 //格式化参数
                 $json_data = json_decode($data);
                 //初始化

+ 1 - 1
app/Home/Controllers/GameController.php

@@ -34,7 +34,7 @@ class GameController extends Controller
         $user_id = $request->session()->get('user_id');
 
         //注册gateway地址
-        Gateway::$registerAddress = '127.0.0.1:1238';
+        Gateway::$registerAddress = env("WS_REGEDIT_ADDR");
         //获取房间号
         $room_id = RoomUser::where(["user_id"=>$user_id,"state"=>1])->value('room_id');
 

+ 3 - 4
app/Home/Controllers/UserController.php

@@ -33,8 +33,7 @@ class UserController extends Controller
             $client = new Client([
                 'verify' => false,
             ]);
-            $ip = '211.139.191.175';
-            $port = '38083';
+            $platform_get_userinfo_url = env("PLATFORM_GET_USERINFO_URL");
             $req_time = date('YmdHis');
             $sign = md5($cmcc_id . $req_time . $mt);
             $params['req_param'] = [
@@ -49,7 +48,7 @@ class UserController extends Controller
                 "page_info" => [],
                 "busi_info" => [],
             ];
-            $result = $client->request('POST', "http://{$ip}:{$port}/hgs/uc/queryusergameinfo",[
+            $result = $client->request('POST', $platform_get_userinfo_url, [
                 'json' => $params
             ]);
 
@@ -157,7 +156,7 @@ class UserController extends Controller
         $user_id = $request->session()->get('user_id');
         $client_id = $request->input('client_id');
         //注册地址
-        Gateway::$registerAddress = '127.0.0.1:1238';
+        Gateway::$registerAddress = env("WS_REGEDIT_ADDR");
         //异地登录机制
         $user = User::where("user_id", $user_id)->first();
         // var_dump($user,$client_id);exit;

+ 1 - 1
app/Jobs/Distribute.php

@@ -50,7 +50,7 @@ class Distribute implements ShouldQueue
         $questions_id = RoomQuestion::where("room_id", $this->room_id)->pluck("question_id");
         if(count($questions_id) < 5){
             //注册地址
-            Gateway::$registerAddress = '127.0.0.1:1238';
+            Gateway::$registerAddress = env("WS_REGEDIT_ADDR");
             //获取题目
             $question = Question::inRandomOrder()->select('question_id','title')->where("is_released",1)->whereNotIn("question_id", $questions_id)->first();
             $options = Option::select('option_id','title')->where("question_id",$question->question_id)->get($question->question_id);

+ 3 - 4
app/Jobs/Settlement.php

@@ -52,7 +52,7 @@ class Settlement implements ShouldQueue
         //获取当前房间获取问题数
         $room_question_count = RoomQuestion::where("room_id", $this->room_id)->count();
         //注册gateway地址
-        Gateway::$registerAddress = '127.0.0.1:1238';
+        Gateway::$registerAddress = env("WS_REGEDIT_ADDR");
         //结算当前局
         $update_data["end_at"] = date("Y-m-d H:i:s");
         RoomQuestion::where([
@@ -112,8 +112,7 @@ class Settlement implements ShouldQueue
                 $client = new Client([
                     'verify' => false,
                 ]);
-                $ip = '211.139.191.175';
-                $port = '38083';
+                $platform_upload_score_url = env("PLATFORM_UPLOAD_SCORE_URL");
                 $req_time = date('YmdHis');
                 $sign = md5($cmcc_id . $req_time . $mt);
                 $params['req_param'] = [
@@ -136,7 +135,7 @@ class Settlement implements ShouldQueue
 
                 Log::info("通知平台放请求信息: \n ". json_encode($params) ."\n");
 
-                $result = $client->request('POST', "http://{$ip}:{$port}/hgs/uc/pktaskresult",[
+                $result = $client->request('POST', $platform_upload_score_url, [
                     'json' => $params
                 ]);