Commit 59acfdf8 by huangchengyi

1.0

parents
Showing with 9200 additions and 0 deletions
/go.sum
/.idea/
gowatch.yml
*.exe
*.exe~
cmd.exe~
/cmd/logs/
/cmd/*.exe~
/cmd/logs
/bat/logs/
/conf/*.ini
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run ../cmd/course_server.go --server_address :9092
\ No newline at end of file
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run ../cmd/course_http_server.go -config=../conf/config.ini
\ No newline at end of file
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
micro api
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
micro api
protoc --proto_path=protos --micro_out=protopb/mouser --go_out=protopb/mouser mouser.proto
\ No newline at end of file
::protoc --proto_path=protos --micro_out=users --go_out=users users.proto
protoc --proto_path=protos --micro_out=course --go_out=course course.proto
protoc-go-inject-tag -input=course/course.pb.go
protoc --proto_path=protos --micro_out=course --go_out=course common.proto
protoc --proto_path=protos --micro_out=course --go_out=course course_topic.proto
protoc-go-inject-tag -input=course/course_topic.pb.go
\ No newline at end of file
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run ../cmd/goods_machining.go -config=../conf/config.ini
\ No newline at end of file
::set MICRO_REGISTRY=etcd
::set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run ../cmd/search_http_server.go -config=../conf
\ No newline at end of file
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run cmd/user_server.go --server_address :9090
\ No newline at end of file
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
micro web
protoc --proto_path=../protos -I="C:\Program Files (x86)\protoc\include" --micro_out=../protopb/course --go_out=../protopb/course course.proto
protoc-go-inject-tag -input=../protopb/course/course.pb.go
protoc --proto_path=../protos -I="C:\Program Files (x86)\protoc\include" --micro_out=../protopb/common --go_out=../protopb/common common.proto
protoc --proto_path=../protos -I="C:\Program Files (x86)\protoc\include" --micro_out=../protopb/course --go_out=../protopb/course course_topic.proto
protoc-go-inject-tag -input=../protopb/course/course_topic.pb.go
protoc --proto_path=../protos -I="C:\Program Files (x86)\protoc\include" --micro_out=../protopb/users --go_out=../protopb/users users.proto
protoc --proto_path=../protos -I="C:\Program Files (x86)\protoc\include" --micro_out=../protopb/bom --go_out=../protopb/bom bom.proto
protoc-go-inject-tag -input=../protopb/bom/bom.pb.go
protoc --proto_path=../protos -I="C:\Program Files (x86)\protoc\include" --micro_out=../protopb/goods --go_out=../protopb/goods goods.proto
protoc-go-inject-tag -input=../protopb/goods/goods.pb.go
\ No newline at end of file
package boot
import (
"goods_machining/pkg/config"
"goods_machining/pkg/gredis"
"goods_machining/pkg/logger"
"goods_machining/pkg/mongo"
"goods_machining/pkg/mysql"
)
func Boot(configPath string) (err error) {
if err = config.SetUp(configPath); err != nil {
panic(err)
}
if err = mysql.Setup(); err != nil {
panic(err)
return
}
if err = gredis.Setup(); err != nil {
panic(err)
return
}
if err = mongo.SetUp(); err != nil {
panic(err)
return
}
if err = logger.SetUp(); err != nil {
panic(err)
return
}
return
}
package main
import (
_ "goods_machining/controller"
)
func main() {
//
//var path string
//flag.StringVar(&path, "config", "conf/config.ini", "配置文件")
//flag.Parse()
//if err := boot.Boot(path); err != nil {
// log.Println(err)
//}
//
//r := gin.New()
//gin_.BootStrap(r)
//
//c:=grpc.NewClient()
//r:=gin.New()
//r.Handle("GET","/test", func(ctx *gin.Context) {
// news
// c:=Course.NewCourseService("api.jtthink.com.course",c)
// course_rsp,_:=c.ListForTop(context.Background(),&Course.ListRequest{Size:10})
// ctx.JSON(200,gin.H{"Result":course_rsp.Result})
//})
//service:=web.NewService(
// web.Name("api.jtthink.com.http.course"),
// web.Handler(r),
//)
//
//
//
//port := config.Get("web.port").String()
////web改成micro 就是grpc,并直接注册到etcd里面
//service := web.NewService(
// web.Name("go.micro.api.http.course"),
// web.Handler(r),
// web.Address(":"+port),
//)
//
//if err := service.Init(); err != nil {
// log.Println(err)
//}
//if err := service.Run(); err != nil {
// log.Println(err)
//}
}
package main
import (
"context"
"github.com/micro/go-micro/v2/client/grpc"
"github.com/micro/go-micro/v2/web"
"goods_machining/Course"
"log"
"net/http"
)
func main() {
service:=web.NewService(
web.Name("api.jtthink.com.http.course"))
c:=grpc.NewClient()
service.HandleFunc("/test", func(writer http.ResponseWriter, request *http.Request) {
c:=Course.NewCourseService("go.micro.api.jtthink.course",c)
course_rsp,_:=c.ListForTop(context.Background(),&Course.ListRequest{Size:10})
log.Println(course_rsp.Result)
writer.Write([]byte("http api test"))
})
service.Init()
if err:= service.Run(); err != nil {
log.Println(err)
}
}
\ No newline at end of file
package main
import (
"github.com/micro/go-micro/v2"
"goods_machining/protopb/course"
"goods_machining/service"
"log"
)
func main() {
cService:=micro.NewService(
micro.Name("go.micro.api.jtthink.course"))
cService.Init()
err:=course.RegisterCourseServiceHandler(cService.Server(),service.NewCourseServiceImpl())
if err!=nil{
log.Fatal(err)
}
if err = cService.Run(); err != nil {
log.Println(err)
}
}
\ No newline at end of file
package main
import (
"flag"
"github.com/gin-gonic/gin"
"github.com/micro/go-micro/v2/web"
"goods_machining/boot"
//_ "goods_machining/controller"
"goods_machining/pkg/config"
"goods_machining/routes"
)
func main() {
var path string
flag.StringVar(&path, "config", "conf", "配置文件")
flag.Parse()
if err := boot.Boot(path); err != nil {
panic(err)
}
gin.SetMode(config.Get("web.mode").String())
r := routes.InitRouter()
port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面
service := web.NewService(
web.Name("go.micro.api.http.search"),
web.Handler(r),
web.Address(":"+port),
)
if err := service.Init(); err != nil {
panic(err)
}
if err := service.Run(); err != nil {
panic(err)
}
}
package main
import (
"github.com/micro/go-micro/v2"
"goods_machining/protopb/bom"
"goods_machining/service"
"log"
)
func main() {
cService:=micro.NewService(
micro.Name("go.micro.grpc.search"))
cService.Init()
err:=bom.RegisterBomServiceHandler(cService.Server(),service.NewBomServiceImpl())
if err!=nil{
log.Fatal(err)
}
if err = cService.Run(); err != nil {
log.Println(err)
}
}
\ No newline at end of file
package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/tidwall/gjson"
"os"
"goods_machining/boot"
"goods_machining/service/query"
)
func main() {
//MouserService := service.NewMouserServiceImpl()
//MouserGetData(MouserService)
var path string
flag.StringVar(&path, "config", "conf", "配置文件")
flag.Parse()
if err := boot.Boot(path); err != nil {
panic(err)
}
//lock_key := "searchapi_668777";
////flag := gredis.Set(lock_key,php2go.Time()+2)
//flag,_ := gredis.Setnx(lock_key,2222)
//
//fmt.Println(flag)
//os.Exit(1)
//redisConn := gredis.Conn("search_r")
//defer redisConn.Close()
//attrName, err := gredis.String(redisConn.Do("GET", "hcy1"))
//
//fmt.Println(err)
//fmt.Println(attrName)
//os.Exit(1)
//ss := "LM358"
//mouserRes := service.OutLink(&ss,"-1")
//for k, mouseItem := range mouserRes {
// fmt.Println(k)
// fmt.Println(mouseItem.PriceTemp)
// os.Exit(1)
//}
//fmt.Errorf()
println(query.GetExactGoodsQuery("nninin"))
jsonstr := `{"goods_id":1156147221172418504,"goods_sn":"","spu_id":"2156147221162468806","update_time":1561472211,"goods_status":3,"goods_name":"RC0603FR-07100KL","goods_type":2,"supplier_id":17,"encoded":"10059","batch_sn":"1148","moq":27961,"mpq":1,"stock":1765,"hk_delivery_time":"","cn_delivery_time":"4\u4e2a\u5de5\u4f5c\u65e5","goods_details":"","ladder_price":[{"purchases":2765,"price_cn":0.01072951425,"price_us":0},{"purchases":45654,"price_cn":0.343434,"price_us":6666}],"goods_images":"","canal":"L0000110","cp_time":0}`
m, ok := gjson.Parse(jsonstr).Value().(map[string]interface{})
if !ok {
fmt.Println(ok)
os.Exit(1)
}
goods_id := gjson.Get(jsonstr, "goods_id").String()
ladder := gjson.Get(jsonstr, "ladder_price").Array()
temp1 := []map[string]float64{};
for _,value:=range ladder {
b := value.Map()
temp1 = append(temp1,map[string]float64{
"purchases":b["purchases"].Float(),
"price_cn":b["price_cn"].Float(),
"price_us":b["price_us"].Float(),
})
}
//fmt.Println(ladder)
//
m["goods_id"] = goods_id
m["ladder_price"] = temp1
dd,_ := json.Marshal(m)
fmt.Println(string(dd))
//lines := []string{
// `{"index":{"_index":"hcy1","_type":"goods","_id":"s1"} }`,
// `{"name":"john doe","age":25 }`,
// `{"index":{"_index":"hcy1","_type":"goods","_id":"s2"} }`,
// `{"name":"mary smith","age":32 }`,
//}
//param := strings.Join(lines, "\n")+"\n"
//
//result,err := es.BulkES(param)
//println(result,err)
//var skuEsUpdataList []string
//
//param := map[string]interface{}{
// "goods_status":1,
// "status":1,
// "encoded": "{'ddd'}",
//}
//
//paramjson,_ := json.Marshal(param)
//
//skuEsUpdataList = append(skuEsUpdataList,string(paramjson))
//skuEsUpdataList = append(skuEsUpdataList,string(paramjson))
//
//
//println(strings.Join(skuEsUpdataList,"\n"))
os.Exit(1)
}
//xml := strings.NewReader(resp)
//json, err := xj.Convert(xml)
//if err != nil {
// panic("That's embarrassing...")
//}
//
//json_str := json.String();
////ss := gjson.Get(json_str,"hello").String()
//
//fmt.Println(json_str)
package main
import (
"context"
"github.com/micro/go-micro/v2/client"
"goods_machining/protopb/course"
"github.com/micro/go-micro/v2"
"goods_machining/protopb/users"
"log"
)
type UserService struct{
client client.Client
}
func (this *UserService) Test(ctx context.Context, req *users.UserRequest, rsp *users.UserResponse) error {
rsp.Ret="users"+req.Id
c:=course.NewCourseService("go.micro.api.jtthink.course",this.client)
course_rsp,_:=c.ListForTop(ctx,&course.ListRequest{Size:10})
log.Println(course_rsp.Result)
return nil
}
func NewUserService(c client.Client) *UserService {
return &UserService{client:c}
}
func main() {
service:=micro.NewService(
micro.Name("go.micro.api.jtthink.user"))
service.Init()
err:=users.RegisterUserServiceHandler(service.Server(),NewUserService(service.Client()))
if err!=nil{
log.Fatal(err)
}
if err = service.Run(); err != nil {
log.Println(err)
}
}
[web]
port = 9000
mode = debug
cors_domain = http://bom.liexin.com
domain = liexin.com
[message]
api_domain = http://api.ichunt.com/msg/sendMessageByAuto
api_md5_str = fh6y5t4rr351d2c3bryi
[goods]
api_url = http://192.168.2.232:60004
sz_api_url = http://192.168.2.232:60004
[es]
url = http://192.168.2.232:9200
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
[redis]
write_host = 192.168.1.235:6379
read_host = 192.168.1.235:6379
write_password = icDb29mLy2s
read_password = icDb29mLy2s
max_idle = 10
max_active = 10
idle_timeout = 20
[mongo]
host = 192.168.1.237:27017
username = "ichunt"
password = "huntmon6699"
database = ichunt
maxPoolSize=100
[ZIYING_CACHE]
is_no_ziying_cache=true
#是否是测试环境
[IS_SZ]
is_sz = true
#自营mongodb缓存表 正式线ziying_class_aggs
[AGG_TABLE]
agg_table = ziying_class_aggs
#自营mongodb缓存表 正式线 ziying_first_lists
[FIRSTLISTS_TABLE]
firstLists_table = ziying_first_lists
\ No newline at end of file
[web]
port = 9000
mode = debug
cors_domain = http://bom.liexin.com
[message]
api_domain = http://api.ichunt.com/msg/sendMessageByAuto
api_md5_str = fh6y5t4rr351d2c3bryi
[goods]
api_url = http://192.168.2.232:60004
[es]
url = http://192.168.2.232:9200
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
[database]
user_name = root
password = root
host = 192.168.2.239
database = test
table_prefix =
type = mysql
[redis]
write_host = 192.168.1.235:6379
read_host = 192.168.1.235:6379
write_password = icDb29mLy2s
read_password = icDb29mLy2s
max_idle = 10
max_active = 10
idle_timeout = 20
[mongo]
host = 127.0.0.1:27017
database = liexin_config
[brand]
#是否开启排除品牌
IS_NOT_TI = 1
TI_LY_BRAND_IDS = 23,45069,7754,17484,43215,13421,5220,7636,44534,43556,44543,9429,758,9470,10430,10653,10707,11227,11276,11819,12608,12965,12997,13327,13675,13680,13752
ti_zy_brand_id = 23
\ No newline at end of file
[gorm]
mode = debug
[spu]
user_name = spu
password = spu
host = 192.168.1.234
database = liexin_spu
table_prefix =lie_
type = mysql
#线上地址
#SupDbUser:Supssy2@@!!@$#yxy@172.18.137.21:3306/liexin_supp
[supp]
user_name = liexin_ass
password = `liexin_ass#zsyM`
host = 192.168.2.232
database = liexin_ass
table_prefix =lie_
type = mysql
[cms]
user_name = ichuntcms
password = `ichuntcms#zsyM`
host = 192.168.2.232
database = ichuntcms
table_prefix =
type = mysql
[DINGDING]
SEARCH_API_MONITOR = 6d0fa85e01a02c39347d011ae973fd21b76c6c7ce582d3ea470c6b65a318848d
\ No newline at end of file
[rabmq]
url = amqp://guest:guest@192.168.2.232:5672/
;存放本系统所有的队列名称
[rabmq_all]
; bom任务id
MQ_BOM_ITEMS_LIST=bom_items_list
; bom更新数据队列
MQ_BOM_SKU_LIST=bom_sku_list
;联营数据更新-推送入队列-》go后台任务消费(斌哥脚本)
SEARCH_SKU_UPDATE_LIST=search_sku_update_list
;联营数据新增-推送入队列-》go后台任务消费(斌哥脚本)
SEARCH_SKU_LIST=search_sku_list
; bom任务id
ZIYING_MQ_BOM_ITEMS_LIST=ziying_bom_items_list
; bom更新数据队列
ZIYING_MQ_BOM_SKU_LIST=ziying_bom_sku_list
\ No newline at end of file
[default_redis_read]
host = 192.168.1.235:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
idle_timeout = 20
[default_redis_write]
host = 192.168.1.235:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
idle_timeout = 20
[api_redis]
host = 192.168.1.235:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
idle_timeout = 20
\ No newline at end of file
;存放本系统所有的redis键值对和解析
[redis_all]
;供应商redis的首key
SUPPLIER_REDIS_PRE=SUPPLIER_REDIS_INFO_
;需要展示的供应商列表
SUPPLIER_REDIS_LIST_PRE=SUPPLIER_REDIS_LIST_INFO_
;新增sku时判读sku是否存在
SKU_UNIQUE_JUDGE=sku_unique_judge
;新增sku时判读sku是否存在
SPU_UNIQUE_JUDGE=sku_unique_judge
;品牌信息判断,根据md5后的品牌名称获取id
BRAND_NAME_ALL=brand_name_all
;品牌id,获取品牌名称
BRAND=brand
;供应商品牌信息判断,存在多对一的情况,根据md5后的品牌名称获取标准品牌id
SUPPLIER_BRAND_ALL=supplier_brand_all
;统计调用外联接口的次数的key的前缀 后面接mouser、verical、arrow、master
SEARCH_API_TOTAL_PRE=search_api_total_
;统计调用外联接口失败的次数的key的前缀 后面接mouser、verical、arrow、master
SEARCH_API_ERORR_PRE=search_api_overtime_
;曝光时间记录哈希集合
SEARCH_SHOW_SKU_TIME=search_show_sku_time
;获取关税信息,根据goods_name,brand_name获取
TAX_CUSTOMS_INFO=tax_customs_info
;存放联营外链原始映射
SKU_RAW_MAP=sku_raw_map
[redis_ziyin]
AGG_TABLE=sz_ziying_class_aggs
FIRST_LISTS_TABLE=ziying_first_lists
ZIYING_CLASS_KEY=ziying_class_string
TAX_CUSTOMS_INFO=tax_customs_info
;存放联营所有sku
SKU=sku
;存放联营所有spu
SPU=SPU
;存放digikey 型号映射
SKU_RAW_MAP=sku_raw_map
POOL_ALIKE_GOODS=pool_alike_goods
[SUPPLIER_ALL]
1 = future
2 = powerandsignal
3 = rochester
4 = tme
5 = verical
6 = element14
7 = digikey
8 = chip1stop
9 = aipco
10 = arrow
11 = bisco
12 = alliedelec
13 = avnet
14 = mouser
#16 = liexin_lianying1
17 = zhuanmai
18 = liexin_ti
19 = peigenesis
20 = powell
21 = rs
1676 = buerklin
[SEARCH_SUPPLIER_MERGE]
17 = zhuanmai
1 = future
3 = rochester
6 = element14
7 = digikey
8 = chip1stop
9 = aipco
12 = alliedelec
13 = avnet
19 = peigenesis
20 = powell
21 = rs
[SEARCH_SUPPLIER]
1 = future
#2 = powerandsignal
3 = rochester
4 = tme
5 = verical
6 = element14
7 = digikey
8 = chip1stop
9 = aipco
10 = arrow
#11 = bisco
12 = alliedelec
13 = avnet
14 = mouser
#15 = company
#16 = liexin_lianying1
17 = zhuanmai
#18 = liexin_ti
19 = peigenesis
20 = powell
21 = rs
#22 = liexin_sell
#100 = ziying
#101 = liexin_jingdiao
1676 = buerklin
#相似物料供应商
[ALIKE_SUPPLIER]
1 = ti
[common]
MOUSER_API = 'http://footstone.liexin.net/webapi/handle_mouser'
[BRAND]
IS_NOT_TI = 0
TI_LY_BRAND_IDS = 23,45069,7754,17484,43215,13421,5220,7636,44534,43556,44543,9429,758,9470,10430,10653,10707,11227,11276,11819,12608,12965,12997,13327,13675,13680,13752
TI_ZY_BRAND_IDS = 23
[supplier]
# 供应商redis的首key
SUPPLIER_REDIS_PRE = SUPPLIER_REDIS_INFO_
[ZIYING_BRAND_REPLACE]
FH = FH(风华)
BL = BL(上海贝岭)
TE = TE(泰科)
FM = FM(富满)
CJ = CJ(长电)
ST = ST(意法)
SK = SK(时科)
ON = ON(安森美)
TM = TM(天微)
TP = TP(拓微)
TI = TI(德州仪器)
MD = MD(明达)
EG = EG(屹晶微)
HF = HF(宏发)
DY = DY(迪一)
MK = MK(米客方德)
国民 = Nationz(国民技术)
中芯 = SMIC(中芯国际)
富士 = Fuji Electric(富士电机)
国星 = Nationstar(国星光电)
贝岭 = BL(上海贝岭)
[ZIYING_CONFIG]
Index = liexin_ziying
[SEARCH_KEYWORD_MAPPING]
`^(.* )?([\d\.]+)(欧|欧姆|R|r)( .*)?$` = ${1}${2}Ω${4}
`^(.* )?([\d\.]+)(U|u|μ)(.?)( .*)?$` = ${1}${2}Μ${4}${5}
`COG` = C0G
`NPO` = NP0
`华科|华新科技|华新科` = 华新
[mathExactGoodsName]
0=M7
1=M1
2=M4
3=M2
4=A7
5=F7
6=X2
7=G4
8=X4
9=m7
10=m1
11=m4
12=m2
13=a7
14=f7
15=x2
16=g4
17=x4
;自营以某些单位进行搜索时,进行特殊处理
[ZIYING_MEASURE]
0=kΩ
1=uf
2=v
3=kg
4=MHz
5=pf
6=pin
7=ppm
8=kw
[OFFICIAL_WEBSITE]
1 = https://www.futureelectronics.cn/search/?text=liexin
2 = http://www.powerandsignal.com/Products/Search?searchBox=liexin
3 = https://www.rocelec.com/search?q=liexin
4 = https://www.tme.eu/zh/katalog/#search=liexin
5 = https://www.verical.com/s/liexin/
6 = https://cn.element14.com/search?st=liexin
7 = https://www.digikey.com/products/en?keywords=liexin
8 = https://www.chip1stop.com/CHN/zh/view/searchResult/SearchResultTop?keyword=liexin
9 = http://www.aipco.com/search.php?pn=liexin
10 = https://www.arrow.com/en/products/search?cat=&q=liexin
11 = https://www.biscoind.com?SEARCHTEXT=liexin
12 = https://www.alliedelec.com/view/search?keyword=liexin
13 = https://www.avnet.com/shop/apac/search/liexin
14 = https://www.mouser.com/Search/Refine?Keyword=liexin
15 =
16 =
18 =
19 = https://www.peigenesis.cn/cn/shop/f/liexin.html
20 = https://www.powell.com/e2wItemQuickSearch.aspx?searchText=liexin
21 = https://uk.rs-online.com/web/c/semiconductors/amplifiers-comparators/op-amps/?searchTerm=liexin
22 =
1672 = https://www.masterelectronics.com/parts.aspx?text=liexin
1673 = https://www.rutronik24.com/search-result/qs:liexin
1675 = https://www.zaikostore.com/zaikostore/stockList?productName_forFind=liexin
1676 = https://www.buerklin.com/en/search?text=liexin
1677 = https://www.microchipdirect.com/product/search/all/liexin
1678 = https://estore.heilindasia.com/search.asp?p=liexin
1680 = http://shop.wpgam.com/WPGAStore/index.php?route=product/search&filter_description=true&filter_name=liexin
[AUTH]
SUPER_AUTH_KEY = fh6y5t4rr351d2c3bryi
SEARCH_TOKEN_EXPIRE_TIME = 30
[UNIT_SUPPLIER_LOG_CODE]
333333 = arrow
444444 = master
555555 = mouser
666666 = verical
777777 = tme
888888 = buerklin
999999 = zhuanmai
[SEARCH_API_LOG]
SEARCH_API_ERROR_PRE = search_api_overtime_
\ No newline at end of file
[web]
port = 10001
mode = release
cors_domain = https://bom.ichunt.com
domain = ichunt.com
[message]
api_domain = http://api.ichunt.com/msg/sendMessageByAuto
api_md5_str = fh6y5t4rr351d2c3bryi
[goods]
api_url = http://47.106.60.211:60004
sz_api_url = http://47.106.60.211:60004
[es]
url = http://172.18.137.29:9211
urls = http://172.18.137.29:9211,http://172.18.137.30:9211
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
[redis]
write_host = 172.18.137.38:6379
read_host = 172.18.137.39:6379
write_password = icDb29mLy2s
read_password = icDb29mLy2s
max_idle = 10
max_active = 10
idle_timeout = 20
[mongo]
host = 172.18.137.23:27017
username = "ichunt"
password = "huntmon66499"
database = ichunt
maxPoolSize=100
[ZIYING_CACHE]
is_no_ziying_cache=true
#是否是测试环境
[IS_SZ]
is_sz = false
#自营mongodb缓存表 正式线ziying_class_aggs
[AGG_TABLE]
agg_table = ziying_class_aggs
#自营mongodb缓存表 正式线 ziying_first_lists
[FIRSTLISTS_TABLE]
firstLists_table = ziying_first_lists
\ No newline at end of file
[gorm]
mode = debug
#线上地址
#mysql://LxiCSpu:Mysx3Tyzlo00oxlmlly@172.18.137.29:3306
[spu]
user_name = LxiCSpu
password = Mysx3Tyzlo00oxlmlly
host = 172.18.137.29
database = liexin_spu
table_prefix =lie_
type = mysql
#线上地址
#SupDbUser:Supssy2@@!!@$#yxy@172.18.137.21:3306/liexin_supp
[supp]
user_name = SupDbUser
password = `Supssy2@@!!@$#yxy`
host = 172.18.137.21
database = liexin_supp
table_prefix =lie_
type = mysql
#线上地址
#mysql://dtuserread:dAtaL#ym2902m2lLX2y33@172.18.137.22:3306/icdata#utf8
[cms]
user_name = dtuser
password = `dAtaL#ym2902m2lLX2y33`
host = appdb-master.ichunt.db
database = icdata
table_prefix =
type = mysql
[DINGDING]
SEARCH_API_MONITOR = cd1661d0ce733a8ff0b603b532b317aae9de6dbaf39186b0352f272e47a860e8
\ No newline at end of file
[rabmq]
url = amqp://huntweb:xMtMi29zTm@119.23.79.136:5672/
;存放本系统所有的队列名称
[rabmq_all]
; bom任务id
MQ_BOM_ITEMS_LIST=bom_items_list
; bom更新数据队列
MQ_BOM_SKU_LIST=bom_sku_list
;联营数据更新-推送入队列-》go后台任务消费(斌哥脚本)
SEARCH_SKU_UPDATE_LIST=search_sku_update_list
;联营数据新增-推送入队列-》go后台任务消费(斌哥脚本)
SEARCH_SKU_LIST=search_sku_list
; bom任务id
ZIYING_MQ_BOM_ITEMS_LIST=ziying_bom_items_list
; bom更新数据队列
ZIYING_MQ_BOM_SKU_LIST=ziying_bom_sku_list
\ No newline at end of file
[default_redis_read]
host = 172.18.137.39:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
idle_timeout = 20
[default_redis_write]
host = 172.18.137.38:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
idle_timeout = 20
[api_redis_read]
host = 172.18.137.38:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
idle_timeout = 20
[api_redis_write]
host = 172.18.137.39:6379
password = icDb29mLy2s
max_idle = 50
max_active = 100
idle_timeout = 20
;存放本系统所有的redis键值对和解析
[redis_all]
;供应商redis的首key
SUPPLIER_REDIS_PRE=SUPPLIER_REDIS_INFO_
;需要展示的供应商列表
SUPPLIER_REDIS_LIST_PRE=SUPPLIER_REDIS_LIST_INFO_
;新增sku时判读sku是否存在
SKU_UNIQUE_JUDGE=sku_unique_judge
;新增sku时判读sku是否存在
SPU_UNIQUE_JUDGE=sku_unique_judge
;品牌信息判断,根据md5后的品牌名称获取id
BRAND_NAME_ALL=brand_name_all
;品牌id,获取品牌名称
BRAND=brand
;供应商品牌信息判断,存在多对一的情况,根据md5后的品牌名称获取标准品牌id
SUPPLIER_BRAND_ALL=supplier_brand_all
;统计调用外联接口的次数的key的前缀 后面接mouser、verical、arrow、master
SEARCH_API_TOTAL_PRE=search_api_total_
;统计调用外联接口失败的次数的key的前缀 后面接mouser、verical、arrow、master
SEARCH_API_ERORR_PRE=search_api_overtime_
;曝光时间记录哈希集合
SEARCH_SHOW_SKU_TIME=search_show_sku_time
;获取关税信息,根据goods_name,brand_name获取
TAX_CUSTOMS_INFO=tax_customs_info
;存放联营外链原始映射
SKU_RAW_MAP=sku_raw_map
[redis_ziyin]
AGG_TABLE=sz_ziying_class_aggs
FIRST_LISTS_TABLE=ziying_first_lists
ZIYING_CLASS_KEY=ziying_class_string
TAX_CUSTOMS_INFO=tax_customs_info
;存放联营所有sku
SKU=sku
;存放联营所有spu
SPU=SPU
;存放digikey 型号映射
SKU_RAW_MAP=sku_raw_map
POOL_ALIKE_GOODS=pool_alike_goods
[SUPPLIER_ALL]
1 = future
2 = powerandsignal
3 = rochester
4 = tme
5 = verical
6 = element14
7 = digikey
8 = chip1stop
9 = aipco
10 = arrow
11 = bisco
12 = alliedelec
13 = avnet
14 = mouser
15 = company
16 = liexin_lianying1
17 = zhuanmai
18 = liexin_ti
19 = peigenesis
20 = powell
21 = rs
22 = liexin_sell
100 = ziying
101 = liexin_jingdiao
1672 = master
1673 = rutronik
1675 = corestaff
1676 = buerklin
1677 = microchip
1678 = heilind
1680 = wpg
1681 = jameco
1679 = ti
1684 = distrelec
1685 = tlc
1686 = adi
#搜索结果页合并供应商
[SEARCH_SUPPLIER_MERGE]
1 = future
3 = rochester
6 = element14
#7 = digikey
8 = chip1stop
9 = aipco
12 = alliedelec
13 = avnet
19 = peigenesis
20 = powell
21 = rs
1675 = corestaff
1677 = microchip
1678 = heilind
1680 = wpg
1681 = jameco
1679 = ti
1684 = distrelec
1685 = tlc
1686 = adi
#相似物料供应商
[ALIKE_SUPPLIER]
1 = ti
[common]
MOUSER_API = 'http://footstone.liexin.net/webapi/handle_mouser'
[BRAND]
IS_NOT_TI = 0
TI_LY_BRAND_IDS = 23,45069,7754,17484,43215,13421,5220,7636,44534,43556,44543,9429,758,9470,10430,10653,10707,11227,11276,11819,12608,12965,12997,13327,13675,13680,13752
TI_ZY_BRAND_IDS = 23
[supplier]
# 供应商redis的首key
SUPPLIER_REDIS_PRE = SUPPLIER_REDIS_INFO_
[ZIYING_BRAND_REPLACE]
FH = FH(风华)
BL = BL(上海贝岭)
TE = TE(泰科)
FM = FM(富满)
CJ = CJ(长电)
ST = ST(意法)
SK = SK(时科)
ON = ON(安森美)
TM = TM(天微)
TP = TP(拓微)
TI = TI(德州仪器)
MD = MD(明达)
EG = EG(屹晶微)
HF = HF(宏发)
DY = DY(迪一)
MK = MK(米客方德)
国民 = Nationz(国民技术)
中芯 = SMIC(中芯国际)
富士 = Fuji Electric(富士电机)
国星 = Nationstar(国星光电)
贝岭 = BL(上海贝岭)
[ZIYING_CONFIG]
Index = liexin_ziying
[SEARCH_KEYWORD_MAPPING]
`^(.* )?([\d\.]+)(欧|欧姆|R|r)( .*)?$` = ${1}${2}Ω${4}
`^(.* )?([\d\.]+)(U|u|μ)(.?)( .*)?$` = ${1}${2}Μ${4}${5}
`COG` = C0G
`NPO` = NP0
`华科|华新科技|华新科` = 华新
[mathExactGoodsName]
0=M7
1=M1
2=M4
3=M2
4=A7
5=F7
6=X2
7=G4
8=X4
9=m7
10=m1
11=m4
12=m2
13=a7
14=f7
15=x2
16=g4
17=x4
;自营以某些单位进行搜索时,进行特殊处理
[ZIYING_MEASURE]
0=kΩ
1=uf
2=v
3=kg
4=MHz
5=pf
6=pin
7=ppm
8=kw
[OFFICIAL_WEBSITE]
1 = https://www.futureelectronics.cn/search/?text=liexin
2 = http://www.powerandsignal.com/Products/Search?searchBox=liexin
3 = https://www.rocelec.com/search?q=liexin
4 = https://www.tme.eu/zh/katalog/#search=liexin
5 = https://www.verical.com/s/liexin/
6 = https://cn.element14.com/search?st=liexin
7 = https://www.digikey.com/products/en?keywords=liexin
8 = https://www.chip1stop.com/CHN/zh/view/searchResult/SearchResultTop?keyword=liexin
9 = http://www.aipco.com/search.php?pn=liexin
10 = https://www.arrow.com/en/products/search?cat=&q=liexin
11 = https://www.biscoind.com?SEARCHTEXT=liexin
12 = https://www.alliedelec.com/view/search?keyword=liexin
13 = https://www.avnet.com/shop/apac/search/liexin
14 = https://www.mouser.com/Search/Refine?Keyword=liexin
15 =
16 =
18 =
19 = https://www.peigenesis.cn/cn/shop/f/liexin.html
20 = https://www.powell.com/e2wItemQuickSearch.aspx?searchText=liexin
21 = https://uk.rs-online.com/web/c/semiconductors/amplifiers-comparators/op-amps/?searchTerm=liexin
22 =
1672 = https://www.masterelectronics.com/parts.aspx?text=liexin
1673 = https://www.rutronik24.com/search-result/qs:liexin
1675 = https://www.zaikostore.com/zaikostore/stockList?productName_forFind=liexin
1676 = https://www.buerklin.com/en/search?text=liexin
1677 = https://www.microchipdirect.com/product/search/all/liexin
1678 = https://estore.heilindasia.com/search.asp?p=liexin
1680 = http://shop.wpgam.com/WPGAStore/index.php?route=product/search&filter_description=true&filter_name=liexin
[AUTH]
SUPER_AUTH_KEY = fh6y5t4rr351d2c3bryi
SEARCH_TOKEN_EXPIRE_TIME = 30
[UNIT_SUPPLIER_LOG_CODE]
333333 = arrow
444444 = master
555555 = mouser
666666 = verical
777777 = tme
888888 = buerklin
999999 = zhuanmai
[SEARCH_API_LOG]
SEARCH_API_ERROR_PRE = search_api_overtime_
package controller
import (
"github.com/gin-gonic/gin"
"net/http"
"goods_machining/framework/gin_"
"goods_machining/pkg/config"
)
//放 通用中间件
//检查服务是否可用
func Check_Middleware() gin_.Middleware {
return func(next gin_.Endpoint) gin_.Endpoint {
return func(context *gin.Context, request interface{}) (response interface{}, err error) {
return next(context, request)
}
}
}
func Cors_Middleware() gin_.Middleware {
return func(next gin_.Endpoint) gin_.Endpoint {
return func(c *gin.Context, request interface{}) (response interface{}, err error) {
method := c.Request.Method
corsDomains := config.Get("web.cors.domain").Strings(",")
for _, domain := range corsDomains {
c.Header("Access-Control-Allow-Origin", domain)
}
c.Header("Access-Control-Allow-Origin", "https://bom.ichunt.com")
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token")
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
c.Header("Access-Control-Allow-Credentials", "true")
//放行所有OPTIONS方法
if method == "OPTIONS" {
c.AbortWithStatus(http.StatusNoContent)
}
// 处理请求
return next(c, request)
}
}
}
package controller
import (
"github.com/gin-gonic/gin"
"github.com/syyongx/php2go"
"goods_machining/middleware"
"goods_machining/pkg/common"
"goods_machining/service"
"sync"
)
const goods_slice_count = 50 //每多少个型号id开启一个协程
/*
查询商品详情(自营或者联营)
@doc http://192.168.2.232:3000/project/128/interface/api/649
@param goods_id 支持批量,不建议超过40个,超过会导致处理时间超过2秒,进程异常 : 74564,65897,456464131
@param power[newCustomer] 是否获取新客价 :true
@param power[member] 是否获取会员价 :true
@param power[mobile] 获取会员价时,用户有手机号时必填,用于会员价可见名单。活动价时必须,否则可能导致用户无法享受活动价 :13510507993
@param power[email] 获取会员价时,用户有邮箱时必填,用于会员价可见名单。活动价时必须,否则可能导致用户无法享受活动价 ymx@ichunt.com
@param power[user_id] 获取会员价时,必填,用于会员价可见名单。活动价时必须,否则可能导致用户无法享受活动价,如果用户未登录,可为空,用户是否可见活动价取决于配置 65139
@param power[fast] 仅获取价格与库存 :1
@param power[invoice] 增值税普通发票公司名字,活动价时必须,否则可能导致用户无法享受活动价 :深圳是猎芯科技有限公司
@param power[special_invoice] 增值税专用发票公司名字,活动价时需要,否则可能导致用户无法享受活动价 : 深圳是猎芯科技有限公司
@param power[verify_blacklist] 是否验证黑名单,用于折扣活动提交订单页面与后台下单 :true
*/
func Synchronization(c *gin.Context) {
common.PrintDebugHeader() //开启debug调试
zyService := service.ZiyingService{} //实例化自营查询
lyService := service.LyService{} //实例化自营查询
//抽取自营 或者联营 goods_id
GoodsIdStr := middleware.REQUEST["goods_id"]
if GoodsIdStr == "" {
common.Output(1001,"查询型号ID不得为空","")
}
GoodsRes := make(map[string]interface{}, 0) //接收算好的数据
goodsIdArr := php2go.Explode(",",GoodsIdStr)
wg := sync.WaitGroup{}
zyGoodsId := make([]string,0)
lyGoodsId := make([]string,0)
for _,goods_id := range goodsIdArr {
if len(goods_id) < 19 { //自营
zyGoodsId = append(zyGoodsId,goods_id)
if len(zyGoodsId) >= goods_slice_count {
common.PrintDebugHtml("zy增加协程:")
common.PrintDebugHtml(zyGoodsId)
wg.Add(1) //协程计数一
go zyService.ZyGoodsDetail(zyGoodsId,&GoodsRes,&wg)
zyGoodsId = zyGoodsId[:0:0]
}
}else{ //联营
lyGoodsId = append(lyGoodsId,goods_id)
if len(lyGoodsId) >= goods_slice_count {
common.PrintDebugHtml("ly增加协程:")
common.PrintDebugHtml(zyGoodsId)
wg.Add(1)
go lyService.LyGoodsDetail(lyGoodsId,&wg)
lyGoodsId = lyGoodsId[:0:0]
}
}
}
if len(zyGoodsId) >0 {
common.PrintDebugHtml("zy增加协程:")
common.PrintDebugHtml(zyGoodsId)
wg.Add(1) //协程计数一
go zyService.ZyGoodsDetail(zyGoodsId,&GoodsRes,&wg)
}
if len(lyGoodsId) >= goods_slice_count {
common.PrintDebugHtml("ly增加协程:")
common.PrintDebugHtml(zyGoodsId)
wg.Add(1)
go lyService.LyGoodsDetail(lyGoodsId,&wg)
}
wg.Wait()
common.Output(0,"查询成功",GoodsRes)
}
package dao
import (
"goods_machining/model"
"goods_machining/pkg/mysql"
)
//获取所有内部编码
func GetAllIntraCode() (intracode []model.Intracode, err error) {
err = mysql.Conn("cms").Table("lie_intracode").Select("code_id,admin_id").Find(&intracode)
return
}
//获取所有的用户基础信息
func GetAllUserBaseInfo() (userBaseInfo []model.CmsUserInfo, err error) {
err = mysql.Conn("cms").Table("user_info").Select("name,email,userId").Find(&userBaseInfo)
return
}
package dao
import (
"goods_machining/model"
"goods_machining/pkg/mysql"
)
//获取供应商编码和渠道开发员id
func GetAllSupplierCodeAndUid() (supplierChannels []model.SupplierChannel, err error) {
err = mysql.Conn("supp").Table("lie_supplier_channel").Select("supplier_code,channel_uid").
Where("status = ?", 2).Find(&supplierChannels)
return
}
package dao
import (
"encoding/json"
"github.com/ichunt2019/logger"
"goods_machining/model"
"goods_machining/pkg/mysql"
)
//根据id获取供应商信息
func GetSupplierExtraBySupplierId(supplierId int) (supplierExtra model.SupplierExtra, err error) {
_, err = mysql.Conn("spu").Table("lie_supplier_extra").Select("hk_delivery,cn_delivery,price_json as price_json_str,ad_text,supplier_logo,ad_url,sort").
Where("supplier_id = ?", supplierId).Get(&supplierExtra)
if supplierExtra.PriceJsonStr != "" {
err = json.Unmarshal([]byte(supplierExtra.PriceJsonStr), &supplierExtra.PriceJson)
if err != nil {
logger.Error("%s", err)
}
}
return
}
File mode changed
package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"strings"
)
func Sha1(query string, pri_key string) string {
key := []byte(pri_key)
mac := hmac.New(sha1.New, key)
mac.Write([]byte(query))
query = base64.StdEncoding.EncodeToString(mac.Sum(nil))
return query
}
func main() {
ss := strings.Index("attr[456546]","attr")
print(ss)
return
//println(php2go.Sha1("123456"+"123456"))
//ss := Sha1("POST&https%3A%2F%2Fapi.tme.eu%2FProducts%2FSearch.json&Country%3DUS%26Currency%3DUSD%26Language%3DEN%26SearchPlain%3DRMCF0402FT12R0%26Token%3D3381c9d5d9663be68eb69ea3ce00af3a2b5789094c7cd488a4","a1d8647fa38710140628")
//println(ss)
}
package main
import (
"fmt"
"sort"
)
// 按map的key排序
func main() {
params := make(map[string]interface{})
params["name"] = "xxx"
params["age"] = 23
params["sex"] = 0
params["level"] = 1
// 1.取出所有的key
var keys []string
for k := range params{
keys = append(keys, k)
}
// 对字符串切片排序
sort.Strings(keys)
fmt.Println(keys)
// 打印key, val
for _, k := range keys{
fmt.Printf("key: %v val:%v \n", k, params[k])
}
}
package main
import (
cmap "github.com/orcaman/concurrent-map"
)
func main() {
m := cmap.New()
// Sets item within map, sets "bar" under key "foo"
m.Set("foo", "bar")
m.Set("a1", "dd")
m.Set("b2", "ba343r")
// Retrieve item from map.
if tmp, ok := m.Get("foo"); ok {
bar := tmp.(string)
println(bar)
}
s,_ := m.MarshalJSON()
println(string(s))
// Removes item under key "foo"
//m.Remove("foo")
}
\ No newline at end of file
package main
import (
"encoding/json"
"fmt"
"github.com/iancoleman/orderedmap"
)
func main() {
o := orderedmap.New()
o.Set("error_code", 1)
o.Set("error_msg", "fagaga")
s := orderedmap.New()
s.Set("total",10)
aggs := orderedmap.New()
aggs.Set("1001€品牌",[...]string{"3001€mouser€0","4003€arrowV€0"})
aggs.Set("1002€标称电压",[...]string{"2001€5.5V€0","4003€arrowV€0"})
s.Set("aggs",aggs)
o.Set("data", s)
m1,_ := o.Get("error_msg")
fmt.Print(m1)
bytes, err := json.Marshal(o)
fmt.Print(string(bytes),err)
return
//// use Get instead of i, ok := o["a"]
//val, ok := o.Get("a")
//
//// use Keys instead of for k, v := range o
//key := o.Keys()
//for _, k := range keys {
// v, _ := o.Get(k)
//}
// use o.Delete instead of delete(o, key)
//err := o.Delete("a")
// serialize to a json string using encoding/json
//bytes, err := json.Marshal(o)
//fmt.Print(string(bytes),err)
//prettyBytes, err := json.MarshalIndent(o)
//
//// deserialize a json string using encoding/json
//// all maps (including nested maps) will be parsed as orderedmaps
//s := `{"a": 1}`
//err := json.Unmarshal([]byte(s), &o)
//
//// sort the keys
//o.SortKeys(sort.Strings)
//
//// sort by Pair
//o.Sort(func(a *Pair, b *Pair) bool {
// return a.Value().(float64) < b.Value().(float64)
//})
}
\ No newline at end of file
package main
import (
"github.com/tidwall/sjson"
"gopkg.in/olivere/elastic.v5"
)
const json = `{"name":{"first":"Janet","last":"Prichard"},"age":47}`
const param1 = `{
"query": {
"bool": {
"must": [
]
}
},
"aggs": {
"brand_id": {
"terms": {
"field": "brand_id",
"size": 1000
}
},
"attrs": {
"nested": {
"path": "attrs"
},
"aggs": {
"attr_name": {
"terms": {
"field": "attrs.attr_name",
"size": 5000
},
"aggs": {
"attr_value": {
"terms": {
"field": "attrs.attr_value",
"size": 5000
}
}
}
}
}
}
},
"sort": {
"sort": {
"order": "desc"
}
},
"from": 0,
"size": 0
}`
func main() {
query := elastic.NewBoolQuery()
query1 := elastic.NewBoolQuery()
query2 := elastic.NewBoolQuery()
query1.Must(elastic.NewTermQuery("class_id2",111))
query1.Should(elastic.NewTermQuery("brand_id","108"))
query1.Should(elastic.NewTermQuery("brand_id","107"))
query2.Should(elastic.NewNestedQuery("attrs",elastic.NewBoolQuery().Must(elastic.NewTermQuery("attrs.attr_name","nin"),elastic.NewTermQuery("attrs.attr_value","nni"))))
query2.Should(elastic.NewNestedQuery("attrs",elastic.NewBoolQuery().Must(elastic.NewTermQuery("attrs.attr_name","3333"),elastic.NewTermQuery("attrs.attr_value","333"))))
source := elastic.NewSearchSource()
source.Aggregation("brand_id",elastic.NewTermsAggregation().Field("brand_id").Size(1000))
source.Aggregation("attrs",elastic.NewNestedAggregation().Path("attrs").
SubAggregation("attr_name",elastic.NewTermsAggregation().Field("attrs.attr_name").Size(5000).
SubAggregation("attr_value",elastic.NewTermsAggregation().Field("attrs.attr_value").Size(5000))))
source.FetchSourceContext(elastic.NewFetchSourceContext(true).Include("goods_id", "stock")) //显示字段
source.Size(1)
query.Must(query1)
query.Must(query2)
source.Query(query)
searchRequest := elastic.NewSearchRequest().Source(source)
queryString, _ := searchRequest.Body()
print(queryString)
return
value, _ := sjson.Set(param1, "query.bool.must.-1", map[string]interface{}{"hello":"world"})
value, _ = sjson.Set(value, "query.bool.must.-1", map[string]interface{}{"hellosss":"world"})
println(value)
}
\ No newline at end of file
package main
import (
"fmt"
"github.com/gomodule/redigo/redis"
"log"
)
func main() {
c1, err := redis.Dial("tcp", "192.168.1.235:6379")
if err != nil {
log.Fatalln(err)
}
if _, err := c1.Do("AUTH", "icDb29mLy2s"); err != nil {
c1.Close()
log.Fatalln(err)
}
defer c1.Close()
reply, err := redis.Values(c1.Do("hvals", "Self_StockLock165514"))
if err != nil {
fmt.Print(err,"错误")
// handle error
}
var albums []int64
if err := redis.ScanSlice(reply, &albums); err != nil {
fmt.Println(err)
return
}
fmt.Printf("%v\n", albums)
//if _, err := redis.Scan(reply, &value1,&value2); err != nil {
// // handle error
// }
// fmt.Print(value1,value2)
return
//c1.Send("HGet", "sku","1150969960421953396")
c1.Send("hvals", "Self_StockLock165514")
//c1.Send("HGet", "sku","1159160904159516648333")
//c1.Send("HGet", "sku","1150961577851663286")
c1.Flush()
//echoReceive(c1.Receive())
s,err := c1.Receive()
fmt.Print(err,s.([]uint64))
//echoReceive(c1.Receive())
//echoReceive(c1.Receive())
//echoReceive(c1.Receive())
}
func echoReceive(res interface{}, err error){
if err != nil{
fmt.Println(err)
}else {
if res != nil{
fmt.Printf("--------- ")
fmt.Println(string(res.([]byte)))
}else {
fmt.Println(res)
}
}
}
package main
import (
"flag"
"fmt"
log "github.com/sirupsen/logrus"
"github.com/syyongx/php2go"
"reflect"
"goods_machining/boot"
"goods_machining/service"
)
func StrRandom(lenNum int) string {
randStr := "sdwpkxmiqplmzacbmeruwulurjlauejrifkfghjklzxcvbnmqwwertyuiopkdsieurnvewjeilweiskvnx"
strLen := len(randStr) - 9
var result string
for i := 0; i < lenNum; i++ {
//start := common.Rand(0, strLen)
start := php2go.Rand(0, strLen)
fmt.Println(start)
str := php2go.Substr(randStr, uint(start), 9)
result = result + " " + str
}
return result
}
type LogFormatter struct{}
//格式详情
func (s *LogFormatter) Format(entry *log.Entry) ([]byte, error) {
msg := entry.Message + "\n"
return []byte(msg), nil
}
func main() {
var path string
flag.StringVar(&path, "configPath", "conf", "配置文件")
flag.Parse()
if err := boot.Boot(path); err != nil {
fmt.Println(err)
}
res, _ := service.GetGoodsInfo([]string{"74163","116492","74123","106095","116451","162774","74152","116078","74122","74132"})
fmt.Println(len(res))
}
func InterfaceSlice(slice interface{}) []interface{} {
s := reflect.ValueOf(slice)
if s.Kind() != reflect.Slice {
panic("InterfaceSlice() given a non-slice type")
}
ret := make([]interface{}, s.Len())
for i := 0; i < s.Len(); i++ {
ret[i] = s.Index(i).Interface()
}
return ret
}
package main
import (
"fmt"
"encoding/json"
)
func main() {
var goodsList []interface{}
var productList map[string]interface{}
var price_temp []interface{}
var tiered []interface{}
m := make(map[string]interface{})
m["goods_names"] = "LM358"
m["stock"] = [...]int64{1,23}
price_temp = append(price_temp,[...]int64{3,5})
m["price_temp"] = price_temp;
s := make(map[string]interface{})
s["purchases"]=1
s["price_us"]=0.66
s["price_us"]=0.67
s["price_cn"]=0.33
tiered = append(tiered,s);
m["tiered"] = tiered;
goodsList = append(goodsList, m)
productList = make(map[string]interface{})
productList["595-LM358BIDR"] = goodsList
productList["595-LM358LVIDDFR"] = goodsList
//map的遍历
for k, v := range productList{
fmt.Println(k,v)
}
jsonStr, err := json.Marshal(productList)
if err!=nil{
return
}
fmt.Printf("%s\n",jsonStr)
}
\ No newline at end of file
package main
import (
"fmt"
"encoding/json"
"goods_machining/model"
)
func main() {
var LyClearGoodsList model.LyClearGoodsList
LyClearGoodsList.GoodsName = "LM358"
ladderPrice := make([]*model.TierItem, 0)
ladder := model.TierItem{
Purchases: 1,
PriceUs: 0.44,
PriceCn: 1.55,
}
ladderPrice = append(ladderPrice, &ladder)
LyClearGoodsList.Tiered = ladderPrice
var productList map[string]*model.LyClearGoodsList
productList = make(map[string]*model.LyClearGoodsList,0)
productList["595-LM358BIDR"] = &LyClearGoodsList
//map的遍历
for k, v := range productList{
fmt.Println(k,v)
}
jsonStr, err := json.Marshal(productList)
if err!=nil{
return
}
fmt.Printf("%s\n",jsonStr)
}
\ No newline at end of file
package main
import (
"bytes"
"fmt"
"strconv"
)
func intsToString(values []int) string {
var buf bytes.Buffer
buf.WriteByte('[')
for i, v := range values {
if i > 0 {
buf.WriteString(", ")
}
fmt.Fprintf(&buf, "%d", v)
}
buf.WriteByte(']')
return buf.String()
}
func main() {
var a,b,c float64
a=1.69*100
b=1.7*10
c=a*b/(100*10)
//��ȷ���2.873
fmt.Println(c)
//fmt.Println(fmt.Sprintf("%.2f",c))
//fmt.Println(FloatRound(c,2))
}
// ��ȡС��λ��
func FloatRound(f float64, n int) float64 {
format := "%." + strconv.Itoa(n) + "f"
//fmt.Println(format)
res, _ := strconv.ParseFloat(fmt.Sprintf(format, f), 64)
return res
}
package main
import (
"fmt"
"reflect"
)
// interface{}转为 []interface{}
func CreateAnyTypeSlice(slice interface{}) ([]interface{}, bool) {
val, ok := isSlice(slice)
if !ok {
return nil, false
}
sliceLen := val.Len()
out := make([]interface{}, sliceLen)
for i := 0; i < sliceLen; i++ {
out[i] = val.Index(i).Interface()
}
return out, true
}
// 判断是否为slcie数据
func isSlice(arg interface{}) (val reflect.Value, ok bool) {
val = reflect.ValueOf(arg)
if val.Kind() == reflect.Slice {
ok = true
}
return
}
// 看需求写的代码
func faa(arg interface{}) {
slice, ok := CreateAnyTypeSlice(arg)
if !ok {
return
}
for index,value := range slice {
fmt.Println(index,value)
}
}
func main() {
intSlice := []int{1,2,3,4,5,6,7,8}
strSlice := []string{"a","b","c","d"}
boolSlice := []bool{true,true,false,true}
faa(intSlice)
faa(strSlice)
faa(boolSlice)
}
\ No newline at end of file
package main
import (
"fmt"
"reflect"
"regexp"
"strings"
)
func remove2(s interface{}, deleteVal int) []interface{} {
val := reflect.ValueOf(s)
sliceLen := val.Len()
out := make([]interface{}, sliceLen)
if val.Kind() == reflect.Slice {
sliceLen := val.Len()
for i := 0; i < sliceLen; i++ {
if val.Index(i).Int() != int64(deleteVal){
out[i] = val.Index(i).Interface()
}
}
}
return out
}
func main(){
a := []int{1,2,3,4,5}
fmt.Println(remove2(a,3))
test := "a,b,c,d,e"
aaa := test
keywordSlice := strings.Split(test,",")
for _,v := range keywordSlice{
reg := regexp.MustCompile("(?i)"+v)
aaa = reg.ReplaceAllString(aaa,"<b class='f-red'>"+strings.ToUpper(v)+"</b>")
fmt.Println(aaa)
}
}
package main
import (
"bytes"
"fmt"
"io"
)
const debug = false
func main() {
//var buf *bytes.Buffer
var buf io.Writer
fmt.Printf("%T \n",buf)
if debug {
buf = new(bytes.Buffer) // enable collection of output
}
f(buf) // NOTE: subtly incorrect!
if debug {
// ...use buf...
}
}
// If out is non-nil, output will be written to it.
func f(out io.Writer) {
// ...do something...
fmt.Println(out)
fmt.Printf("%T \n",out)
if out != nil {
fmt.Println("!!!!!!!!!!")
out.Write([]byte("done!\n"))
}
var a interface{}
a = map[string]string{
"a":"b",
}
a = nil
b,_ := a.(map[string]string)
fmt.Println(b)
}
\ No newline at end of file
package main
import (
"fmt"
"github.com/imroc/req"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
"goods_machining/middleware"
"goods_machining/model"
"goods_machining/pkg/common"
"strconv"
"time"
)
//tme 类
type tme struct {
}
//tme外链网址
const tme_api_url_product string = "https://api.tme.eu/Products/Search.json" //'Products/Search' 查询商品 或者 'Products/GetPricesAndStocks' 查询价格
const tme_api_url_stock string = "https://api.tme.eu/Products/GetPricesAndStocks.json" //'Products/Search' 查询商品 或者 'Products/GetPricesAndStocks' 查询价格
const tme_token string = "3381c9d5d9663be68eb69ea3ce00af3a2b5789094c7cd488a4"//密钥
const tme_app_secret string = "a1d8647fa38710140628" //账号
//tme请求外链
func OutLinkTme(goodsName *string) map[string]*model.LyClearGoodsList {
if *goodsName == "" {
return nil
}
var (
result string //请求外链原始结果
SymbolList string //外链原始数据的goods_sn
);
if middleware.REQUEST["flags"] == "-1" { //原始数据调试
result = `{"Status":"OK","Data":{"ProductList":[{"Symbol":"0402WGF1000TCE","CustomerSymbol":"","OriginalSymbol":"0402WGF1000TCE","Producer":"ROYAL OHM","Description":"Resistor: thick film; SMD; 0402; 100\u03a9; 63mW; \u00b11%; -55\u00f7155\u00b0C","CategoryId":"100578","Category":"0402 SMD resistors","Photo":"\/\/ce8dc832c.cloudimg.io\/fit\/640x480\/n@4760e4647bc7d903de9205a51f321b69cdbed098\/_cdn_\/D9\/C2\/B0\/00\/0\/732317_1.jpg?mark_url=_tme-wrk_%2Ftme_new_render3d.png&mark_pos=center&mark_size=100pp","Thumbnail":"\/\/ce8dc832c.cloudimg.io\/fit\/100x75\/webp@3ec3fbcb8427a46b791b093cd6e191b483328d8a\/_cdn_\/D9\/C2\/B0\/00\/0\/732317_1.jpg","Weight":0.01,"WeightUnit":"g","SuppliedAmount":0,"MinAmount":10000,"Multiples":10000,"ProductStatusList":[],"Unit":"pcs","ProductInformationPage":"\/\/www.tme.eu\/en\/details\/0402wgf1000tce\/0402-smd-resistors\/royal-ohm\/","Guarantee":null,"OfferId":null},{"Symbol":"SMD0402-100R-1%","CustomerSymbol":"","OriginalSymbol":"0402WGF1000TCE","Producer":"ROYAL OHM","Description":"Resistor: thick film; SMD; 0402; 100\u03a9; 63mW; \u00b11%; -55\u00f7155\u00b0C","CategoryId":"100578","Category":"0402 SMD resistors","Photo":"\/\/ce8dc832c.cloudimg.io\/fit\/640x480\/n@4760e4647bc7d903de9205a51f321b69cdbed098\/_cdn_\/D9\/C2\/B0\/00\/0\/732317_1.jpg?mark_url=_tme-wrk_%2Ftme_new_render3d.png&mark_pos=center&mark_size=100pp","Thumbnail":"\/\/ce8dc832c.cloudimg.io\/fit\/100x75\/webp@3ec3fbcb8427a46b791b093cd6e191b483328d8a\/_cdn_\/D9\/C2\/B0\/00\/0\/732317_1.jpg","Weight":0.006,"WeightUnit":"g","SuppliedAmount":0,"MinAmount":100,"Multiples":100,"ProductStatusList":[],"Unit":"pcs","ProductInformationPage":"\/\/www.tme.eu\/en\/details\/smd0402-100r-1%\/0402-smd-resistors\/royal-ohm\/0402wgf1000tce\/","Guarantee":null,"OfferId":null}],"Amount":2,"PageNumber":1,"CategoryList":{"111000":2,"100299":2,"100300":2,"100578":2,"112309":2}}}`;
}else{
params1 := "Country=US&Currency=USD&Language=EN&SearchPlain="+*goodsName+"&Token="+tme_token
param := "POST"+"&"+php2go.Rawurlencode(tme_api_url_product)+"&"+php2go.Rawurlencode(params1)
common.PrintDebugHtml(param)
sign := common.Sha1(param,tme_app_secret) //生成签名
postParam := params1+"&ApiSignature="+php2go.URLEncode(sign);
common.PrintDebugHtml(postParam)
req.SetTimeout(30 * time.Second)
//resp, err := req.Post(params2,postParam)
req.Debug = true
ss := req.Param{
"SearchPlain":*goodsName,
"Country":"US",
"Currency":"USD",
"Language":"EN",
"Token":"3381c9d5d9663be68eb69ea3ce00af3a2b5789094c7cd488a4",
"ApiSignature":sign,
}
resp, err := req.Post(tme_api_url_product,ss)
if err != nil {
print(tme_api_url_product)
print(err)
}
result = resp.String(); //请求外链拿到结果
}
common.PrintDebugHtml("原始数据:"+result)
productList := make(map[string]*model.LyClearGoodsList,0)
if gjson.Get(result,"Status").String() != "OK" {
common.PrintDebugHtml("请求出错-没有数据")
return nil
}
apiGoodsList := gjson.Get(result, "Data.ProductList").Array()
i := 0;
for _, goods := range apiGoodsList {
goodsSn := goods.Get("Symbol").String()
if i == 0 {
SymbolList = SymbolList+"&SymbolList[0]="+goodsSn
}else{
SymbolList = SymbolList+"&SymbolList["+strconv.Itoa(i)+"]"+goodsSn
}
i ++;
var increment int64 = 1;
if goods.Get("Multiples").Int() > 0 {
increment = goods.Get("Multiples").Int()
}
var moq int64 = 1;
if goods.Get("MinAmount").Int() > 0 {
moq = goods.Get("MinAmount").Int()
}
//拼接联营数据
LyClearGoodsList := model.LyClearGoodsList{
GoodsName: goods.Get("OriginalSymbol").String(),
BrandName: goods.Get("Producer").String(),
Desc: goods.Get("Description").String(),
GoodsSn: goodsSn,
Docurl: goods.Get("DataSheetUrl").String(),
Url: goods.Get("ProductInformationPage").String(),
GoodsImg: goods.Get("Photo").String(),
Increment: increment,
Moq:moq, //最低起订量
}
productList[goodsSn] = &LyClearGoodsList
}
//查询价格库存
params1 := "Country=US&Currency=USD&Language=EN&SymbolList="+SymbolList+"&Token="+tme_token
param := "POST"+"&"+php2go.Rawurlencode(tme_api_url_stock)+php2go.Rawurlencode(params1)
sign := common.Sha1(param,tme_app_secret) //生成签名
req.SetTimeout(10 * time.Second)
resp, err := req.Post(tme_api_url_stock,req.BodyJSON(params1+"&ApiSignature"+sign))
if err != nil {
print(tme_api_url_stock)
print(err)
}
result = resp.String(); //请求外链拿到结果
fmt.Println(result,SymbolList)
if gjson.Get(result,"Status").String() != "OK" {
common.PrintDebugHtml("请求出错-价格库存")
return nil
}
priceData := gjson.Get(result, "Data.ProductList").Array()
for _, info := range priceData {
ladderPrice := make([]*model.TierItem, 0)
priceTemp := make([]interface{}, 0)
//拼接价格梯度
apiPriceTi := info.Get("PriceList").Array()
var apiLowerPrice float64 = 0; //计算最低价格
for _,priceItem := range apiPriceTi{
priceItemStr := priceItem.String();
skuPrice := gjson.Get(priceItemStr, "PriceValue").Float()
quantity := gjson.Get(priceItemStr, "Amount").Int()
if apiLowerPrice == 0 {
apiLowerPrice = skuPrice
}else if apiLowerPrice > skuPrice {
apiLowerPrice = skuPrice
}
ladder := model.TierItem{
Purchases: quantity,
PriceUs: skuPrice,
PriceCn: 0,
}
ladderPrice = append(ladderPrice, &ladder)
//梯度缓存数据
priceTemp = append(priceTemp,[]interface{}{
quantity,
skuPrice,
})
}
goodsSn := info.Get("Symbol").String()
productList[goodsSn].Stock = info.Get("Amount").Int() //库存
productList[goodsSn].Tiered = ladderPrice //梯度价格
productList[goodsSn].PriceTemp = priceTemp //梯度价格2
productList[goodsSn].SinglePrice = apiLowerPrice //最低价格
}
return productList
}
***redis键值: Self_SelfGoods
{
"other_attrs": "",
"goods_id": 203065,
"goods_type": 0,
"supplier_id": 10000,
"brand_id": 4492,
"class_id1": 10152,
"class_id2": 10164,
"goods_name": "RR0603(0201)L1203FTD",
"status": 1,
"encoded": "",
"encap": "0201(0603)",
"packing": 5,
"goods_unit": 1,
"goods_images": "",
"pdf": "",
"goods_brief": "",
"moq": 50,
"mpq": 15000,
"ladder_price": [
{
"purchases": 50,
"price_cn": 0.0044
},
{
"purchases": 1000,
"price_cn": 0.0044
},
{
"purchases": 15000,
"price_cn": 0.0044
}
],
"update_time": 1592218150,
"sku_name": "RR0603(0201)L1203FTD u7f16u5e26 PTC u70edu654fu7535u963b ",
"mpl": 1,
"stock": 0,
"attrs": "",
"cost": "0.000000",
"new_cost": "0.000000",
"supplier_stock": 473349,
"self_supplier_type": 4
}
#############最终结果##########
Array
(
[33072] => Array
(
[other_attrs] => Array
(
[length] =>
[gross_wegiht] => 0.000582
)
[goods_id] => 33072
[goods_type] => 0
[supplier_id] => 10000
[brand_id] => 703
[class_id1] => 161
[class_id2] => 169
[goods_name] => 3362P-1-101LF
[status] => 1
[encoded] => 10141
[encap] => 3362P
[packing] => 8
[goods_unit] => 1
[goods_images] => http://img.ichunt.com/images/goods/bb/a6/bba6b9cb12bf5f581cd4525a9d5995de.png
[pdf] => http://img.ichunt.com/doc/pdf/cms/201809/13/d110c1966263019b39775c419f57b4a2.pdf
[goods_brief] =>
[moq] => 1
[mpq] => 50
[ladder_price] => Array
(
[0] => Array
(
[purchases] => 1
[price_cn] => 0.95
[price_ac] => 0.5944
)
[1] => Array
(
[purchases] => 10
[price_cn] => 0.874
[price_ac] => 0.5944
)
[2] => Array
(
[purchases] => 20
[price_cn] => 0.836
[price_ac] => 0.5944
)
[3] => Array
(
[purchases] => 50
[price_cn] => 0.798
[price_ac] => 0.5944
)
[4] => Array
(
[purchases] => 250
[price_cn] => 0.76
[price_ac] => 0.5944
)
)
[update_time] => 1596436153
[sku_name] => 3362P-1-101LF 精密可调电阻 100Ω(101) 3362P
[mpl] => 1
[stock] => 67
[attrs] => Array
(
[0] => Array
(
[attr_name] => 阻值(欧姆)
[attr_value] => 100Ω(101)
)
[1] => Array
(
[attr_name] => 精度
[attr_value] =>
)
[2] => Array
(
[attr_name] => 温度系数
[attr_value] =>
)
)
[cost] => 0.699248
[new_cost] => 0.602800
[supplier_stock] => 0
[self_supplier_type] => 1
[cn_delivery_time] => 3-7工作日
[brand_name] => BOURNS(伯恩斯)
[supplier_name] => 猎芯自营
[goods_unit_name] => 个
[packing_name] => 管
[mpq_unit_name] => 管
[scm_brand_name] =>
[actual_stock] => 100
[ac_type] => 6
[allow_coupon] => 1
[allow_presale] => 1
[saler_atio] =>
[szlc_price] =>
[class_id1_name] => 电阻
[class_id2_name] => 精密可调电阻
[is_buy] => 1
)
)
package gin_
type ServiceBuilder struct {
service interface{}
endPoint Endpoint
requestFunc EncodeRequestFunc
responseFunc DecodeResponseFunc
methods string
middlewares []Middleware
}
func NewBuilder() *ServiceBuilder {
return &ServiceBuilder{middlewares:make([]Middleware,0)}
}
func(this *ServiceBuilder) WithService(obj interface{}) *ServiceBuilder {
this.service=obj
return this
}
func(this *ServiceBuilder) WithMiddleware(obj Middleware) *ServiceBuilder {
this.middlewares=append(this.middlewares,obj)
return this
}
func(this *ServiceBuilder) WithEndpoint(obj Endpoint) *ServiceBuilder {
this.endPoint=obj
return this
}
func(this *ServiceBuilder) WithRequest(obj EncodeRequestFunc) *ServiceBuilder {
this.requestFunc=obj
return this
}
func(this *ServiceBuilder) WithResponse(obj DecodeResponseFunc) *ServiceBuilder {
this.responseFunc=obj
return this
}
func(this *ServiceBuilder) WithMethods(methods string) *ServiceBuilder {
this.methods=methods
return this
}
func(this *ServiceBuilder) Build(path string,methods string) *ServiceBuilder{
finalEndpoint:=this.endPoint
for _,m:=range this.middlewares{ //遍历中间件
finalEndpoint=m(finalEndpoint)
}
handler:=RegisterHandler(finalEndpoint,this.requestFunc,this.responseFunc)
SetHandler(methods,path,handler)
return this
}
package gin_
import (
"fmt"
"github.com/gin-gonic/gin"
)
type Middleware func(next Endpoint) Endpoint
//业务最终函数原型
type Endpoint func(ctx *gin.Context,request interface{}) (response interface{}, err error)
//怎么取参数
type EncodeRequestFunc func(*gin.Context) (interface{}, error)
//怎么处理业务结果
type DecodeResponseFunc func(*gin.Context, interface{}) error
func RegisterHandler(endpoint Endpoint,encodeFunc EncodeRequestFunc, decodeFunc DecodeResponseFunc) func(context *gin.Context){
return func(ctx *gin.Context) {
defer func() {
if r:=recover();r!=nil{
ctx.JSON(500,gin.H{"error":fmt.Sprintf("fatal error:%s",r)})
return
}
}()
//参数:=怎么取参数(context)
//业务结果,error:=业务最终函数(context,参数)
//
//
//怎么处理业务结果(业务结果)
req,err:=encodeFunc(ctx) //获取参数
if err!=nil{
ctx.JSON(400,gin.H{"error":"param error:"+err.Error()})
return
}
rsp,err:=endpoint(ctx,req) //执行业务过程
if err!=nil{
ctx.JSON(400,gin.H{"error":"response error:"+err.Error()})
return
}
err=decodeFunc(ctx,rsp) //处理 业务执行 结果
if err!=nil{
ctx.JSON(500,gin.H{"error":"server error:"+err.Error()})
return
}
}
}
package gin_
import (
"github.com/gin-gonic/gin"
)
var HandlerMap map[string]map[string]gin.HandlerFunc
func init() {
HandlerMap=make( map[string]map[string]gin.HandlerFunc)
}
func SetHandler(methods string,path string,handler gin.HandlerFunc) {
if _,ok:=HandlerMap[path];ok{
HandlerMap[path][methods]=handler
}else{
HandlerMap[path]=make(map[string]gin.HandlerFunc)
}
HandlerMap[path][methods]=handler
}
func BootStrap(router *gin.Engine) {
for path,hmap:=range HandlerMap{
for method,handler:=range hmap{
router.Handle(method,path,handler)
}
}
}
\ No newline at end of file
module goods_machining
go 1.14
require (
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd // indirect
github.com/elliotchance/orderedmap v1.3.0 // indirect
github.com/gin-contrib/cors v1.3.1
github.com/gin-gonic/gin v1.6.3
github.com/go-ini/ini v1.57.0
github.com/go-sql-driver/mysql v1.5.0
github.com/go-xorm/xorm v0.7.9
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.4.2
github.com/gomodule/redigo v2.0.1-0.20180401191855-9352ab68be13+incompatible
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.14.3 // indirect
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0
github.com/ichunt2019/go-rabbitmq v1.0.1
github.com/ichunt2019/logger v1.0.5
github.com/imroc/req v0.3.0
github.com/mattn/go-sqlite3 v2.0.1+incompatible // indirect
github.com/micro/go-micro v1.16.0
github.com/micro/go-micro/v2 v2.9.0
github.com/prometheus/client_golang v1.5.1 // indirect
github.com/prometheus/common v0.10.0
github.com/prometheus/procfs v0.0.11 // indirect
github.com/sirupsen/logrus v1.5.0
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/stretchr/testify v1.5.1 // indirect
github.com/syyongx/php2go v0.9.4
github.com/tidwall/gjson v1.6.1
github.com/tidwall/sjson v1.1.1 // indirect
github.com/uniplaces/carbon v0.1.6
go.mongodb.org/mongo-driver v1.3.5 // indirect
go.uber.org/zap v1.14.1 // indirect
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece
google.golang.org/grpc v1.29.1 // indirect
google.golang.org/protobuf v1.24.0
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/olivere/elastic.v5 v5.0.85
sigs.k8s.io/yaml v1.2.0 // indirect
xorm.io/core v0.7.2-0.20190928055935-90aeac8d08eb
)
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
*
!.gitignore
\ No newline at end of file
package middleware
import (
"github.com/gin-gonic/gin"
"strings"
)
var Context *gin.Context
var REQUEST map[string]string //等同于php 的$_REQUEST,只接收非数组值
var REQUEST_MAP map[string][]string //接收参数的数组,只支持二维
//将gin的上下文放到全局变量
func ContextVars() gin.HandlerFunc {
return func(c *gin.Context) {
//接收所有的变量+值
REQUEST = make(map[string]string)
REQUEST_MAP = make(map[string][]string)
c.MultipartForm()
for requestName, requstValue := range c.Request.Form {
values := make([]string,0);
if len(requstValue) == 1 {
REQUEST[requestName] = strings.TrimSpace(requstValue[0])
REQUEST_MAP[requestName] = append(values,requstValue[0])
}
if len(requstValue) > 1 { //接收多维数组
var i int
for i = 0; i < len(requstValue); i++ {
values = append(values,requstValue[i])
}
REQUEST_MAP[requestName] = values
}
}
//将gin的上下文放到全局变量
Context = c
c.Next()
}
}
package middleware
import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"goods_machining/pkg/config"
"time"
)
func Cors() gin.HandlerFunc {
corsDomain := config.Get("web.cors_domain").Strings(",")
corsDomain = append(corsDomain, "https://bom.ichunt.com")
corsDomain = append(corsDomain, "https://bom.ichunt.com")
return cors.New(cors.Config{
AllowOrigins: corsDomain,
AllowMethods: []string{"POST", "GET", "PUT", "DELETE"},
AllowCredentials: true,
MaxAge: 12 * time.Hour,
})
}
package model
import (
"goods_machining/pkg/config"
)
//获取需要排除的品牌id
//branType = 1 : 联营 2 : 自营
func GetExcludeBrandIds(brandType int) (excludeBrandIds []int) {
isNoTi := config.Get("BRAND.IS_NOT_TI").String()
//如果关闭,直接返回空数据
if isNoTi == "0" {
return
}
//返回联营的brand_id切片
if brandType == 1 {
tiLyBrandIds := config.Get("BRAND.TI_LY_BRAND_IDS").Ints(",")
excludeBrandIds = tiLyBrandIds
//获取的是字符串
return
}
//返回自营的ti的brand_id切片
tiZyBrandId := config.Get("BRAND.TI_ZY_BRAND_IDS").Ints(",")
excludeBrandIds = tiZyBrandId
return
}
package model
type ApiGoods struct {
PickType int `json:"pick_type,omitempty"`
BarCode string `json:"barcode,omitempty"`
GoodsId string `json:"goods_id"`
GoodsName string `json:"goods_name"`
GoodsSn string `json:"goods_sn"`
GoodsType int `json:"goods_type"`
GoodsStatus int `json:"goods_status"`
SupplierId int `json:"supplier_id"`
Moq int `json:"-"`
MoqStr interface{} `json:"moq"`
Mpq int `json:"-"`
MpqStr interface{} `json:"mpq"`
Mpl int `json:"-"`
MplStr interface{} `json:"mpl,omitempty"`
Stock int `json:"-"`
StockStr interface{} `json:"stock"`
HkDeliveryTime string `json:"hk_delivery_time"`
CnDeliveryTime string `json:"cn_delivery_time"`
LadderPrice []LadderPrice `json:"ladder_price"`
BrandName string `json:"brand_name"`
SupplierName string `json:"supplier_name"`
BrandId int `json:"brand_id"`
ClassId1 int `json:"class_id1"`
ClassId2 int `json:"class_id2"`
ClassName string `json:"class_name"`
Encoded string `json:"encoded"`
Packing string `json:"packing,omitempty"`
GoodsUnit string `json:"goods_unit,goods_unit"`
GoodsImages string `json:"goods_images"`
GoodsDetails string `json:"goods_details"`
GoodsBrief string `json:"goods_brief,omitempty"`
IsBuy int `json:"is_buy"`
Status int `json:"status"`
Pdf string `json:"pdf"`
Encap string `json:"encap"`
AcType int `json:"ac_type"`
OtherAttrs OtherAttrs `json:"other_attrs"`
UpdateTime int `json:"update_time"`
SkuName string `json:"sku_name,omitempty"`
Attrs Attrs `json:"attrs"`
Cost string `json:"cost,omitempty"`
NewCost string `json:"new_cost,omitempty"`
SupplierStock int `json:"supplier_stock,omitempty"`
SelfSupplierType int `json:"self_supplier_type,omitempty"`
GoodsUnitName string `json:"goods_unit_name,omitempty"`
PackingName string `json:"packing_name,omitempty"`
MpgUnitName string `json:"mpg_unit_name,omitempty"`
ScmBrandName string `json:"scm_brand_name,omitempty"`
AllowCoupon int `json:"allow_coupon"`
ClassId1Name string `json:"class_id1_name"`
CLassId2Name string `json:"class_id2_name"`
SpuId string `json:"spu_id,omitempty"`
BatchSn string `json:"batch_sn"`
Canal string `json:"canal"`
CpTime int `json:"cp_time"`
Coefficient Coefficient `json:"coefficient,omitempty"`
OriginalPrice []OriginalPrice `json:"original_price,omitempty"`
SuppExtendFee SuppExtendFee `json:"supp_extend_fee,omitempty"`
ClassId3 int `json:"class_id3"`
SpuName string `json:"spu_name,omitempty"`
ImagesL string `json:"images_l,omitempty"`
SpuBrief string `json:"spu_brief"`
SpuDetail string `json:"spu_detail"`
ClassName3 string `json:"class_name3"`
ErpTax bool `json:"erp_tax"`
ScmBrand ScmBrand `json:"scm_brand,omitempty"`
ActivityEndTime int64 `json:"activity_end_time,omitempty"`
}
type ZiyinGoodsInfo struct {
GoodsNameOrg string `json:"goods_name_org"`
SampleStatus string `json:"sample_status"`
SampleMaxNumber string `json:"sample_max_number"`
SampleClassId string `json:"sample_class_id"`
SampleClassIdName string `json:"sample_class_id_name"`
Quota int `json:"quota"`
DullGoodsData
}
//经过处理后的商品数据
type DullGoodsData struct {
ApiGoods
//额外增加的字段
GoodsNameTemp string `json:"goods_name_temp,omitempty"`
Multiple int `json:"-"`
MultipleStr interface{} `json:"multiple,omitempty"`
SupplierLogo string `json:"supplier_logo,omitempty"`
SupplierSort int `json:"supplier_sort,omitempty"`
SupplierAd interface{} `json:"supplier_ad"`
SearchSampleApplication string `json:"search_sample_application"`
SearchContactExperts string `json:"search_contact_experts"`
PageFlag int `json:"page_flag"`
SupplierWebsite string `json:"supplier_website"`
PurchaseName string `json:"purchase_name"`
Ratio int `json:"ratio"`
PriceXs float64 `json:"price_xs"`
PriceProfit float64 `json:"price_profit"`
PriceHkxs float64 `json:"price_hkxs"`
CouponId int `json:"coupon_id"`
CouponTitle string `json:"coupon_title"`
LastSearchTime int `json:"last_search_time"`
CustomsTax string `json:"customs_tax"`
Alike string `json:"alike"`
BrandUrl string `json:"brand_url"`
GoodsUrl string `json:"goods_url"`
CompanyName string `json:"-"`
ProviderName string `json:"-"`
}
type Attr struct {
AttrName string `json:"attr_name,omitempty"`
AttrValue string `json:"attr_value,omitempty"`
}
type Attrs map[string]Attr
type OtherAttrs struct {
GrossWeight string `json:"gross_weight,omitempty"`
}
type LadderPrice struct {
Purchases int `json:"-"`
PurchasesStr interface{} `json:"purchases"`
PriceUs float64 `json:"price_us"`
PriceCn float64 `json:"price_cn"`
PriceAc float64 `json:"price_ac,omitempty"`
}
type Coefficient struct {
Cn float64 `json:"cn"`
Hk float64 `json:"hk"`
ExtraRatio float64 `json:"extra_ratio"`
Ratio float64 `json:"ratio"`
Tax float64 `json:"tax"`
}
type OriginalPrice struct {
Purchases int `json:"purchases"`
PriceCn float64 `json:"price_cn"`
PriceUs float64 `json:"price_us"`
}
type SuppExtendFee struct {
Cn struct {
Max int `json:"max"`
Price float64 `json:"price"`
} `json:"cn,omitempty"`
Hk struct {
Max int `json:"max"`
Price float64 `json:"price"`
} `json:"hk,omitempty"`
}
type ScmBrand struct {
ErpBrandName string `json:"erp_brand_name,omitempty"`
ErpBrandId string `json:"erp_brand_id,omitempty"`
ScmBrandId string `json:"scm_brand_id,omitempty"`
}
package model
//联营统一返回格式
type LyResponse struct {
ErrorCode int `json:"error_code"`
ErrorMsg string `json:"error_msg"`
Data interface{} `json:"data"`
}
//联营请求外链后格式化数据
type LyClearGoodsList struct {
SkuId string `json:"sku_id"` //平台型号id (非必填)
SpuId string `json:"spu_id"` //平台spuId (非必填)
BrandId string `json:"brand_id"` //平台品牌id (非必填)
GoodsName string `json:"goods_name"` //型号名称
BrandName string `json:"brand_name"` //品牌名称
Desc string `json:"desc"` //描述
BatchSn string `json:"batch_sn"` //批次号
GoodsSn string `json:"goods_sn"` //api唯一编码
Docurl string `json:"docurl"` //sku对应供应商的文档路径
Url string `json:"url"` //sku对应供应商的商品详情
GoodsImg string `json:"goods_img"` //sku图片
Cat string `json:"cat"` //分类
Encap string `json:"encap"` //包装
Canal string `json:"canal"` //渠道标签
Encoded string `json:"encoded"` //内部编码
RestrictionMessage string `json:"RestrictionMessage"` //额外购买限制内容,如 ‘当前商品不在本地区销售’
Increment int64 `json:"increment"` //最小包装量、倍数 =Mpq
SinglePrice float64 `json:"single_price"` //最小单价
Stock int64 `json:"stock"` //库存
Moq int64 `json:"moq"` //最小起订量、起订量
Packaging string `json:"Packaging"` //包装
RawGoodsId string `json:"raw_goods_id"` //外链原始goods_sn,如digikey:{'raw_goods_id': 'AT28C64X-25PC-ND', 'raw_brand_name': 'Microchip Technology'}
RawBrandName string `json:"raw_brand_name"` //外链原始品牌名称,如digikey:{'raw_goods_id': 'AT28C64X-25PC-ND', 'raw_brand_name': 'Microchip Technology'}
Tiered []*TierItem `json:"tiered"` //价格梯度数量
PriceTemp []interface{} `json:"price_temp"` //拼接梯度,目前只有联营推送队列用
DigiKeyPartNumber string `json:"DigiKeyPartNumber"` //digkey 唯一编码 (额外字段)
ManufacturerLeadWeeks string `json:"ManufacturerLeadWeeks"` //digikey交期(额外字段)
}
type TierItem struct {
Purchases int64 `json:"purchases"` //购买数量
PriceUs float64 `json:"price_us"` //数量对应的英文价格
PriceCn float64 `json:"price_cn"` //数量对应的中文价格
PriceAc float64 `json:"price_ac"`
}
//原始品牌(目前只有digikey使用)
type RawGoods struct {
RawGoodsId string `json:"raw_goods_id"` //原始goods_sn
RawBrandName string `json:"raw_brand_name"` //原始品牌名称
Pack string `json:"pack"` //包装
}
/*
供应商详情
Array
(
[supplier_id] => 4
[supplier_nickname] => tme
[ad_text] => 电子元器件、电工产品和工业自动化元件的全球分销商
[cn_delivery] => 5-9工作日
[hk_delivery] => 4-7工作日
[ad_url] => https://www.ichunt.com/
[sort] => 0
[supplier_logo] => http://img.ichunt.com/images/cms/201912/11/b2c4e3aae9a2312dfe6b9c318b430354.jpg
[status] => 1
[describe] => 电子元器件、电工产品和工业自动化元件的全球分销商
[price_json] => Array
(
[0] => Array
(
[hk] => 1.197
[cn] => 9.2534796
[rate] => 6.9
)
)
)
*/
type SUPPLIER_REDIS_INFO struct {
SupplierId int64 `json:"supplier_id"` //供应商id
SupplierNickname string `json:"supplier_nickname"` //供应商名称
AdText string `json:"ad_text"` //供应商描述
CnDelivery string `json:"cn_delivery"` //国内交货时间
HkDelivery string `json:"hk_delivery"` //香港交货时间
AdUrl string `json:"ad_url"` //供应商官网
Sort string `json:"sort"` //排序
SupplierLogo string `json:"supplier_logo"` //供应商logo
Status string `json:"status"` //状态,1开启
Describe string `json:"describe"` //描述
PriceJson []*PriceJsonItem //价格
}
type PriceJsonItem struct {
hk float64 //购买数量
cn float64 //数量对应的英文价格
rate float64 //数量对应的中文价格
}
/*
联营sku详情
Array
(
[spu_id] => 2.1540893752409E+18
[encoded] =>
[moq] => 624
[mpq] => 1
[old_goods_id] => 0
[goods_type] => 1
[goods_status] => 1
[batch_sn] =>
[stock] => 0
[hk_delivery_time] =>
[cn_delivery_time] =>
[update_time] => 1540967156
[goods_images] =>
[canal] =>
[supplier_id] => 10
[is_expire] => 1
[ladder_price] => Array
(
[0] => Array
(
[purchases] => 624
[price_cn] => 0
[price_us] => 13.42
)
[1] => Array
(
[purchases] => 6240
[price_cn] => 0
[price_us] => 12.12
)
[2] => Array
(
[purchases] => 624000
[price_cn] => 0
[price_us] => 2.383
)
)
)
*/
type LySkuInfo struct {
SpuId string `json:"spu_id"` //spu_id
Encoded string `json:"encoded"`
Moq int64 `json:"moq"`
Mpq int64 `json:"mpq"`
OldGoodsId int64 `json:"old_goods_id"`
GoodsType int `json:"goods_type"`
GoodsStatus int `json:"goods_status"`
BatchSn string `json:"batch_sn"`
Stock int64 `json:"stock"`
UpdateTime int64 `json:"update_time"`
GoodsImages string `json:"goods_images"`
Canal string `json:"canal"`
SupplierId int64 `json:"supplier_id"`
IsExpire string `json:"is_expire"`
HkDeliveryTime string `json:"hk_delivery_time"`
CnDeliveryTime string `json:"cn_delivery_time"`
LadderPrice []*TierItem `json:"ladder_price"`
}
/*
spu详情
Array
(
[class_id1] => 0
[class_id2] => 0
[class_id3] => 0
[brand_id] => 7087
[spu_name] => SI4704-D50-GM
[status] => 1
[images_l] =>
[encap] =>
[pdf] =>
[spu_brief] =>
[update_time] => 1540893752
)
*/
type LySpuInfo struct {
ClassId1 int64 `json:"class_id1"` //一级分类
ClassId2 int64 `json:"class_id2"` //二级分类
ClassId3 int64 `json:"class_id3"` //三级分类
BrandId int64 `json:"brand_id"` //品牌ID
SpuName string `json:"spu_name"` //型号名称
Status int `json:"status"` // 状态
ImagesL string `json:"images_l"` //图片
Encap string `json:"encap"` //封装
Pdf string `json:"pdf"` //pdf
SpuBrief string `json:"spu_brief"` //描述
UpdateTime int64 `json:"update_time"` //更新时间
}
package common
var KeywordRegular = map[string]string{
//`^(.* )?([\d\.]+)(欧|欧姆|R|r)( .*)?$`: `$1$2Ω$4`,
//`^(.* )?([\d\.]+)(U|u|μ)(.?)( .*)?$`: `$1$2Μ$4$5`,
"COG": "C0G",
"NPO|NP0|nPO|npO|npo|nP0|np0": "C0G",
"华科|华新科技|华新科": "华新",
`(欧姆|欧|O|o|R|r)`: "Ω",
`(Uf|uf|μf|uF|UF)`: "μF",
`(Uh|uh|μh|uH|UH)`: "μH",
`K`: "nF",
`v`: "V",
}
var PureNumberRegular = `(\d+(\.\d+)?)`
var PureLetterRegular = `[a-zA-Z0-9]+`
var GetAttrUnitRegular = `[\d.]|±|\+_|\+-|/|\(.*\)|\+/-|`
//属性单位对应属性
var UnitAttrMapping = map[string]string{
"r": "阻值(欧姆)|直流电阻(内阻)",
"Ω": "阻值(欧姆)|直流电阻(内阻)",
"OHM": "阻值(欧姆)|直流电阻(内阻)",
"mh": "电感",
"F": "容值",
"w": "功率",
"W": "功率",
"Ω/r ": "内阻",
"%": "精度",
"V": "额定电压",
"A": "额定电流",
}
//属性对应的基础属性
var UnitBaseMapping = map[string]string{
"μΩ": "Ω",
"mΩ": "Ω",
"Ω": "Ω",
"kΩ": "Ω",
"KΩ": "Ω",
"MΩ": "Ω",
"pF": "F",
"nF": "F",
"μF": "F",
"μf": "F",
"mF": "F",
"F": "F",
"μH": "H",
"mH": "H",
"H": "H",
"V": "V",
"kV": "V",
"mA": "A",
"A": "A",
"W": "W",
"kW": "W",
"KW": "W",
"%": "%",
}
//根据单位对值的转换,比如1kΩ=>1000Ω
var UnitValueMapping = map[string]string{
"μΩ": "0.000001",
"mΩ": "0.001",
"Ω": "1",
"kΩ": "1000",
"KΩ": "1000",
"MΩ": "1000000",
"pF": "1",
"nF": "1000",
"μF": "1000000",
"mF": "1000000000",
"F": "1000000000000",
"μH": "1",
"mH": "1000",
"H": "1000000",
"V": "1",
"kV": "1000",
"mA": "1",
"A": "1000",
"W": "1",
"kW": "1000",
"%": "0.01",
}
package common
import (
"crypto/hmac"
"crypto/md5"
crand "crypto/rand"
"crypto/sha1"
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/syyongx/php2go"
"math/big"
"math/rand"
"reflect"
"regexp"
"goods_machining/middleware"
"goods_machining/pkg/config"
"goods_machining/pkg/vars"
"sort"
"strconv"
"strings"
"time"
)
/*
sha1加密(tme目前在用)
@param string query 查询字符串
@param string pri_key 加密字符串
@return 返回加密后的字符串
*/
func Sha1(query string, pri_key string) string {
key := []byte(pri_key)
mac := hmac.New(sha1.New, key)
mac.Write([]byte(query))
query = base64.StdEncoding.EncodeToString(mac.Sum(nil))
return query
}
/*
输出header
*/
func PrintDebugHeader() {
if middleware.REQUEST["flag"] == "101" {
middleware.Context.Header("Content-Type", "text/html; charset=utf-8")
}
}
/*
格式化数据直接输出浏览器
@parm jsonStr 需要json输出的内容
*/
func PrintDebugHtml(jsonStr interface{}) {
if middleware.REQUEST["flag"] != "101" || jsonStr == "" {
return
}
if v, p := jsonStr.(string); p {
middleware.Context.String(200,"</br></br>-----------"+v)
}else{
jsonData,err := json.Marshal(jsonStr)
if err != nil {
fmt.Println("错误:-----",err)
}
middleware.Context.String(200,"</br></br>-----------"+string(jsonData))
}
}
// Md5 md5()
func Md5(str string) string {
hash := md5.New()
hash.Write([]byte(str))
return hex.EncodeToString(hash.Sum(nil))
}
//非精确匹配,字符串截取向下80%,5个字符以下不截,5-10个截一个,10-20个向下取80%,20个以上向下取70%
func SubKeyWordStr(str string) string {
strLen := len(str)
strLenFloat := float64(strLen)
if strLen < 5 {
return str
}
if strLen >= 5 && strLen <= 10 {
str = php2go.Substr(str, 0, strLen-1)
}
if strLen > 10 && strLen <= 20 {
num := php2go.Floor(strLenFloat * 0.2)
str = php2go.Substr(str, 0, strLen-int(num))
}
if strLen > 20 {
num := php2go.Floor(strLenFloat * 0.3)
str = php2go.Substr(str, 0, strLen-int(num))
}
return str
}
//转成字符串的方法
func ToString(a interface{}) string {
if v, p := a.(int); p {
return strconv.Itoa(v)
}
if v, p := a.(int16); p {
return strconv.Itoa(int(v))
}
if v, p := a.(int32); p {
return strconv.Itoa(int(v))
}
if v, p := a.(uint); p {
return strconv.Itoa(int(v))
}
if v, p := a.(float32); p {
return strconv.FormatFloat(float64(v), 'f', -1, 32)
}
if v, p := a.(float64); p {
return strconv.FormatFloat(v, 'f', -1, 32)
}
return "change to String error"
}
//替换字符串,不区分大小写
func CaseInsensitiveReplace(subject string, search string, replace string) string {
searchRegex := regexp.MustCompile("(?i)" + search)
return searchRegex.ReplaceAllString(subject, replace)
}
/*
md5字符串
*/
func GetKey(s string) string {
return php2go.Md5(strings.ToLower(s))
}
/**
* 获取联营活动价
*/
func lyActivityPrice() {
}
/*构造SPU和SKU的ID
*生成19位纯数组id
*/
func CreateId(types string) string {
var id, db string
if types == "sku" {
id = "1"
db = strconv.Itoa(php2go.Rand(0, 9)) + strconv.Itoa(php2go.Rand(0, 9))
} else {
id = "2"
db = "0" + strconv.Itoa(php2go.Rand(0, 9))
}
s := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000)
return id + strconv.FormatInt(int64(s), 10) + strconv.FormatInt(php2go.Time(), 10) + db
}
/*
* 反爬虫用html标签替换数字,不包括“.”
* number 数字串
*/
func NumberToHtml(number int) (html string) {
numberToClassSlice := vars.NumberToClass
if number != 0 {
//数字转字符串
numberStr := ToString(number)
for i := 0; i < len(numberStr); i++ {
var classHtml string
numStr := php2go.Substr(numberStr, uint(i), 1)
if php2go.IsNumeric(numStr) {
num, _ := strconv.Atoi(numStr)
index := php2go.Rand(0, 3)
class := numberToClassSlice[num][index]
otherClass := StrRandom(3)
classHtml = `<font class="` + class + otherClass + `"></font>`
}
html = html + classHtml
return
}
}
return
}
/**
* 生成纯小写字母的字符串
* 返回形式如下 : yuiopkdsi rnvewjeil xmiqplmza
*/
func StrRandom(lenNum int) string {
randStr := "sdwpkxmiqplmzacbmeruwulurjlauejrifkfghjklzxcvbnmqwwertyuiopkdsieurnvewjeilweiskvnx"
strLen := len(randStr) - 9
var result string
for i := 0; i < lenNum; i++ {
start := php2go.Rand(0, strLen)
str := php2go.Substr(randStr, uint(start), 9)
result = result + " " + str
}
return result
}
//生成范围区间内的随机数
func Rand(min, max int) int {
n, _ := crand.Int(crand.Reader, big.NewInt(int64(max+1)))
return int(n.Int64()) + min
}
func CopyMapString(distmap map[string]string) map[string]string {
tmpmap := make(map[string]string, 0)
for k, v := range distmap {
tmpmap[k] = v
}
return tmpmap
}
//反爬虫加密验证
func CheckSignApi() (resNo int) {
params := make(map[string]string)
ctx := middleware.Context
if ctx == nil {
return
}
referer := ctx.Request.Referer()
request := make(map[string]string)
ctx.MultipartForm()
for name, value := range ctx.Request.Form {
if value[0] != "" {
request[name] = strings.TrimSpace(value[0])
}
}
if request["hcy_test"] == "1122" {
return 0
}
if request["no_rule"] == "1122" {
return 0
}
if request["check_button"] == "2" || strings.Contains(ctx.Request.Referer(), "liexin.com") {
return 0
}
//如果是内部验证通过,则内部通过
if auth() {
return 0
}
//验证必填参数
if referer == "" {
return 4
}
if ctx.Query("asdfghjkl") != "" {
params = request
}
if ctx.PostForm("asdfghjkl") != "" {
params = request
}
params["Yo4teW_gid"], _ = ctx.Cookie("Yo4teW_gid")
if params["asdfghjkl"] == "" || params["Yo4teW_gid"] == "" || params["qwertyuiop"] == "" {
return 1
}
var temp1 []string
//根据参数,按照规则进行签名生成
for k, v := range params {
if k == "asdfghjkl" || k == "_" || k == "callback" {
continue
}
if v == "" || v == "undefined" || v == "null" || v == "NULL" {
continue
}
if len(v) <= 0 {
continue
}
temp1 = append(temp1, k+"="+v)
}
SortSlice(temp1)
temp2 := strings.Join(temp1, "")
r := regexp.MustCompile(`[^0-9a-zA-Z]`)
temp2 = r.ReplaceAllString(temp2, "")
temp2 = strings.ToUpper(temp2)
r = regexp.MustCompile(`[ABC]`)
temp2 = r.ReplaceAllString(temp2, "")
temp3 := php2go.Sha1(temp2)
//'YO4TEW_GID%3DEFDDE3E06D15F887866E9D96DOM_RNK%3D1GOODS_NME%2FONDITION%3DLM358P%3D1PF%3D1TIME_LIEXIN%3D1545009990450';
//验证签名
if temp3 == params["asdfghjkl"] {
return 0
}
return 3
}
//内部免验证通过
func auth() bool {
ctx := middleware.Context
if ctx == nil {
return false
}
request := make(map[string]string)
ctx.MultipartForm()
for name, value := range ctx.Request.Form {
if value[0] != "" {
request[name] = strings.TrimSpace(value[0])
}
}
k1 := request["k1"]
k1Num, _ := strconv.Atoi(k1)
k2 := request["k2"]
key := config.Get("AUTH.SUPER_AUTH_KEY").String()
if k1 != "" && int64(k1Num) < (time.Now().Unix()-600) {
return false
}
//md5(md5($pwd).$salt);
pwd := Md5(Md5(k1) + key)
if k2 == pwd {
return true
}
return false
}
func CreateAnyTypeSlice(slice interface{}) ([]interface{}, bool) {
val, ok := isSlice(slice)
if !ok {
return nil, false
}
sliceLen := val.Len()
out := make([]interface{}, sliceLen)
for i := 0; i < sliceLen; i++ {
out[i] = val.Index(i).Interface()
}
return out, true
}
// 判断是否为slcie数据
func isSlice(arg interface{}) (val reflect.Value, ok bool) {
val = reflect.ValueOf(arg)
if val.Kind() == reflect.Slice {
ok = true
}
return
}
//向左补充字符串
func StrPadLeft(input string, padLength int, padString string) string {
output := padString
for padLength > len(output) {
output += output
}
if len(input) >= padLength {
return input
}
return output[:padLength-len(input)] + input
}
//移除字符串切片中某個元素
func RemoveSliceString(s []string, i string) []string {
b := make([]string,0)
for _,v:=range s{
if v != i{
b= append(b,v)
}
}
return b
}
//map排序
func MapSort(mapList map[int]int) []int{
var(
keys []int
newList []int
)
newList = make([]int,0)
for _,v:=range mapList{
keys = append(keys,v)
}
sort.Ints(keys)
for _,k:=range keys{
newList = append(newList,mapList[k])
}
return newList
}
////////////类型转换/////////////////////
func MyInt(str string) int {
res,_ := strconv.ParseInt(str,10,64)
return int(res)
}
func MyInt8(str string) int8 {
res,_ := strconv.ParseInt(str,10,64)
return int8(res)
}
func MyInt16(str string) int16 {
res,_ := strconv.ParseInt(str,10,64)
return int16(res)
}
func MyInt64(str string) int64 {
res,_ := strconv.ParseInt(str,10,64)
return int64(res)
}
func MyFloat32(str string) float32 {
res,_ := strconv.ParseFloat(str,64)
return float32(res)
}
func MyFloat64(str string) float64 {
res,_ := strconv.ParseFloat(str,64)
return float64(res)
}
func MyFloat64ToStr(numb float64) string {
return strconv.FormatFloat(numb,'f',6,64)
}
func MyInt64ToStr(numb int64) string {
return strconv.FormatInt(numb,10)
}
////////////类型转换/////////////////////
\ No newline at end of file
package common
import (
"github.com/gomodule/redigo/redis"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
"goods_machining/pkg/config"
"goods_machining/pkg/gredis"
"strings"
)
//获取上次查询时间等信息
func GetLastSearchTime(goodsId string) (timeStamp int) {
redisCon := gredis.Conn("search_r")
defer redisCon.Close()
key := config.Get("redis_all.SEARCH_SHOW_SKU_TIME").String()
timeStamp, err := redis.Int(redisCon.Do("HGET", key, goodsId))
if err != nil {
timeStamp = 0
}
return
}
//获取关税信息
func GetCustomsTax(goodsName, brandName string) (tax string) {
if goodsName == "" || brandName == "" {
return
}
redisCon := gredis.Conn("search_r")
defer redisCon.Close()
member := php2go.Md5(strings.ToUpper(goodsName + brandName))
key := config.Get("redis_all.TAX_CUSTOMS_INFO")
res, _ := redis.String(redisCon.Do("HGET", key, member))
taxRateRow := gjson.Get(res, "tax_rate_low").Float()
if res == "" || taxRateRow <= 0 {
return
}
return ToString(taxRateRow) + "%"
}
package common
import (
"encoding/json"
"github.com/gomodule/redigo/redis"
"github.com/ichunt2019/logger"
log "github.com/sirupsen/logrus"
"os"
"goods_machining/middleware"
"goods_machining/pkg/config"
"goods_machining/pkg/gredis"
"goods_machining/pkg/message"
"strconv"
"strings"
"time"
)
type SearchApiLog struct {
Msg string `json:"msg"`
MsgCode string `json:"msgCode"`
Ts int64 `json:"ts"`
DateStr string `json:"dateStr"`
App string `json:"app"`
ServerIp string `json:"serverIp"`
FileName string `json:"fileName"`
LineNo string `json:"lineNo"`
Method string `json:"method"`
}
func AnalyzeSearchError(code int, ip, errMsg, file, line, method string) (log SearchApiLog) {
//获取所有参数
request := make(map[string]string)
ctx := middleware.Context
ctx.MultipartForm()
for name, value := range ctx.Request.Form {
if value[0] != "" {
request[name] = strings.TrimSpace(value[0])
}
}
requestByte, _ := json.Marshal(request)
log.Msg = errMsg + string(requestByte)
codeStr := strconv.Itoa(code)
log.MsgCode = StrPadLeft(codeStr, 6, "0")
log.Ts = time.Now().Unix()
log.DateStr = time.Now().Format("2006-01-02 15:04:05")
log.App = "search_api"
log.ServerIp = ip
log.FileName = file
log.LineNo = line
log.Method = method
//还要判断是否要推送消息
unitSupplierLogCode := config.Cfg.Section("UNIT_SUPPLIER_LOG_CODE").KeysHash()
if unitSupplierLogCode[codeStr] == "" {
if !strings.Contains(strings.ToUpper(errMsg), "SOAP-ERROR") {
//推送到钉钉
result, err := message.DingDingPush(errMsg)
if err != nil || result.Errcode != 0 {
logger.Error("%s", err, result)
}
}
} else {
redisCon := gredis.Conn("search_w")
defer redisCon.Close()
key := config.Get("SEARCH_API_LOG.SEARCH_API_ERROR_PRE").String() + unitSupplierLogCode[codeStr]
_, err := redis.Bool(redisCon.Do("INCR", key))
if err != nil {
logger.Error("%s", err)
}
}
return
}
type LogFormatter struct{}
//格式详情
func (s *LogFormatter) Format(entry *log.Entry) ([]byte, error) {
msg := entry.Message + "\n"
return []byte(msg), nil
}
//写入到特定的文件夹给ELK使用的日志
func WriteSearchErrorLog(searchLog string) {
// 设置日志格式为json格式
log.SetFormatter(new(LogFormatter))
path := "../logs/search/"
//设置output,默认为stderr,可以为任何io.Writer,比如文件*os.File
//生成当天的日志
filePath := path + time.Now().Format("20060102") + ".log"
file, _ := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
log.SetOutput(file)
log.Error(searchLog)
}
package common
import "math"
//分页方法,根据传递过来的页数,每页数,总数,返回分页的内容 7个页数 前 1,2,3,4,5 后 的格式返回,小于5页返回具体页数
func Paginator(page, prepage int, nums int64) map[string]interface{} {
var firstpage int //前一页地址
var lastpage int //后一页地址
//根据nums总数,和prepage每页数量 生成分页总数
totalpages := int(math.Ceil(float64(nums) / float64(prepage))) //page总数
if page > totalpages {
page = totalpages
}
if page <= 0 {
page = 1
}
var pages []int
switch {
case page >= totalpages-5 && totalpages > 5: //最后5页
start := totalpages - 5 + 1
firstpage = page - 1
lastpage = int(math.Min(float64(totalpages), float64(page+1)))
pages = make([]int, 5)
for i, _ := range pages {
pages[i] = start + i
}
case page >= 3 && totalpages > 5:
start := page - 3 + 1
pages = make([]int, 5)
firstpage = page - 3
for i, _ := range pages {
pages[i] = start + i
}
firstpage = page - 1
lastpage = page + 1
default:
pages = make([]int, int(math.Min(5, float64(totalpages))))
for i, _ := range pages {
pages[i] = i + 1
}
firstpage = int(math.Max(float64(1), float64(page-1)))
lastpage = page + 1
//fmt.Println(pages)
}
paginatorMap := make(map[string]interface{})
paginatorMap["pages"] = pages
paginatorMap["totalpages"] = totalpages
paginatorMap["firstpage"] = firstpage
paginatorMap["lastpage"] = lastpage
paginatorMap["currpage"] = page
return paginatorMap
}
\ No newline at end of file
package common
import (
"github.com/gin-gonic/gin"
"strings"
)
type RecommendRequest struct {
GoodsName string `form:"goods_name"`
Attrs string `form:"attrs"`
Encap string `form:"encap"`
Num int `form:"num"`
DeliveryType int `form:"delivery_type"`
Flag int `form:"flag"`
BrandName string `form:"brand_name"`
}
//获取所有请求参数放到字典里面
func GetAllRequestParams(c *gin.Context) (request map[string]string){
request = make(map[string]string)
c.MultipartForm()
for name, value := range c.Request.Form {
if value[0] != "" {
request[name] = strings.TrimSpace(value[0])
}
}
return
}
package common
import (
"encoding/json"
"runtime"
"goods_machining/middleware"
"strconv"
"strings"
)
type Response struct {
ErrCode int `json:"error_code"`
ErrMsg string `json:"err_msg"`
Data interface{} `json:"data"`
}
type BomResponse struct {
ErrCode int `json:"error_code"`
ErrMsg string `json:"error_msg"`
Flag int `json:"flag"`
Total int `json:"total"`
Data interface{} `json:"data"`
}
func SuccessResponse(errCode int, errMsg string, data interface{}) Response {
return Response{
ErrCode: errCode,
ErrMsg: errMsg,
Data: data,
}
}
func ErrorResponse(errCode int, errMsg string) Response {
return Response{
ErrCode: errCode,
ErrMsg: errMsg,
Data: []string{},
}
}
//统一输出,里面还要去处理jsonp
func Output(errCode int, errMsg string, data interface{}) {
if data == nil {
data = []string{}
}
response := Response{
ErrCode: errCode,
ErrMsg: errMsg,
Data: data,
}
if errCode >= 100 {
SearchApiLogger(errCode, errMsg)
}
ctx := middleware.Context
if ctx.DefaultQuery("callback", "") != "" {
ctx.JSONP(200, response)
} else {
referer := ctx.Request.Referer()
referer = strings.TrimRight(referer, "/")
ctx.Header("Access-Control-Allow-Origin", referer)
ctx.Header("Access-Control-Allow-Credentials", "true")
//允许跨站访问的站点域名
//跨域请求头设置
ctx.JSON(200, response)
}
}
//简单的返回数据方法
func ReturnData(errCode int, errMsg string, data interface{}) {
if data == nil {
data = []string{}
if errCode == 0 {
errCode = 1
}
}
response := Response{
ErrCode: errCode,
ErrMsg: errMsg,
Data: data,
}
ctx := middleware.Context
ctx.JSON(200, response)
}
//错误的搜索日志记录
func SearchApiLogger(code int, msg string) {
pc, file, line, _ := runtime.Caller(2)
f := runtime.FuncForPC(pc)
ctx := middleware.Context
errMsg := "提示信息:" + msg + ",请求url:" + ctx.Request.URL.String()
lineNo := strconv.Itoa(line)
searchLog := AnalyzeSearchError(code, ctx.ClientIP(), errMsg, file, lineNo, f.Name())
searchLogByte, _ := json.Marshal(searchLog)
WriteSearchErrorLog(string(searchLogByte))
}
package common
import (
"reflect"
"sort"
)
func getCommon(array interface{}) (reflect.Type, reflect.Value, int) {
t := reflect.TypeOf(array)
v := reflect.ValueOf(array)
l := v.Len()
return t, v, l
}
func SortSlice(array interface{}) {
t, v, _ := getCommon(array)
// res := make([]interface{}, l)
if t.Kind() == reflect.Slice {
switch v.Index(0).Kind() {
case reflect.Int:
array := array.([]int)
sort.Ints(array)
case reflect.String:
array := array.([]string)
sort.Strings(array)
case reflect.Float64:
array := array.([]float64)
sort.Float64s(array)
default:
panic("the param can only be int/string/float64 array")
}
} else {
panic("expects parameter 1 to be array")
}
}
package common
//与supplier相关的变量
var SearchSupplier = map[int]string{
1: "uture",
//2:"powerandsignal",
3: "rochester",
4: "tme",
5: "verical",
6: "element14",
7: "digikey",
8: "chip1stop",
9: "aipco",
10: "arrow",
//11:"bisco",
12: "alliedelec",
13: "avnet",
14: "mouser",
//15:"company",
//16:"liexin_lianying1"
17: "zhuanmai",
//18:"liexin_ti",
19: "peigenesis",
20: "powell",
21: "rs",
//22:"liexin_sell",
//100:"ziying",
//101:"liexin_jingdiao",
1676: "buerklin",
}
package config
import (
"github.com/go-ini/ini"
"strings"
)
var (
Cfg *ini.File
)
func SetUp(path string) (err error) {
//引入多个文件
Cfg, err = ini.LooseLoad(path+"/config.ini", path+"/search.ini", path+"/redis_key.ini", path+"/rabmq_key.ini", path+"/database.ini",
path+"/redis_config.ini", path+"/message.ini")
return
}
func Get(key string) *ini.Key {
if strings.Contains(key, ".") {
keys := strings.Split(key, ".")
return Cfg.Section(keys[0]).Key(keys[1])
}
return Cfg.Section("").Key(key)
}
func GetSectionValues(key string) (result []string) {
values := Cfg.Section(key).Keys()
for _, value := range values {
result = append(result, value.String())
}
return result
}
package config
type MongoDbDatabase struct {
Host string
UserName string
Password string
Database string
MaxPoolSize string
}
func BuildMongoDbConfgs () map[string]MongoDbDatabase{
return map[string]MongoDbDatabase{
"default" : {
Host:Get("mongo.host").String(),
UserName:Get("mongo.username").String(),
Password:Get("mongo.password").String(),
Database:Get("mongo.database").String(),
MaxPoolSize:Get("mongo.maxPoolSize").String(),
},
}
}
package config
type BaseDatabase struct {
UserName string
Password string
Host string
Database string
MaxIdleCons int
MaxOpenCons int
Prefix string
}
//多数据库配置
func BuildDatabaseList() (DatabaseList map[string]BaseDatabase) {
return map[string]BaseDatabase{
"spu": {
UserName: Get("spu.user_name").String(),
Password: Get("spu.password").String(),
Host: Get("spu.host").String(),
Database: Get("spu.database").String(),
Prefix: Get("spu.table_prefix").String(),
},
"supp": {
UserName: Get("supp.user_name").String(),
Password: Get("supp.password").String(),
Host: Get("supp.host").String(),
Database: Get("supp.database").String(),
Prefix: Get("supp.table_prefix").String(),
},
"cms": {
UserName: Get("cms.user_name").String(),
Password: Get("cms.password").String(),
Host: Get("cms.host").String(),
Database: Get("cms.database").String(),
Prefix: Get("cms.table_prefix").String(),
},
"liexin_data": {
UserName: Get("liexin_data.user_name").String(),
Password: Get("liexin_data.password").String(),
Host: Get("liexin_data.host").String(),
Database: Get("liexin_data.database").String(),
Prefix: Get("liexin_data.table_prefix").String(),
},
}
}
package config
type RedisDatabase struct {
Password string
Host string
Database string
MaxIdle string
MaxActive string
MaxAIdleTimeoutctive string
Prefix string
}
//多数据库配置
func BuildRedisConfgs() (RedisDatabaseMap map[string]RedisDatabase) {
return map[string]RedisDatabase{
"search_r": {
Host: Get("default_redis_read.host").String(),
Password: Get("default_redis_read.password").String(),
MaxIdle: Get("default_redis_read.max_idle").String(),
MaxActive: Get("default_redis_read.max_active").String(),
},
"search_w": {
Host: Get("default_redis_write.host").String(),
Password: Get("default_redis_write.password").String(),
MaxIdle: Get("default_redis_read.max_idle").String(),
MaxActive: Get("default_redis_read.max_active").String(),
},
"api_redis": {
Host: Get("api_redis.host").String(),
Password: Get("api_redis.password").String(),
MaxIdle: Get("api_redis.max_idle").String(),
MaxActive: Get("api_redis.max_active").String(),
},
}
}
package e
type FatalError struct {
ErrMsg string
}
func (err *FatalError) Error() string {
return err.ErrMsg
}
func NewFatalError( msg string) *FatalError {
return &FatalError{ ErrMsg: msg}
}
func IsFatalError(err error) bool {
if _,ok:=err.(*FatalError);ok{
return true
}
return false
}
\ No newline at end of file
package es
import (
"github.com/imroc/req"
"math/rand"
"net/http"
"goods_machining/pkg/config"
)
type Response struct {
Took int `json:"took"`
TimeOut bool `json:"time_out"`
Shard map[string]int `json:"_shard"`
HitsResult HitsResult `json:"hits"`
}
type HitsResult struct {
Total int `json:"total"`
MaxScore float64 `json:"max_score"`
Hits string `json:"hits"`
}
func CurlES(index string, param string) (result string, err error) {
endpoints := config.Get("es.urls").Strings(",")
//随机获取一个节点进行请求
esUrl := endpoints[rand.Intn(len(endpoints))]
params := req.BodyJSON(param)
resp, err := req.Get(esUrl+"/"+index+"/_search", params)
if err != nil {
return
}
result = resp.String()
return
}
/*
主分片查询
*/
func CurlEsPrimary(index string, param string) (result string, err error) {
endpoints := config.Get("es.urls").Strings(",")
//随机获取一个节点进行请求
esUrl := endpoints[rand.Intn(len(endpoints))]
params := req.BodyJSON(param)
resp, err := req.Get(esUrl+"/"+index+"/_search?preference=_primary_first", params)
if err != nil {
return
}
result = resp.String()
return
}
/*
批量插入 或者 更新 es
POST /_bulk
{ "index":{"_index":"hcy1","_type":"goods","_id":"333333"} }
{ "name":"john doe","age":25 }
{ "index":{"_index":"hcy1","_type":"goods","_id":"6666"} }
{ "name":"mary smith","age":32 }
eg:
方法一:
param := `{"index":{"_index":"hcy1","_type":"goods","_id":"s1"} }`+"\n"+`{"name":"john doe","age":25 }`+"\n"+`{"index":{"_index":"hcy1","_type":"goods","_id":"s2"} }`+"\n"+`{"name":"john doe","age":25 }`+"\n"
result,err := es.BulkES(param)
println(result,err)
方法二:
lines := []string{
`{"index":{"_index":"hcy1","_type":"goods","_id":"s1"} }`,
`{"name":"john doe","age":25 }`,
`{"index":{"_index":"hcy1","_type":"goods","_id":"s2"} }`,
`{"name":"mary smith","age":32 }`,
}
param := strings.Join(lines, "\n")+"\n"
*/
func BulkES(param string) (result string, err error) {
endpoints := config.Get("es.urls").Strings(",")
esUrl := endpoints[rand.Intn(len(endpoints))] //随机获取一个节点进行请求
//params := req.BodyJSON(param)
//req.Debug = true
header := make(http.Header)
header.Set("Content-Type", "application/x-ndjson")
resp, err := req.Post(esUrl+"/_bulk?refresh=true", header, param) //refresh=true 立刻插入或修改 立刻生效,不需要等待es缓存写入文档
if err != nil {
return
}
result = resp.String()
return
}
//多条件多索引查询,需要查询的索引和条件自己拼接成queryJson里面
func CurlESMSearch(queryJson string) (result string, err error) {
endpoints := config.Get("es.urls").Strings(",")
//随机获取一个节点进行请求
req.Debug = false
esUrl := endpoints[rand.Intn(len(endpoints))]
params := req.BodyJSON(queryJson)
resp, err := req.Post(esUrl+"/_msearch", params)
if err != nil {
return
}
result = resp.String()
return
}
//滚动搜索和索引之间的文档重索引
func ScrollES(param string) (result string, err error) {
endpoints := config.Get("es.urls").Strings(",")
//随机获取一个节点进行请求
req.Debug = false
esUrl := endpoints[rand.Intn(len(endpoints))]
params := req.BodyJSON(param)
resp, err := req.Post(esUrl+"/_search/scroll", params)
if err != nil {
return
}
result = resp.String()
return
}
package gredis
import (
"fmt"
"github.com/gomodule/redigo/redis"
"goods_machining/pkg/config"
"time"
)
type ichuntRedis struct {
RedisList map[string]*redis.Pool
}
var ichuntRedis_ = &ichuntRedis{}
func Conn(connection string) (redis.Conn){
return ichuntRedis_.RedisList[connection].Get()
}
var writeConn, readConn *redis.Pool
func Setup() (err error) {
ichuntRedis_.RedisList = make(map[string]*redis.Pool,0)
RedisDatabaseMap := config.BuildRedisConfgs()
for redisKey,redisConfig := range RedisDatabaseMap{
ichuntRedis_.RedisList[redisKey],err = getConn(redisConfig.Host, redisConfig.Password)
if err != nil{
panic(err)
}
}
return nil
}
//格式化成字符串
func String( a interface{},err error) (string,error) {
return redis.String(a,err)
}
func getConn(writeHost, password string) (pool *redis.Pool, err error) {
maxIdle, _ := config.Get("redis.max_idle").Int()
maxActive, _ := config.Get("redis.max_active").Int()
pool = &redis.Pool{
MaxIdle: maxIdle,
MaxActive: maxActive,
Dial: func() (redis.Conn, error) {
c, err := redis.Dial("tcp", writeHost)
if err != nil {
return nil, err
}
if password != "" {
if _, err := c.Do("AUTH", password); err != nil {
c.Close()
return nil, err
}
}
return c, err
},
TestOnBorrow: func(c redis.Conn, t time.Time) error {
_, err := c.Do("PING")
return err
},
}
return
}
/*
批量或者单个查询redis数据,统一返回map[string]string
@param hkey string 集合键值,如sku
@param targetIds string 查询的id 切片
eg:
redisConn := gredis.Conn("search_r")
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",[]string{"1001","10005"})
*/
func HgetPi(redisConn *redis.Conn,hkey string,targetIds []string) map[string]string {
skuArr := make(map[string]string,0)
if len(targetIds) == 1 {
oneId := targetIds[0]
info,_ := String((*redisConn).Do("HGET",hkey,oneId))
if info == "" {
skuArr[oneId] = ""
}else{
skuArr[oneId] = info
}
fmt.Print("单个获取")
return skuArr
}
for _,v := range targetIds{
(*redisConn).Send("HGet",hkey,v)
}
(*redisConn).Flush()
for _,goods_id := range targetIds{
info,_ := (*redisConn).Receive()
if info == nil{
skuArr[goods_id] = ""
continue;
}
oneInfo := string(info.([]byte))
skuArr[goods_id] = oneInfo
}
return skuArr
}
package logger
import (
"github.com/ichunt2019/logger"
)
func SetUp() (err error) {
logConfig := make(map[string]string)
logConfig["log_path"] = "logs"
logConfig["log_chan_size"] = "5"
err = logger.InitLogger("file", logConfig)
if err != nil {
return err
}
logger.Init()
return
}
package logger
import (
"io"
"os"
"time"
"strings"
)
func check(e error) {
if e != nil {
panic(e)
}
}
/**
* 判断文件是否存在 存在返回 true 不存在返回false
*/
func checkFileIsExist(filename string) bool {
var exist = true
if _, err := os.Stat(filename); os.IsNotExist(err) {
exist = false
}
return exist
}
/*
@param writeString 写入文件字符串
@param file_pre 附加文件前缀
eg: logic.Loginfo("逾期统计开始","_yuqilv_");
*/
func Log(writeString string,log_file_pre string) {
log_file_pre = "_"+log_file_pre
date := time.Now().Format("2006-01-02")
date2 := time.Now().Format("2006-01-02 15:04:05")
var filename = "./logs/"+date+log_file_pre+".txt"
var f *os.File
var err1 error
if checkFileIsExist(filename) { //如果文件存在
f, err1 = os.OpenFile(filename, os.O_APPEND, 0666) //打开文件
} else {
f, err1 = os.Create(filename) //创建文件
}
check(err1)
ss := StrReplace("\r\n","",writeString,1) //替换多余换行
io.WriteString(f,"\r\n"+date2+"----"+ss) //写入文件(字符串)
//fmt.Print(err)
}
// StrReplace str_replace()
func StrReplace(search, replace, subject string, count int) string {
return strings.Replace(subject, search, replace, count)
}
package message
import (
"encoding/json"
"github.com/imroc/req"
"github.com/tidwall/gjson"
"goods_machining/pkg/config"
"strings"
)
//发送钉钉消息的包
type DingDingRequest struct {
MsgType string `json:"msgtype"`
Text map[string]string `json:"text"`
IsAtAll bool `json:"isAtAll"`
}
type DingDingResponse struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
}
func DingDingPush(content string) (result DingDingResponse, err error) {
accessToken := config.Get("DINGDING.SEARCH_API_MONITOR").String()
webhook := "https://oapi.dingtalk.com/robot/send?access_token=" + accessToken
data := make(map[string]interface{})
data["msgtype"] = "text"
data["text"] = map[string]string{
"content": content,
}
req.Debug = false
dataStrByte, _ := json.Marshal(data)
dataStr := string(dataStrByte)
dataStr = strings.Replace(dataStr, "\\", "\\\\", -1)
params := req.BodyJSON(dataStr)
resp, err := req.Post(webhook, params, req.Header{
"Content-Type": "application/json",
"charset": "UTF-8",
})
if resp == nil {
return
}
result.Errcode = int(gjson.Get(resp.String(), "errcode").Int())
result.Errmsg = gjson.Get(resp.String(), "errmsg").String()
return
}
package message
import (
"encoding/json"
"fmt"
"github.com/syyongx/php2go"
"net/http"
"net/url"
"goods_machining/pkg/config"
"strconv"
"time"
)
//普通发短信
func SendMessage(mobile int64, keyWord string, content map[string]interface{}) {
//es连接告警的keyword是 es_connect_monitor
if mobile != 0 {
timeNow := time.Now().Unix()
requestContent, _ := json.Marshal(content)
requestTel, _ := json.Marshal([]int64{mobile})
apiDomain := config.Get("message.api_domain").String()
apiMd5Str := config.Get("message.api_md5_str").String()
resp, err := http.PostForm(apiDomain, url.Values{
"data": {string(requestContent)},
"touser": {string(requestTel)},
"keyword": {keyWord},
"k1": {strconv.FormatInt(timeNow, 10)},
"k2": {php2go.Md5(php2go.Md5(strconv.FormatInt(timeNow, 10)) + apiMd5Str)},
"is_ignore": {},
})
if err != nil {
fmt.Print(err)
}
defer resp.Body.Close()
}
}
package mongo
import (
"fmt"
"gopkg.in/mgo.v2"
"goods_machining/pkg/config"
"strconv"
)
var session *mgo.Session
type ichuntMongo struct {
MongoList map[string]*mgo.Session
}
var ichuntMongo_ = &ichuntMongo{}
func getconn(mongoConfig config.MongoDbDatabase) (*mgo.Session ,error){
url := mongoConfig.Host
maxPoolSize := mongoConfig.MaxPoolSize
maxPoolSizeInt,err := strconv.Atoi(maxPoolSize)
if err != nil{
maxPoolSizeInt = 100
}
url += "?maxPoolSize="+maxPoolSize
session, err = mgo.Dial(url)
if err != nil {
return nil ,err
}
fmt.Println("url",url)
fmt.Println("maxPoolSizeInt",maxPoolSizeInt)
session.SetPoolLimit(maxPoolSizeInt)
session.SetMode(mgo.Monotonic, true)
myDB :=session.DB(mongoConfig.Database)
err = myDB.Login(mongoConfig.UserName,mongoConfig.Password)
if err != nil {
return nil ,err
}
return session,nil
}
func SetUp() (err error) {
err = nil
ichuntMongo_.MongoList = make(map[string]*mgo.Session,0)
mongodbList := config.BuildMongoDbConfgs()
if len(mongodbList) > 0{
for mongoName,mongoConfig := range mongodbList{
ichuntMongo_.MongoList[mongoName],err = getconn(mongoConfig)
if err != nil{
break
}
}
}
return err
}
func Conn(connection string) (*mgo.Session){
return ichuntMongo_.MongoList[connection].Copy()
}
package mq
import (
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"goods_machining/pkg/config"
)
func PushMsg(listName string, data string) {
queueExchange := rabbitmq.QueueExchange{
listName,
listName,
"",
"direct",
config.Get("rabmq.url").String(),
}
rabbitmq.Send(queueExchange, data)
}
package mysql
import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/go-xorm/xorm"
"goods_machining/pkg/config"
"goods_machining/pkg/e"
)
var DatabaseConMap map[string]*xorm.Engine
func Setup() error {
DatabaseConMap = make(map[string]*xorm.Engine, 0)
DatabaseList := config.BuildDatabaseList()
var err error
//循环生成数据库链接
for conName, db := range DatabaseList {
userName := db.UserName
password := db.Password
host := db.Host
database := db.Database
dataSourceName := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8", userName, password, host, database)
DatabaseConMap[conName], err = xorm.NewEngine("mysql", dataSourceName)
if err != nil {
return e.NewFatalError(err.Error()) //这里返回致命异常
}
//日志打印SQL
DatabaseConMap[conName].ShowSQL(true)
//设置连接池的空闲数大小
DatabaseConMap[conName].SetMaxIdleConns(db.MaxIdleCons)
//设置最大打开连接数
DatabaseConMap[conName].SetMaxOpenConns(db.MaxOpenCons)
}
return nil
}
func Conn(conName string) *xorm.Engine {
return DatabaseConMap[conName]
}
package vars
const (
Table_CourseMain="course_main"
Table_CourseCounts="course_counts"
)
package vars
//数字转class字符串,按顺序0-9
var NumberToClass = [][]string{
{"sfgdqwer", "asfgdtyhg", "asfgdpolk", "asfgdpoqw"},
{"sfgdrfdf","asfgderfd","asfgdwdsa","asfgdpoer"},
{"asfgdasde","asfgdqwsz","asfgdrtgd","asfgdpovv"},
{"asfgdwsxc","asfgdwsxz","asfgdrfvb","asfgdpoee"},
{"asfgdqazs","asfgdqasd","asfgdqwag","asfgdpogh"},
{"asfgdrtyh","asfgdyutr","asfgdeews","asfgdpotg"},
{"asfgdpluj","asfgdikjf","asfgdesgj","asfgdpfff"},
{"asfgdtrdb","asfgdiksf","asfgdsgkp","asfgdprty"},
{"asfgdpehl","asfgdstgb","asfgderll","asfgdpokf"},
{"asfgdpehg","asfgdstgf","asfgderlf","asfgdpogk"},
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: bom.proto
package bom
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type AutoSpuRequest struct {
// @inject_tag: uri:"goods_name"
GoodsName string `protobuf:"bytes,1,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty" uri:"goods_name"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AutoSpuRequest) Reset() { *m = AutoSpuRequest{} }
func (m *AutoSpuRequest) String() string { return proto.CompactTextString(m) }
func (*AutoSpuRequest) ProtoMessage() {}
func (*AutoSpuRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{0}
}
func (m *AutoSpuRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AutoSpuRequest.Unmarshal(m, b)
}
func (m *AutoSpuRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AutoSpuRequest.Marshal(b, m, deterministic)
}
func (m *AutoSpuRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_AutoSpuRequest.Merge(m, src)
}
func (m *AutoSpuRequest) XXX_Size() int {
return xxx_messageInfo_AutoSpuRequest.Size(m)
}
func (m *AutoSpuRequest) XXX_DiscardUnknown() {
xxx_messageInfo_AutoSpuRequest.DiscardUnknown(m)
}
var xxx_messageInfo_AutoSpuRequest proto.InternalMessageInfo
func (m *AutoSpuRequest) GetGoodsName() string {
if m != nil {
return m.GoodsName
}
return ""
}
type AutoSpuResponse struct {
// @inject_tag: json:"error_code"
ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code"`
// @inject_tag: json:"error_message"
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message"`
// @inject_tag: json:"data"
Data []string `protobuf:"bytes,3,rep,name=data,proto3" json:"data"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AutoSpuResponse) Reset() { *m = AutoSpuResponse{} }
func (m *AutoSpuResponse) String() string { return proto.CompactTextString(m) }
func (*AutoSpuResponse) ProtoMessage() {}
func (*AutoSpuResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{1}
}
func (m *AutoSpuResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AutoSpuResponse.Unmarshal(m, b)
}
func (m *AutoSpuResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AutoSpuResponse.Marshal(b, m, deterministic)
}
func (m *AutoSpuResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_AutoSpuResponse.Merge(m, src)
}
func (m *AutoSpuResponse) XXX_Size() int {
return xxx_messageInfo_AutoSpuResponse.Size(m)
}
func (m *AutoSpuResponse) XXX_DiscardUnknown() {
xxx_messageInfo_AutoSpuResponse.DiscardUnknown(m)
}
var xxx_messageInfo_AutoSpuResponse proto.InternalMessageInfo
func (m *AutoSpuResponse) GetErrorCode() int32 {
if m != nil {
return m.ErrorCode
}
return 0
}
func (m *AutoSpuResponse) GetErrorMessage() string {
if m != nil {
return m.ErrorMessage
}
return ""
}
func (m *AutoSpuResponse) GetData() []string {
if m != nil {
return m.Data
}
return nil
}
type RecommendRequest struct {
// @inject_tag: form:"goods_name"
GoodsName string `protobuf:"bytes,1,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty" form:"goods_name"`
// @inject_tag: form:"attrs"
Attrs string `protobuf:"bytes,2,opt,name=attrs,proto3" json:"attrs,omitempty" form:"attrs"`
// @inject_tag: form:"encap"
Encap string `protobuf:"bytes,3,opt,name=encap,proto3" json:"encap,omitempty" form:"encap"`
// @inject_tag: form:"num"
Num int32 `protobuf:"varint,4,opt,name=num,proto3" json:"num,omitempty" form:"num"`
// @inject_tag: form:"delivery_type"
DeliveryType int32 `protobuf:"varint,5,opt,name=delivery_type,json=deliveryType,proto3" json:"delivery_type,omitempty" form:"delivery_type"`
// @inject_tag: form:"flag"
Flag int32 `protobuf:"varint,6,opt,name=flag,proto3" json:"flag,omitempty" form:"flag"`
// @inject_tag: form:"brand_name"
BrandName string `protobuf:"bytes,7,opt,name=brand_name,json=brandName,proto3" json:"brand_name,omitempty" form:"brand_name"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RecommendRequest) Reset() { *m = RecommendRequest{} }
func (m *RecommendRequest) String() string { return proto.CompactTextString(m) }
func (*RecommendRequest) ProtoMessage() {}
func (*RecommendRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{2}
}
func (m *RecommendRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RecommendRequest.Unmarshal(m, b)
}
func (m *RecommendRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RecommendRequest.Marshal(b, m, deterministic)
}
func (m *RecommendRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_RecommendRequest.Merge(m, src)
}
func (m *RecommendRequest) XXX_Size() int {
return xxx_messageInfo_RecommendRequest.Size(m)
}
func (m *RecommendRequest) XXX_DiscardUnknown() {
xxx_messageInfo_RecommendRequest.DiscardUnknown(m)
}
var xxx_messageInfo_RecommendRequest proto.InternalMessageInfo
func (m *RecommendRequest) GetGoodsName() string {
if m != nil {
return m.GoodsName
}
return ""
}
func (m *RecommendRequest) GetAttrs() string {
if m != nil {
return m.Attrs
}
return ""
}
func (m *RecommendRequest) GetEncap() string {
if m != nil {
return m.Encap
}
return ""
}
func (m *RecommendRequest) GetNum() int32 {
if m != nil {
return m.Num
}
return 0
}
func (m *RecommendRequest) GetDeliveryType() int32 {
if m != nil {
return m.DeliveryType
}
return 0
}
func (m *RecommendRequest) GetFlag() int32 {
if m != nil {
return m.Flag
}
return 0
}
func (m *RecommendRequest) GetBrandName() string {
if m != nil {
return m.BrandName
}
return ""
}
type ResponseData struct {
// @inject_tag: json:"total"
Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
// @inject_tag: json:"flag"
Flag int32 `protobuf:"varint,2,opt,name=flag,proto3" json:"flag"`
// @inject_tag: json:"data"
Data []*GoodsModel `protobuf:"bytes,3,rep,name=data,proto3" json:"data"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ResponseData) Reset() { *m = ResponseData{} }
func (m *ResponseData) String() string { return proto.CompactTextString(m) }
func (*ResponseData) ProtoMessage() {}
func (*ResponseData) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{3}
}
func (m *ResponseData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResponseData.Unmarshal(m, b)
}
func (m *ResponseData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ResponseData.Marshal(b, m, deterministic)
}
func (m *ResponseData) XXX_Merge(src proto.Message) {
xxx_messageInfo_ResponseData.Merge(m, src)
}
func (m *ResponseData) XXX_Size() int {
return xxx_messageInfo_ResponseData.Size(m)
}
func (m *ResponseData) XXX_DiscardUnknown() {
xxx_messageInfo_ResponseData.DiscardUnknown(m)
}
var xxx_messageInfo_ResponseData proto.InternalMessageInfo
func (m *ResponseData) GetTotal() int64 {
if m != nil {
return m.Total
}
return 0
}
func (m *ResponseData) GetFlag() int32 {
if m != nil {
return m.Flag
}
return 0
}
func (m *ResponseData) GetData() []*GoodsModel {
if m != nil {
return m.Data
}
return nil
}
type RecommendResponse struct {
// @inject_tag: json:"error_code"
ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code"`
// @inject_tag: json:"error_message"
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message"`
// @inject_tag: json:"data"
Data *ResponseData `protobuf:"bytes,3,opt,name=data,proto3" json:"data"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RecommendResponse) Reset() { *m = RecommendResponse{} }
func (m *RecommendResponse) String() string { return proto.CompactTextString(m) }
func (*RecommendResponse) ProtoMessage() {}
func (*RecommendResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{4}
}
func (m *RecommendResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RecommendResponse.Unmarshal(m, b)
}
func (m *RecommendResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RecommendResponse.Marshal(b, m, deterministic)
}
func (m *RecommendResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_RecommendResponse.Merge(m, src)
}
func (m *RecommendResponse) XXX_Size() int {
return xxx_messageInfo_RecommendResponse.Size(m)
}
func (m *RecommendResponse) XXX_DiscardUnknown() {
xxx_messageInfo_RecommendResponse.DiscardUnknown(m)
}
var xxx_messageInfo_RecommendResponse proto.InternalMessageInfo
func (m *RecommendResponse) GetErrorCode() int32 {
if m != nil {
return m.ErrorCode
}
return 0
}
func (m *RecommendResponse) GetErrorMessage() string {
if m != nil {
return m.ErrorMessage
}
return ""
}
func (m *RecommendResponse) GetData() *ResponseData {
if m != nil {
return m.Data
}
return nil
}
type OtherAttrs struct {
GrossWegiht string `protobuf:"bytes,1,opt,name=gross_wegiht,json=grossWegiht,proto3" json:"gross_wegiht,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *OtherAttrs) Reset() { *m = OtherAttrs{} }
func (m *OtherAttrs) String() string { return proto.CompactTextString(m) }
func (*OtherAttrs) ProtoMessage() {}
func (*OtherAttrs) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{5}
}
func (m *OtherAttrs) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OtherAttrs.Unmarshal(m, b)
}
func (m *OtherAttrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_OtherAttrs.Marshal(b, m, deterministic)
}
func (m *OtherAttrs) XXX_Merge(src proto.Message) {
xxx_messageInfo_OtherAttrs.Merge(m, src)
}
func (m *OtherAttrs) XXX_Size() int {
return xxx_messageInfo_OtherAttrs.Size(m)
}
func (m *OtherAttrs) XXX_DiscardUnknown() {
xxx_messageInfo_OtherAttrs.DiscardUnknown(m)
}
var xxx_messageInfo_OtherAttrs proto.InternalMessageInfo
func (m *OtherAttrs) GetGrossWegiht() string {
if m != nil {
return m.GrossWegiht
}
return ""
}
type LadderPrice struct {
Purchases int64 `protobuf:"varint,1,opt,name=purchases,proto3" json:"purchases,omitempty"`
PriceCn float32 `protobuf:"fixed32,2,opt,name=price_cn,json=priceCn,proto3" json:"price_cn,omitempty"`
PriceUs float32 `protobuf:"fixed32,3,opt,name=price_us,json=priceUs,proto3" json:"price_us,omitempty"`
PriceAc float32 `protobuf:"fixed32,4,opt,name=price_ac,json=priceAc,proto3" json:"price_ac,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LadderPrice) Reset() { *m = LadderPrice{} }
func (m *LadderPrice) String() string { return proto.CompactTextString(m) }
func (*LadderPrice) ProtoMessage() {}
func (*LadderPrice) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{6}
}
func (m *LadderPrice) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LadderPrice.Unmarshal(m, b)
}
func (m *LadderPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LadderPrice.Marshal(b, m, deterministic)
}
func (m *LadderPrice) XXX_Merge(src proto.Message) {
xxx_messageInfo_LadderPrice.Merge(m, src)
}
func (m *LadderPrice) XXX_Size() int {
return xxx_messageInfo_LadderPrice.Size(m)
}
func (m *LadderPrice) XXX_DiscardUnknown() {
xxx_messageInfo_LadderPrice.DiscardUnknown(m)
}
var xxx_messageInfo_LadderPrice proto.InternalMessageInfo
func (m *LadderPrice) GetPurchases() int64 {
if m != nil {
return m.Purchases
}
return 0
}
func (m *LadderPrice) GetPriceCn() float32 {
if m != nil {
return m.PriceCn
}
return 0
}
func (m *LadderPrice) GetPriceUs() float32 {
if m != nil {
return m.PriceUs
}
return 0
}
func (m *LadderPrice) GetPriceAc() float32 {
if m != nil {
return m.PriceAc
}
return 0
}
type GoodsModel struct {
// @inject_tag: json:"other_attrs"
OtherAttrs *OtherAttrs `protobuf:"bytes,1,opt,name=other_attrs,json=otherAttrs,proto3" json:"other_attrs"`
// @inject_tag: json:"pick_type"
PickType int64 `protobuf:"varint,2,opt,name=pick_type,json=pickType,proto3" json:"pick_type"`
// @inject_tag: json:"barcode"
Barcode string `protobuf:"bytes,3,opt,name=barcode,proto3" json:"barcode"`
// @inject_tag: json:"goods_id"
GoodsId string `protobuf:"bytes,4,opt,name=goods_id,json=goodsId,proto3" json:"goods_id"`
// @inject_tag: json:"goods_type
GoodsType int64 `protobuf:"varint,5,opt,name=goods_type,json=goodsType,proto3" json:"goods_type,omitempty"`
// @inject_tag: json:"supplier_id"
SupplierId int64 `protobuf:"varint,6,opt,name=supplier_id,json=supplierId,proto3" json:"supplier_id"`
// @inject_tag: json:"brand_id"
BrandId int64 `protobuf:"varint,7,opt,name=brand_id,json=brandId,proto3" json:"brand_id"`
// @inject_tag: json:"class_id1"
ClassId1 int64 `protobuf:"varint,8,opt,name=class_id1,json=classId1,proto3" json:"class_id1"`
// @inject_tag: json:"class_id2"
ClassId2 int64 `protobuf:"varint,9,opt,name=class_id2,json=classId2,proto3" json:"class_id2"`
// @inject_tag: json:"goods_name"
GoodsName string `protobuf:"bytes,10,opt,name=goods_name,json=goodsName,proto3" json:"goods_name"`
// @inject_tag: json:"status"
Status int64 `protobuf:"varint,11,opt,name=status,proto3" json:"status"`
// @inject_tag: json:"encoded"
Encoded string `protobuf:"bytes,12,opt,name=encoded,proto3" json:"encoded"`
// @inject_tag: json:"encap"
Encap string `protobuf:"bytes,13,opt,name=encap,proto3" json:"encap"`
// @inject_tag: json:"packing"
Packing int64 `protobuf:"varint,14,opt,name=packing,proto3" json:"packing"`
// @inject_tag: json:"goods_unit"
GoodsUnit int64 `protobuf:"varint,15,opt,name=goods_unit,json=goodsUnit,proto3" json:"goods_unit"`
// @inject_tag: json:"goods_images"
GoodsImages bool `protobuf:"varint,16,opt,name=goods_images,json=goodsImages,proto3" json:"goods_images"`
// @inject_tag: json:"pdf"
Pdf string `protobuf:"bytes,17,opt,name=pdf,proto3" json:"pdf"`
// @inject_tag: json:"goods_brief"
GoodsBrief string `protobuf:"bytes,18,opt,name=goods_brief,json=goodsBrief,proto3" json:"goods_brief"`
// @inject_tag: json:"moq"
Moq int64 `protobuf:"varint,19,opt,name=moq,proto3" json:"moq"`
// @inject_tag: json:"mpq"
Mpq int64 `protobuf:"varint,20,opt,name=mpq,proto3" json:"mpq"`
// @inject_tag: json:"ladder_price"
LadderPrice []*LadderPrice `protobuf:"bytes,21,rep,name=ladder_price,json=ladderPrice,proto3" json:"ladder_price"`
// @inject_tag: json:"update_time"
UpdateTime int64 `protobuf:"varint,22,opt,name=update_time,json=updateTime,proto3" json:"update_time"`
// @inject_tag: json:"sku_name"
SkuName string `protobuf:"bytes,23,opt,name=sku_name,json=skuName,proto3" json:"sku_name"`
// @inject_tag: json:"mpl"
Mpl int64 `protobuf:"varint,24,opt,name=mpl,proto3" json:"mpl"`
// @inject_tag: json:"stock"
Stock int64 `protobuf:"varint,25,opt,name=stock,proto3" json:"stock"`
// @inject_tag: json:"attrs"
Attrs string `protobuf:"bytes,26,opt,name=attrs,proto3" json:"attrs"`
// @inject_tag: json:"cost"
Cost string `protobuf:"bytes,27,opt,name=cost,proto3" json:"cost"`
// @inject_tag: json:"new_cost"
NewCost string `protobuf:"bytes,28,opt,name=new_cost,json=newCost,proto3" json:"new_cost"`
// @inject_tag: json:"supplier_stock"
SupplierStock int64 `protobuf:"varint,29,opt,name=supplier_stock,json=supplierStock,proto3" json:"supplier_stock"`
// @inject_tag: json:"self_supplier_type"
SelfSupplierType int64 `protobuf:"varint,30,opt,name=self_supplier_type,json=selfSupplierType,proto3" json:"self_supplier_type"`
// @inject_tag: json:"cn_delivery_time"
CnDeliveryTime string `protobuf:"bytes,31,opt,name=cn_delivery_time,json=cnDeliveryTime,proto3" json:"cn_delivery_time"`
// @inject_tag: json:"brand_name"
BrandName string `protobuf:"bytes,32,opt,name=brand_name,json=brandName,proto3" json:"brand_name"`
// @inject_tag: json:"supplier_name"
SupplierName string `protobuf:"bytes,33,opt,name=supplier_name,json=supplierName,proto3" json:"supplier_name"`
GoodsUnitName string `protobuf:"bytes,34,opt,name=goods_unit_name,json=goodsUnitName,proto3" json:"goods_unit_name,omitempty"`
PackingName string `protobuf:"bytes,35,opt,name=packing_name,json=packingName,proto3" json:"packing_name,omitempty"`
MpqUnitName string `protobuf:"bytes,36,opt,name=mpq_unit_name,json=mpqUnitName,proto3" json:"mpq_unit_name,omitempty"`
// @inject_tag: json:"ac_type"
AcType int64 `protobuf:"varint,37,opt,name=ac_type,json=acType,proto3" json:"ac_type"`
AllowCoupon int64 `protobuf:"varint,38,opt,name=allow_coupon,json=allowCoupon,proto3" json:"allow_coupon,omitempty"`
ClassId1Name string `protobuf:"bytes,39,opt,name=class_id1_name,json=classId1Name,proto3" json:"class_id1_name,omitempty"`
ClassId2Name string `protobuf:"bytes,40,opt,name=class_id2_name,json=classId2Name,proto3" json:"class_id2_name,omitempty"`
// @inject_tag: json:"otheis_buyr_attrs"
IsBuy int64 `protobuf:"varint,41,opt,name=is_buy,json=isBuy,proto3" json:"otheis_buyr_attrs"`
// @inject_tag: json:"hk_delivery_type"
HkDeliveryType string `protobuf:"bytes,42,opt,name=hk_delivery_type,json=hkDeliveryType,proto3" json:"hk_delivery_type"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GoodsModel) Reset() { *m = GoodsModel{} }
func (m *GoodsModel) String() string { return proto.CompactTextString(m) }
func (*GoodsModel) ProtoMessage() {}
func (*GoodsModel) Descriptor() ([]byte, []int) {
return fileDescriptor_f689add15dae9986, []int{7}
}
func (m *GoodsModel) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GoodsModel.Unmarshal(m, b)
}
func (m *GoodsModel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GoodsModel.Marshal(b, m, deterministic)
}
func (m *GoodsModel) XXX_Merge(src proto.Message) {
xxx_messageInfo_GoodsModel.Merge(m, src)
}
func (m *GoodsModel) XXX_Size() int {
return xxx_messageInfo_GoodsModel.Size(m)
}
func (m *GoodsModel) XXX_DiscardUnknown() {
xxx_messageInfo_GoodsModel.DiscardUnknown(m)
}
var xxx_messageInfo_GoodsModel proto.InternalMessageInfo
func (m *GoodsModel) GetOtherAttrs() *OtherAttrs {
if m != nil {
return m.OtherAttrs
}
return nil
}
func (m *GoodsModel) GetPickType() int64 {
if m != nil {
return m.PickType
}
return 0
}
func (m *GoodsModel) GetBarcode() string {
if m != nil {
return m.Barcode
}
return ""
}
func (m *GoodsModel) GetGoodsId() string {
if m != nil {
return m.GoodsId
}
return ""
}
func (m *GoodsModel) GetGoodsType() int64 {
if m != nil {
return m.GoodsType
}
return 0
}
func (m *GoodsModel) GetSupplierId() int64 {
if m != nil {
return m.SupplierId
}
return 0
}
func (m *GoodsModel) GetBrandId() int64 {
if m != nil {
return m.BrandId
}
return 0
}
func (m *GoodsModel) GetClassId1() int64 {
if m != nil {
return m.ClassId1
}
return 0
}
func (m *GoodsModel) GetClassId2() int64 {
if m != nil {
return m.ClassId2
}
return 0
}
func (m *GoodsModel) GetGoodsName() string {
if m != nil {
return m.GoodsName
}
return ""
}
func (m *GoodsModel) GetStatus() int64 {
if m != nil {
return m.Status
}
return 0
}
func (m *GoodsModel) GetEncoded() string {
if m != nil {
return m.Encoded
}
return ""
}
func (m *GoodsModel) GetEncap() string {
if m != nil {
return m.Encap
}
return ""
}
func (m *GoodsModel) GetPacking() int64 {
if m != nil {
return m.Packing
}
return 0
}
func (m *GoodsModel) GetGoodsUnit() int64 {
if m != nil {
return m.GoodsUnit
}
return 0
}
func (m *GoodsModel) GetGoodsImages() bool {
if m != nil {
return m.GoodsImages
}
return false
}
func (m *GoodsModel) GetPdf() string {
if m != nil {
return m.Pdf
}
return ""
}
func (m *GoodsModel) GetGoodsBrief() string {
if m != nil {
return m.GoodsBrief
}
return ""
}
func (m *GoodsModel) GetMoq() int64 {
if m != nil {
return m.Moq
}
return 0
}
func (m *GoodsModel) GetMpq() int64 {
if m != nil {
return m.Mpq
}
return 0
}
func (m *GoodsModel) GetLadderPrice() []*LadderPrice {
if m != nil {
return m.LadderPrice
}
return nil
}
func (m *GoodsModel) GetUpdateTime() int64 {
if m != nil {
return m.UpdateTime
}
return 0
}
func (m *GoodsModel) GetSkuName() string {
if m != nil {
return m.SkuName
}
return ""
}
func (m *GoodsModel) GetMpl() int64 {
if m != nil {
return m.Mpl
}
return 0
}
func (m *GoodsModel) GetStock() int64 {
if m != nil {
return m.Stock
}
return 0
}
func (m *GoodsModel) GetAttrs() string {
if m != nil {
return m.Attrs
}
return ""
}
func (m *GoodsModel) GetCost() string {
if m != nil {
return m.Cost
}
return ""
}
func (m *GoodsModel) GetNewCost() string {
if m != nil {
return m.NewCost
}
return ""
}
func (m *GoodsModel) GetSupplierStock() int64 {
if m != nil {
return m.SupplierStock
}
return 0
}
func (m *GoodsModel) GetSelfSupplierType() int64 {
if m != nil {
return m.SelfSupplierType
}
return 0
}
func (m *GoodsModel) GetCnDeliveryTime() string {
if m != nil {
return m.CnDeliveryTime
}
return ""
}
func (m *GoodsModel) GetBrandName() string {
if m != nil {
return m.BrandName
}
return ""
}
func (m *GoodsModel) GetSupplierName() string {
if m != nil {
return m.SupplierName
}
return ""
}
func (m *GoodsModel) GetGoodsUnitName() string {
if m != nil {
return m.GoodsUnitName
}
return ""
}
func (m *GoodsModel) GetPackingName() string {
if m != nil {
return m.PackingName
}
return ""
}
func (m *GoodsModel) GetMpqUnitName() string {
if m != nil {
return m.MpqUnitName
}
return ""
}
func (m *GoodsModel) GetAcType() int64 {
if m != nil {
return m.AcType
}
return 0
}
func (m *GoodsModel) GetAllowCoupon() int64 {
if m != nil {
return m.AllowCoupon
}
return 0
}
func (m *GoodsModel) GetClassId1Name() string {
if m != nil {
return m.ClassId1Name
}
return ""
}
func (m *GoodsModel) GetClassId2Name() string {
if m != nil {
return m.ClassId2Name
}
return ""
}
func (m *GoodsModel) GetIsBuy() int64 {
if m != nil {
return m.IsBuy
}
return 0
}
func (m *GoodsModel) GetHkDeliveryType() string {
if m != nil {
return m.HkDeliveryType
}
return ""
}
func init() {
proto.RegisterType((*AutoSpuRequest)(nil), "bom.AutoSpuRequest")
proto.RegisterType((*AutoSpuResponse)(nil), "bom.AutoSpuResponse")
proto.RegisterType((*RecommendRequest)(nil), "bom.RecommendRequest")
proto.RegisterType((*ResponseData)(nil), "bom.ResponseData")
proto.RegisterType((*RecommendResponse)(nil), "bom.RecommendResponse")
proto.RegisterType((*OtherAttrs)(nil), "bom.OtherAttrs")
proto.RegisterType((*LadderPrice)(nil), "bom.LadderPrice")
proto.RegisterType((*GoodsModel)(nil), "bom.GoodsModel")
}
func init() { proto.RegisterFile("bom.proto", fileDescriptor_f689add15dae9986) }
var fileDescriptor_f689add15dae9986 = []byte{
// 986 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0xdb, 0x36,
0x14, 0x86, 0xe3, 0x24, 0x8e, 0x8f, 0x1c, 0xc7, 0x51, 0xd3, 0x96, 0xfd, 0x5b, 0x12, 0xa7, 0xe9,
0xbc, 0x61, 0x68, 0x57, 0x77, 0x2f, 0x90, 0x1f, 0x60, 0x08, 0xb0, 0x6e, 0x83, 0xd2, 0x62, 0x57,
0x83, 0x40, 0x8b, 0x8c, 0x2d, 0x58, 0x12, 0x69, 0x91, 0x6a, 0x60, 0x60, 0xd8, 0x73, 0xec, 0x8d,
0xf6, 0x5a, 0x03, 0xcf, 0xd1, 0x9f, 0x73, 0xb5, 0x8b, 0xde, 0xf1, 0x7c, 0xe7, 0x90, 0xe7, 0xe3,
0xc7, 0x8f, 0x94, 0xa0, 0x3f, 0x53, 0xe9, 0x5b, 0x9d, 0x2b, 0xab, 0xfc, 0xee, 0x4c, 0xa5, 0xe3,
0x77, 0x30, 0xbc, 0x28, 0xac, 0xba, 0xd5, 0x45, 0x20, 0x57, 0x85, 0x34, 0xd6, 0x7f, 0x05, 0x30,
0x57, 0x4a, 0x98, 0x30, 0xe3, 0xa9, 0x64, 0x9d, 0x93, 0xce, 0xa4, 0x1f, 0xf4, 0x11, 0xf9, 0x95,
0xa7, 0x72, 0x1c, 0xc3, 0x41, 0x3d, 0xc1, 0x68, 0x95, 0x19, 0xe9, 0x66, 0xc8, 0x3c, 0x57, 0x79,
0x18, 0x29, 0x41, 0x33, 0x76, 0x82, 0x3e, 0x22, 0x57, 0x4a, 0x48, 0xff, 0x0c, 0xf6, 0x29, 0x9d,
0x4a, 0x63, 0xf8, 0x5c, 0xb2, 0x2d, 0x5c, 0x73, 0x80, 0xe0, 0x47, 0xc2, 0x7c, 0x1f, 0xb6, 0x05,
0xb7, 0x9c, 0x75, 0x4f, 0xba, 0x93, 0x7e, 0x80, 0xe3, 0xf1, 0xbf, 0x1d, 0x18, 0x05, 0x32, 0x52,
0x69, 0x2a, 0x33, 0xf1, 0xff, 0xe8, 0xf9, 0x47, 0xb0, 0xc3, 0xad, 0xcd, 0x4d, 0xd9, 0x84, 0x02,
0x87, 0xca, 0x2c, 0xe2, 0x9a, 0x75, 0x09, 0xc5, 0xc0, 0x1f, 0x41, 0x37, 0x2b, 0x52, 0xb6, 0x8d,
0x84, 0xdd, 0xd0, 0x51, 0x15, 0x32, 0x89, 0xbf, 0xc8, 0x7c, 0x1d, 0xda, 0xb5, 0x96, 0x6c, 0x07,
0x73, 0x83, 0x0a, 0xfc, 0xb4, 0xd6, 0x48, 0xf5, 0x2e, 0xe1, 0x73, 0xb6, 0x8b, 0x39, 0x1c, 0x3b,
0x56, 0xb3, 0x9c, 0x67, 0x82, 0x58, 0xf5, 0x88, 0x15, 0x22, 0x28, 0xda, 0x9f, 0x30, 0xa8, 0xd4,
0xba, 0xe6, 0x96, 0x3b, 0x3e, 0x56, 0x59, 0x9e, 0x20, 0xff, 0x6e, 0x40, 0x41, 0xbd, 0xf0, 0x56,
0x6b, 0xe1, 0xb3, 0x96, 0x2e, 0xde, 0xf4, 0xe0, 0xad, 0x3b, 0xbe, 0x9f, 0xdd, 0x6e, 0x3f, 0x2a,
0x21, 0x93, 0x52, 0xa8, 0xbf, 0xe1, 0xb0, 0xa5, 0xd3, 0x57, 0x3c, 0x95, 0xf3, 0xba, 0x7b, 0x67,
0xe2, 0x4d, 0x0f, 0xb1, 0x7b, 0x7b, 0x23, 0x65, 0xff, 0x77, 0x00, 0xbf, 0xd9, 0x85, 0xcc, 0x2f,
0x50, 0xec, 0x53, 0x18, 0xcc, 0x73, 0x65, 0x4c, 0x78, 0x2f, 0xe7, 0xf1, 0xc2, 0x96, 0x67, 0xe4,
0x21, 0xf6, 0x07, 0x42, 0xe3, 0xbf, 0xc0, 0xfb, 0x85, 0x0b, 0x21, 0xf3, 0xdf, 0xf3, 0x38, 0x92,
0xfe, 0x4b, 0xe8, 0xeb, 0x22, 0x8f, 0x16, 0xdc, 0x48, 0x53, 0x4a, 0xd2, 0x00, 0xfe, 0x33, 0xd8,
0xd3, 0xae, 0x2c, 0x8c, 0x32, 0x24, 0xb9, 0x15, 0xf4, 0x30, 0xbe, 0xca, 0x9a, 0x54, 0x61, 0x90,
0x63, 0x95, 0xfa, 0xdc, 0x9a, 0xc5, 0x23, 0x3c, 0xe1, 0x2a, 0x75, 0x11, 0x8d, 0xff, 0x01, 0x80,
0x46, 0x43, 0xff, 0x47, 0xf0, 0x94, 0x63, 0x1f, 0x92, 0x71, 0x3a, 0xb8, 0x57, 0x52, 0xba, 0xd9,
0x55, 0x00, 0xaa, 0xd9, 0xe1, 0x0b, 0xe8, 0xeb, 0x38, 0x5a, 0x92, 0x45, 0xb6, 0x90, 0xef, 0x9e,
0x03, 0xd0, 0x1e, 0x0c, 0x7a, 0x33, 0x9e, 0xa3, 0xe8, 0xe4, 0xb6, 0x2a, 0x74, 0x94, 0xc8, 0xba,
0xb1, 0x40, 0x4a, 0xfd, 0xa0, 0x87, 0xf1, 0x8d, 0x68, 0x5c, 0x5d, 0xbb, 0xae, 0x5b, 0xba, 0x1a,
0xd7, 0x3c, 0x06, 0xcf, 0x14, 0x5a, 0x27, 0xb1, 0xcc, 0xdd, 0xe4, 0x5d, 0xcc, 0x43, 0x05, 0xdd,
0x08, 0xb7, 0x34, 0xf9, 0x2f, 0x16, 0xe8, 0xbe, 0x6e, 0xd0, 0xc3, 0xf8, 0x46, 0x38, 0xb2, 0x51,
0xc2, 0x8d, 0xeb, 0xfa, 0x9e, 0xed, 0x11, 0x59, 0x04, 0x6e, 0xc4, 0xfb, 0x76, 0x72, 0xca, 0xfa,
0x1b, 0xc9, 0xe9, 0x83, 0xab, 0x06, 0x0f, 0xaf, 0xda, 0x13, 0xd8, 0x35, 0x96, 0xdb, 0xc2, 0x30,
0x0f, 0x27, 0x96, 0x91, 0x13, 0x40, 0x66, 0x6e, 0xc3, 0x82, 0x0d, 0x68, 0x97, 0x65, 0xd8, 0x5c,
0xc3, 0xfd, 0xf6, 0x35, 0x64, 0xd0, 0xd3, 0x3c, 0x5a, 0xc6, 0xd9, 0x9c, 0x0d, 0x89, 0x7a, 0x19,
0x36, 0x04, 0x8a, 0x2c, 0xb6, 0xec, 0xa0, 0xa5, 0xca, 0xe7, 0x2c, 0xb6, 0x68, 0x34, 0xd2, 0x33,
0xe5, 0x73, 0x69, 0xd8, 0xe8, 0xa4, 0x33, 0xd9, 0x0b, 0x3c, 0xd2, 0x14, 0x21, 0x77, 0xc5, 0xb5,
0xb8, 0x63, 0x87, 0xd8, 0xcf, 0x0d, 0x9d, 0x94, 0x34, 0x69, 0x96, 0xc7, 0xf2, 0x8e, 0xf9, 0x98,
0xa1, 0x36, 0x97, 0x0e, 0x71, 0x53, 0x52, 0xb5, 0x62, 0x8f, 0xb0, 0x9b, 0x1b, 0x22, 0xa2, 0x57,
0xec, 0xa8, 0x44, 0xf4, 0xca, 0xff, 0x00, 0x83, 0x04, 0xfd, 0x1b, 0xa2, 0xa7, 0xd8, 0x63, 0xbc,
0x9d, 0x23, 0xf4, 0x4c, 0xcb, 0xd8, 0x81, 0x97, 0xb4, 0x5c, 0x7e, 0x0c, 0x5e, 0xa1, 0x05, 0xb7,
0x32, 0xb4, 0x71, 0x2a, 0xd9, 0x13, 0x3a, 0x44, 0x82, 0x3e, 0xc5, 0x29, 0xfa, 0xc3, 0x2c, 0x0b,
0x52, 0xfb, 0x29, 0x29, 0x67, 0x96, 0x05, 0x6a, 0x8d, 0x14, 0x12, 0xc6, 0x2a, 0x0a, 0x89, 0xd3,
0xd2, 0x58, 0x15, 0x2d, 0xd9, 0x33, 0x7a, 0x42, 0x30, 0x68, 0x9e, 0xbf, 0xe7, 0xed, 0xe7, 0xcf,
0x87, 0xed, 0x48, 0x19, 0xcb, 0x5e, 0x20, 0x88, 0x63, 0xd7, 0x2c, 0x93, 0xf7, 0x21, 0xe2, 0x2f,
0xa9, 0x59, 0x26, 0xef, 0xaf, 0x5c, 0xea, 0x1c, 0x86, 0xb5, 0xdb, 0xa8, 0xc7, 0x2b, 0xec, 0xb1,
0x5f, 0xa1, 0xb7, 0xd8, 0xeb, 0x07, 0xf0, 0x8d, 0x4c, 0xee, 0xc2, 0xba, 0x16, 0xbd, 0xfb, 0x0d,
0x96, 0x8e, 0x5c, 0xe6, 0xb6, 0x4c, 0xa0, 0x85, 0x27, 0x30, 0x8a, 0xb2, 0xb0, 0x79, 0x5d, 0x9d,
0x04, 0xc7, 0xd8, 0x77, 0x18, 0x65, 0xd7, 0xd5, 0xfb, 0xea, 0x64, 0xd8, 0x7c, 0x4b, 0x4f, 0x1e,
0xbc, 0xa5, 0xee, 0xe1, 0xaa, 0x3b, 0x62, 0xc5, 0x29, 0x3d, 0x5c, 0x15, 0x88, 0x45, 0x6f, 0xe0,
0xa0, 0x71, 0x0e, 0x95, 0x8d, 0xb1, 0x6c, 0xbf, 0xb6, 0x0f, 0xd6, 0x9d, 0xc2, 0xa0, 0x34, 0x1b,
0x15, 0x9d, 0xd1, 0x5b, 0x55, 0x62, 0x58, 0x32, 0x86, 0xfd, 0x54, 0xaf, 0x5a, 0x0b, 0xbd, 0xa6,
0x9a, 0x54, 0xaf, 0xea, 0x65, 0x9e, 0x42, 0x8f, 0x47, 0xb4, 0xff, 0x73, 0xba, 0x0b, 0x3c, 0xc2,
0x5d, 0x9f, 0xc2, 0x80, 0x27, 0x89, 0x72, 0x3a, 0x17, 0x5a, 0x65, 0xec, 0x0d, 0x66, 0x3d, 0xc4,
0xae, 0x10, 0xf2, 0x5f, 0xc3, 0xb0, 0xbe, 0x9f, 0xd4, 0xe0, 0x5b, 0xda, 0x50, 0x75, 0x49, 0xb1,
0x43, 0xab, 0x6a, 0x4a, 0x55, 0x93, 0x8d, 0xaa, 0x29, 0x56, 0x3d, 0x86, 0xdd, 0xd8, 0x84, 0xb3,
0x62, 0xcd, 0xbe, 0x23, 0x57, 0xc4, 0xe6, 0xb2, 0x58, 0x3b, 0xed, 0x17, 0xcb, 0x70, 0xf3, 0xcb,
0xf6, 0x3d, 0x69, 0xbf, 0x58, 0x5e, 0xb7, 0xbe, 0x6d, 0xd3, 0x4b, 0x80, 0x4b, 0x95, 0xde, 0xca,
0xfc, 0x8b, 0x73, 0xec, 0x4f, 0xd0, 0x2b, 0xbf, 0xf5, 0xfe, 0x23, 0xf4, 0xf6, 0xe6, 0xaf, 0xc2,
0xf3, 0xa3, 0x4d, 0x90, 0xbe, 0x0b, 0xb3, 0x5d, 0xfc, 0xbd, 0xf8, 0xf0, 0x5f, 0x00, 0x00, 0x00,
0xff, 0xff, 0x62, 0x52, 0x05, 0x28, 0x6b, 0x08, 0x00, 0x00,
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: bom.proto
package bom
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for BomService service
func NewBomServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for BomService service
type BomService interface {
AutoSpu(ctx context.Context, in *AutoSpuRequest, opts ...client.CallOption) (*AutoSpuResponse, error)
}
type bomService struct {
c client.Client
name string
}
func NewBomService(name string, c client.Client) BomService {
return &bomService{
c: c,
name: name,
}
}
func (c *bomService) AutoSpu(ctx context.Context, in *AutoSpuRequest, opts ...client.CallOption) (*AutoSpuResponse, error) {
req := c.c.NewRequest(c.name, "BomService.AutoSpu", in)
out := new(AutoSpuResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for BomService service
type BomServiceHandler interface {
AutoSpu(context.Context, *AutoSpuRequest, *AutoSpuResponse) error
}
func RegisterBomServiceHandler(s server.Server, hdlr BomServiceHandler, opts ...server.HandlerOption) error {
type bomService interface {
AutoSpu(ctx context.Context, in *AutoSpuRequest, out *AutoSpuResponse) error
}
type BomService struct {
bomService
}
h := &bomServiceHandler{hdlr}
return s.Handle(s.NewHandler(&BomService{h}, opts...))
}
type bomServiceHandler struct {
BomServiceHandler
}
func (h *bomServiceHandler) AutoSpu(ctx context.Context, in *AutoSpuRequest, out *AutoSpuResponse) error {
return h.BomServiceHandler.AutoSpu(ctx, in, out)
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: common.proto
package common
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Timestamp struct {
Timestamp *timestamp.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Timestr string `protobuf:"bytes,2,opt,name=timestr,proto3" json:"timestr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Timestamp) Reset() { *m = Timestamp{} }
func (m *Timestamp) String() string { return proto.CompactTextString(m) }
func (*Timestamp) ProtoMessage() {}
func (*Timestamp) Descriptor() ([]byte, []int) {
return fileDescriptor_555bd8c177793206, []int{0}
}
func (m *Timestamp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Timestamp.Unmarshal(m, b)
}
func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic)
}
func (m *Timestamp) XXX_Merge(src proto.Message) {
xxx_messageInfo_Timestamp.Merge(m, src)
}
func (m *Timestamp) XXX_Size() int {
return xxx_messageInfo_Timestamp.Size(m)
}
func (m *Timestamp) XXX_DiscardUnknown() {
xxx_messageInfo_Timestamp.DiscardUnknown(m)
}
var xxx_messageInfo_Timestamp proto.InternalMessageInfo
func (m *Timestamp) GetTimestamp() *timestamp.Timestamp {
if m != nil {
return m.Timestamp
}
return nil
}
func (m *Timestamp) GetTimestr() string {
if m != nil {
return m.Timestr
}
return ""
}
func init() {
proto.RegisterType((*Timestamp)(nil), "common.Timestamp")
}
func init() { proto.RegisterFile("common.proto", fileDescriptor_555bd8c177793206) }
var fileDescriptor_555bd8c177793206 = []byte{
// 121 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0xce, 0xcf, 0xcd,
0xcd, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0xa4, 0xe4, 0xd3, 0xf3,
0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xc1, 0xa2, 0x49, 0xa5, 0x69, 0xfa, 0x25, 0x99, 0xb9, 0xa9, 0xc5,
0x25, 0x89, 0xb9, 0x05, 0x10, 0x85, 0x4a, 0xf1, 0x5c, 0x9c, 0x21, 0x30, 0x21, 0x21, 0x0b, 0x2e,
0x4e, 0xb8, 0xbc, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x94, 0x1e, 0xc4, 0x04, 0x3d, 0x98,
0x09, 0x7a, 0x70, 0xe5, 0x41, 0x08, 0xc5, 0x42, 0x12, 0x5c, 0xec, 0x10, 0x4e, 0x91, 0x04, 0x93,
0x02, 0xa3, 0x06, 0x67, 0x10, 0x8c, 0x9b, 0xc4, 0x06, 0xd6, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff,
0xff, 0x1b, 0x45, 0x2b, 0x0e, 0xa0, 0x00, 0x00, 0x00,
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: common.proto
package common
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: course.proto
package course
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type CourseModel struct {
CourseId int32 `protobuf:"varint,1,opt,name=course_id,json=courseId,proto3" json:"course_id,omitempty"`
CourseName string `protobuf:"bytes,2,opt,name=course_name,json=courseName,proto3" json:"course_name,omitempty"`
CourseDispName string `protobuf:"bytes,3,opt,name=course_disp_name,json=courseDispName,proto3" json:"course_disp_name,omitempty"`
CourseIntr string `protobuf:"bytes,4,opt,name=course_intr,json=courseIntr,proto3" json:"course_intr,omitempty"`
CoursePrice float32 `protobuf:"fixed32,5,opt,name=course_price,json=coursePrice,proto3" json:"course_price,omitempty"`
CoursePrice2 float32 `protobuf:"fixed32,6,opt,name=course_price2,json=coursePrice2,proto3" json:"course_price2,omitempty"`
// @inject_tag: gorm:"type:timestamp"
Addtime int64 `protobuf:"varint,7,opt,name=addtime,proto3" json:"addtime,omitempty" gorm:"type:timestamp"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CourseModel) Reset() { *m = CourseModel{} }
func (m *CourseModel) String() string { return proto.CompactTextString(m) }
func (*CourseModel) ProtoMessage() {}
func (*CourseModel) Descriptor() ([]byte, []int) {
return fileDescriptor_ad75674299e1bb1e, []int{0}
}
func (m *CourseModel) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CourseModel.Unmarshal(m, b)
}
func (m *CourseModel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CourseModel.Marshal(b, m, deterministic)
}
func (m *CourseModel) XXX_Merge(src proto.Message) {
xxx_messageInfo_CourseModel.Merge(m, src)
}
func (m *CourseModel) XXX_Size() int {
return xxx_messageInfo_CourseModel.Size(m)
}
func (m *CourseModel) XXX_DiscardUnknown() {
xxx_messageInfo_CourseModel.DiscardUnknown(m)
}
var xxx_messageInfo_CourseModel proto.InternalMessageInfo
func (m *CourseModel) GetCourseId() int32 {
if m != nil {
return m.CourseId
}
return 0
}
func (m *CourseModel) GetCourseName() string {
if m != nil {
return m.CourseName
}
return ""
}
func (m *CourseModel) GetCourseDispName() string {
if m != nil {
return m.CourseDispName
}
return ""
}
func (m *CourseModel) GetCourseIntr() string {
if m != nil {
return m.CourseIntr
}
return ""
}
func (m *CourseModel) GetCoursePrice() float32 {
if m != nil {
return m.CoursePrice
}
return 0
}
func (m *CourseModel) GetCoursePrice2() float32 {
if m != nil {
return m.CoursePrice2
}
return 0
}
func (m *CourseModel) GetAddtime() int64 {
if m != nil {
return m.Addtime
}
return 0
}
type ListRequest struct {
// @inject_tag: form:"size"
Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty" form:"size"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_ad75674299e1bb1e, []int{1}
}
func (m *ListRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRequest.Unmarshal(m, b)
}
func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic)
}
func (m *ListRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListRequest.Merge(m, src)
}
func (m *ListRequest) XXX_Size() int {
return xxx_messageInfo_ListRequest.Size(m)
}
func (m *ListRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListRequest proto.InternalMessageInfo
func (m *ListRequest) GetSize() int32 {
if m != nil {
return m.Size
}
return 0
}
type DetailRequest struct {
// @inject_tag: uri:"course_id"
CourseId int32 `protobuf:"varint,1,opt,name=course_id,json=courseId,proto3" json:"course_id,omitempty" uri:"course_id"`
// @inject_tag: header:"fetch_type"
FetchType int32 `protobuf:"varint,2,opt,name=fetch_type,json=fetchType,proto3" json:"fetch_type,omitempty" header:"fetch_type"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DetailRequest) Reset() { *m = DetailRequest{} }
func (m *DetailRequest) String() string { return proto.CompactTextString(m) }
func (*DetailRequest) ProtoMessage() {}
func (*DetailRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_ad75674299e1bb1e, []int{2}
}
func (m *DetailRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DetailRequest.Unmarshal(m, b)
}
func (m *DetailRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DetailRequest.Marshal(b, m, deterministic)
}
func (m *DetailRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DetailRequest.Merge(m, src)
}
func (m *DetailRequest) XXX_Size() int {
return xxx_messageInfo_DetailRequest.Size(m)
}
func (m *DetailRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DetailRequest.DiscardUnknown(m)
}
var xxx_messageInfo_DetailRequest proto.InternalMessageInfo
func (m *DetailRequest) GetCourseId() int32 {
if m != nil {
return m.CourseId
}
return 0
}
func (m *DetailRequest) GetFetchType() int32 {
if m != nil {
return m.FetchType
}
return 0
}
//计数
type CourseCounts struct {
// @inject_tag: json:"-"
CountId int32 `protobuf:"varint,1,opt,name=count_id,json=countId,proto3" json:"-"`
// @inject_tag: json:"-"
CourseId int32 `protobuf:"varint,2,opt,name=course_id,json=courseId,proto3" json:"-"`
CountKey string `protobuf:"bytes,3,opt,name=count_key,json=countKey,proto3" json:"count_key,omitempty"`
CountValue int32 `protobuf:"varint,4,opt,name=count_value,json=countValue,proto3" json:"count_value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CourseCounts) Reset() { *m = CourseCounts{} }
func (m *CourseCounts) String() string { return proto.CompactTextString(m) }
func (*CourseCounts) ProtoMessage() {}
func (*CourseCounts) Descriptor() ([]byte, []int) {
return fileDescriptor_ad75674299e1bb1e, []int{3}
}
func (m *CourseCounts) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CourseCounts.Unmarshal(m, b)
}
func (m *CourseCounts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CourseCounts.Marshal(b, m, deterministic)
}
func (m *CourseCounts) XXX_Merge(src proto.Message) {
xxx_messageInfo_CourseCounts.Merge(m, src)
}
func (m *CourseCounts) XXX_Size() int {
return xxx_messageInfo_CourseCounts.Size(m)
}
func (m *CourseCounts) XXX_DiscardUnknown() {
xxx_messageInfo_CourseCounts.DiscardUnknown(m)
}
var xxx_messageInfo_CourseCounts proto.InternalMessageInfo
func (m *CourseCounts) GetCountId() int32 {
if m != nil {
return m.CountId
}
return 0
}
func (m *CourseCounts) GetCourseId() int32 {
if m != nil {
return m.CourseId
}
return 0
}
func (m *CourseCounts) GetCountKey() string {
if m != nil {
return m.CountKey
}
return ""
}
func (m *CourseCounts) GetCountValue() int32 {
if m != nil {
return m.CountValue
}
return 0
}
type ListResponse struct {
Result []*CourseModel `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ad75674299e1bb1e, []int{4}
}
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListResponse.Unmarshal(m, b)
}
func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic)
}
func (m *ListResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListResponse.Merge(m, src)
}
func (m *ListResponse) XXX_Size() int {
return xxx_messageInfo_ListResponse.Size(m)
}
func (m *ListResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListResponse proto.InternalMessageInfo
func (m *ListResponse) GetResult() []*CourseModel {
if m != nil {
return m.Result
}
return nil
}
type DetailResponse struct {
Course *CourseModel `protobuf:"bytes,1,opt,name=course,proto3" json:"course,omitempty"`
Counts []*CourseCounts `protobuf:"bytes,2,rep,name=counts,proto3" json:"counts,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DetailResponse) Reset() { *m = DetailResponse{} }
func (m *DetailResponse) String() string { return proto.CompactTextString(m) }
func (*DetailResponse) ProtoMessage() {}
func (*DetailResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ad75674299e1bb1e, []int{5}
}
func (m *DetailResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DetailResponse.Unmarshal(m, b)
}
func (m *DetailResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DetailResponse.Marshal(b, m, deterministic)
}
func (m *DetailResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_DetailResponse.Merge(m, src)
}
func (m *DetailResponse) XXX_Size() int {
return xxx_messageInfo_DetailResponse.Size(m)
}
func (m *DetailResponse) XXX_DiscardUnknown() {
xxx_messageInfo_DetailResponse.DiscardUnknown(m)
}
var xxx_messageInfo_DetailResponse proto.InternalMessageInfo
func (m *DetailResponse) GetCourse() *CourseModel {
if m != nil {
return m.Course
}
return nil
}
func (m *DetailResponse) GetCounts() []*CourseCounts {
if m != nil {
return m.Counts
}
return nil
}
func init() {
proto.RegisterType((*CourseModel)(nil), "course.CourseModel")
proto.RegisterType((*ListRequest)(nil), "course.ListRequest")
proto.RegisterType((*DetailRequest)(nil), "course.DetailRequest")
proto.RegisterType((*CourseCounts)(nil), "course.CourseCounts")
proto.RegisterType((*ListResponse)(nil), "course.ListResponse")
proto.RegisterType((*DetailResponse)(nil), "course.DetailResponse")
}
func init() { proto.RegisterFile("course.proto", fileDescriptor_ad75674299e1bb1e) }
var fileDescriptor_ad75674299e1bb1e = []byte{
// 431 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xcf, 0x8b, 0xd3, 0x40,
0x14, 0xc7, 0x99, 0x76, 0xdb, 0xda, 0xd7, 0x76, 0x91, 0x71, 0x95, 0x71, 0x45, 0xcc, 0xc6, 0x4b,
0x40, 0xd9, 0x43, 0x3d, 0x08, 0x7a, 0xdc, 0x45, 0x29, 0xab, 0x22, 0x71, 0xf1, 0x1a, 0x62, 0xf3,
0xc4, 0x61, 0xdb, 0x49, 0x9c, 0x79, 0x59, 0xa8, 0xe7, 0xfd, 0xa3, 0x3d, 0x4a, 0xe6, 0x4d, 0x6c,
0x52, 0xd0, 0x5b, 0xe6, 0xfb, 0x3e, 0xef, 0xc7, 0x7c, 0xdf, 0x04, 0xe6, 0xeb, 0xb2, 0xb6, 0x0e,
0xcf, 0x2b, 0x5b, 0x52, 0x29, 0xc7, 0x7c, 0x8a, 0x7f, 0x0b, 0x98, 0x5d, 0xf8, 0xcf, 0x8f, 0x65,
0x81, 0x1b, 0xf9, 0x04, 0xa6, 0x1c, 0xc9, 0x74, 0xa1, 0x44, 0x24, 0x92, 0x51, 0x7a, 0x8f, 0x85,
0x55, 0x21, 0x9f, 0xc1, 0x2c, 0x04, 0x4d, 0xbe, 0x45, 0x35, 0x88, 0x44, 0x32, 0x4d, 0x81, 0xa5,
0x4f, 0xf9, 0x16, 0x65, 0x02, 0xf7, 0x03, 0x50, 0x68, 0x57, 0x31, 0x35, 0xf4, 0xd4, 0x31, 0xeb,
0x97, 0xda, 0x55, 0x9e, 0xdc, 0x97, 0xd2, 0x86, 0xac, 0x3a, 0xea, 0x96, 0x5a, 0x19, 0xb2, 0xf2,
0xac, 0x1d, 0x38, 0xab, 0xac, 0x5e, 0xa3, 0x1a, 0x45, 0x22, 0x19, 0xa4, 0x21, 0xe9, 0x73, 0x23,
0xc9, 0xe7, 0xb0, 0xe8, 0x22, 0x4b, 0x35, 0xf6, 0xcc, 0xbc, 0xc3, 0x2c, 0xa5, 0x82, 0x49, 0x5e,
0x14, 0xa4, 0xb7, 0xa8, 0x26, 0x91, 0x48, 0x86, 0x69, 0x7b, 0x8c, 0xcf, 0x60, 0xf6, 0x41, 0x3b,
0x4a, 0xf1, 0x67, 0x8d, 0x8e, 0xa4, 0x84, 0x23, 0xa7, 0x7f, 0x61, 0xb8, 0xb4, 0xff, 0x8e, 0xaf,
0x60, 0x71, 0x89, 0x94, 0xeb, 0x4d, 0x0b, 0xfd, 0xd7, 0x9e, 0xa7, 0x00, 0xdf, 0x91, 0xd6, 0x3f,
0x32, 0xda, 0x55, 0xec, 0xce, 0x28, 0x9d, 0x7a, 0xe5, 0x7a, 0x57, 0x61, 0x7c, 0x27, 0x60, 0xce,
0x56, 0x5f, 0x94, 0xb5, 0x21, 0x27, 0x1f, 0x43, 0x93, 0x6b, 0x68, 0x5f, 0x6b, 0xe2, 0xcf, 0xab,
0xa2, 0xdf, 0x67, 0x70, 0xd0, 0x87, 0x83, 0x86, 0xb2, 0x1b, 0xdc, 0x05, 0x7b, 0xb9, 0xd0, 0x15,
0xee, 0x82, 0xb1, 0x86, 0xb2, 0xdb, 0x7c, 0x53, 0xa3, 0x37, 0x76, 0xe4, 0x8d, 0x35, 0xf4, 0xb5,
0x51, 0xe2, 0xb7, 0x30, 0xe7, 0x6b, 0xbb, 0xaa, 0x34, 0x0e, 0xe5, 0x0b, 0x18, 0x5b, 0x74, 0xf5,
0x86, 0x94, 0x88, 0x86, 0xc9, 0x6c, 0xf9, 0xe0, 0x3c, 0x3c, 0x94, 0xce, 0xb3, 0x48, 0x03, 0x12,
0xdf, 0xc0, 0x71, 0x6b, 0xc8, 0x3e, 0x9d, 0x79, 0x7f, 0x85, 0x7f, 0xa5, 0xb3, 0x26, 0x5f, 0x7a,
0xd8, 0x90, 0x53, 0x03, 0xdf, 0xeb, 0xa4, 0x0f, 0xb3, 0x2f, 0x69, 0x60, 0x96, 0x77, 0x02, 0x16,
0x1c, 0xf8, 0x82, 0xf6, 0xb6, 0xd9, 0xf8, 0x6b, 0x80, 0x66, 0xf6, 0x77, 0xa5, 0xbd, 0x2e, 0x2b,
0xf9, 0xb7, 0x55, 0x67, 0x8d, 0xa7, 0x27, 0x7d, 0x31, 0x4c, 0xf9, 0x06, 0xa6, 0xef, 0x91, 0x78,
0x74, 0xf9, 0xb0, 0x45, 0x7a, 0xbb, 0x3d, 0x7d, 0x74, 0x28, 0x73, 0xee, 0xb7, 0xb1, 0xff, 0x63,
0x5e, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x18, 0x2c, 0xe0, 0xbb, 0x41, 0x03, 0x00, 0x00,
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: course.proto
package course
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for CourseService service
func NewCourseServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for CourseService service
type CourseService interface {
ListForTop(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
GetDetail(ctx context.Context, in *DetailRequest, opts ...client.CallOption) (*DetailResponse, error)
}
type courseService struct {
c client.Client
name string
}
func NewCourseService(name string, c client.Client) CourseService {
return &courseService{
c: c,
name: name,
}
}
func (c *courseService) ListForTop(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "CourseService.ListForTop", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *courseService) GetDetail(ctx context.Context, in *DetailRequest, opts ...client.CallOption) (*DetailResponse, error) {
req := c.c.NewRequest(c.name, "CourseService.GetDetail", in)
out := new(DetailResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for CourseService service
type CourseServiceHandler interface {
ListForTop(context.Context, *ListRequest, *ListResponse) error
GetDetail(context.Context, *DetailRequest, *DetailResponse) error
}
func RegisterCourseServiceHandler(s server.Server, hdlr CourseServiceHandler, opts ...server.HandlerOption) error {
type courseService interface {
ListForTop(ctx context.Context, in *ListRequest, out *ListResponse) error
GetDetail(ctx context.Context, in *DetailRequest, out *DetailResponse) error
}
type CourseService struct {
courseService
}
h := &courseServiceHandler{hdlr}
return s.Handle(s.NewHandler(&CourseService{h}, opts...))
}
type courseServiceHandler struct {
CourseServiceHandler
}
func (h *courseServiceHandler) ListForTop(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.CourseServiceHandler.ListForTop(ctx, in, out)
}
func (h *courseServiceHandler) GetDetail(ctx context.Context, in *DetailRequest, out *DetailResponse) error {
return h.CourseServiceHandler.GetDetail(ctx, in, out)
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: course_topic.proto
package course
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type CourseTopic struct {
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
CourseId int32 `protobuf:"varint,2,opt,name=CourseId,proto3" json:"CourseId,omitempty"`
CourseDid int32 `protobuf:"varint,3,opt,name=CourseDid,proto3" json:"CourseDid,omitempty"`
Likes int32 `protobuf:"varint,4,opt,name=Likes,proto3" json:"Likes,omitempty"`
Unlikes int32 `protobuf:"varint,5,opt,name=Unlikes,proto3" json:"Unlikes,omitempty"`
Title string `protobuf:"bytes,6,opt,name=Title,proto3" json:"Title,omitempty"`
Content string `protobuf:"bytes,7,opt,name=Content,proto3" json:"Content,omitempty"`
UserId int32 `protobuf:"varint,8,opt,name=UserId,proto3" json:"UserId,omitempty"`
Addtime int64 `protobuf:"varint,9,opt,name=Addtime,proto3" json:"Addtime,omitempty"`
Updatetime int64 `protobuf:"varint,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CourseTopic) Reset() { *m = CourseTopic{} }
func (m *CourseTopic) String() string { return proto.CompactTextString(m) }
func (*CourseTopic) ProtoMessage() {}
func (*CourseTopic) Descriptor() ([]byte, []int) {
return fileDescriptor_f51a07ace88d3cfc, []int{0}
}
func (m *CourseTopic) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CourseTopic.Unmarshal(m, b)
}
func (m *CourseTopic) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CourseTopic.Marshal(b, m, deterministic)
}
func (m *CourseTopic) XXX_Merge(src proto.Message) {
xxx_messageInfo_CourseTopic.Merge(m, src)
}
func (m *CourseTopic) XXX_Size() int {
return xxx_messageInfo_CourseTopic.Size(m)
}
func (m *CourseTopic) XXX_DiscardUnknown() {
xxx_messageInfo_CourseTopic.DiscardUnknown(m)
}
var xxx_messageInfo_CourseTopic proto.InternalMessageInfo
func (m *CourseTopic) GetId() int32 {
if m != nil {
return m.Id
}
return 0
}
func (m *CourseTopic) GetCourseId() int32 {
if m != nil {
return m.CourseId
}
return 0
}
func (m *CourseTopic) GetCourseDid() int32 {
if m != nil {
return m.CourseDid
}
return 0
}
func (m *CourseTopic) GetLikes() int32 {
if m != nil {
return m.Likes
}
return 0
}
func (m *CourseTopic) GetUnlikes() int32 {
if m != nil {
return m.Unlikes
}
return 0
}
func (m *CourseTopic) GetTitle() string {
if m != nil {
return m.Title
}
return ""
}
func (m *CourseTopic) GetContent() string {
if m != nil {
return m.Content
}
return ""
}
func (m *CourseTopic) GetUserId() int32 {
if m != nil {
return m.UserId
}
return 0
}
func (m *CourseTopic) GetAddtime() int64 {
if m != nil {
return m.Addtime
}
return 0
}
func (m *CourseTopic) GetUpdatetime() int64 {
if m != nil {
return m.Updatetime
}
return 0
}
type CourseTopicReply struct {
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
TopicId int32 `protobuf:"varint,2,opt,name=TopicId,proto3" json:"TopicId,omitempty"`
Content string `protobuf:"bytes,3,opt,name=Content,proto3" json:"Content,omitempty"`
UserId int32 `protobuf:"varint,4,opt,name=UserId,proto3" json:"UserId,omitempty"`
Likes int32 `protobuf:"varint,5,opt,name=Likes,proto3" json:"Likes,omitempty"`
Unlikes int32 `protobuf:"varint,6,opt,name=Unlikes,proto3" json:"Unlikes,omitempty"`
Addtime int64 `protobuf:"varint,7,opt,name=Addtime,proto3" json:"Addtime,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CourseTopicReply) Reset() { *m = CourseTopicReply{} }
func (m *CourseTopicReply) String() string { return proto.CompactTextString(m) }
func (*CourseTopicReply) ProtoMessage() {}
func (*CourseTopicReply) Descriptor() ([]byte, []int) {
return fileDescriptor_f51a07ace88d3cfc, []int{1}
}
func (m *CourseTopicReply) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CourseTopicReply.Unmarshal(m, b)
}
func (m *CourseTopicReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CourseTopicReply.Marshal(b, m, deterministic)
}
func (m *CourseTopicReply) XXX_Merge(src proto.Message) {
xxx_messageInfo_CourseTopicReply.Merge(m, src)
}
func (m *CourseTopicReply) XXX_Size() int {
return xxx_messageInfo_CourseTopicReply.Size(m)
}
func (m *CourseTopicReply) XXX_DiscardUnknown() {
xxx_messageInfo_CourseTopicReply.DiscardUnknown(m)
}
var xxx_messageInfo_CourseTopicReply proto.InternalMessageInfo
func (m *CourseTopicReply) GetId() int32 {
if m != nil {
return m.Id
}
return 0
}
func (m *CourseTopicReply) GetTopicId() int32 {
if m != nil {
return m.TopicId
}
return 0
}
func (m *CourseTopicReply) GetContent() string {
if m != nil {
return m.Content
}
return ""
}
func (m *CourseTopicReply) GetUserId() int32 {
if m != nil {
return m.UserId
}
return 0
}
func (m *CourseTopicReply) GetLikes() int32 {
if m != nil {
return m.Likes
}
return 0
}
func (m *CourseTopicReply) GetUnlikes() int32 {
if m != nil {
return m.Unlikes
}
return 0
}
func (m *CourseTopicReply) GetAddtime() int64 {
if m != nil {
return m.Addtime
}
return 0
}
type TopicRequest struct {
CourseId int32 `protobuf:"varint,1,opt,name=CourseId,proto3" json:"CourseId,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TopicRequest) Reset() { *m = TopicRequest{} }
func (m *TopicRequest) String() string { return proto.CompactTextString(m) }
func (*TopicRequest) ProtoMessage() {}
func (*TopicRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f51a07ace88d3cfc, []int{2}
}
func (m *TopicRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TopicRequest.Unmarshal(m, b)
}
func (m *TopicRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TopicRequest.Marshal(b, m, deterministic)
}
func (m *TopicRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_TopicRequest.Merge(m, src)
}
func (m *TopicRequest) XXX_Size() int {
return xxx_messageInfo_TopicRequest.Size(m)
}
func (m *TopicRequest) XXX_DiscardUnknown() {
xxx_messageInfo_TopicRequest.DiscardUnknown(m)
}
var xxx_messageInfo_TopicRequest proto.InternalMessageInfo
func (m *TopicRequest) GetCourseId() int32 {
if m != nil {
return m.CourseId
}
return 0
}
type TopicResponse struct {
Result []*CourseTopic `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TopicResponse) Reset() { *m = TopicResponse{} }
func (m *TopicResponse) String() string { return proto.CompactTextString(m) }
func (*TopicResponse) ProtoMessage() {}
func (*TopicResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f51a07ace88d3cfc, []int{3}
}
func (m *TopicResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TopicResponse.Unmarshal(m, b)
}
func (m *TopicResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TopicResponse.Marshal(b, m, deterministic)
}
func (m *TopicResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_TopicResponse.Merge(m, src)
}
func (m *TopicResponse) XXX_Size() int {
return xxx_messageInfo_TopicResponse.Size(m)
}
func (m *TopicResponse) XXX_DiscardUnknown() {
xxx_messageInfo_TopicResponse.DiscardUnknown(m)
}
var xxx_messageInfo_TopicResponse proto.InternalMessageInfo
func (m *TopicResponse) GetResult() []*CourseTopic {
if m != nil {
return m.Result
}
return nil
}
func init() {
proto.RegisterType((*CourseTopic)(nil), "course.CourseTopic")
proto.RegisterType((*CourseTopicReply)(nil), "course.CourseTopicReply")
proto.RegisterType((*TopicRequest)(nil), "course.TopicRequest")
proto.RegisterType((*TopicResponse)(nil), "course.TopicResponse")
}
func init() { proto.RegisterFile("course_topic.proto", fileDescriptor_f51a07ace88d3cfc) }
var fileDescriptor_f51a07ace88d3cfc = []byte{
// 337 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x4b, 0xc3, 0x30,
0x14, 0xc6, 0x49, 0xbb, 0xb6, 0xdb, 0x9b, 0x8a, 0xc4, 0x29, 0x61, 0x88, 0x94, 0x9e, 0x8a, 0xc2,
0x0e, 0xf3, 0xe0, 0xc5, 0x8b, 0x4c, 0x90, 0x82, 0x5e, 0xea, 0x76, 0x16, 0x5d, 0xde, 0xa1, 0x58,
0xdb, 0xda, 0x64, 0x82, 0x7f, 0x82, 0xff, 0x91, 0x7f, 0x9e, 0xf4, 0xa5, 0x9d, 0xa9, 0xb2, 0x5b,
0xbe, 0xdf, 0xf7, 0xd2, 0x7e, 0xf9, 0x12, 0xe0, 0xeb, 0x72, 0x53, 0x2b, 0x7c, 0xd2, 0x65, 0x95,
0xad, 0x67, 0x55, 0x5d, 0xea, 0x92, 0xfb, 0x86, 0x45, 0x5f, 0x0e, 0x8c, 0x17, 0xb4, 0x5c, 0x36,
0x2e, 0x3f, 0x00, 0x27, 0x91, 0x82, 0x85, 0x2c, 0xf6, 0x52, 0x27, 0x91, 0x7c, 0x0a, 0x43, 0x63,
0x27, 0x52, 0x38, 0x44, 0xb7, 0x9a, 0x9f, 0xc2, 0xc8, 0xac, 0x6f, 0x33, 0x29, 0x5c, 0x32, 0x7f,
0x01, 0x9f, 0x80, 0x77, 0x9f, 0xbd, 0xa2, 0x12, 0x03, 0x72, 0x8c, 0xe0, 0x02, 0x82, 0x55, 0x91,
0x13, 0xf7, 0x88, 0x77, 0xb2, 0x99, 0x5f, 0x66, 0x3a, 0x47, 0xe1, 0x87, 0x2c, 0x1e, 0xa5, 0x46,
0x34, 0xf3, 0x8b, 0xb2, 0xd0, 0x58, 0x68, 0x11, 0x10, 0xef, 0x24, 0x3f, 0x01, 0x7f, 0xa5, 0xb0,
0x4e, 0xa4, 0x18, 0xd2, 0x87, 0x5a, 0xd5, 0xec, 0xb8, 0x91, 0x52, 0x67, 0x6f, 0x28, 0x46, 0x21,
0x8b, 0xdd, 0xb4, 0x93, 0xfc, 0x0c, 0x60, 0x55, 0xc9, 0x67, 0x8d, 0x64, 0x02, 0x99, 0x16, 0x89,
0xbe, 0x19, 0x1c, 0x5a, 0x5d, 0xa4, 0x58, 0xe5, 0x9f, 0xff, 0x0a, 0x11, 0x10, 0x90, 0xbb, 0xed,
0xa3, 0x93, 0x76, 0x54, 0x77, 0x57, 0xd4, 0x41, 0x2f, 0xea, 0xb6, 0x22, 0x6f, 0x47, 0x45, 0x7e,
0xbf, 0x22, 0xeb, 0x68, 0x41, 0xef, 0x68, 0xd1, 0x39, 0xec, 0xb5, 0x99, 0xdf, 0x37, 0xa8, 0x74,
0xef, 0xda, 0x58, 0xff, 0xda, 0xa2, 0x6b, 0xd8, 0x6f, 0x67, 0x55, 0x55, 0x16, 0x0a, 0xf9, 0x05,
0xf8, 0x35, 0xaa, 0x4d, 0xae, 0x05, 0x0b, 0xdd, 0x78, 0x3c, 0x3f, 0x9a, 0x99, 0xc7, 0x31, 0xb3,
0xcb, 0x68, 0x47, 0xe6, 0x0f, 0xc0, 0x2d, 0xfc, 0x88, 0xf5, 0x47, 0xb6, 0x46, 0x7e, 0x05, 0xc3,
0x3b, 0xd4, 0xe6, 0x09, 0x4d, 0xba, 0xed, 0x76, 0xa2, 0xe9, 0xf1, 0x1f, 0x6a, 0xfe, 0xfd, 0xe2,
0xd3, 0x73, 0xbc, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x1f, 0xc4, 0xb7, 0xa4, 0x02, 0x00,
0x00,
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: course_topic.proto
package course
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for CourseTopicService service
func NewCourseTopicServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for CourseTopicService service
type CourseTopicService interface {
GetTopic(ctx context.Context, in *TopicRequest, opts ...client.CallOption) (*TopicResponse, error)
}
type courseTopicService struct {
c client.Client
name string
}
func NewCourseTopicService(name string, c client.Client) CourseTopicService {
return &courseTopicService{
c: c,
name: name,
}
}
func (c *courseTopicService) GetTopic(ctx context.Context, in *TopicRequest, opts ...client.CallOption) (*TopicResponse, error) {
req := c.c.NewRequest(c.name, "CourseTopicService.GetTopic", in)
out := new(TopicResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for CourseTopicService service
type CourseTopicServiceHandler interface {
GetTopic(context.Context, *TopicRequest, *TopicResponse) error
}
func RegisterCourseTopicServiceHandler(s server.Server, hdlr CourseTopicServiceHandler, opts ...server.HandlerOption) error {
type courseTopicService interface {
GetTopic(ctx context.Context, in *TopicRequest, out *TopicResponse) error
}
type CourseTopicService struct {
courseTopicService
}
h := &courseTopicServiceHandler{hdlr}
return s.Handle(s.NewHandler(&CourseTopicService{h}, opts...))
}
type courseTopicServiceHandler struct {
CourseTopicServiceHandler
}
func (h *courseTopicServiceHandler) GetTopic(ctx context.Context, in *TopicRequest, out *TopicResponse) error {
return h.CourseTopicServiceHandler.GetTopic(ctx, in, out)
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: goods.proto
package goods
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type OTHER_ATTRS struct {
GrossWegiht string `protobuf:"bytes,1,opt,name=gross_wegiht,json=grossWegiht,proto3" json:"gross_wegiht,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *OTHER_ATTRS) Reset() { *m = OTHER_ATTRS{} }
func (m *OTHER_ATTRS) String() string { return proto.CompactTextString(m) }
func (*OTHER_ATTRS) ProtoMessage() {}
func (*OTHER_ATTRS) Descriptor() ([]byte, []int) {
return fileDescriptor_a30593c5487368b0, []int{0}
}
func (m *OTHER_ATTRS) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OTHER_ATTRS.Unmarshal(m, b)
}
func (m *OTHER_ATTRS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_OTHER_ATTRS.Marshal(b, m, deterministic)
}
func (m *OTHER_ATTRS) XXX_Merge(src proto.Message) {
xxx_messageInfo_OTHER_ATTRS.Merge(m, src)
}
func (m *OTHER_ATTRS) XXX_Size() int {
return xxx_messageInfo_OTHER_ATTRS.Size(m)
}
func (m *OTHER_ATTRS) XXX_DiscardUnknown() {
xxx_messageInfo_OTHER_ATTRS.DiscardUnknown(m)
}
var xxx_messageInfo_OTHER_ATTRS proto.InternalMessageInfo
func (m *OTHER_ATTRS) GetGrossWegiht() string {
if m != nil {
return m.GrossWegiht
}
return ""
}
type LADDER_PRICE struct {
Purchases int64 `protobuf:"varint,1,opt,name=purchases,proto3" json:"purchases,omitempty"`
PriceCn float32 `protobuf:"fixed32,2,opt,name=price_cn,json=priceCn,proto3" json:"price_cn,omitempty"`
PriceUs float32 `protobuf:"fixed32,3,opt,name=price_us,json=priceUs,proto3" json:"price_us,omitempty"`
PriceAc float32 `protobuf:"fixed32,4,opt,name=price_ac,json=priceAc,proto3" json:"price_ac,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LADDER_PRICE) Reset() { *m = LADDER_PRICE{} }
func (m *LADDER_PRICE) String() string { return proto.CompactTextString(m) }
func (*LADDER_PRICE) ProtoMessage() {}
func (*LADDER_PRICE) Descriptor() ([]byte, []int) {
return fileDescriptor_a30593c5487368b0, []int{1}
}
func (m *LADDER_PRICE) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LADDER_PRICE.Unmarshal(m, b)
}
func (m *LADDER_PRICE) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LADDER_PRICE.Marshal(b, m, deterministic)
}
func (m *LADDER_PRICE) XXX_Merge(src proto.Message) {
xxx_messageInfo_LADDER_PRICE.Merge(m, src)
}
func (m *LADDER_PRICE) XXX_Size() int {
return xxx_messageInfo_LADDER_PRICE.Size(m)
}
func (m *LADDER_PRICE) XXX_DiscardUnknown() {
xxx_messageInfo_LADDER_PRICE.DiscardUnknown(m)
}
var xxx_messageInfo_LADDER_PRICE proto.InternalMessageInfo
func (m *LADDER_PRICE) GetPurchases() int64 {
if m != nil {
return m.Purchases
}
return 0
}
func (m *LADDER_PRICE) GetPriceCn() float32 {
if m != nil {
return m.PriceCn
}
return 0
}
func (m *LADDER_PRICE) GetPriceUs() float32 {
if m != nil {
return m.PriceUs
}
return 0
}
func (m *LADDER_PRICE) GetPriceAc() float32 {
if m != nil {
return m.PriceAc
}
return 0
}
type GoodsModel struct {
OtherAttrs *OTHER_ATTRS `protobuf:"bytes,1,opt,name=other_attrs,json=otherAttrs,proto3" json:"other_attrs,omitempty"`
PickType int64 `protobuf:"varint,2,opt,name=pick_type,json=pickType,proto3" json:"pick_type,omitempty"`
Barcode string `protobuf:"bytes,3,opt,name=barcode,proto3" json:"barcode,omitempty"`
GoodsId string `protobuf:"bytes,4,opt,name=goods_id,json=goodsId,proto3" json:"goods_id,omitempty"`
GoodsType int64 `protobuf:"varint,5,opt,name=goods_type,json=goodsType,proto3" json:"goods_type,omitempty"`
SupplierId int64 `protobuf:"varint,6,opt,name=supplier_id,json=supplierId,proto3" json:"supplier_id,omitempty"`
BrandId int64 `protobuf:"varint,7,opt,name=brand_id,json=brandId,proto3" json:"brand_id,omitempty"`
ClassId1 int64 `protobuf:"varint,8,opt,name=class_id1,json=classId1,proto3" json:"class_id1,omitempty"`
ClassId2 int64 `protobuf:"varint,9,opt,name=class_id2,json=classId2,proto3" json:"class_id2,omitempty"`
GoodsName string `protobuf:"bytes,10,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty"`
Status int64 `protobuf:"varint,11,opt,name=status,proto3" json:"status,omitempty"`
Encoded string `protobuf:"bytes,12,opt,name=encoded,proto3" json:"encoded,omitempty"`
Encap string `protobuf:"bytes,13,opt,name=encap,proto3" json:"encap,omitempty"`
Packing int64 `protobuf:"varint,14,opt,name=packing,proto3" json:"packing,omitempty"`
GoodsUnit int64 `protobuf:"varint,15,opt,name=goods_unit,json=goodsUnit,proto3" json:"goods_unit,omitempty"`
GoodsImages bool `protobuf:"varint,16,opt,name=goods_images,json=goodsImages,proto3" json:"goods_images,omitempty"`
Pdf bool `protobuf:"varint,17,opt,name=pdf,proto3" json:"pdf,omitempty"`
GoodsBrief string `protobuf:"bytes,18,opt,name=goods_brief,json=goodsBrief,proto3" json:"goods_brief,omitempty"`
Moq int64 `protobuf:"varint,19,opt,name=moq,proto3" json:"moq,omitempty"`
Mpq int64 `protobuf:"varint,20,opt,name=mpq,proto3" json:"mpq,omitempty"`
LadderPrice []*LADDER_PRICE `protobuf:"bytes,21,rep,name=ladder_price,json=ladderPrice,proto3" json:"ladder_price,omitempty"`
UpdateTime int64 `protobuf:"varint,22,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
SkuName string `protobuf:"bytes,23,opt,name=sku_name,json=skuName,proto3" json:"sku_name,omitempty"`
Mpl int64 `protobuf:"varint,24,opt,name=mpl,proto3" json:"mpl,omitempty"`
Stock int64 `protobuf:"varint,25,opt,name=stock,proto3" json:"stock,omitempty"`
Attrs string `protobuf:"bytes,26,opt,name=attrs,proto3" json:"attrs,omitempty"`
Cost string `protobuf:"bytes,27,opt,name=cost,proto3" json:"cost,omitempty"`
NewCost string `protobuf:"bytes,28,opt,name=new_cost,json=newCost,proto3" json:"new_cost,omitempty"`
SupplierStock int64 `protobuf:"varint,29,opt,name=supplier_stock,json=supplierStock,proto3" json:"supplier_stock,omitempty"`
SelfSupplierType int64 `protobuf:"varint,30,opt,name=self_supplier_type,json=selfSupplierType,proto3" json:"self_supplier_type,omitempty"`
CnDeliveryTime string `protobuf:"bytes,31,opt,name=cn_delivery_time,json=cnDeliveryTime,proto3" json:"cn_delivery_time,omitempty"`
BrandName string `protobuf:"bytes,32,opt,name=brand_name,json=brandName,proto3" json:"brand_name,omitempty"`
SupplierName string `protobuf:"bytes,33,opt,name=supplier_name,json=supplierName,proto3" json:"supplier_name,omitempty"`
GoodsUnitName string `protobuf:"bytes,34,opt,name=goods_unit_name,json=goodsUnitName,proto3" json:"goods_unit_name,omitempty"`
PackingName string `protobuf:"bytes,35,opt,name=packing_name,json=packingName,proto3" json:"packing_name,omitempty"`
MpqUnitName string `protobuf:"bytes,36,opt,name=mpq_unit_name,json=mpqUnitName,proto3" json:"mpq_unit_name,omitempty"`
AcType int64 `protobuf:"varint,37,opt,name=ac_type,json=acType,proto3" json:"ac_type,omitempty"`
AllowCoupon int64 `protobuf:"varint,38,opt,name=allow_coupon,json=allowCoupon,proto3" json:"allow_coupon,omitempty"`
ClassId1Name string `protobuf:"bytes,39,opt,name=class_id1_name,json=classId1Name,proto3" json:"class_id1_name,omitempty"`
ClassId2Name string `protobuf:"bytes,40,opt,name=class_id2_name,json=classId2Name,proto3" json:"class_id2_name,omitempty"`
IsBuy int64 `protobuf:"varint,41,opt,name=is_buy,json=isBuy,proto3" json:"is_buy,omitempty"`
HkDeliveryType string `protobuf:"bytes,42,opt,name=hk_delivery_type,json=hkDeliveryType,proto3" json:"hk_delivery_type,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GoodsModel) Reset() { *m = GoodsModel{} }
func (m *GoodsModel) String() string { return proto.CompactTextString(m) }
func (*GoodsModel) ProtoMessage() {}
func (*GoodsModel) Descriptor() ([]byte, []int) {
return fileDescriptor_a30593c5487368b0, []int{2}
}
func (m *GoodsModel) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GoodsModel.Unmarshal(m, b)
}
func (m *GoodsModel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GoodsModel.Marshal(b, m, deterministic)
}
func (m *GoodsModel) XXX_Merge(src proto.Message) {
xxx_messageInfo_GoodsModel.Merge(m, src)
}
func (m *GoodsModel) XXX_Size() int {
return xxx_messageInfo_GoodsModel.Size(m)
}
func (m *GoodsModel) XXX_DiscardUnknown() {
xxx_messageInfo_GoodsModel.DiscardUnknown(m)
}
var xxx_messageInfo_GoodsModel proto.InternalMessageInfo
func (m *GoodsModel) GetOtherAttrs() *OTHER_ATTRS {
if m != nil {
return m.OtherAttrs
}
return nil
}
func (m *GoodsModel) GetPickType() int64 {
if m != nil {
return m.PickType
}
return 0
}
func (m *GoodsModel) GetBarcode() string {
if m != nil {
return m.Barcode
}
return ""
}
func (m *GoodsModel) GetGoodsId() string {
if m != nil {
return m.GoodsId
}
return ""
}
func (m *GoodsModel) GetGoodsType() int64 {
if m != nil {
return m.GoodsType
}
return 0
}
func (m *GoodsModel) GetSupplierId() int64 {
if m != nil {
return m.SupplierId
}
return 0
}
func (m *GoodsModel) GetBrandId() int64 {
if m != nil {
return m.BrandId
}
return 0
}
func (m *GoodsModel) GetClassId1() int64 {
if m != nil {
return m.ClassId1
}
return 0
}
func (m *GoodsModel) GetClassId2() int64 {
if m != nil {
return m.ClassId2
}
return 0
}
func (m *GoodsModel) GetGoodsName() string {
if m != nil {
return m.GoodsName
}
return ""
}
func (m *GoodsModel) GetStatus() int64 {
if m != nil {
return m.Status
}
return 0
}
func (m *GoodsModel) GetEncoded() string {
if m != nil {
return m.Encoded
}
return ""
}
func (m *GoodsModel) GetEncap() string {
if m != nil {
return m.Encap
}
return ""
}
func (m *GoodsModel) GetPacking() int64 {
if m != nil {
return m.Packing
}
return 0
}
func (m *GoodsModel) GetGoodsUnit() int64 {
if m != nil {
return m.GoodsUnit
}
return 0
}
func (m *GoodsModel) GetGoodsImages() bool {
if m != nil {
return m.GoodsImages
}
return false
}
func (m *GoodsModel) GetPdf() bool {
if m != nil {
return m.Pdf
}
return false
}
func (m *GoodsModel) GetGoodsBrief() string {
if m != nil {
return m.GoodsBrief
}
return ""
}
func (m *GoodsModel) GetMoq() int64 {
if m != nil {
return m.Moq
}
return 0
}
func (m *GoodsModel) GetMpq() int64 {
if m != nil {
return m.Mpq
}
return 0
}
func (m *GoodsModel) GetLadderPrice() []*LADDER_PRICE {
if m != nil {
return m.LadderPrice
}
return nil
}
func (m *GoodsModel) GetUpdateTime() int64 {
if m != nil {
return m.UpdateTime
}
return 0
}
func (m *GoodsModel) GetSkuName() string {
if m != nil {
return m.SkuName
}
return ""
}
func (m *GoodsModel) GetMpl() int64 {
if m != nil {
return m.Mpl
}
return 0
}
func (m *GoodsModel) GetStock() int64 {
if m != nil {
return m.Stock
}
return 0
}
func (m *GoodsModel) GetAttrs() string {
if m != nil {
return m.Attrs
}
return ""
}
func (m *GoodsModel) GetCost() string {
if m != nil {
return m.Cost
}
return ""
}
func (m *GoodsModel) GetNewCost() string {
if m != nil {
return m.NewCost
}
return ""
}
func (m *GoodsModel) GetSupplierStock() int64 {
if m != nil {
return m.SupplierStock
}
return 0
}
func (m *GoodsModel) GetSelfSupplierType() int64 {
if m != nil {
return m.SelfSupplierType
}
return 0
}
func (m *GoodsModel) GetCnDeliveryTime() string {
if m != nil {
return m.CnDeliveryTime
}
return ""
}
func (m *GoodsModel) GetBrandName() string {
if m != nil {
return m.BrandName
}
return ""
}
func (m *GoodsModel) GetSupplierName() string {
if m != nil {
return m.SupplierName
}
return ""
}
func (m *GoodsModel) GetGoodsUnitName() string {
if m != nil {
return m.GoodsUnitName
}
return ""
}
func (m *GoodsModel) GetPackingName() string {
if m != nil {
return m.PackingName
}
return ""
}
func (m *GoodsModel) GetMpqUnitName() string {
if m != nil {
return m.MpqUnitName
}
return ""
}
func (m *GoodsModel) GetAcType() int64 {
if m != nil {
return m.AcType
}
return 0
}
func (m *GoodsModel) GetAllowCoupon() int64 {
if m != nil {
return m.AllowCoupon
}
return 0
}
func (m *GoodsModel) GetClassId1Name() string {
if m != nil {
return m.ClassId1Name
}
return ""
}
func (m *GoodsModel) GetClassId2Name() string {
if m != nil {
return m.ClassId2Name
}
return ""
}
func (m *GoodsModel) GetIsBuy() int64 {
if m != nil {
return m.IsBuy
}
return 0
}
func (m *GoodsModel) GetHkDeliveryType() string {
if m != nil {
return m.HkDeliveryType
}
return ""
}
func init() {
proto.RegisterType((*OTHER_ATTRS)(nil), "goods.OTHER_ATTRS")
proto.RegisterType((*LADDER_PRICE)(nil), "goods.LADDER_PRICE")
proto.RegisterType((*GoodsModel)(nil), "goods.GoodsModel")
}
func init() { proto.RegisterFile("goods.proto", fileDescriptor_a30593c5487368b0) }
var fileDescriptor_a30593c5487368b0 = []byte{
// 774 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x54, 0x5d, 0x6f, 0xea, 0x46,
0x10, 0x15, 0x97, 0x1b, 0x3e, 0xc6, 0xc0, 0xa5, 0x7b, 0xef, 0x4d, 0x36, 0x4d, 0xd2, 0x00, 0xf9,
0x28, 0xad, 0xaa, 0xa8, 0x21, 0x52, 0xdf, 0x09, 0x89, 0x5a, 0xa4, 0x7e, 0x44, 0x0e, 0x51, 0x1f,
0xad, 0x65, 0xbd, 0x01, 0x0b, 0x7f, 0x2c, 0x5e, 0xbb, 0x11, 0x0f, 0xfd, 0x2b, 0xfd, 0xad, 0xd5,
0xce, 0x18, 0x70, 0xde, 0x3c, 0x67, 0xce, 0xee, 0x9c, 0x39, 0x9c, 0x05, 0x9c, 0x45, 0x92, 0xf8,
0xe6, 0x46, 0xa7, 0x49, 0x96, 0xb0, 0x03, 0x2c, 0x06, 0x3f, 0x83, 0xf3, 0xd7, 0xec, 0xb7, 0x47,
0xd7, 0x1b, 0xcf, 0x66, 0xee, 0x33, 0xeb, 0x43, 0x6b, 0x91, 0x26, 0xc6, 0x78, 0x6f, 0x6a, 0x11,
0x2c, 0x33, 0x5e, 0xe9, 0x55, 0x86, 0x4d, 0xd7, 0x41, 0xec, 0x6f, 0x84, 0x06, 0xff, 0x42, 0xeb,
0xf7, 0xf1, 0xc3, 0xc3, 0xa3, 0xeb, 0x3d, 0xb9, 0xd3, 0xc9, 0x23, 0x3b, 0x85, 0xa6, 0xce, 0x53,
0xb9, 0x14, 0x46, 0x19, 0xe4, 0x57, 0xdd, 0x3d, 0xc0, 0x8e, 0xa1, 0xa1, 0xd3, 0x40, 0x2a, 0x4f,
0xc6, 0xfc, 0x43, 0xaf, 0x32, 0xfc, 0xe0, 0xd6, 0xb1, 0x9e, 0xc4, 0xfb, 0x56, 0x6e, 0x78, 0xb5,
0xd4, 0x7a, 0x29, 0x9d, 0x12, 0x92, 0x7f, 0x2c, 0xb5, 0xc6, 0x72, 0xf0, 0x1f, 0x00, 0xfc, 0x6a,
0xa5, 0xff, 0x91, 0xf8, 0x2a, 0x64, 0x77, 0xe0, 0x24, 0xd9, 0x52, 0xa5, 0x9e, 0xc8, 0xb2, 0x94,
0xe6, 0x3b, 0x23, 0x76, 0x43, 0x9b, 0x96, 0x36, 0x73, 0x01, 0x69, 0x63, 0xcb, 0x62, 0x27, 0xd0,
0xd4, 0x81, 0x5c, 0x79, 0xd9, 0x46, 0x2b, 0x54, 0x55, 0x75, 0x1b, 0x16, 0x98, 0x6d, 0xb4, 0x62,
0x1c, 0xea, 0x73, 0x91, 0xca, 0xc4, 0x57, 0xa8, 0xaa, 0xe9, 0x6e, 0x4b, 0xab, 0x0a, 0xef, 0xf5,
0x02, 0x1f, 0x55, 0x35, 0xdd, 0x3a, 0xd6, 0x53, 0x9f, 0x9d, 0x01, 0x50, 0x0b, 0xaf, 0x3c, 0x20,
0x17, 0x10, 0xc1, 0x3b, 0xcf, 0xc1, 0x31, 0xb9, 0xd6, 0x61, 0xa0, 0x52, 0x7b, 0xb8, 0x86, 0x7d,
0xd8, 0x42, 0x53, 0xdf, 0x5e, 0x3d, 0x4f, 0x45, 0xec, 0xdb, 0x6e, 0x1d, 0xbb, 0x75, 0xac, 0xa7,
0xbe, 0x15, 0x2b, 0x43, 0x61, 0xec, 0xd4, 0x5b, 0xde, 0x20, 0xb1, 0x08, 0x4c, 0xfd, 0xdb, 0x72,
0x73, 0xc4, 0x9b, 0xef, 0x9a, 0xa3, 0xbd, 0xa8, 0x58, 0x44, 0x8a, 0x03, 0x2a, 0x26, 0x51, 0x7f,
0x8a, 0x48, 0xb1, 0x43, 0xa8, 0x99, 0x4c, 0x64, 0xb9, 0xe1, 0x0e, 0x1e, 0x2c, 0x2a, 0x6b, 0x80,
0x8a, 0xed, 0xc2, 0x3e, 0x6f, 0xd1, 0x96, 0x45, 0xc9, 0xbe, 0xc0, 0x81, 0x8a, 0xa5, 0xd0, 0xbc,
0x8d, 0x38, 0x15, 0x96, 0xaf, 0x85, 0x5c, 0x05, 0xf1, 0x82, 0x77, 0x48, 0x7a, 0x51, 0xee, 0x05,
0xe4, 0x71, 0x90, 0xf1, 0x4f, 0x25, 0x57, 0x5e, 0xe2, 0x20, 0xc3, 0xb0, 0x91, 0x9f, 0x91, 0x58,
0x28, 0xc3, 0xbb, 0xbd, 0xca, 0xb0, 0xe1, 0x52, 0x4a, 0xa7, 0x08, 0xb1, 0x2e, 0x54, 0xb5, 0xff,
0xca, 0xbf, 0xc1, 0x8e, 0xfd, 0xb4, 0x56, 0xd2, 0xa1, 0x79, 0x1a, 0xa8, 0x57, 0xce, 0x50, 0x09,
0x8d, 0xb9, 0xb7, 0x88, 0x3d, 0x12, 0x25, 0x6b, 0xfe, 0x19, 0xa7, 0xd9, 0x4f, 0x44, 0xf4, 0x9a,
0x7f, 0x29, 0x10, 0xbd, 0x66, 0xbf, 0x40, 0x2b, 0x14, 0xbe, 0xaf, 0x52, 0x0f, 0x63, 0xc5, 0xbf,
0xf6, 0xaa, 0x43, 0x67, 0xf4, 0xb9, 0x88, 0x4d, 0x39, 0xde, 0xae, 0x43, 0xc4, 0x27, 0xcb, 0xb3,
0xc3, 0x73, 0xed, 0x8b, 0x4c, 0x79, 0x59, 0x10, 0x29, 0x7e, 0x48, 0xbf, 0x23, 0x41, 0xb3, 0x20,
0xc2, 0x88, 0x98, 0x55, 0x4e, 0x86, 0x1f, 0x91, 0x79, 0x66, 0x95, 0xa3, 0xdd, 0xa8, 0x22, 0xe4,
0x7c, 0xab, 0x22, 0xb4, 0x76, 0x9a, 0x2c, 0x91, 0x2b, 0x7e, 0x8c, 0x18, 0x15, 0x16, 0xa5, 0x2c,
0x7f, 0x4b, 0x26, 0x63, 0xc1, 0x18, 0x7c, 0x94, 0x89, 0xc9, 0xf8, 0x09, 0x82, 0xf8, 0x6d, 0x87,
0xc5, 0xea, 0xcd, 0x43, 0xfc, 0x94, 0x86, 0xc5, 0xea, 0x6d, 0x62, 0x5b, 0x57, 0xd0, 0xd9, 0x05,
0x8e, 0x66, 0x9c, 0xe1, 0x8c, 0xf6, 0x16, 0x7d, 0xc6, 0x59, 0x3f, 0x01, 0x33, 0x2a, 0x7c, 0xf5,
0x76, 0x5c, 0x8c, 0xef, 0x77, 0x48, 0xed, 0xda, 0xce, 0x73, 0xd1, 0xc0, 0x14, 0x0f, 0xa1, 0x2b,
0x63, 0xcf, 0x57, 0x61, 0xf0, 0x8f, 0x4a, 0x37, 0x64, 0xc1, 0x39, 0xce, 0xed, 0xc8, 0xf8, 0xa1,
0x80, 0xd1, 0x86, 0x33, 0x00, 0x8a, 0x33, 0x1a, 0xd1, 0xa3, 0xe4, 0x21, 0x82, 0x56, 0x5c, 0xc0,
0x4e, 0x07, 0x31, 0xfa, 0xc8, 0x68, 0x6d, 0x41, 0x24, 0x5d, 0xc3, 0xa7, 0x7d, 0x78, 0x88, 0x36,
0x40, 0x5a, 0x7b, 0x97, 0x20, 0xe4, 0xf5, 0xa1, 0x55, 0xe4, 0x8d, 0x48, 0x17, 0xf4, 0x97, 0x55,
0x60, 0x48, 0x19, 0x40, 0x3b, 0xd2, 0xeb, 0xd2, 0x45, 0x97, 0xc4, 0x89, 0xf4, 0x7a, 0x77, 0xcd,
0x11, 0xd4, 0x85, 0xa4, 0xfd, 0xaf, 0xe8, 0x39, 0x08, 0x89, 0x5b, 0xf7, 0xa1, 0x25, 0xc2, 0x30,
0xb1, 0x3e, 0xe7, 0x3a, 0x89, 0xf9, 0x35, 0x76, 0x1d, 0xc4, 0x26, 0x08, 0xb1, 0x4b, 0xe8, 0xec,
0x9e, 0x28, 0x0d, 0xf8, 0x9e, 0x16, 0xda, 0xbe, 0x53, 0x9c, 0x50, 0x62, 0x8d, 0x88, 0x35, 0x7c,
0xc7, 0x1a, 0x21, 0xeb, 0x2b, 0xd4, 0x02, 0xe3, 0xcd, 0xf3, 0x0d, 0xff, 0x81, 0x52, 0x11, 0x98,
0xfb, 0x7c, 0x63, 0xbd, 0x5f, 0xae, 0x4a, 0xde, 0x5b, 0x9d, 0x3f, 0x92, 0xf7, 0xcb, 0xd5, 0xce,
0xfb, 0x8d, 0x56, 0xf3, 0x1a, 0xfe, 0xbf, 0xdf, 0xfd, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x3b, 0xa6,
0xc1, 0x76, 0xee, 0x05, 0x00, 0x00,
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: goods.proto
package goods
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: mouser.proto
package mouser
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type MouserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: uri:"goods_name"
GoodsName string `protobuf:"bytes,1,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty"`
}
func (x *MouserRequest) Reset() {
*x = MouserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MouserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MouserRequest) ProtoMessage() {}
func (x *MouserRequest) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MouserRequest.ProtoReflect.Descriptor instead.
func (*MouserRequest) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{0}
}
func (x *MouserRequest) GetGoodsName() string {
if x != nil {
return x.GoodsName
}
return ""
}
type ResponseData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: json:"total"
Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
// @inject_tag: json:"flag"
Flag int32 `protobuf:"varint,2,opt,name=flag,proto3" json:"flag,omitempty"`
// @inject_tag: json:"data"
Data []*GoodsModel `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *ResponseData) Reset() {
*x = ResponseData{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResponseData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResponseData) ProtoMessage() {}
func (x *ResponseData) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResponseData.ProtoReflect.Descriptor instead.
func (*ResponseData) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{1}
}
func (x *ResponseData) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
func (x *ResponseData) GetFlag() int32 {
if x != nil {
return x.Flag
}
return 0
}
func (x *ResponseData) GetData() []*GoodsModel {
if x != nil {
return x.Data
}
return nil
}
type MouserResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: json:"error_code"
ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
// @inject_tag: json:"error_message"
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
// @inject_tag: json:"data"
Data *ResponseData `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}
func (x *MouserResponse) Reset() {
*x = MouserResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MouserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MouserResponse) ProtoMessage() {}
func (x *MouserResponse) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MouserResponse.ProtoReflect.Descriptor instead.
func (*MouserResponse) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{2}
}
func (x *MouserResponse) GetErrorCode() int32 {
if x != nil {
return x.ErrorCode
}
return 0
}
func (x *MouserResponse) GetErrorMessage() string {
if x != nil {
return x.ErrorMessage
}
return ""
}
func (x *MouserResponse) GetData() *ResponseData {
if x != nil {
return x.Data
}
return nil
}
type OtherAttrs struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GrossWegiht string `protobuf:"bytes,1,opt,name=gross_wegiht,json=grossWegiht,proto3" json:"gross_wegiht,omitempty"`
}
func (x *OtherAttrs) Reset() {
*x = OtherAttrs{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OtherAttrs) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OtherAttrs) ProtoMessage() {}
func (x *OtherAttrs) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OtherAttrs.ProtoReflect.Descriptor instead.
func (*OtherAttrs) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{3}
}
func (x *OtherAttrs) GetGrossWegiht() string {
if x != nil {
return x.GrossWegiht
}
return ""
}
type LadderPrice struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Purchases int64 `protobuf:"varint,1,opt,name=purchases,proto3" json:"purchases,omitempty"`
PriceCn float32 `protobuf:"fixed32,2,opt,name=price_cn,json=priceCn,proto3" json:"price_cn,omitempty"`
PriceUs float32 `protobuf:"fixed32,3,opt,name=price_us,json=priceUs,proto3" json:"price_us,omitempty"`
PriceAc float32 `protobuf:"fixed32,4,opt,name=price_ac,json=priceAc,proto3" json:"price_ac,omitempty"`
}
func (x *LadderPrice) Reset() {
*x = LadderPrice{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LadderPrice) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LadderPrice) ProtoMessage() {}
func (x *LadderPrice) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LadderPrice.ProtoReflect.Descriptor instead.
func (*LadderPrice) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{4}
}
func (x *LadderPrice) GetPurchases() int64 {
if x != nil {
return x.Purchases
}
return 0
}
func (x *LadderPrice) GetPriceCn() float32 {
if x != nil {
return x.PriceCn
}
return 0
}
func (x *LadderPrice) GetPriceUs() float32 {
if x != nil {
return x.PriceUs
}
return 0
}
func (x *LadderPrice) GetPriceAc() float32 {
if x != nil {
return x.PriceAc
}
return 0
}
type GoodsModel struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: json:"other_attrs"
OtherAttrs *OtherAttrs `protobuf:"bytes,1,opt,name=other_attrs,json=otherAttrs,proto3" json:"other_attrs,omitempty"`
// @inject_tag: json:"pick_type"
PickType int64 `protobuf:"varint,2,opt,name=pick_type,json=pickType,proto3" json:"pick_type,omitempty"`
// @inject_tag: json:"barcode"
Barcode string `protobuf:"bytes,3,opt,name=barcode,proto3" json:"barcode,omitempty"`
// @inject_tag: json:"goods_id"
GoodsId string `protobuf:"bytes,4,opt,name=goods_id,json=goodsId,proto3" json:"goods_id,omitempty"`
// @inject_tag: json:"goods_type
GoodsType int64 `protobuf:"varint,5,opt,name=goods_type,json=goodsType,proto3" json:"goods_type,omitempty"`
// @inject_tag: json:"supplier_id"
SupplierId int64 `protobuf:"varint,6,opt,name=supplier_id,json=supplierId,proto3" json:"supplier_id,omitempty"`
// @inject_tag: json:"brand_id"
BrandId int64 `protobuf:"varint,7,opt,name=brand_id,json=brandId,proto3" json:"brand_id,omitempty"`
// @inject_tag: json:"class_id1"
ClassId1 int64 `protobuf:"varint,8,opt,name=class_id1,json=classId1,proto3" json:"class_id1,omitempty"`
// @inject_tag: json:"class_id2"
ClassId2 int64 `protobuf:"varint,9,opt,name=class_id2,json=classId2,proto3" json:"class_id2,omitempty"`
// @inject_tag: json:"goods_name"
GoodsName string `protobuf:"bytes,10,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty"`
// @inject_tag: json:"status"
Status int64 `protobuf:"varint,11,opt,name=status,proto3" json:"status,omitempty"`
// @inject_tag: json:"encoded"
Encoded string `protobuf:"bytes,12,opt,name=encoded,proto3" json:"encoded,omitempty"`
// @inject_tag: json:"encap"
Encap string `protobuf:"bytes,13,opt,name=encap,proto3" json:"encap,omitempty"`
// @inject_tag: json:"packing"
Packing int64 `protobuf:"varint,14,opt,name=packing,proto3" json:"packing,omitempty"`
// @inject_tag: json:"goods_unit"
GoodsUnit int64 `protobuf:"varint,15,opt,name=goods_unit,json=goodsUnit,proto3" json:"goods_unit,omitempty"`
// @inject_tag: json:"goods_images"
GoodsImages bool `protobuf:"varint,16,opt,name=goods_images,json=goodsImages,proto3" json:"goods_images,omitempty"`
// @inject_tag: json:"pdf"
Pdf string `protobuf:"bytes,17,opt,name=pdf,proto3" json:"pdf,omitempty"`
// @inject_tag: json:"goods_brief"
GoodsBrief string `protobuf:"bytes,18,opt,name=goods_brief,json=goodsBrief,proto3" json:"goods_brief,omitempty"`
// @inject_tag: json:"moq"
Moq int64 `protobuf:"varint,19,opt,name=moq,proto3" json:"moq,omitempty"`
// @inject_tag: json:"mpq"
Mpq int64 `protobuf:"varint,20,opt,name=mpq,proto3" json:"mpq,omitempty"`
// @inject_tag: json:"ladder_price"
LadderPrice []*LadderPrice `protobuf:"bytes,21,rep,name=ladder_price,json=ladderPrice,proto3" json:"ladder_price,omitempty"`
// @inject_tag: json:"update_time"
UpdateTime int64 `protobuf:"varint,22,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
// @inject_tag: json:"sku_name"
SkuName string `protobuf:"bytes,23,opt,name=sku_name,json=skuName,proto3" json:"sku_name,omitempty"`
// @inject_tag: json:"mpl"
Mpl int64 `protobuf:"varint,24,opt,name=mpl,proto3" json:"mpl,omitempty"`
// @inject_tag: json:"stock"
Stock int64 `protobuf:"varint,25,opt,name=stock,proto3" json:"stock,omitempty"`
// @inject_tag: json:"attrs"
Attrs string `protobuf:"bytes,26,opt,name=attrs,proto3" json:"attrs,omitempty"`
// @inject_tag: json:"cost"
Cost string `protobuf:"bytes,27,opt,name=cost,proto3" json:"cost,omitempty"`
// @inject_tag: json:"new_cost"
NewCost string `protobuf:"bytes,28,opt,name=new_cost,json=newCost,proto3" json:"new_cost,omitempty"`
// @inject_tag: json:"supplier_stock"
SupplierStock int64 `protobuf:"varint,29,opt,name=supplier_stock,json=supplierStock,proto3" json:"supplier_stock,omitempty"`
// @inject_tag: json:"self_supplier_type"
SelfSupplierType int64 `protobuf:"varint,30,opt,name=self_supplier_type,json=selfSupplierType,proto3" json:"self_supplier_type,omitempty"`
// @inject_tag: json:"cn_delivery_time"
CnDeliveryTime string `protobuf:"bytes,31,opt,name=cn_delivery_time,json=cnDeliveryTime,proto3" json:"cn_delivery_time,omitempty"`
// @inject_tag: json:"brand_name"
BrandName string `protobuf:"bytes,32,opt,name=brand_name,json=brandName,proto3" json:"brand_name,omitempty"`
// @inject_tag: json:"supplier_name"
SupplierName string `protobuf:"bytes,33,opt,name=supplier_name,json=supplierName,proto3" json:"supplier_name,omitempty"`
GoodsUnitName string `protobuf:"bytes,34,opt,name=goods_unit_name,json=goodsUnitName,proto3" json:"goods_unit_name,omitempty"`
PackingName string `protobuf:"bytes,35,opt,name=packing_name,json=packingName,proto3" json:"packing_name,omitempty"`
MpqUnitName string `protobuf:"bytes,36,opt,name=mpq_unit_name,json=mpqUnitName,proto3" json:"mpq_unit_name,omitempty"`
// @inject_tag: json:"ac_type"
AcType int64 `protobuf:"varint,37,opt,name=ac_type,json=acType,proto3" json:"ac_type,omitempty"`
AllowCoupon int64 `protobuf:"varint,38,opt,name=allow_coupon,json=allowCoupon,proto3" json:"allow_coupon,omitempty"`
ClassId1Name string `protobuf:"bytes,39,opt,name=class_id1_name,json=classId1Name,proto3" json:"class_id1_name,omitempty"`
ClassId2Name string `protobuf:"bytes,40,opt,name=class_id2_name,json=classId2Name,proto3" json:"class_id2_name,omitempty"`
// @inject_tag: json:"otheis_buyr_attrs"
IsBuy int64 `protobuf:"varint,41,opt,name=is_buy,json=isBuy,proto3" json:"is_buy,omitempty"`
// @inject_tag: json:"hk_delivery_type"
HkDeliveryType string `protobuf:"bytes,42,opt,name=hk_delivery_type,json=hkDeliveryType,proto3" json:"hk_delivery_type,omitempty"`
}
func (x *GoodsModel) Reset() {
*x = GoodsModel{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GoodsModel) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GoodsModel) ProtoMessage() {}
func (x *GoodsModel) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GoodsModel.ProtoReflect.Descriptor instead.
func (*GoodsModel) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{5}
}
func (x *GoodsModel) GetOtherAttrs() *OtherAttrs {
if x != nil {
return x.OtherAttrs
}
return nil
}
func (x *GoodsModel) GetPickType() int64 {
if x != nil {
return x.PickType
}
return 0
}
func (x *GoodsModel) GetBarcode() string {
if x != nil {
return x.Barcode
}
return ""
}
func (x *GoodsModel) GetGoodsId() string {
if x != nil {
return x.GoodsId
}
return ""
}
func (x *GoodsModel) GetGoodsType() int64 {
if x != nil {
return x.GoodsType
}
return 0
}
func (x *GoodsModel) GetSupplierId() int64 {
if x != nil {
return x.SupplierId
}
return 0
}
func (x *GoodsModel) GetBrandId() int64 {
if x != nil {
return x.BrandId
}
return 0
}
func (x *GoodsModel) GetClassId1() int64 {
if x != nil {
return x.ClassId1
}
return 0
}
func (x *GoodsModel) GetClassId2() int64 {
if x != nil {
return x.ClassId2
}
return 0
}
func (x *GoodsModel) GetGoodsName() string {
if x != nil {
return x.GoodsName
}
return ""
}
func (x *GoodsModel) GetStatus() int64 {
if x != nil {
return x.Status
}
return 0
}
func (x *GoodsModel) GetEncoded() string {
if x != nil {
return x.Encoded
}
return ""
}
func (x *GoodsModel) GetEncap() string {
if x != nil {
return x.Encap
}
return ""
}
func (x *GoodsModel) GetPacking() int64 {
if x != nil {
return x.Packing
}
return 0
}
func (x *GoodsModel) GetGoodsUnit() int64 {
if x != nil {
return x.GoodsUnit
}
return 0
}
func (x *GoodsModel) GetGoodsImages() bool {
if x != nil {
return x.GoodsImages
}
return false
}
func (x *GoodsModel) GetPdf() string {
if x != nil {
return x.Pdf
}
return ""
}
func (x *GoodsModel) GetGoodsBrief() string {
if x != nil {
return x.GoodsBrief
}
return ""
}
func (x *GoodsModel) GetMoq() int64 {
if x != nil {
return x.Moq
}
return 0
}
func (x *GoodsModel) GetMpq() int64 {
if x != nil {
return x.Mpq
}
return 0
}
func (x *GoodsModel) GetLadderPrice() []*LadderPrice {
if x != nil {
return x.LadderPrice
}
return nil
}
func (x *GoodsModel) GetUpdateTime() int64 {
if x != nil {
return x.UpdateTime
}
return 0
}
func (x *GoodsModel) GetSkuName() string {
if x != nil {
return x.SkuName
}
return ""
}
func (x *GoodsModel) GetMpl() int64 {
if x != nil {
return x.Mpl
}
return 0
}
func (x *GoodsModel) GetStock() int64 {
if x != nil {
return x.Stock
}
return 0
}
func (x *GoodsModel) GetAttrs() string {
if x != nil {
return x.Attrs
}
return ""
}
func (x *GoodsModel) GetCost() string {
if x != nil {
return x.Cost
}
return ""
}
func (x *GoodsModel) GetNewCost() string {
if x != nil {
return x.NewCost
}
return ""
}
func (x *GoodsModel) GetSupplierStock() int64 {
if x != nil {
return x.SupplierStock
}
return 0
}
func (x *GoodsModel) GetSelfSupplierType() int64 {
if x != nil {
return x.SelfSupplierType
}
return 0
}
func (x *GoodsModel) GetCnDeliveryTime() string {
if x != nil {
return x.CnDeliveryTime
}
return ""
}
func (x *GoodsModel) GetBrandName() string {
if x != nil {
return x.BrandName
}
return ""
}
func (x *GoodsModel) GetSupplierName() string {
if x != nil {
return x.SupplierName
}
return ""
}
func (x *GoodsModel) GetGoodsUnitName() string {
if x != nil {
return x.GoodsUnitName
}
return ""
}
func (x *GoodsModel) GetPackingName() string {
if x != nil {
return x.PackingName
}
return ""
}
func (x *GoodsModel) GetMpqUnitName() string {
if x != nil {
return x.MpqUnitName
}
return ""
}
func (x *GoodsModel) GetAcType() int64 {
if x != nil {
return x.AcType
}
return 0
}
func (x *GoodsModel) GetAllowCoupon() int64 {
if x != nil {
return x.AllowCoupon
}
return 0
}
func (x *GoodsModel) GetClassId1Name() string {
if x != nil {
return x.ClassId1Name
}
return ""
}
func (x *GoodsModel) GetClassId2Name() string {
if x != nil {
return x.ClassId2Name
}
return ""
}
func (x *GoodsModel) GetIsBuy() int64 {
if x != nil {
return x.IsBuy
}
return 0
}
func (x *GoodsModel) GetHkDeliveryType() string {
if x != nil {
return x.HkDeliveryType
}
return ""
}
var File_mouser_proto protoreflect.FileDescriptor
var file_mouser_proto_rawDesc = []byte{
0x0a, 0x0c, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x22, 0x2e, 0x0a, 0x0d, 0x4d, 0x6f, 0x75, 0x73, 0x65, 0x72,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x6f,
0x64, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04,
0x66, 0x6c, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67,
0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12,
0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x4d, 0x6f, 0x64,
0x65, 0x6c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7e, 0x0a, 0x0e, 0x4d, 0x6f, 0x75, 0x73,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72,
0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x28,
0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d,
0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x61,
0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2f, 0x0a, 0x0a, 0x4f, 0x74, 0x68, 0x65,
0x72, 0x41, 0x74, 0x74, 0x72, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x72, 0x6f, 0x73, 0x73, 0x5f,
0x77, 0x65, 0x67, 0x69, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x67, 0x72,
0x6f, 0x73, 0x73, 0x57, 0x65, 0x67, 0x69, 0x68, 0x74, 0x22, 0x7c, 0x0a, 0x0b, 0x4c, 0x61, 0x64,
0x64, 0x65, 0x72, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x72, 0x63,
0x68, 0x61, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x75, 0x72,
0x63, 0x68, 0x61, 0x73, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x63, 0x65, 0x5f,
0x63, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x07, 0x70, 0x72, 0x69, 0x63, 0x65, 0x43,
0x6e, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x18, 0x03, 0x20,
0x01, 0x28, 0x02, 0x52, 0x07, 0x70, 0x72, 0x69, 0x63, 0x65, 0x55, 0x73, 0x12, 0x19, 0x0a, 0x08,
0x70, 0x72, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x07,
0x70, 0x72, 0x69, 0x63, 0x65, 0x41, 0x63, 0x22, 0x9e, 0x0a, 0x0a, 0x0a, 0x47, 0x6f, 0x6f, 0x64,
0x73, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x33, 0x0a, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f,
0x61, 0x74, 0x74, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x6f,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x41, 0x74, 0x74, 0x72, 0x73, 0x52,
0x0a, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x41, 0x74, 0x74, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70,
0x69, 0x63, 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
0x70, 0x69, 0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x72, 0x63,
0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f,
0x64, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x1d, 0x0a,
0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b,
0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a,
0x08, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52,
0x07, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x61, 0x73,
0x73, 0x5f, 0x69, 0x64, 0x31, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x6c, 0x61,
0x73, 0x73, 0x49, 0x64, 0x31, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69,
0x64, 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49,
0x64, 0x32, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28,
0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x63,
0x6f, 0x64, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x63, 0x6f,
0x64, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x63, 0x61, 0x70, 0x18, 0x0d, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x63, 0x61, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63,
0x6b, 0x69, 0x6e, 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b,
0x69, 0x6e, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x75, 0x6e, 0x69,
0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x55, 0x6e,
0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x69, 0x6d, 0x61, 0x67,
0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49,
0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x64, 0x66, 0x18, 0x11, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x70, 0x64, 0x66, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x6f, 0x6f, 0x64, 0x73,
0x5f, 0x62, 0x72, 0x69, 0x65, 0x66, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x6f,
0x6f, 0x64, 0x73, 0x42, 0x72, 0x69, 0x65, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x6f, 0x71, 0x18,
0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x6f, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x70,
0x71, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x70, 0x71, 0x12, 0x36, 0x0a, 0x0c,
0x6c, 0x61, 0x64, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x15, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x61, 0x64, 0x64,
0x65, 0x72, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x0b, 0x6c, 0x61, 0x64, 0x64, 0x65, 0x72, 0x50,
0x72, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x6b, 0x75, 0x5f, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x6b, 0x75, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x10, 0x0a, 0x03, 0x6d, 0x70, 0x6c, 0x18, 0x18, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d,
0x70, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x18, 0x19, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72,
0x73, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x12, 0x12,
0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f,
0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x1c,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x43, 0x6f, 0x73, 0x74, 0x12, 0x25, 0x0a,
0x0e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x18,
0x1d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53,
0x74, 0x6f, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x65, 0x6c, 0x66, 0x5f, 0x73, 0x75, 0x70,
0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x03,
0x52, 0x10, 0x73, 0x65, 0x6c, 0x66, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x54, 0x79,
0x70, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72,
0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6e,
0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a,
0x62, 0x72, 0x61, 0x6e, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x20, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73,
0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x21, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x26, 0x0a, 0x0f, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x67, 0x6f, 0x6f, 0x64, 0x73,
0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x63, 0x6b,
0x69, 0x6e, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x23, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x70, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6d,
0x70, 0x71, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x24, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x6d, 0x70, 0x71, 0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x17, 0x0a, 0x07, 0x61, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x61, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x6c, 0x6c, 0x6f,
0x77, 0x5f, 0x63, 0x6f, 0x75, 0x70, 0x6f, 0x6e, 0x18, 0x26, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b,
0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x70, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x63,
0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x31, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x27, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x31, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x24, 0x0a, 0x0e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x32, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x73, 0x73,
0x49, 0x64, 0x32, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x73, 0x5f, 0x62, 0x75,
0x79, 0x18, 0x29, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x73, 0x42, 0x75, 0x79, 0x12, 0x28,
0x0a, 0x10, 0x68, 0x6b, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x6b, 0x44, 0x65, 0x6c, 0x69,
0x76, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x32, 0x4f, 0x0a, 0x0d, 0x4d, 0x6f, 0x75, 0x73,
0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x4d, 0x6f, 0x75,
0x73, 0x65, 0x72, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x15, 0x2e, 0x6d, 0x6f, 0x75,
0x73, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x75, 0x73, 0x65,
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_mouser_proto_rawDescOnce sync.Once
file_mouser_proto_rawDescData = file_mouser_proto_rawDesc
)
func file_mouser_proto_rawDescGZIP() []byte {
file_mouser_proto_rawDescOnce.Do(func() {
file_mouser_proto_rawDescData = protoimpl.X.CompressGZIP(file_mouser_proto_rawDescData)
})
return file_mouser_proto_rawDescData
}
var file_mouser_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_mouser_proto_goTypes = []interface{}{
(*MouserRequest)(nil), // 0: mouser.MouserRequest
(*ResponseData)(nil), // 1: mouser.ResponseData
(*MouserResponse)(nil), // 2: mouser.MouserResponse
(*OtherAttrs)(nil), // 3: mouser.OtherAttrs
(*LadderPrice)(nil), // 4: mouser.LadderPrice
(*GoodsModel)(nil), // 5: mouser.GoodsModel
}
var file_mouser_proto_depIdxs = []int32{
5, // 0: mouser.ResponseData.data:type_name -> mouser.GoodsModel
1, // 1: mouser.MouserResponse.data:type_name -> mouser.ResponseData
3, // 2: mouser.GoodsModel.other_attrs:type_name -> mouser.OtherAttrs
4, // 3: mouser.GoodsModel.ladder_price:type_name -> mouser.LadderPrice
0, // 4: mouser.MouserService.MouserGetData:input_type -> mouser.MouserRequest
2, // 5: mouser.MouserService.MouserGetData:output_type -> mouser.MouserResponse
5, // [5:6] is the sub-list for method output_type
4, // [4:5] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_mouser_proto_init() }
func file_mouser_proto_init() {
if File_mouser_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_mouser_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MouserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResponseData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MouserResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OtherAttrs); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LadderPrice); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GoodsModel); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mouser_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_mouser_proto_goTypes,
DependencyIndexes: file_mouser_proto_depIdxs,
MessageInfos: file_mouser_proto_msgTypes,
}.Build()
File_mouser_proto = out.File
file_mouser_proto_rawDesc = nil
file_mouser_proto_goTypes = nil
file_mouser_proto_depIdxs = nil
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: mouser.proto
package mouser
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for MouserService service
type MouserService interface {
MouserGetData(ctx context.Context, in *MouserRequest, opts ...client.CallOption) (*MouserResponse, error)
}
type mouserService struct {
c client.Client
name string
}
func NewMouserService(name string, c client.Client) MouserService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "mouser"
}
return &mouserService{
c: c,
name: name,
}
}
func (c *mouserService) MouserGetData(ctx context.Context, in *MouserRequest, opts ...client.CallOption) (*MouserResponse, error) {
req := c.c.NewRequest(c.name, "MouserService.MouserGetData", in)
out := new(MouserResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for MouserService service
type MouserServiceHandler interface {
MouserGetData(context.Context, *MouserRequest, *MouserResponse) error
}
func RegisterMouserServiceHandler(s server.Server, hdlr MouserServiceHandler, opts ...server.HandlerOption) error {
type mouserService interface {
MouserGetData(ctx context.Context, in *MouserRequest, out *MouserResponse) error
}
type MouserService struct {
mouserService
}
h := &mouserServiceHandler{hdlr}
return s.Handle(s.NewHandler(&MouserService{h}, opts...))
}
type mouserServiceHandler struct {
MouserServiceHandler
}
func (h *mouserServiceHandler) MouserGetData(ctx context.Context, in *MouserRequest, out *MouserResponse) error {
return h.MouserServiceHandler.MouserGetData(ctx, in, out)
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: users.proto
package users
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type UserRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UserRequest) Reset() { *m = UserRequest{} }
func (m *UserRequest) String() string { return proto.CompactTextString(m) }
func (*UserRequest) ProtoMessage() {}
func (*UserRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_030765f334c86cea, []int{0}
}
func (m *UserRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserRequest.Unmarshal(m, b)
}
func (m *UserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UserRequest.Marshal(b, m, deterministic)
}
func (m *UserRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_UserRequest.Merge(m, src)
}
func (m *UserRequest) XXX_Size() int {
return xxx_messageInfo_UserRequest.Size(m)
}
func (m *UserRequest) XXX_DiscardUnknown() {
xxx_messageInfo_UserRequest.DiscardUnknown(m)
}
var xxx_messageInfo_UserRequest proto.InternalMessageInfo
func (m *UserRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type UserResponse struct {
Ret string `protobuf:"bytes,2,opt,name=ret,proto3" json:"ret,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UserResponse) Reset() { *m = UserResponse{} }
func (m *UserResponse) String() string { return proto.CompactTextString(m) }
func (*UserResponse) ProtoMessage() {}
func (*UserResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_030765f334c86cea, []int{1}
}
func (m *UserResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserResponse.Unmarshal(m, b)
}
func (m *UserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UserResponse.Marshal(b, m, deterministic)
}
func (m *UserResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_UserResponse.Merge(m, src)
}
func (m *UserResponse) XXX_Size() int {
return xxx_messageInfo_UserResponse.Size(m)
}
func (m *UserResponse) XXX_DiscardUnknown() {
xxx_messageInfo_UserResponse.DiscardUnknown(m)
}
var xxx_messageInfo_UserResponse proto.InternalMessageInfo
func (m *UserResponse) GetRet() string {
if m != nil {
return m.Ret
}
return ""
}
func init() {
proto.RegisterType((*UserRequest)(nil), "users.UserRequest")
proto.RegisterType((*UserResponse)(nil), "users.UserResponse")
}
func init() { proto.RegisterFile("users.proto", fileDescriptor_030765f334c86cea) }
var fileDescriptor_030765f334c86cea = []byte{
// 134 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x2d, 0x4e, 0x2d,
0x2a, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x73, 0x94, 0x64, 0xb9, 0xb8, 0x43,
0x8b, 0x53, 0x8b, 0x82, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0xf8, 0xb8, 0x98, 0x32, 0x53,
0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x98, 0x32, 0x53, 0x94, 0x14, 0xb8, 0x78, 0x20, 0xd2,
0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x02, 0x5c, 0xcc, 0x45, 0xa9, 0x25, 0x12, 0x4c, 0x60,
0x05, 0x20, 0xa6, 0x91, 0x03, 0xc4, 0x80, 0xe0, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0x54, 0x21, 0x43,
0x2e, 0x96, 0x10, 0x90, 0x41, 0x42, 0x7a, 0x10, 0xcb, 0x90, 0x0c, 0x97, 0x12, 0x46, 0x11, 0x83,
0x98, 0xa8, 0xc4, 0x90, 0xc4, 0x06, 0x76, 0x90, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x35, 0x8a,
0xe3, 0x2d, 0x9f, 0x00, 0x00, 0x00,
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: users.proto
package users
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for UserService service
func NewUserServiceEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for UserService service
type UserService interface {
Test(ctx context.Context, in *UserRequest, opts ...client.CallOption) (*UserResponse, error)
}
type userService struct {
c client.Client
name string
}
func NewUserService(name string, c client.Client) UserService {
return &userService{
c: c,
name: name,
}
}
func (c *userService) Test(ctx context.Context, in *UserRequest, opts ...client.CallOption) (*UserResponse, error) {
req := c.c.NewRequest(c.name, "UserService.Test", in)
out := new(UserResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for UserService service
type UserServiceHandler interface {
Test(context.Context, *UserRequest, *UserResponse) error
}
func RegisterUserServiceHandler(s server.Server, hdlr UserServiceHandler, opts ...server.HandlerOption) error {
type userService interface {
Test(ctx context.Context, in *UserRequest, out *UserResponse) error
}
type UserService struct {
userService
}
h := &userServiceHandler{hdlr}
return s.Handle(s.NewHandler(&UserService{h}, opts...))
}
type userServiceHandler struct {
UserServiceHandler
}
func (h *userServiceHandler) Test(ctx context.Context, in *UserRequest, out *UserResponse) error {
return h.UserServiceHandler.Test(ctx, in, out)
}
syntax = "proto3";
package bom;
service BomService {
rpc AutoSpu(AutoSpuRequest) returns (AutoSpuResponse);
}
message AutoSpuRequest {
// @inject_tag: uri:"goods_name"
string goods_name = 1;
}
message AutoSpuResponse{
// @inject_tag: json:"error_code"
int32 error_code = 1;
// @inject_tag: json:"error_message"
string error_message = 2;
// @inject_tag: json:"data"
repeated string data = 3;
}
message RecommendRequest{
// @inject_tag: form:"goods_name"
string goods_name = 1;
// @inject_tag: form:"attrs"
string attrs = 2;
// @inject_tag: form:"encap"
string encap = 3;
// @inject_tag: form:"num"
int32 num = 4;
// @inject_tag: form:"delivery_type"
int32 delivery_type = 5;
// @inject_tag: form:"flag"
int32 flag = 6;
// @inject_tag: form:"brand_name"
string brand_name = 7;
}
message ResponseData{
// @inject_tag: json:"total"
int64 total = 1;
// @inject_tag: json:"flag"
int32 flag = 2;
// @inject_tag: json:"data"
repeated GoodsModel data = 3;
}
message RecommendResponse{
// @inject_tag: json:"error_code"
int32 error_code = 1;
// @inject_tag: json:"error_message"
string error_message = 2;
// @inject_tag: json:"data"
ResponseData data = 3;
}
message OtherAttrs {
string gross_wegiht = 1;
}
message LadderPrice {
int64 purchases = 1;
float price_cn = 2;
float price_us = 3;
float price_ac = 4;
}
message GoodsModel {
// @inject_tag: json:"other_attrs"
OtherAttrs other_attrs = 1;
// @inject_tag: json:"pick_type"
int64 pick_type = 2;
// @inject_tag: json:"barcode"
string barcode = 3;
// @inject_tag: json:"goods_id"
string goods_id = 4;
// @inject_tag: json:"goods_type
int64 goods_type = 5;
// @inject_tag: json:"supplier_id"
int64 supplier_id = 6;
// @inject_tag: json:"brand_id"
int64 brand_id = 7;
// @inject_tag: json:"class_id1"
int64 class_id1 = 8;
// @inject_tag: json:"class_id2"
int64 class_id2 = 9;
// @inject_tag: json:"goods_name"
string goods_name = 10;
// @inject_tag: json:"status"
int64 status = 11;
// @inject_tag: json:"encoded"
string encoded = 12;
// @inject_tag: json:"encap"
string encap = 13;
// @inject_tag: json:"packing"
int64 packing = 14;
// @inject_tag: json:"goods_unit"
int64 goods_unit = 15;
// @inject_tag: json:"goods_images"
bool goods_images = 16;
// @inject_tag: json:"pdf"
string pdf = 17;
// @inject_tag: json:"goods_brief"
string goods_brief = 18;
// @inject_tag: json:"moq"
int64 moq = 19;
// @inject_tag: json:"mpq"
int64 mpq = 20;
// @inject_tag: json:"ladder_price"
repeated LadderPrice ladder_price = 21;
// @inject_tag: json:"update_time"
int64 update_time = 22;
// @inject_tag: json:"sku_name"
string sku_name = 23;
// @inject_tag: json:"mpl"
int64 mpl = 24;
// @inject_tag: json:"stock"
int64 stock = 25;
// @inject_tag: json:"attrs"
string attrs = 26;
// @inject_tag: json:"cost"
string cost = 27;
// @inject_tag: json:"new_cost"
string new_cost = 28;
// @inject_tag: json:"supplier_stock"
int64 supplier_stock = 29;
// @inject_tag: json:"self_supplier_type"
int64 self_supplier_type = 30;
// @inject_tag: json:"cn_delivery_time"
string cn_delivery_time = 31;
// @inject_tag: json:"brand_name"
string brand_name = 32;
// @inject_tag: json:"supplier_name"
string supplier_name = 33;
string goods_unit_name = 34;
string packing_name = 35;
string mpq_unit_name = 36;
// @inject_tag: json:"ac_type"
int64 ac_type = 37;
int64 allow_coupon = 38;
string class_id1_name = 39;
string class_id2_name = 40;
// @inject_tag: json:"otheis_buyr_attrs"
int64 is_buy = 41;
// @inject_tag: json:"hk_delivery_type"
string hk_delivery_type = 42;
}
\ No newline at end of file
syntax = "proto3";
import "google/protobuf/timestamp.proto";
package common;
message Timestamp {
google.protobuf.Timestamp timestamp = 1;
string timestr=2;
}
\ No newline at end of file
syntax = "proto3";
package course;
service CourseService {
rpc ListForTop(ListRequest) returns (ListResponse);
rpc GetDetail(DetailRequest) returns(DetailResponse);
}
message CourseModel{
int32 course_id=1;
string course_name=2;
string course_disp_name=3;
string course_intr=4;
float course_price=5;
float course_price2=6;
// @inject_tag: gorm:"type:timestamp"
int64 addtime=7;
}
message ListRequest {
// @inject_tag: form:"size"
int32 size = 1;
}
message DetailRequest{
// @inject_tag: uri:"course_id"
int32 course_id=1;
// @inject_tag: header:"fetch_type"
int32 fetch_type=2;
}
//计数
message CourseCounts{
// @inject_tag: json:"-"
int32 count_id=1;
// @inject_tag: json:"-"
int32 course_id=2;
string count_key=3;
int32 count_value=4;
}
message ListResponse {
repeated CourseModel result = 1;
}
message DetailResponse{
CourseModel course=1;
repeated CourseCounts counts=2;
}
syntax = "proto3";
package course;
message CourseTopic{
int32 Id = 1;
int32 CourseId = 2;
int32 CourseDid = 3;
int32 Likes = 4;
int32 Unlikes = 5;
string Title = 6;
string Content = 7;
int32 UserId = 8;
int64 Addtime = 9;
int64 Updatetime = 10;
}
message CourseTopicReply{
int32 Id = 1;
int32 TopicId = 2;
string Content = 3;
int32 UserId = 4;
int32 Likes = 5;
int32 Unlikes = 6;
int64 Addtime = 7;
}
message TopicRequest{
int32 CourseId = 1;
}
message TopicResponse{
repeated CourseTopic result = 1;
}
service CourseTopicService {
rpc GetTopic(TopicRequest) returns (TopicResponse);
}
\ No newline at end of file
syntax = "proto3";
package mouser;
service MouserService {
rpc MouserGetData(MouserRequest) returns (MouserResponse);
}
message MouserRequest {
// @inject_tag: uri:"goods_name"
string goods_name = 1;
}
message ResponseData{
// @inject_tag: json:"total"
int64 total = 1;
// @inject_tag: json:"flag"
int32 flag = 2;
// @inject_tag: json:"data"
repeated GoodsModel data = 3;
}
message MouserResponse{
// @inject_tag: json:"error_code"
int32 error_code = 1;
// @inject_tag: json:"error_message"
string error_message = 2;
// @inject_tag: json:"data"
ResponseData data = 3;
}
message OtherAttrs {
string gross_wegiht = 1;
}
message LadderPrice {
int64 purchases = 1;
float price_cn = 2;
float price_us = 3;
float price_ac = 4;
}
message GoodsModel {
// @inject_tag: json:"other_attrs"
OtherAttrs other_attrs = 1;
// @inject_tag: json:"pick_type"
int64 pick_type = 2;
// @inject_tag: json:"barcode"
string barcode = 3;
// @inject_tag: json:"goods_id"
string goods_id = 4;
// @inject_tag: json:"goods_type
int64 goods_type = 5;
// @inject_tag: json:"supplier_id"
int64 supplier_id = 6;
// @inject_tag: json:"brand_id"
int64 brand_id = 7;
// @inject_tag: json:"class_id1"
int64 class_id1 = 8;
// @inject_tag: json:"class_id2"
int64 class_id2 = 9;
// @inject_tag: json:"goods_name"
string goods_name = 10;
// @inject_tag: json:"status"
int64 status = 11;
// @inject_tag: json:"encoded"
string encoded = 12;
// @inject_tag: json:"encap"
string encap = 13;
// @inject_tag: json:"packing"
int64 packing = 14;
// @inject_tag: json:"goods_unit"
int64 goods_unit = 15;
// @inject_tag: json:"goods_images"
bool goods_images = 16;
// @inject_tag: json:"pdf"
string pdf = 17;
// @inject_tag: json:"goods_brief"
string goods_brief = 18;
// @inject_tag: json:"moq"
int64 moq = 19;
// @inject_tag: json:"mpq"
int64 mpq = 20;
// @inject_tag: json:"ladder_price"
repeated LadderPrice ladder_price = 21;
// @inject_tag: json:"update_time"
int64 update_time = 22;
// @inject_tag: json:"sku_name"
string sku_name = 23;
// @inject_tag: json:"mpl"
int64 mpl = 24;
// @inject_tag: json:"stock"
int64 stock = 25;
// @inject_tag: json:"attrs"
string attrs = 26;
// @inject_tag: json:"cost"
string cost = 27;
// @inject_tag: json:"new_cost"
string new_cost = 28;
// @inject_tag: json:"supplier_stock"
int64 supplier_stock = 29;
// @inject_tag: json:"self_supplier_type"
int64 self_supplier_type = 30;
// @inject_tag: json:"cn_delivery_time"
string cn_delivery_time = 31;
// @inject_tag: json:"brand_name"
string brand_name = 32;
// @inject_tag: json:"supplier_name"
string supplier_name = 33;
string goods_unit_name = 34;
string packing_name = 35;
string mpq_unit_name = 36;
// @inject_tag: json:"ac_type"
int64 ac_type = 37;
int64 allow_coupon = 38;
string class_id1_name = 39;
string class_id2_name = 40;
// @inject_tag: json:"otheis_buyr_attrs"
int64 is_buy = 41;
// @inject_tag: json:"hk_delivery_type"
string hk_delivery_type = 42;
}
\ No newline at end of file
syntax = "proto3";
package users;
service UserService {
rpc Test(UserRequest) returns (UserResponse) {}
}
message UserRequest {
string id = 1;
}
message UserResponse {
string ret = 2;
}
## 搜索服务
### 项目启动
直接到cmd下面直接找到想启动的服务进行```go run xxx```即可,需要传入配置文件地址的话,则可以
```go run xxx.go -config xxx/xxx.ini```
### 目录结构
├── bat //运行脚本或者protoc生成脚本
├── boot //启动文件,比如配置加载,数据库加载等等
├── cmd //服务的主入口,可直接go run执行
├── conf //配置文件目录
├── framework //gin框架接入
├── controller //顾名思义
├── dao //数据访问层
├── model //模型目录
├── pkg //公用包目录,比如配置读取,获取数据库实例,通用函数或者变量等都可以从这里获取
├── protopb //生成的protos.pb.go文件
├── protos //原始的protos文件
├── service //业务逻辑操作所在目录
### 已经封装的模块以及用法
#### 1.配置读取
接在```conf/config.ini```文件添加自己的配置项
然后使用```config.Get("xxx.xxx").String()```或者```config.Get("xxx.xxx").Int()```即可
如果想要获取某个节点下的所有值,可以用```config.GetSectionValues("xxx")```
如果想要去获取更多其它的值,可以用暴露出来的配置变量自己去获取,比如: ```config.Cfg.Section("xxx").Key("xxx")```
配置包的文档 : https://ini.unknwon.io/docs
#### 2.mysql连接实例
使用```mysql.GetDB()```即可获取对应的实例,不同数据库的连接可以自己定义不同的GetDB方法
gorm包的文档 : https://gorm.io/zh_CN/docs/index.html
#### 3.redis使用
可以直接调用```gredis.Hset(),gredis.Hget()```等方法,具体使用请参考代码,其中返回的结果是一个redis对象,需要自己转成自己需要的类型,比如 : ```redis.String(gredis.HGet("test",1))``` .
redis包文档 : https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib/garyburd/redigo?tab=doc
#### 4.mgo连接实例
使用```mongo.GetDB()```即可,不同数据库的连接可以自己定义不同的GetDB方法
然后用C方法指定集合进行操作即可: ```mongo.GetDB().C("xxx").Find(bson.M{}).Count()``` .
mgo包的文档 : https://godoc.org/gopkg.in/mgo.v2
文档2 : https://zhuanlan.zhihu.com/p/99731299
#### 5.钉钉群消息以及短信
直接在pkg/message包调用对应的函数即可:
钉钉的为```message.DingDingPush```
#### 6.商品信息获取
直接调用```service.GetGoodsInfo```函数即可,传入goods_id的字符串,多个goods_id用逗号隔开(商品服务的请求本来亦是如此),会返回json字符串,然后可以根据自己的需求用gjson获取对应的信息即可
#### 7.ES的基本请求
直接调用```es.CurlES```函数即可,传入索引名称和请求的json参数即可,得到的返回结果是ES的原生结果,可以根据自己的需求用gjson获取对应的信息
#### 7.队列推送
直接调用```mq.PushMsg("xian_test","test")```函数即可(调用方式保持和PHP一致),第一个参数队列名同时也是路由名,第二个是要传的值
package requests
//使用根据供应商获取商品信息方法的通用请求
type GetGoodsBySupplierRequest struct {
Keyword string `form:"keyword"`
SupplierName string `form:"supplier_name"`
Stock int `form:"stock"`
SupplierId string `form:"supplier_id"`
Offset int `form:"offset"`
FollowHit int `form:"follow_hit"`
CheckButton int `form:"check_button"`
GoodsNameEq string `form:"goods_name/eq"`
IsExact int `form:"is_exact"`
BrandId string `form:"brand_id"`
Flag string `form:"flag"` //调试标志
AvailRank int `form:"avail_rank"`
SingleRank int `form:"single_rank"`
StockRank int `form:"stock_rank"`
ComRank int `form:"com_rank"`
FirstSearchPage int `form:"first_search_page"`
P int `form:"p"`
Topic int `form:"topic"`
K1 int `form:"k1"`
K2 int `form:"k2"`
}
package requests
type GetDataIndexRequest struct {
//Keyword string `form:"keyword"`
KNums int `form:"kNums"`
IsSort int `form:"is_sort"`
//SupplierId string `form:"supplier_id"`
//SupplierName string `form:"supplier_name"`
//GoodsNameEq string `form:"goods_name/eq"`
//BrandId string `form:"brand_id"`
//Offset int `form:"offset"`
//FollowHit int `form:"follow_hit"`
//Stock int `form:"stock"`
//IsExact int `form:"is_exact"`
//AvailRank int `form:"avail_rank"`
//SingleRank int `form:"single_rank"`
//StockRank int `form:"stock_rank"`
//ComRank int `form:"com_rank"`
//FirstSearchPage int `form:"first_search_page"`
//P int `form:"p"`
//Topic int `form:"topic"`
//K1 int `form:"k1"`
//K2 int `form:"k2"`
//Keyword string `form:"keyword"`
//SupplierId string `form:"supplier_id"`
//SupplierName string `form:"supplier_name"`
//Stock int `form:"stock"`
GetGoodsBySupplierRequest
}
package requests
type ExactGoodsRequest struct {
SupplierId string `json:"supplier_id"`
GoodsName string `json:"goods_name"`
}
package requests
import (
"github.com/syyongx/php2go"
"goods_machining/pkg/config"
)
type QuoteIndexRequest struct {
GetGoodsBySupplierRequest
}
type QuoteGetDataRequest struct {
Keyword string `form:"keyword"`
SupplierName string `form:"supplier_name"`
}
func CheckQuoteRequest(r QuoteIndexRequest) (errCode int, errMsg string) {
//解码参数
var err error
if r.Keyword != "" {
r.Keyword, err = php2go.URLDecode(r.Keyword)
if err != nil {
return 1, "参数解码失败"
}
}
//判断参数
if r.Keyword == "" || r.SupplierId == "" {
return 1, "缺少参数"
}
//判断供应商
if config.Get("SUPPLIER_ALL."+r.SupplierId).String() == "" {
return 1, "供应商id有误"
}
return
}
package requests
type SumIpRequest struct {
StartTime int64 `form:"start_time"`
EndTime int64 `form:"end_time"`
Size int `form:"size"`
}
type ScrollRequest struct {
Scroll int `form:"scroll"`
ScrollId int `form:"scroll_id"`
}
package requests
type SetButtonRequest struct {
Val int `form:"val"`
}
type GetWbListRequest struct {
ListType int `form:"type"`
}
type SetWbListRequest struct {
Type string `form:"type"`
IpList string `form:"ip_list"`
AddOrRm string `form:"add_or_rm"`
}
type SetIpalgRequest struct {
Ip string `form:"ip"`
ListType int `form:"type"`
Num int `json:"num"`
}
\ No newline at end of file
package routes
import (
"github.com/gin-gonic/gin"
"goods_machining/controller"
"goods_machining/middleware"
)
//初始化路由
func InitRouter() *gin.Engine {
r := gin.New()
r.Use(gin.Logger())
r.Use(gin.Recovery())
r.Use(middleware.Cors())
r.Use(middleware.ContextVars())
//联营参数选择搜索
r.GET("synchronization", controller.Synchronization)
r.POST("synchronization",controller.Synchronization)
return r
}
#!/bin/bash
cd /data/gocode/goods_machining
git pull origin dev
cp /data/gocode/goods_machining/conf/prod/config.ini.prod /data/gocode/goods_machining/conf/config.ini
cp /data/gocode/goods_machining/conf/prod/database.ini.prod /data/gocode/goods_machining/conf/database.ini
cp /data/gocode/goods_machining/conf/prod/message.ini.prod /data/gocode/goods_machining/conf/message.ini
cp /data/gocode/goods_machining/conf/prod/rabmq_key.ini.prod /data/gocode/goods_machining/conf/rabmq_key.ini
cp /data/gocode/goods_machining/conf/prod/redis_config.ini.prod /data/gocode/goods_machining/conf/redis_config.ini
cp /data/gocode/goods_machining/conf/prod/redis_key.ini.prod /data/gocode/goods_machining/conf/redis_key.ini
cp /data/gocode/goods_machining/conf/prod/search.ini.prod /data/gocode/goods_machining/conf/search.ini
go build -o ./cmd/search_http_server ./cmd/search_http_server.go
supervisorctl restart goods_machining
package service
import (
"goods_machining/model"
"sync"
)
type LyService struct {
}
/*
自营数据详情
*/
func (qs *LyService) LyGoodsDetail(goodsIds []string, wg *sync.WaitGroup) (results model.LyResponse) {
return
}
package service
import (
"fmt"
"github.com/gomodule/redigo/redis"
"github.com/iancoleman/orderedmap"
"github.com/tidwall/gjson"
"goods_machining/pkg/gredis"
"sync"
)
type ZiyingService struct {
}
/*
自营数据详情
*/
func (qs *ZiyingService) ZyGoodsDetail(goodsIds []string,goodsRes *map[string]interface{}, wg *sync.WaitGroup) {
defer wg.Done();
redisConn := gredis.Conn("search_r")
/////批量获取商品详情
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",goodsIds)
fmt.Print(skuArr)
for goods_id,info := range skuArr {
A := orderedmap.New() //初始化有序map,拼接data 数据
A.Set("goods_id",goods_id)
A.Set("goods_type", gjson.Get(info, "goods_type").Int()) //查询总条数
A.Set("supplier_id", gjson.Get(info, "supplier_id").String()) //查询总条数
A.Set("brand_id", gjson.Get(info, "brand_id").String()) //
A.Set("class_id1", gjson.Get(info, "class_id1").String()) //
A.Set("class_id2", gjson.Get(info, "class_id2").String()) //
A.Set("goods_name", gjson.Get(info, "goods_name").String()) //
A.Set("status", gjson.Get(info, "status").String()) //
A.Set("encoded", gjson.Get(info, "encoded").String()) //
A.Set("encap", gjson.Get(info, "encap").String()) //
A.Set("packing", gjson.Get(info, "packing").String()) //
A.Set("goods_unit", gjson.Get(info, "goods_unit").String()) //
A.Set("goods_images", gjson.Get(info, "goods_images").String()) //
A.Set("pdf", gjson.Get(info, "pdf").String()) //
A.Set("goods_brief", gjson.Get(info, "goods_brief").String()) //
A.Set("moq", gjson.Get(info, "moq").String()) //
A.Set("mpq", gjson.Get(info, "mpq").String()) //
A.Set("ladder_price", gjson.Get(info, "ladder_price").String()) //
A.Set("update_time", gjson.Get(info, "update_time").String()) //
A.Set("sku_name", gjson.Get(info, "sku_name").String()) //
A.Set("mpl", gjson.Get(info, "mpl").String()) //
A.Set("stock", gjson.Get(info, "stock").String()) //
A.Set("attrs", gjson.Get(info, "attrs").String()) //
A.Set("cost", gjson.Get(info, "cost").String()) //
A.Set("new_cost", gjson.Get(info, "new_cost").String()) //
A.Set("supplier_stock", gjson.Get(info, "supplier_stock").String()) //
A.Set("self_supplier_type", gjson.Get(info, "self_supplier_type").String()) //
A.Set("cn_delivery_time", gjson.Get(info, "cn_delivery_time").String()) //
A.Set("brand_name", gjson.Get(info, "brand_name").String()) //
A.Set("supplier_name", gjson.Get(info, "supplier_name").String()) //
A.Set("goods_unit_name", gjson.Get(info, "goods_unit_name").String()) //
A.Set("packing_name", gjson.Get(info, "packing_name").String()) //
A.Set("mpq_unit_name", gjson.Get(info, "mpq_unit_name").String()) //
A.Set("scm_brand_name", gjson.Get(info, "scm_brand_name").String()) //
A.Set("actual_stock", gjson.Get(info, "actual_stock").String()) //
A.Set("ac_type", gjson.Get(info, "ac_type").String()) //
A.Set("allow_coupon", gjson.Get(info, "allow_coupon").String()) //
A.Set("allow_presale", gjson.Get(info, "allow_presale").String()) //
A.Set("saler_atio", gjson.Get(info, "saler_atio").String()) //
A.Set("szlc_price", gjson.Get(info, "szlc_price").String()) //
A.Set("class_id1_name", gjson.Get(info, "class_id1_name").String()) //
A.Set("class_id2_name", gjson.Get(info, "class_id2_name").String()) //
A.Set("is_buy", gjson.Get(info, "is_buy").String()) //
(*goodsRes)[goods_id] = A
}
}
/*
计算单个sku总锁库数量
*/
func skuLockNum(c *redis.Conn,goodsId string) int64{
reply, err := redis.Values((*c).Do("hvals", "Self_StockLock"+goodsId))
if err != nil {
return 0;
}
var albums []int64
if err := redis.ScanSlice(reply, &albums); err != nil {
return 0;
}
if len(albums) == 0 {
return 0;
}else{
var all int64 = 0
for _,n := range albums {
all = all+n
}
return all
}
}
\ No newline at end of file
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