Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_server_goods
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
3c1c338a
authored
Dec 11, 2019
by
叶明星
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
重要参数
parent
b1b2f045
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
15 deletions
.env
app/Model/SelfClassifyModel.php
app/Model/SelfGoodsModel.php
.env
View file @
3c1c338a
...
...
@@ -11,7 +11,7 @@ SYSTEM_NAME=商品信息处理服务(开发环境)
//laravels监听IP和端口
LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=6
0
002
LARAVELS_LISTEN_PORT=6
2
002
//基石自营商品主库
DB_Self_HOST=192.168.2.239
...
...
@@ -19,7 +19,7 @@ DB_Self_DATABASE=lc_footstone
DB_Self_USERNAME=root
DB_Self_PASSWORD=root
DB_Self_PORT=3306
DB_Self_PREFIX=l
c
_
DB_Self_PREFIX=l
ie
_
//采购系统数据库
DB_Pur_HOST=192.168.2.239
...
...
@@ -27,7 +27,7 @@ DB_Pur_DATABASE=lc_wms
DB_Pur_USERNAME=root
DB_Pur_PASSWORD=root
DB_Pur_PORT=3306
DB_Pur_PREFIX=l
c
_
DB_Pur_PREFIX=l
ie
_
REDIS_HOST=192.168.1.235
...
...
@@ -39,10 +39,5 @@ REDIS_READ_HOST=192.168.1.237
REDIS_READ_PASSWORD=icDb29mLy2s
REDIS_READ_PORT=6379
MONG_DB_SPU_ATTRS_HOST=192.168.1.237
MONG_DB_SPU_ATTRS_USERNAME=ichunt
MONG_DB_SPU_ATTRS_PASSWORD=huntmon6699
MONG_DB_SPU_ATTRS_DATABASE=ichunt
CACHE_DRIVER=file
QUEUE_DRIVER=sync
app/Model/SelfClassifyModel.php
View file @
3c1c338a
...
...
@@ -5,6 +5,7 @@ namespace App\Model;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\Cache
;
use
Illuminate\Support\Facades\DB
;
use
Common\Model\RedisModel
;
class
SelfClassifyModel
extends
Model
{
...
...
@@ -79,4 +80,14 @@ class SelfClassifyModel extends Model
}
}
//获取分类参数
public
function
getClassAttr
(
$class_id
){
$Redis
=
new
RedisModel
();
$Cache
=
json_decode
(
$Redis
->
hget
(
'class_attr'
,
$class_id
),
true
);
if
(
empty
(
$Cache
)){
return
false
;
}
return
$Cache
;
}
}
app/Model/SelfGoodsModel.php
View file @
3c1c338a
...
...
@@ -16,7 +16,6 @@ class SelfGoodsModel extends Model
if
(
empty
(
$SupplierModel
))
$SupplierModel
=
new
SupplierChannelModel
();
if
(
empty
(
$BrandModel
))
$BrandModel
=
new
SelfBrandModel
();
if
(
empty
(
$UnitModel
))
$UnitModel
=
new
UnitModel
();
if
(
empty
(
$ResourceModel
))
$ResourceModel
=
new
ResourceModel
();
if
(
empty
(
$ClassModel
))
$ClassModel
=
new
SelfClassifyModel
();
$Find
[
'supplier_name'
]
=
$SupplierModel
->
ObSupplierName
(
$Find
[
'supplier_id'
]);
...
...
@@ -24,10 +23,6 @@ class SelfGoodsModel extends Model
$Find
[
'goods_unit_name'
]
=
$UnitModel
->
OBUnitInfo
(
$Find
[
'goods_unit'
],
$Redis
);
$Find
[
'packing_name'
]
=
$UnitModel
->
OBUnitInfo
(
$Find
[
'packing'
],
$Redis
);
$Find
[
'mpq_unit_name'
]
=
$UnitModel
->
OBUnitInfoAlias
(
$Find
[
'packing'
],
$Redis
);
$GoodsImages
=
$ResourceModel
->
GetResourceInfoById
(
$Find
[
'goods_images'
],
$Redis
);
$Find
[
'goods_images'
]
=
$GoodsImages
;
$GoodsPdf
=
$ResourceModel
->
GetResourceInfoById
(
$Find
[
'pdf'
],
$Redis
);
$Find
[
'pdf'
]
=
$GoodsPdf
;
if
(
!
empty
(
$Find
[
'class_name'
]))
unset
(
$Find
[
'class_name'
]);
//处理库存
...
...
@@ -56,13 +51,26 @@ class SelfGoodsModel extends Model
if
(
!
empty
(
$Find
[
'class_id2'
])){
$class_id2
=
$ClassModel
->
ProduceClassRedis
(
$Find
[
'class_id2'
],
false
,
$Redis
);
empty
(
$class_id2
[
'class_name'
])
||
$Find
[
'class_id2_name'
]
=
$class_id2
[
'class_name'
];
//处理分类参数重要值
$ClassAttrCache
=
$ClassModel
->
getClassAttr
(
$Find
[
'class_id2'
]);
if
(
$ClassAttrCache
&&
is_array
(
$ClassAttrCache
)){
foreach
(
$ClassAttrCache
as
$k
=>
$v
){
$ClassAttrCache
[
md5
(
$v
[
'attr_name'
])]
=
empty
(
$v
[
'is_important'
])
?
1
:
$v
[
'is_important'
];
unset
(
$ClassAttrCache
[
$k
]);
}
if
(
!
empty
(
$Find
[
'attrs'
])
&&
is_array
(
$Find
[
'attrs'
])){
foreach
(
$Find
[
'attrs'
]
as
$k
=>
$v
){
$Find
[
'attrs'
][
$k
][
'is_important'
]
=
empty
(
$ClassAttrCache
[
md5
(
$v
[
'attr_name'
])])
?
1
:
$ClassAttrCache
[
md5
(
$v
[
'attr_name'
])];
}
}
}
}
if
(
is_array
(
$Find
[
'ladder_price'
])){
$Find
[
'ladder_price'
]
=
arraySequence
(
$Find
[
'ladder_price'
],
'purchases'
,
'SORT_ASC'
);
}
if
(
$Find
[
'status'
]
!=
1
||
!
count
(
$Find
[
'ladder_price'
])
>
0
||
empty
(
$Find
[
'ladder_price'
][
0
][
'purchases'
])){
$Find
[
'is_buy'
]
=
0
;
}
else
{
...
...
@@ -211,7 +219,7 @@ class SelfGoodsModel extends Model
$this
->
connection
=
'self'
;
//开始连接数据库
$fieldArr
=
[
'other_attrs'
,
'goods_id'
,
'goods_type'
,
'supplier_id'
,
'brand_id'
,
'class_id1'
,
'class_id2'
,
'goods_name'
,
'status'
,
'encoded'
,
'encap'
,
'packing'
,
'goods_unit'
,
'goods_images'
,
'pdf'
,
'goods_brief'
,
'moq'
,
'mpq'
,
'ladder_price'
,
'update_time'
,
'sku_name'
,
'mpl'
,
'stock'
,
'attrs'
,
'cost'
,
'new_cost'
];
'ladder_price'
,
'update_time'
,
'sku_name'
,
'mpl'
,
'stock'
,
'attrs'
,
'cost'
,
'new_cost'
,
'cn_delivery_time'
];
$info
=
$this
->
where
(
'goods_id'
,
'='
,
$goods_id
)
->
select
(
$fieldArr
)
->
first
();
if
(
!
$info
)
return
false
;
$info
=
$info
->
toArray
();
...
...
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