|  | @@ -293,33 +293,21 @@ class Api2021Service
 | 
	
		
			
			| 293 | 293 |                  ],
 | 
	
		
			
			| 294 | 294 |                  'timeout' => 60, // Response timeout
 | 
	
		
			
			| 295 | 295 |                  'connect_timeout' => 30, // Connection timeout
 | 
	
		
			
			| 296 |  | -//                'on_headers' => function (\Psr\Http\Message\ResponseInterface $response) {
 | 
	
		
			
			| 297 |  | -//                    if ($response->getHeaderLine('Content-Length') > 1024) {
 | 
	
		
			
			| 298 |  | -//                        throw new \Exception('The file is too big!');
 | 
	
		
			
			| 299 |  | -//                    }
 | 
	
		
			
			| 300 |  | -//                },
 | 
	
		
			
			| 301 | 296 |                  'on_stats' => function (\GuzzleHttp\TransferStats $stats) {
 | 
	
		
			
			| 302 |  | -//                    echo $stats->getEffectiveUri() . "\n";
 | 
	
		
			
			| 303 |  | -//                    echo $stats->getTransferTime() . "\n";
 | 
	
		
			
			| 304 |  | -//                    var_dump($stats->getHandlerStats());
 | 
	
		
			
			| 305 |  | -
 | 
	
		
			
			| 306 |  | -                    $this->debuglog('lineFriendCheck-on_stats', [
 | 
	
		
			
			| 307 |  | -                        'rqid' => $rqid ?? 0
 | 
	
		
			
			| 308 |  | -                    ], [
 | 
	
		
			
			| 309 |  | -                        'transferTime' => $stats->getTransferTime(),
 | 
	
		
			
			| 310 |  | -                        'handlerStats' => $stats->getHandlerStats(),
 | 
	
		
			
			| 311 |  | -                    ]);
 | 
	
		
			
			| 312 |  | -
 | 
	
		
			
			| 313 |  | -                    // You must check if a response was received before using the
 | 
	
		
			
			| 314 |  | -                    // response object.
 | 
	
		
			
			| 315 |  | -//                    if ($stats->hasResponse()) {
 | 
	
		
			
			| 316 |  | -//                        echo $stats->getResponse()->getStatusCode();
 | 
	
		
			
			| 317 |  | -//                    } else {
 | 
	
		
			
			| 318 |  | -//                        // Error data is handler specific. You will need to know what
 | 
	
		
			
			| 319 |  | -//                        // type of error data your handler uses before using this
 | 
	
		
			
			| 320 |  | -//                        // value.
 | 
	
		
			
			| 321 |  | -//                        var_dump($stats->getHandlerErrorData());
 | 
	
		
			
			| 322 |  | -//                    }
 | 
	
		
			
			|  | 297 | +                    if ($stats->hasResponse()) {
 | 
	
		
			
			|  | 298 | +                        $this->debuglog('lineFriendCheck-on_stats_ok', [
 | 
	
		
			
			|  | 299 | +                            'rqid' => $rqid ?? 0
 | 
	
		
			
			|  | 300 | +                        ], [
 | 
	
		
			
			|  | 301 | +                            'transferTime' => $stats->getTransferTime(),
 | 
	
		
			
			|  | 302 | +                            'handlerStats' => $stats->getHandlerStats(),
 | 
	
		
			
			|  | 303 | +                        ]);
 | 
	
		
			
			|  | 304 | +                    } else {
 | 
	
		
			
			|  | 305 | +                        $this->debuglog('lineFriendCheck-on_stats_ng', [
 | 
	
		
			
			|  | 306 | +                            'rqid' => $rqid ?? 0
 | 
	
		
			
			|  | 307 | +                        ], [
 | 
	
		
			
			|  | 308 | +                            'handlerErrorData' => $stats->getHandlerErrorData(),
 | 
	
		
			
			|  | 309 | +                        ]);
 | 
	
		
			
			|  | 310 | +                    }
 | 
	
		
			
			| 323 | 311 |                  }
 | 
	
		
			
			| 324 | 312 |              ];
 | 
	
		
			
			| 325 | 313 |  
 | 
	
	
		
			
			|  | @@ -356,8 +344,8 @@ class Api2021Service
 | 
	
		
			
			| 356 | 344 |              if (!$isfollow || !$ismember) return false;
 | 
	
		
			
			| 357 | 345 |          } catch (Exception $ex) {
 | 
	
		
			
			| 358 | 346 |              // 錯誤可能發生在 memoIn 或是 out
 | 
	
		
			
			| 359 |  | -            $data['memoIn'] = json_encode(['error' => 'exception', 'param' => array_merge($param, $logdata)], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			| 360 |  | -            $data['memoOut'] = json_encode(['code' => $ex->getCode(), 'msg' => $ex->getMessage()], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			|  | 347 | +//            $data['memoIn'] = json_encode(['error' => 'exception', 'param' => array_merge($param, $logdata)], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			|  | 348 | +//            $data['memoOut'] = json_encode(['code' => $ex->getCode(), 'msg' => $ex->getMessage()], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			| 361 | 349 |  //            $this->syslog($data);
 | 
	
		
			
			| 362 | 350 |  
 | 
	
		
			
			| 363 | 351 |              $this->debuglog('lineFriendCheck', [
 | 
	
	
		
			
			|  | @@ -1028,10 +1016,28 @@ class Api2021Service
 | 
	
		
			
			| 1028 | 1016 |                  ],
 | 
	
		
			
			| 1029 | 1017 |                  'timeout' => 60, // Response timeout
 | 
	
		
			
			| 1030 | 1018 |                  'connect_timeout' => 30, // Connection timeout
 | 
	
		
			
			|  | 1019 | +                'on_stats' => function (\GuzzleHttp\TransferStats $stats) {
 | 
	
		
			
			|  | 1020 | +                    if ($stats->hasResponse()) {
 | 
	
		
			
			|  | 1021 | +                        $this->debuglog('playerTag-on_stats_ok', [
 | 
	
		
			
			|  | 1022 | +                            'rqid' => $rqid ?? 0
 | 
	
		
			
			|  | 1023 | +                        ], [
 | 
	
		
			
			|  | 1024 | +                            'transferTime' => $stats->getTransferTime(),
 | 
	
		
			
			|  | 1025 | +                            'handlerStats' => $stats->getHandlerStats(),
 | 
	
		
			
			|  | 1026 | +                        ]);
 | 
	
		
			
			|  | 1027 | +                    } else {
 | 
	
		
			
			|  | 1028 | +                        $this->debuglog('playerTag-on_stats_ng', [
 | 
	
		
			
			|  | 1029 | +                            'rqid' => $rqid ?? 0
 | 
	
		
			
			|  | 1030 | +                        ], [
 | 
	
		
			
			|  | 1031 | +                            'handlerErrorData' => $stats->getHandlerErrorData(),
 | 
	
		
			
			|  | 1032 | +                        ]);
 | 
	
		
			
			|  | 1033 | +                    }
 | 
	
		
			
			|  | 1034 | +                }
 | 
	
		
			
			| 1031 | 1035 |              ];
 | 
	
		
			
			| 1032 | 1036 |              if (!in_array($_SERVER['SERVER_ADDR'], ['172.31.30.167', '172.31.9.233', '172.31.42.197'])) $req['proxy'] = env('CCH_PROXY');
 | 
	
		
			
			| 1033 | 1037 |  
 | 
	
		
			
			| 1034 | 1038 |              $requestTime = date("Y-m-d H:i:s");
 | 
	
		
			
			|  | 1039 | +            $logdata['requestTime'] = $requestTime;
 | 
	
		
			
			|  | 1040 | +
 | 
	
		
			
			| 1035 | 1041 |              $response = $this->c->request('POST', env('API_BASE') . '/line/api/twpapi/tag/Tagging', $req);
 | 
	
		
			
			| 1036 | 1042 |              $res = $response->getBody();
 | 
	
		
			
			| 1037 | 1043 |  
 | 
	
	
		
			
			|  | @@ -1045,8 +1051,8 @@ class Api2021Service
 | 
	
		
			
			| 1045 | 1051 |  
 | 
	
		
			
			| 1046 | 1052 |          } catch (Exception $ex) {
 | 
	
		
			
			| 1047 | 1053 |              // 錯誤可能發生在 memoIn 或是 out
 | 
	
		
			
			| 1048 |  | -            $data['memoIn'] = json_encode(['error' => 'exception'], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			| 1049 |  | -            $data['memoOut'] = json_encode(['code' => $ex->getCode(), 'msg' => $ex->getMessage()], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			|  | 1054 | +//            $data['memoIn'] = json_encode(['error' => 'exception'], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			|  | 1055 | +//            $data['memoOut'] = json_encode(['code' => $ex->getCode(), 'msg' => $ex->getMessage()], JSON_UNESCAPED_UNICODE);
 | 
	
		
			
			| 1050 | 1056 |  //            $this->syslog($data);
 | 
	
		
			
			| 1051 | 1057 |  
 | 
	
		
			
			| 1052 | 1058 |              $this->debuglog('playerTag', [
 | 
	
	
		
			
			|  | @@ -1054,9 +1060,10 @@ class Api2021Service
 | 
	
		
			
			| 1054 | 1060 |              ], [
 | 
	
		
			
			| 1055 | 1061 |                  'errCode' => $ex->getCode(),
 | 
	
		
			
			| 1056 | 1062 |                  'requestTime' => $requestTime ?? '',
 | 
	
		
			
			|  | 1063 | +                'logTime' => date("Y-m-d H:i:s"),
 | 
	
		
			
			| 1057 | 1064 |                  'errMsg' => $ex->getMessage(),
 | 
	
		
			
			| 1058 | 1065 |              ]);
 | 
	
		
			
			| 1059 |  | -            
 | 
	
		
			
			|  | 1066 | +
 | 
	
		
			
			| 1060 | 1067 |              return false;
 | 
	
		
			
			| 1061 | 1068 |          }
 | 
	
		
			
			| 1062 | 1069 |          
 |