新查询upc优化
This commit is contained in:
@@ -135,6 +135,9 @@ func (a *API) GetNetUpcInfo(bar string) (getNetUpcInfo *GetNetUpcInfoResult, err
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
getNetUpcInfo = &GetNetUpcInfoResult{}
|
getNetUpcInfo = &GetNetUpcInfoResult{}
|
||||||
body := result["fakeData"].(string)
|
body := result["fakeData"].(string)
|
||||||
|
if strings.Contains(body, "没有收录") {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
results := regexpUpc.FindAllStringSubmatch(body, -1)
|
results := regexpUpc.FindAllStringSubmatch(body, -1)
|
||||||
getNetUpcInfo.Upc = results[0][1]
|
getNetUpcInfo.Upc = results[0][1]
|
||||||
getNetUpcInfo.Name = results[1][1]
|
getNetUpcInfo.Name = results[1][1]
|
||||||
|
|||||||
Reference in New Issue
Block a user