Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lzzzzl
/
liexin_scm_service
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
6dbab836
authored
May 19, 2020
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
测试goodsModel
parent
cc4670c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
app/Http/Model/GoodsModel.php
app/Http/Model/GoodsModel.php
View file @
6dbab836
...
...
@@ -57,6 +57,15 @@ class GoodsModel extends Model
* 写入DB物料
*/
public
function
InsertGoodsInfo
(
$arr
)
{
// 判断ERP ID是否存在,存在则直接执行更新操作
$erpId_exist
=
$this
->
redis
->
hget
(
'scm_goods_erp_id'
,
md5
(
$arr
[
'erp_goods_id'
]));
if
(
$erpId_exist
)
{
unset
(
$arr
[
'add_time'
]);
$this
->
updateGoodsInfo
(
$arr
);
return
true
;
}
$start
=
microtime
(
true
);
$str
=
DB
::
connection
(
$this
->
connection
)
->
transaction
(
function
()
use
(
$arr
,
$start
){
$end1
=
microtime
(
true
);
...
...
@@ -136,7 +145,7 @@ class GoodsModel extends Model
// 判断是否需要更新品牌
if
(
!
empty
(
$arr
[
'brand_name'
]))
{
$brand_name
=
$arr
[
'brand_name'
];
$brand_exist
=
DB
::
connection
(
'mysql'
)
->
table
(
'brand'
)
->
select
(
'brand_id'
)
->
where
(
'brand_name'
,
'='
,
$brand_name
)
->
first
(
);
$brand_exist
=
$this
->
redis
->
hget
(
'scm_brand_name'
,
md5
(
$brand_name
)
);
$brand_params
=
array
(
'brand_name'
=>
$brand_name
,
'admin_name'
=>
$admin_name
,
...
...
@@ -147,7 +156,7 @@ class GoodsModel extends Model
if
(
!
$brand_exist
)
{
$brand_id
=
DB
::
connection
(
'mysql'
)
->
table
(
'brand'
)
->
insertGetId
(
$brand_params
);
}
else
{
$brand_id
=
$brand_exist
->
brand_id
;
$brand_id
=
$brand_exist
;
}
// 更新DB
...
...
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