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
d2800004
authored
Jun 02, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into ysx-供应商需求-20230531
parents
c93a1f4c
d04b7e73
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
17 deletions
app/Http/Services/DataService.php
app/Http/Services/LogService.php
app/Http/Services/SkuService.php
app/Http/Transformers/SupplierTransformer.php
app/Http/routes.php
app/Model/LogModel.php
app/Http/Services/DataService.php
View file @
d2800004
...
@@ -952,7 +952,8 @@ class DataService
...
@@ -952,7 +952,8 @@ class DataService
$logModel
=
new
LogModel
();
$logModel
=
new
LogModel
();
foreach
(
$suppliers
as
$supplier
)
{
foreach
(
$suppliers
as
$supplier
)
{
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
where
(
'ignore_audit_check'
,
0
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$supplier
[
'last_update_name'
]
=
$log
[
'admin_name'
]
?:
'无'
;
$supplier
[
'last_update_name'
]
=
$log
[
'admin_name'
]
?:
'无'
;
if
(
empty
(
$supplier
[
'create_name'
]))
{
if
(
empty
(
$supplier
[
'create_name'
]))
{
$userInfo
=
(
new
AdminUserService
())
->
getAdminUserInfo
(
$supplier
[
'create_uid'
]);
$userInfo
=
(
new
AdminUserService
())
->
getAdminUserInfo
(
$supplier
[
'create_uid'
]);
...
@@ -1224,7 +1225,7 @@ class DataService
...
@@ -1224,7 +1225,7 @@ class DataService
//初始化品牌数量限制(还要跳过API对接的供应商)
//初始化品牌数量限制(还要跳过API对接的供应商)
public
function
initialMainBrandsLimit
()
public
function
initialMainBrandsLimit
()
{
{
$suppliers
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'main_brands_limit'
,
0
)
->
get
()
->
toArray
();
$suppliers
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'main_brands_limit'
,
0
)
->
get
()
->
toArray
();
foreach
(
$suppliers
as
$supplier
)
{
foreach
(
$suppliers
as
$supplier
)
{
//判断是否是API对接的供应商
//判断是否是API对接的供应商
if
(
DataManageModel
::
where
(
'canal'
,
$supplier
[
'supplier_code'
])
->
where
(
'is_type'
,
0
)
->
exists
())
{
if
(
DataManageModel
::
where
(
'canal'
,
$supplier
[
'supplier_code'
])
->
where
(
'is_type'
,
0
)
->
exists
())
{
...
@@ -1251,8 +1252,8 @@ class DataService
...
@@ -1251,8 +1252,8 @@ class DataService
$supplierCount
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
where
(
'sku_num'
,
'>'
,
0
)
->
count
();
$supplierCount
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
where
(
'sku_num'
,
'>'
,
0
)
->
count
();
$yunxinSupplierCodes
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'stockup_type'
,
'like'
,
'%5%'
)
->
where
(
'sku_num'
,
'>'
,
0
)
->
pluck
(
'supplier_code'
);
$yunxinSupplierCodes
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'stockup_type'
,
'like'
,
'%5%'
)
->
where
(
'sku_num'
,
'>'
,
0
)
->
pluck
(
'supplier_code'
);
//找出哪些是云芯上传的
//找出哪些是云芯上传的
$yunxinUploadSupplierCodes
=
SkuUploadLogModel
::
whereIn
(
'supplier_code'
,
$yunxinSupplierCodes
)
->
where
(
'source'
,
2
)
->
pluck
(
'supplier_code'
)
->
unique
()
->
toArray
();
$yunxinUploadSupplierCodes
=
SkuUploadLogModel
::
whereIn
(
'supplier_code'
,
$yunxinSupplierCodes
)
->
where
(
'source'
,
2
)
->
pluck
(
'supplier_code'
)
->
unique
()
->
toArray
();
$skuNumYunxin
=
SupplierChannelModel
::
whereIn
(
'supplier_code'
,
$yunxinUploadSupplierCodes
)
->
sum
(
'sku_num'
);
$skuNumYunxin
=
SupplierChannelModel
::
whereIn
(
'supplier_code'
,
$yunxinUploadSupplierCodes
)
->
sum
(
'sku_num'
);
dump
(
"上架供应商数(不含代购,原厂):"
.
$supplierCount
);
dump
(
"上架供应商数(不含代购,原厂):"
.
$supplierCount
);
dump
(
"上架云芯供应商数:"
.
count
(
$yunxinUploadSupplierCodes
));
dump
(
"上架云芯供应商数:"
.
count
(
$yunxinUploadSupplierCodes
));
dump
(
"SKU 上架总条数(含API接口):"
.
$skuNum1
);
dump
(
"SKU 上架总条数(含API接口):"
.
$skuNum1
);
...
...
app/Http/Services/LogService.php
View file @
d2800004
...
@@ -51,6 +51,28 @@ class LogService
...
@@ -51,6 +51,28 @@ class LogService
return
$model
->
insert
(
$data
);
return
$model
->
insert
(
$data
);
}
}
public
function
BatchAddIgnoreAuditLogs
(
$supplierIds
,
$type
,
$action
,
$content
,
$remark
=
''
)
{
$adminId
=
request
()
->
user
->
userId
;
$adminName
=
request
()
->
user
->
name
;
$data
=
[];
foreach
(
$supplierIds
as
$supplierId
)
{
$data
[]
=
[
'supplier_id'
=>
$supplierId
,
'type'
=>
$type
,
'action'
=>
$action
,
'content'
=>
$content
,
'remark'
=>
$remark
,
'admin_id'
=>
$adminId
,
'admin_name'
=>
$adminName
,
'ignore_audit_check'
=>
1
,
'add_time'
=>
time
(),
];
}
$model
=
new
LogModel
();
return
$model
->
insert
(
$data
);
}
//添加忽略审核的日志
//添加忽略审核的日志
public
function
AddIgnoreAuditCheckLog
(
$supplierId
,
$type
,
$action
,
$content
,
$remark
=
''
)
public
function
AddIgnoreAuditCheckLog
(
$supplierId
,
$type
,
$action
,
$content
,
$remark
=
''
)
{
{
...
...
app/Http/Services/SkuService.php
View file @
d2800004
...
@@ -383,7 +383,7 @@ class SkuService
...
@@ -383,7 +383,7 @@ class SkuService
}
}
$cpTimeDay
=
$cpTimeDay
==
-
1
?
'无限制'
:
$cpTimeDay
;
$cpTimeDay
=
$cpTimeDay
==
-
1
?
'无限制'
:
$cpTimeDay
;
(
new
LogService
())
->
BatchAddLogs
(
$supplierIdList
,
LogModel
::
UPDATE_OPERATE
,
'批量配置供应商sku上架有效期'
,
'上架有效期修改为'
.
$cpTimeDay
.
'天'
);
(
new
LogService
())
->
BatchAdd
IgnoreAudit
Logs
(
$supplierIdList
,
LogModel
::
UPDATE_OPERATE
,
'批量配置供应商sku上架有效期'
,
'上架有效期修改为'
.
$cpTimeDay
.
'天'
);
}
}
}
}
...
@@ -407,7 +407,7 @@ class SkuService
...
@@ -407,7 +407,7 @@ class SkuService
$ruler
[
'upload_validity_period'
]
=
$cpTimeDay
;
$ruler
[
'upload_validity_period'
]
=
$cpTimeDay
;
(
new
SupplierService
())
->
saveSkuCpTimeRulerToRedis
(
$supplierId
,
$ruler
);
(
new
SupplierService
())
->
saveSkuCpTimeRulerToRedis
(
$supplierId
,
$ruler
);
$cpTimeDay
=
$cpTimeDay
==
-
1
?
'无限制'
:
$cpTimeDay
;
$cpTimeDay
=
$cpTimeDay
==
-
1
?
'无限制'
:
$cpTimeDay
;
(
new
LogService
())
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'批量配置供应商sku上架有效期'
,
'上架有效期修由'
.
$originDays
.
'改为'
.
$cpTimeDay
.
'天'
);
(
new
LogService
())
->
Add
IgnoreAuditCheck
Log
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'批量配置供应商sku上架有效期'
,
'上架有效期修由'
.
$originDays
.
'改为'
.
$cpTimeDay
.
'天'
);
}
}
}
}
}
}
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
d2800004
...
@@ -68,9 +68,7 @@ class SupplierTransformer
...
@@ -68,9 +68,7 @@ class SupplierTransformer
$lastUploadSkuTimes
[
$supplier
[
'supplier_code'
]])
:
''
;
$lastUploadSkuTimes
[
$supplier
[
'supplier_code'
]])
:
''
;
//获取最新修改人以及下级审核员
//获取最新修改人以及下级审核员
$logModel
=
new
LogModel
();
$log
=
LogModel
::
getLastLog
(
$supplier
[
'supplier_id'
]);
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$supplier
[
'last_update_name'
]
=
$log
?
$log
[
'admin_name'
]
:
''
;
$supplier
[
'last_update_name'
]
=
$log
?
$log
[
'admin_name'
]
:
''
;
$supplier
[
'last_update_time'
]
=
$log
?
date
(
'Y-m-d H:i:s'
,
$log
[
'add_time'
])
:
''
;
$supplier
[
'last_update_time'
]
=
$log
?
date
(
'Y-m-d H:i:s'
,
$log
[
'add_time'
])
:
''
;
//黑名单
//黑名单
...
@@ -201,9 +199,7 @@ class SupplierTransformer
...
@@ -201,9 +199,7 @@ class SupplierTransformer
$supplier
[
'supplier_type_name'
]
=
array_get
(
config
(
'field.SupplierType'
),
$supplier
[
'supplier_type'
]);
$supplier
[
'supplier_type_name'
]
=
array_get
(
config
(
'field.SupplierType'
),
$supplier
[
'supplier_type'
]);
}
}
//获取最近修改信息
//获取最近修改信息
$logModel
=
new
LogModel
();
$log
=
LogModel
::
getLastLog
(
$supplier
[
'supplier_id'
]);
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$supplier
[
'last_update_name'
]
=
$log
[
'admin_name'
]
?:
'无'
;
$supplier
[
'last_update_name'
]
=
$log
[
'admin_name'
]
?:
'无'
;
$supplier
[
'last_update_time'
]
=
empty
(
$supplier
[
'last_update_time'
])
?
(
$log
[
'add_time'
]
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'last_update_time'
]
=
empty
(
$supplier
[
'last_update_time'
])
?
(
$log
[
'add_time'
]
?
date
(
'Y-m-d H:i:s'
,
$log
[
'add_time'
])
:
'无'
)
:
'无'
;
$log
[
'add_time'
])
:
'无'
)
:
'无'
;
...
...
app/Http/routes.php
View file @
d2800004
...
@@ -70,9 +70,9 @@ Route::match(['get', 'post'], '/test', function () {
...
@@ -70,9 +70,9 @@ Route::match(['get', 'post'], '/test', function () {
(
new
\App\Http\Services\DataService
())
->
statisticsSkuNumber
();
(
new
\App\Http\Services\DataService
())
->
statisticsSkuNumber
();
// (new \App\Http\Services\DataService())->initialMainBrandsLimit();
// (new \App\Http\Services\DataService())->initialMainBrandsLimit();
// (new \App\Http\Services\DataService())->initialMainBrandsToSkuRuler();
// (new \App\Http\Services\DataService())->initialMainBrandsToSkuRuler();
\App\Model\SupplierChannelModel
::
where
(
'supplier_code'
,
'L0010173
'
)
->
update
([
\App\Model\LogModel
::
where
(
'action'
,
'批量配置供应商sku上架有效期
'
)
->
update
([
'stockup_type'
=>
''
,
'ignore_audit_check'
=>
1
]);
]);
// \App\Model\SupplierChannelModel::where('supplier_name', '厦门市三安集成电路有限公司')->update([
// \App\Model\SupplierChannelModel::where('supplier_name', '厦门市三安集成电路有限公司')->update([
// 'status' => 2,
// 'status' => 2,
// 'update_time' => time(),
// 'update_time' => time(),
...
...
app/Model/LogModel.php
View file @
d2800004
...
@@ -6,11 +6,21 @@ use Illuminate\Database\Eloquent\Model;
...
@@ -6,11 +6,21 @@ use Illuminate\Database\Eloquent\Model;
class
LogModel
extends
Model
class
LogModel
extends
Model
{
{
protected
$connection
=
'web'
;
protected
$connection
=
'web'
;
protected
$table
=
'log'
;
protected
$table
=
'log'
;
public
$timestamps
=
false
;
public
$timestamps
=
false
;
const
UPDATE_OPERATE
=
1
;
const
UPDATE_OPERATE
=
1
;
const
ADD_OPERATE
=
2
;
const
ADD_OPERATE
=
2
;
const
VIEW_OPERATE
=
3
;
const
VIEW_OPERATE
=
3
;
public
static
function
getLastLog
(
$supplierId
,
$ignoreAuditCheck
=
true
)
{
$query
=
self
::
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
);
if
(
$ignoreAuditCheck
)
{
$query
->
where
(
'ignore_audit_check'
,
0
);
}
return
$query
->
where
(
'ignore_audit_check'
,
0
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
}
}
}
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