Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8239706f
authored
Sep 13, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
xiufu
parent
989a5aad
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
7 deletions
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Controllers/Filter/SupplierFilter.php
View file @
8239706f
...
...
@@ -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
;
}
...
...
app/Http/Services/DataService.php
View file @
8239706f
...
...
@@ -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'
]);
}
}
}
app/Http/routes.php
View file @
8239706f
...
...
@@ -82,7 +82,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
init
FuturesSkuUploadRuler
();
(
new
\App\Http\Services\DataService
())
->
init
BrandData
();
// $data = [
// 'supplier_code' => 'L0015420',
// 'brand_id' => 0,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment