Commit f4ff2838 by 杨树贤

暂存

parent c4c3a2c6
...@@ -6,6 +6,7 @@ namespace App\Http\Services; ...@@ -6,6 +6,7 @@ namespace App\Http\Services;
//后台用户相关信息服务 //后台用户相关信息服务
use App\Model\SupplierBlacklistModel; use App\Model\SupplierBlacklistModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use http\Exception\InvalidArgumentException;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
//处理多个系统的图片替换问题 //处理多个系统的图片替换问题
...@@ -114,9 +115,9 @@ class DealImageService ...@@ -114,9 +115,9 @@ class DealImageService
if (empty($itemList['data']['goods_id'])) { if (empty($itemList['data']['goods_id'])) {
continue; continue;
} }
foreach ($itemList['data']['goods_id'] as $skuId) { foreach ($itemList['data']['goods_id'] as $skuId) {
$skuDetail = DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->first(); $skuDetail = DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->first();
dd($skuDetail);
$detail = $skuDetail['detail']; $detail = $skuDetail['detail'];
if (empty($detail)) { if (empty($detail)) {
continue; continue;
...@@ -149,9 +150,19 @@ class DealImageService ...@@ -149,9 +150,19 @@ class DealImageService
} }
public static function getSearchDomain()
{
$host = request()->getHost();
if (strpos($host, 'ichunt.com') !== false) {
return 'https://icso.ichunt.com/search/es/searchSku';
} else {
return 'http://search.liexindev.net';
}
}
private static function searchIedgeSku($page = 1) private static function searchIedgeSku($page = 1)
{ {
$url = config('website.search_domain_new') . '/search/es/searchSku'; $url = self::getSearchDomain() . '/search/es/searchSku';
$map['p'] = $page; $map['p'] = $page;
$map['show_status'] = 1; $map['show_status'] = 1;
...@@ -161,10 +172,28 @@ class DealImageService ...@@ -161,10 +172,28 @@ class DealImageService
$map['admin'] = 1; // 后台搜索 $map['admin'] = 1; // 后台搜索
$map['no_rule'] = "1122"; // 后台搜索 $map['no_rule'] = "1122"; // 后台搜索
$map['org_id/eq'] = 3; $map['org_id/eq'] = 3;
$res = Http::get($url, $map)->body(); $client = new \GuzzleHttp\Client();
$data = json_decode($res, true);
//$res = Http::get($url, $map)->body();
//$data = json_decode($res, true);
$response = $client->request('POST', $url, [
'form_params' => $map
]);
if ($response->getStatusCode() != 200) {
throw new InvalidArgumentException('搜索服务不正常!');
}
$content = $response->getBody()->getContents();
$content = json_decode($content, true);
$code = array_get($content, 'error_code', -1);
if ($code !== 0) {
return [];
}
return $data; return $content;
} }
//根据url下载图片并且上传到图片服务 //根据url下载图片并且上传到图片服务
......
...@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function () ...@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
\App\Http\Services\DealImageService::dealCmsImage(); \App\Http\Services\DealImageService::dealSkuDetail();
//\App\Http\Services\SupplierAddressService::initUnitedAddress(); //\App\Http\Services\SupplierAddressService::initUnitedAddress();
//\App\Http\Services\DataService::checkSupplierBandAccount(); //\App\Http\Services\DataService::checkSupplierBandAccount();
//(new CompanyService())->checkSupplierCompanyAndAddress(11042); //(new CompanyService())->checkSupplierCompanyAndAddress(11042);
......
...@@ -356,6 +356,18 @@ return [ ...@@ -356,6 +356,18 @@ return [
'prefix' => 'lie_', 'prefix' => 'lie_',
'strict' => false, 'strict' => false,
], ],
'mongo' => [
'driver' => 'mongodb',
'host' => env('MONGO_HOST'),
'port' => 27017,
'username' => env('MONGO_USERNAME'),
'password' => env('MONGO_PASSWORD'),
'database' => env('MONGO_DB_SELF_SIMILAR_DATABASE'),
'options' => [
'database' => env('MONGO_DB_SELF_SIMILAR_DATABASE'),//不加导致auth fail
]
],
'rabbitmq' => [ 'rabbitmq' => [
'driver' => 'rabbitmq', 'driver' => 'rabbitmq',
'host' => env('RABBITMQ_HOST', '127.0.0.1'), 'host' => env('RABBITMQ_HOST', '127.0.0.1'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment