|
|
@@ -4,12 +4,88 @@ namespace App\Service;
|
|
|
|
|
|
use App\Model\RecordTable;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
-use Illuminate\Support\Facades\Config;
|
|
|
-use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
class TestService extends Service
|
|
|
{
|
|
|
+ public function testPjCommonRule($data){
|
|
|
+ if(empty($data['domain'])) return [false, '域名不能为空'];
|
|
|
+ $url = $data['domain'] . '/api/module-data/asst_daily_schedule/asst_daily_schedule/diy/get_current_daily_schedule';
|
|
|
+ $json = '{}';
|
|
|
+
|
|
|
+ list($status, $result) = $this->post_helper($url,$json, $data['header'], 30,'pj预先调用');
|
|
|
+ if(! $status) return [false, $result];
|
|
|
+
|
|
|
+ if(isset($result['message']) && $result['message'] == 'error.unAuthorized') return [false, $result['description'] ?? '用户未登录或失效'];
|
|
|
+ if(isset($result['status']) && $result['status'] == 'error') return [false, $result['message'] ?? '系统错误,请联系管理员'];
|
|
|
+
|
|
|
+ return [true, ''];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testpj($data){
|
|
|
+ if(empty($data['url']) || empty($data['post']) || empty($data['header'])) return [false,'API请求参数不能为空'];
|
|
|
+ list($status, $msg) = $this->testPjCommonRule($data);
|
|
|
+ if(! $status) return [false, $msg];
|
|
|
+
|
|
|
+ $url = $data['url'];
|
|
|
+// $oldUrl = config('ip.zslf');
|
|
|
+// $newUrl = config('ip.zslfip');
|
|
|
+// $url = str_replace($oldUrl, $newUrl, $url);
|
|
|
+
|
|
|
+ $post = $data['post'];
|
|
|
+ $header = $data['header'];
|
|
|
+
|
|
|
+ $json = json_encode($post);
|
|
|
+ $json = str_replace('"workflowSearchBean":[]','"workflowSearchBean":{}',$json);
|
|
|
+ $json = str_replace('"loginBindingParameters":[]','"loginBindingParameters":{}',$json);
|
|
|
+
|
|
|
+ list($status, $result) = $this->post_helper($url,$json, $header, 40,'pj');
|
|
|
+ if(! $status) return [false, $result];
|
|
|
+
|
|
|
+ return [true, $result];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testpjget($data){
|
|
|
+ if(empty($data['url']) || empty($data['header'])) return [false,'API请求参数不能为空'];
|
|
|
+ list($status, $msg) = $this->testPjCommonRule($data);
|
|
|
+ if(! $status) return [false, $msg];
|
|
|
+
|
|
|
+ $url = $data['url'];
|
|
|
+// $oldUrl = config('ip.zslf');
|
|
|
+// $newUrl = config('ip.zslfip');
|
|
|
+// $url = str_replace($oldUrl, $newUrl, $url);
|
|
|
+
|
|
|
+ $header = $data['header'];
|
|
|
+
|
|
|
+ list($status,$result) = $this->get_helper($url,$header);
|
|
|
+ if(! $status) return [false, $result];
|
|
|
+
|
|
|
+ return [true, $result];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testpjput($data){
|
|
|
+ if(empty($data['url']) || empty($data['post']) || empty($data['header'])) return [false,'API请求参数不能为空'];
|
|
|
+ list($status, $msg) = $this->testPjCommonRule($data);
|
|
|
+ if(! $status) return [false, $msg];
|
|
|
+
|
|
|
+ $url = $data['url'];
|
|
|
+// $oldUrl = config('ip.zslf');
|
|
|
+// $newUrl = config('ip.zslfip');
|
|
|
+// $url = str_replace($oldUrl, $newUrl, $url);
|
|
|
+
|
|
|
+ $post = $data['post'];
|
|
|
+ $header = $data['header'];
|
|
|
+
|
|
|
+ $json = json_encode($post);
|
|
|
+ $json = str_replace('"workflowSearchBean":{}','"workflowSearchBean":[]',json_encode($post));
|
|
|
+ $json = str_replace('"workflowSearchBean":[]','"workflowSearchBean":{}',json_encode($post));
|
|
|
+
|
|
|
+ list($status, $result) = $this->put_helper($url,$json, $header,40);
|
|
|
+ if(! $status) return [false, $result];
|
|
|
+
|
|
|
+ return [true, $result];
|
|
|
+ }
|
|
|
+
|
|
|
public function testdwy($data){
|
|
|
if(empty($data['url']) || empty($data['post']) || empty($data['header'])) return [false,'API请求参数不能为空'];
|
|
|
$url = $data['url'];
|