Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_server
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
4f331a22
authored
Jun 17, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
锁定结果排序
parent
057d86dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
conf/config.ini
service/goods_service.go
conf/config.ini
View file @
4f331a22
...
...
@@ -15,7 +15,7 @@ urls = http://192.168.2.232:9200,http://192.168.2.232:9200
index_name
=
future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,zhuanmai,peigenesis,powell,rs,buerklin,liexin_ziying
search_supplier
=
future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin,zhuanmai
hk_delivery_type_supplier
=
future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin
attr_index
=
goods_map
2
attr_index
=
goods_map
[database]
user_name
=
root
...
...
service/goods_service.go
View file @
4f331a22
...
...
@@ -5,6 +5,7 @@ import (
"github.com/tidwall/gjson"
"search_server/pkg/config"
"search_server/protopb/bom"
"strings"
)
func
GetGoodsInfo
(
goodsIdsStr
string
)
(
goodsList
[]
*
bom
.
GoodsModel
,
err
error
)
{
...
...
@@ -19,7 +20,11 @@ func GetGoodsInfo(goodsIdsStr string) (goodsList []*bom.GoodsModel, err error) {
}
//先判断返回的data是不是字典,不是字典代表可能是返回字符串了
if
gjson
.
Get
(
resp
.
String
(),
"data"
)
.
IsObject
()
{
//排序操作
goodsIdList
:=
strings
.
Split
(
goodsIdsStr
,
","
)
for
_
,
goodsId
:=
range
goodsIdList
{
for
_
,
data
:=
range
gjson
.
Get
(
resp
.
String
(),
"data"
)
.
Map
()
{
if
goodsId
==
data
.
Get
(
"goods_id"
)
.
String
()
{
//还要去判断是否是bool
if
data
.
IsObject
()
{
var
goods
bom
.
GoodsModel
...
...
@@ -57,5 +62,7 @@ func GetGoodsInfo(goodsIdsStr string) (goodsList []*bom.GoodsModel, err error) {
}
}
}
}
}
return
}
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