Commit 8239706f by 杨树贤

xiufu

parent 989a5aad
......@@ -68,8 +68,11 @@ class SupplierFilter
}
if (!empty($map['supplier_search_fuzzy'])) {
$query->where('supplier_name','like',"%${map['supplier_search_fuzzy']}%")
->orWhere('supplier_code','like',"%${map['supplier_search_fuzzy']}%");
$query->where(function ($q) use ($map) {
$q->where('supplier_name', 'like', "%${map['supplier_search_fuzzy']}%")
->orWhere('supplier_code', 'like', "%${map['supplier_search_fuzzy']}%");
});
}
if (!empty($map['create_uid'])) {
......@@ -173,11 +176,11 @@ class SupplierFilter
if (!empty($map['has_cooperation_agreement'])) {
if ($map['has_cooperation_agreement'] == 1) {
$query->whereIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','cooperation_agreement');
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name', 'cooperation_agreement');
});
} else {
$query->whereNotIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','cooperation_agreement');
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name', 'cooperation_agreement');
});
}
}
......@@ -406,12 +409,12 @@ class SupplierFilter
break;
case "no_quality_assurance_agreement_all":
$query->whereNotIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','quality_assurance_agreement');
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name', 'quality_assurance_agreement');
})->where('uploaded_sku', 1);
break;
case "no_cooperation_agreement":
$query->whereNotIn('supplier_id', function ($query) {
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name','cooperation_agreement');
$query->select('supplier_id')->from(with(new SupplierAttachmentsModel())->getTable())->where('field_name', 'cooperation_agreement');
})->where('uploaded_sku', 1);
break;
}
......
......@@ -6,6 +6,7 @@ namespace App\Http\Services;
use App\Http\Transformers\SupplierContactTransformer;
use App\Http\Transformers\SupplierTransformer;
use App\Model\BigData\DataManageModel;
use App\Model\BrandModel;
use App\Model\DepartmentModel;
use App\Model\IntracodeModel;
use App\Model\LogModel;
......@@ -14,6 +15,8 @@ use App\Model\Purchase\StockInItemModel;
use App\Model\Purchase\StockInModel;
use App\Model\RedisModel;
use App\Model\SkuUploadLogModel;
use App\Model\SpuBrandModel;
use App\Model\StandardBrandMappingModel;
use App\Model\StandardBrandModel;
use App\Model\SupplierAccountModel;
use App\Model\SupplierAttachmentModel;
......@@ -1619,4 +1622,36 @@ class DataService
}
}
//初始化品牌数据
public function initBrandData()
{
$prefixKey = '';
$redis = new RedisModel();
ini_set('memory_limit', -1);
//先初始化品牌
$brands = SpuBrandModel::get()->toArray();
$redis->del($prefixKey . 'brand');
$redis->del($prefixKey . 'brand_info');
$redis->del($prefixKey . 'brand_name_all');
$redis->del($prefixKey . 'standard_brand');
$redis->del($prefixKey . 'standard_brand_mapping');
foreach ($brands as $brand) {
$redis->hset($prefixKey . 'brand', $brand['brand_id'], $brand['brand_name']);
$redis->hset($prefixKey . 'brand_info', $brand['brand_id'], json_encode($brand));
$redis->hset($prefixKey.'brand_name_all', md5(strtolower($brand['brand_name'])), $brand['brand_id']);
}
//再去初始化标准品牌
$standardBrands = StandardBrandModel::get()->toArray();
foreach ($standardBrands as $brand) {
$redis->hset($prefixKey . 'standard_brand', $brand['standard_brand_id'], json_encode($brand));
}
//最后初始化标品映射
$mappings = StandardBrandMappingModel::get()->toArray();
foreach ($mappings as $mapping) {
$redis->hset($prefixKey . 'standard_brand_mapping', $mapping['brand_id'], $mapping['standard_brand_id']);
}
}
}
......@@ -82,7 +82,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route::match(['get', 'post'], '/test', function () {
(new \App\Http\Services\DataService())->initFuturesSkuUploadRuler();
(new \App\Http\Services\DataService())->initBrandData();
// $data = [
// 'supplier_code' => 'L0015420',
// 'brand_id' => 0,
......
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