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
325bebb9
authored
Dec 11, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改接口数据
parent
2f26e091
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
76 additions
and
6 deletions
.env
app/Http/Controllers/BrandController.php
app/Model/SelfBrandModel.php
app/Model/SelfClassifyModel.php
app/Model/SelfGoodsModel.php
storage/framework/cache/0c/2f/0c2f6df3fd34a49c58ed3cc739fc856cb0d1907f
storage/framework/cache/1f/4a/1f4a184b1120e82e739c7cccc1e2f0951e15ce36
storage/framework/cache/53/b5/53b5407cc393cd3f1c170869b3484227cde810c0
storage/framework/cache/96/71/9671f22464edbfd64898c65133475a5898511974
storage/framework/cache/c7/47/c747cff393b73e0ed449fda9879b22c0aa9b284f
storage/framework/cache/e8/99/e89931d01b47c350b4a6d2dc59a83db81d6a3c08
.env
View file @
325bebb9
...
...
@@ -4,14 +4,14 @@ APP_KEY=
APP_TIMEZONE=PRC
//系统编码,用于生成错误码
SYSTEM_CODE=0
2
SYSTEM_CODE=0
6
//系统名称,用于告警识别
SYSTEM_NAME=商品信息处理服务(开发环境)
//laravels监听IP和端口
LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=6200
2
LARAVELS_LISTEN_PORT=6200
6
//基石自营商品主库
DB_Self_HOST=192.168.1.234
...
...
app/Http/Controllers/BrandController.php
View file @
325bebb9
...
...
@@ -11,7 +11,7 @@ class BrandController extends Controller
//获取品牌列表
public
function
index
(
Request
$request
,
SelfBrandModel
$model
)
{
$map
=
$request
->
only
([
'brand_area'
]);
$map
=
$request
->
only
([
'brand_area'
,
'brand_id'
]);
$list
=
$model
->
getBrandList
(
$map
);
return
$this
->
Export
(
0
,
'ok'
,
[
'data'
=>
$list
]);
...
...
app/Model/SelfBrandModel.php
View file @
325bebb9
...
...
@@ -34,6 +34,29 @@ class SelfBrandModel extends Model
}
}
public
function
HDBrandLogo
(
$BrandID
=
''
,
$Redis
=
''
)
{
if
(
empty
(
$BrandID
))
{
return
false
;
}
if
(
empty
(
$Redis
))
{
$Redis
=
new
RedisModel
();
}
$BrandName
=
$Redis
->
hget
(
'Self_Brand'
,
$BrandID
);
if
(
!
$BrandName
)
{
$result
=
$this
->
ToRedis
(
$BrandID
,
$Redis
);
if
(
!
$result
)
{
return
false
;
}
return
$result
[
'brand_logo'
];
}
else
{
$BrandName
=
json_decode
(
$BrandName
,
true
);
return
$BrandName
[
'brand_logo'
];
}
}
public
function
ToRedis
(
$BrandID
,
$Redis
=
''
)
{
if
(
empty
(
$BrandID
))
{
...
...
@@ -97,6 +120,18 @@ class SelfBrandModel extends Model
return
$brandListByArea
;
}
//如果有id筛选,就要做数据处理
if
(
!
empty
(
$map
[
'brand_id'
])
&&!
empty
(
$brandList
))
{
$brandListByBrandId
=
[];
$brandIds
=
explode
(
','
,
$map
[
'brand_id'
]);
foreach
(
$brandList
as
$key
=>
$brand
)
{
if
(
in_array
(
$brand
[
'brand_id'
],
$brandIds
))
{
$brandListByBrandId
[]
=
$brand
;
}
}
return
$brandListByBrandId
;
}
//没有就去数据库里面取
if
(
!
$brandList
)
{
...
...
app/Model/SelfClassifyModel.php
View file @
325bebb9
...
...
@@ -58,7 +58,7 @@ class SelfClassifyModel extends Model
$classList
=
array_map
(
function
(
$value
)
{
return
json_decode
(
$value
,
true
);
},
$classList
);
$classList
=
$this
->
transform
(
$classList
);
if
(
!
$classList
)
{
return
Cache
::
remember
(
'classList'
,
$classificationsExpireMinute
,
function
()
{
$field
=
[
...
...
@@ -78,5 +78,29 @@ class SelfClassifyModel extends Model
});
}
return
$classList
;
}
private
function
transform
(
$data
)
{
//将子分类放到父分类下面
$parentClass
=
[];
foreach
(
$data
as
$key
=>
$item
)
{
//先获取所有父分类
if
(
$item
[
'parent_id'
]
==
0
)
{
$item
[
'sub_class'
]
=
[];
$parentClass
[]
=
$item
;
unset
(
$data
[
$key
]);
}
}
foreach
(
$parentClass
as
$key
=>
$value
)
{
foreach
(
$data
as
$k
=>
$v
)
{
if
(
$v
[
'parent_id'
]
==
$value
[
'class_id'
])
{
$parentClass
[
$key
][
'sub_class'
][]
=
$v
;
}
}
}
return
$parentClass
;
}
}
app/Model/SelfGoodsModel.php
View file @
325bebb9
...
...
@@ -21,6 +21,7 @@ class SelfGoodsModel extends Model
$Find
[
'supplier_name'
]
=
$SupplierModel
->
ObSupplierName
(
$Find
[
'supplier_id'
]);
$Find
[
'brand_name'
]
=
$BrandModel
->
HDBrandName
(
$Find
[
'brand_id'
],
$Redis
);
$Find
[
'brand_logo'
]
=
$BrandModel
->
HDBrandLogo
(
$Find
[
'brand_id'
],
$Redis
);
$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
);
...
...
storage/framework/cache/0c/2f/0c2f6df3fd34a49c58ed3cc739fc856cb0d1907f
0 → 100644
View file @
325bebb9
1575964153a:6:{s:8:"brand_id";i:1;s:10:"brand_name";s:7:"ALLEGRO";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:1;}
\ No newline at end of file
storage/framework/cache/1f/4a/1f4a184b1120e82e739c7cccc1e2f0951e15ce36
View file @
325bebb9
1575532911a:6:{s:8:"brand_id";i:5290;s:10:"brand_name";s:20:"CJIANG(长江微电)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:4;}
\ No newline at end of file
1576033942a:6:{s:8:"brand_id";i:5290;s:10:"brand_name";s:20:"CJIANG(长江微电)";s:10:"brand_logo";s:83:"//img.sensorhunt.com/test/images/cms/201912/09/1b65e9e4ad5ad5d568c623dd6eec4581.png";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:4;}
\ No newline at end of file
storage/framework/cache/53/b5/53b5407cc393cd3f1c170869b3484227cde810c0
0 → 100644
View file @
325bebb9
1575860787a:6:{s:8:"brand_id";i:1;s:10:"brand_name";s:7:"ALLEGRO";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:1;}
\ No newline at end of file
storage/framework/cache/96/71/9671f22464edbfd64898c65133475a5898511974
0 → 100644
View file @
325bebb9
1575860782a:6:{s:8:"brand_id";i:1;s:10:"brand_name";s:7:"ALLEGRO";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:1;}
\ No newline at end of file
storage/framework/cache/c7/47/c747cff393b73e0ed449fda9879b22c0aa9b284f
0 → 100644
View file @
325bebb9
1575860773N;
\ No newline at end of file
storage/framework/cache/e8/99/e89931d01b47c350b4a6d2dc59a83db81d6a3c08
0 → 100644
View file @
325bebb9
1575860792a:6:{s:8:"brand_id";i:1;s:10:"brand_name";s:7:"ALLEGRO";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:1;}
\ No newline at end of file
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