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
f2b8edb8
authored
Jun 30, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of
ssh://119.23.72.7:22611/mushishixian/search_server
parents
0e4bf303
88ad28cd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
cmd/test1.go
service/mouser_service.go
cmd/test1.go
0 → 100644
View file @
f2b8edb8
package
main
import
(
"github.com/gin-gonic/gin"
"search_server/framework/gin_"
"search_server/protopb/mouser"
"search_server/service"
)
func
main
()
{
MouserService
:=
service
.
NewMouserServiceImpl
()
rsp
:=
&
mouser
.
MouserResponse
{}
err
=
MouserService
.
MouserGetData
(
*
gin
.
Context
,
request
.
(
*
mouser
.
MouserRequest
),
rsp
)
return
rsp
,
err
}
//处理请求
func
MouserGetData
(
c
*
service
.
MouserServiceImpl
)
gin_
.
Endpoint
{
rsp
:=
&
mouser
.
MouserResponse
{}
err
=
c
.
MouserGetData
(
context
,
request
.
(
*
mouser
.
MouserRequest
),
rsp
)
return
rsp
,
err
}
\ No newline at end of file
service/mouser_service.go
View file @
f2b8edb8
...
...
@@ -11,6 +11,8 @@ import (
"search_server/protopb/mouser"
"strings"
)
//mouser外链网址
const
Mouser_api_url
string
=
"https://www.masterelectronics.com/wst/MSI005ws.asmx/GeneralSearch?InStock=0&ExactMatch=0&username=MSI005&password=MSI005@ME"
//单例
type
MouserServiceImpl
struct
{}
...
...
@@ -30,8 +32,9 @@ func (bs *MouserServiceImpl) MouserGetData(ctx context.Context, req *mouser.Mous
//mouser请求外链
func
OutLink
(
goodsName
string
)
[]
string
{
Mouser_api_urls
:=
Mouser_api_url
+
"&Query="
+
goodsName
+
"&Limit=25"
;
print
(
"nini"
)
print
(
Mouser_api_urls
)
os
.
Exit
(
1
)
replace
,
_
:=
regexp
.
Compile
(
"[^A-Za-z0-9]+"
)
goodsName
=
replace
.
ReplaceAllString
(
goodsName
,
""
)
...
...
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