Commit f2b8edb8 by mushishixian
parents 0e4bf303 88ad28cd
Showing with 27 additions and 1 deletions
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
......@@ -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, "")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment