From 90408f14d3d81a0cc1fa402f3553b37b6db4a940 Mon Sep 17 00:00:00 2001 From: liuhaotian Date: Thu, 2 Dec 2021 13:19:43 +0800 Subject: [PATCH] feat: bugForMJ --- api/detail.go | 131 ++++++++++++++++++++++++++++++++++++++++ api/detail_test.go | 13 ++++ api/list.go | 123 +++++++++++++++++++++++++++++++++++++ api/list_test.go | 16 +++++ api/public.go | 101 +++++++++++++++++++++++++++++++ api/shop.go | 123 +++++++++++++++++++++++++++++++++++++ api/shop_detail.go | 95 +++++++++++++++++++++++++++++ api/shop_detail_test.go | 11 ++++ api/shop_test.go | 26 ++++++++ go.mod | 37 ++++++++++++ go.sum | 119 ++++++++++++++++++++++++++++++++++++ main.go | 7 +++ 12 files changed, 802 insertions(+) create mode 100644 api/detail.go create mode 100644 api/detail_test.go create mode 100644 api/list.go create mode 100644 api/list_test.go create mode 100644 api/public.go create mode 100644 api/shop.go create mode 100644 api/shop_detail.go create mode 100644 api/shop_detail_test.go create mode 100644 api/shop_test.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 main.go diff --git a/api/detail.go b/api/detail.go new file mode 100644 index 0000000..7c6a7e8 --- /dev/null +++ b/api/detail.go @@ -0,0 +1,131 @@ +package api + +import ( + "database/sql/driver" + "encoding/json" + "fmt" + ctxLogger "github.com/luizsuper/ctxLoggers" + "go.uber.org/zap" + "time" +) + +type ( + DetailReq struct { + ScriptId string `json:"scriptId"` + CityCode string `json:"cityCode"` + } + DetailInfo struct { + Resp DetailResp `json:"resp" gorm:"column:resp"` + ID int `json:"id" gorm:"column:id"` + } + DetailResp struct { + Head struct { + Msg string `json:"msg"` + Code int `json:"code"` + } `json:"head" gorm:"column:head"` + Data struct { + ScriptId string `json:"scriptId"` + ScriptName string `json:"scriptName"` + ScriptCoverUrl string `json:"scriptCoverUrl"` + ScriptIntro string `json:"scriptIntro"` + ScriptCategory int `json:"scriptCategory"` + ScriptPlayerLimit int `json:"scriptPlayerLimit"` + ScriptMalePlayerLimit int `json:"scriptMalePlayerLimit"` + ScriptFemalePlayerLimit int `json:"scriptFemalePlayerLimit"` + ScriptTag string `json:"scriptTag"` + ScriptScore float64 `json:"scriptScore"` + ScriptScoreCount int `json:"scriptScoreCount"` + ScriptInferenceScore float64 `json:"scriptInferenceScore"` + ScriptPlotScore float64 `json:"scriptPlotScore"` + ScriptComplexScore float64 `json:"scriptComplexScore"` + ScriptImageContent string `json:"scriptImageContent"` + PlayerRoleReversalStatus int `json:"playerRoleReversalStatus"` + ScriptTextContent string `json:"scriptTextContent"` + ScriptSourceId interface{} `json:"scriptSourceId"` + ScriptGroupCount int `json:"scriptGroupCount"` + ShopHaveScriptCount int `json:"shopHaveScriptCount"` + ScriptWantPlayerCount int `json:"scriptWantPlayerCount"` + ScriptPlayedCount int `json:"scriptPlayedCount"` + WantPlayStatus int `json:"wantPlayStatus"` + UserPlayScriptStatus int `json:"userPlayScriptStatus"` + EvaluateStatus int `json:"evaluateStatus"` + UserPlayScriptTime interface{} `json:"userPlayScriptTime"` + UserScriptScore interface{} `json:"userScriptScore"` + UserPlayScriptId interface{} `json:"userPlayScriptId"` + ShopScriptReserveCount int `json:"shopScriptReserveCount"` + GroupDuration int `json:"groupDuration"` + RecommendUrl string `json:"recommendUrl"` + RecommendNum int `json:"recommendNum"` + ScriptDifficultyDegreeName string `json:"scriptDifficultyDegreeName"` + } `json:"data"` + } +) + +const DetailUrl = "https://api.h5.helloaba.cn/script/platformScriptInfo" + +func (m *DetailInfo) TableName() string { + return "detail_info" +} + +// Value 实现gorm针对json数据结构的interface +func (p DetailResp) Value() (driver.Value, error) { + return json.Marshal(p) +} + +func (p *DetailResp) Scan(input interface{}) error { + return json.Unmarshal(input.([]byte), &p) +} + +// DetailMarshal 将http访问之后的[]byte 解析为DetailResp +func DetailMarshal(req, body []byte) (resp interface{}, err error) { + r := new(DetailResp) + err = json.Unmarshal(body, r) + if err != nil { + ctxLogger.Error(nil, "json UnmarshalError", zap.String("resp body", string(body))) + } + if r.Head.Code != 200 || r.Head.Msg != "成功" { + ctxLogger.Error(nil, "net wrok error", zap.String("resq body", string(req)), zap.String("resp body", string(body))) + } + return r, err +} + +// DetailKvStr todo:抽象 +// DetailKvStr 按照顺序对查询的key排序 +func DetailKvStr(body DetailReq) string { + //strings := []string{"cityCode", "scriptId"} + //sort.Strings(strings) + //cityCode scriptId + var s = "" + s += fmt.Sprintf("%v=%v&", "cityCode", body.CityCode) + s += fmt.Sprintf("%v=%v", "scriptId", body.ScriptId) + return s +} + +//单点访问 +func detail(body DetailReq) { + dto, err := Attach(DetailUrl, GetCheckSum(DetailKvStr(body)), body, M, DetailMarshal) + if err != nil { + ctxLogger.Error(nil, "net error record") + } + if s, ok := dto.(*DetailResp); !ok { + ctxLogger.Error(nil, "assertion error") + } else { + info := DetailInfo{Resp: *s} + DB.Create(&info) + ctxLogger.Info(nil, "detailOk", zap.String("sid", s.Data.ScriptId)) + time.Sleep(time.Duration(1) * time.Second) + } +} + +//todo:页数抽离出来 +//从db中拿出 list的item 中的id,进行轮训访问 +func multiReq() { + var infos []BasicInfo + DB.Where("page > 100 and page <= 573").Find(&infos) + for _, v := range infos { + for _, v := range v.Resp.Data.Items { + req := DetailReq{ScriptId: v.ScriptID, CityCode: "310000"} + detail(req) + } + } +} diff --git a/api/detail_test.go b/api/detail_test.go new file mode 100644 index 0000000..aa30f0e --- /dev/null +++ b/api/detail_test.go @@ -0,0 +1,13 @@ +package api + +import ( + "testing" +) + +func TestSingleReq(t *testing.T) { + body := DetailReq{ + ScriptId: "52586724875648103", + CityCode: "310000", + } + detail(body) +} diff --git a/api/list.go b/api/list.go new file mode 100644 index 0000000..be59479 --- /dev/null +++ b/api/list.go @@ -0,0 +1,123 @@ +package api + +import ( + "database/sql/driver" + "encoding/json" + "fmt" + ctxLogger "github.com/luizsuper/ctxLoggers" + "go.uber.org/zap" + "time" +) + +type ( + // ListBody 访问列表的结构体 + ListBody struct { + TagType string `json:"tagType"` + Keyword string `json:"keyword"` + PageNum int `json:"pageNum"` + PageSize int `json:"pageSize"` + PersonType int `json:"personType"` + } + Item struct { + ScriptID string `json:"scriptId" gorm:"column:scriptId"` + ScriptScore string `json:"scriptScore" gorm:"column:scriptScore"` + RecommendUrl string `json:"recommendUrl" gorm:"column:recommendUrl"` + ScriptTextContent string `json:"scriptTextContent" gorm:"column:scriptTextContent"` + ScriptName string `json:"scriptName" gorm:"column:scriptName"` + ScriptTag string `json:"scriptTag" gorm:"column:scriptTag"` + ScriptPlayerLimit int `json:"scriptPlayerLimit" gorm:"column:scriptPlayerLimit"` + RecommendNum int `json:"recommendNum" gorm:"column:recommendNum"` + ScriptIntro string `json:"scriptIntro" gorm:"column:scriptIntro"` + ScriptCoverUrl string `json:"scriptCoverUrl" gorm:"column:scriptCoverUrl"` + ScriptCategory int `json:"scriptCategory" gorm:"column:scriptCategory"` + } + // ListResp 列表返回的结构体 + ListResp struct { + Head struct { + Msg string `json:"msg"` + Code int `json:"code" gorm:"column:code"` + } `json:"head" gorm:"column:head"` + Data struct { + Pages int `json:"pages" gorm:"column:pages"` + TotalSize string `json:"totalSize" gorm:"column:totalSize"` + Items []Item `json:"items" gorm:"column:items"` + } `json:"data" gorm:"column:data"` + } + // BasicInfo 存入数据库-basic_info表 + BasicInfo struct { + Resp ListResp `json:"resp" gorm:"column:resp;type:json"` + Page int `json:"page" gorm:"column:page;type int"` + } +) + +const SearchUrl = "https://api.h5.helloaba.cn/script/v3/scriptSearchPage" + +func (m *BasicInfo) TableName() string { + return "basic_info" +} + +// Value 实现gorm针对json数据结构的interface +func (p ListResp) Value() (driver.Value, error) { + return json.Marshal(p) +} + +func (p *ListResp) Scan(input interface{}) error { + return json.Unmarshal(input.([]byte), &p) +} + +// ListMarshal 将http访问之后的[]byte 解析为listResp +func ListMarshal(req, body []byte) (resp interface{}, err error) { + r := new(ListResp) + err = json.Unmarshal(body, r) + if err != nil { + ctxLogger.Error(nil, "json UnmarshalError", zap.String("resp body", string(body))) + } + if r.Head.Code != 200 || r.Head.Msg != "成功" { + ctxLogger.Error(nil, "net wrok error", zap.String("resq body", string(req)), zap.String("resp body", string(body))) + } + return r, err +} + +// GetKvStr todo:抽象 +// GetKvStr 按照顺序对查询的key排序 +func GetKvStr(body ListBody) string { + //strings := []string{"TagType", "Keyword", "PageNum", "PageSize", "PersonType"} + //sort.Strings(strings) + //Keyword PageNum PageSize PersonType TagType + var s = "" + s += fmt.Sprintf("%v=%v&", "keyword", body.Keyword) + s += fmt.Sprintf("%v=%v&", "pageNum", body.PageNum) + s += fmt.Sprintf("%v=%v&", "pageSize", body.PageSize) + s += fmt.Sprintf("%v=%v&", "personType", 0) + s += fmt.Sprintf("%v=%v", "tagType", body.TagType) + return s +} + +//todo:页数抽离 +func multiList() { + for i := 201; i <= 573; i++ { + body := ListBody{ + TagType: "0", + Keyword: "", + PageNum: i, + PageSize: 10, + PersonType: 0, + } + list(body) + } +} + +func list(body ListBody) { + dto, err := Attach(SearchUrl, GetCheckSum(GetKvStr(body)), body, M, ListMarshal) + if err != nil { + ctxLogger.Error(nil, "net error record", zap.Int("page", body.PageNum)) + } + if s, ok := dto.(*ListResp); !ok { + ctxLogger.Error(nil, "assertion error", zap.Int("page", body.PageNum)) + } else { + info := BasicInfo{Resp: *s, Page: body.PageNum} + DB.Create(&info) + time.Sleep(1500) + ctxLogger.Info(nil, "ok", zap.Int("page", body.PageNum)) + } +} diff --git a/api/list_test.go b/api/list_test.go new file mode 100644 index 0000000..9948b5f --- /dev/null +++ b/api/list_test.go @@ -0,0 +1,16 @@ +package api + +import ( + "testing" +) + +func TestSingleList(t *testing.T) { + body := ListBody{ + TagType: "0", + Keyword: "", + PageNum: 1, + PageSize: 10, + PersonType: 0, + } + list(body) +} diff --git a/api/public.go b/api/public.go new file mode 100644 index 0000000..14b8300 --- /dev/null +++ b/api/public.go @@ -0,0 +1,101 @@ +package api + +//爬虫的参数组装,返回结构体解析,存入数据库的方法有关的包 +import ( + "crypto/md5" + "encoding/hex" + "encoding/json" + "errors" + ctxLogger "github.com/luizsuper/ctxLoggers" + "github.com/spf13/cast" + "go.uber.org/zap" + "gorm.io/driver/mysql" + "gorm.io/gorm" + "io" + "io/ioutil" + "net/http" + "strings" + "time" +) + +//针对http访问,checkSum计算的抽象 +var ( + M = make(map[string]string) + DB = new(gorm.DB) +) + +const o = `$&*#$%YSGHsghdfg256456857ughdgfEYTHFDBNF5678hncg~!@#$%&$&Uxvcbdfget2577ifhnxgfart$%^&@#$%@%&ghsdft256WRETsgsr623$%TStw45` + +//todo:配置文件 +//初始化DB,以及请求的 +func init() { + err := errors.New("") + dsn := "root:123456qwe@tcp(127.0.0.1:3306)/mijuan?charset=utf8mb4&parseTime=True&loc=Local" + DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{}) + if err != nil { + ctxLogger.Error(nil, "DB connect err", zap.String("reason", err.Error())) + } + M["Content-Type"] = "application/json" + M["version"] = "1.1.9" + //todo: nonce 提取出来 + M["nonce"] = "0.5794467510454496" + M["curTime"] = cast.ToString(TimeToUnix(time.Now())) + M["clientVersion"] = "3.0.0" + M["userToken"] = "" + M["clientType"] = "2" + M["cityCode"] = "310000" + M["mobileType"] = "2" +} + +// TimeToUnix 转化为13位时间戳 +func TimeToUnix(e time.Time) int64 { + timeUnix, _ := time.Parse("2006-01-02 15:04:05", e.Format("2006-01-02 15:04:05")) + return timeUnix.UnixNano() / 1e6 +} + +func GetCheckSum(u string) string { + a := 0.5794467510454496 + toString := cast.ToString(a) + s := toString + u + o + bytes := []byte(s) + h := md5.New() + h.Write(bytes) + k := hex.EncodeToString(h.Sum(nil)) + return k +} + +func Attach(url, getCheckSum string, sbody interface{}, headers map[string]string, marshalFunc func(req, body []byte) (interface{}, error)) (interface{}, error) { + M["checkSum"] = getCheckSum + body, err := PostHeader(url, sbody, headers, marshalFunc) + if err != nil { + return nil, err + } + return body, nil +} + +func PostHeader(url string, sbody interface{}, headers map[string]string, marshalFunc func(req, body []byte) (resp interface{}, err error)) (interface{}, error) { + client := &http.Client{} + marshal, err := json.Marshal(sbody) + if err != nil { + return nil, err + } + req, err := http.NewRequest("POST", url, strings.NewReader(cast.ToString(marshal))) + if err != nil { + return nil, err + } + for key, header := range headers { + req.Header.Set(key, header) + } + resp, err := client.Do(req) + defer func(Body io.ReadCloser) { + err := Body.Close() + if err != nil { + ctxLogger.Error(nil, "net body close error", zap.String("errReason", err.Error())) + } + }(resp.Body) + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return marshalFunc(marshal, body) +} diff --git a/api/shop.go b/api/shop.go new file mode 100644 index 0000000..bdab2b3 --- /dev/null +++ b/api/shop.go @@ -0,0 +1,123 @@ +package api + +import ( + "database/sql/driver" + "encoding/json" + "fmt" + ctxLogger "github.com/luizsuper/ctxLoggers" + "go.uber.org/zap" + "time" +) + +type ( + ShopReq struct { + PageNum int `json:"pageNum"` + PageSize int `json:"pageSize"` + UserLongitude float64 `json:"userLongitude"` + UserLatitude float64 `json:"userLatitude"` + CityCode string `json:"cityCode"` + QuerySource int `json:"querySource"` + } + ShopResp struct { + Head struct { + Msg string `json:"msg"` + Code int `json:"code"` + } `json:"head"` + Data struct { + Pages int `json:"pages"` + TotalSize string `json:"totalSize"` + Items []Item `json:"items"` + } `json:"data"` + } + ShoListItem struct { + ShopId string `json:"shopId"` + ShopLogoUrl string `json:"shopLogoUrl"` + ShopName string `json:"shopName"` + ShopAddr string `json:"shopAddr"` + ShopLongitude string `json:"shopLongitude"` + ShopLatitude string `json:"shopLatitude"` + Distance int `json:"distance"` + ShopScore int `json:"shopScore"` + UserCouponCount int `json:"userCouponCount"` + WeekdayGroupPlayPrice string `json:"weekdayGroupPlayPrice"` + HolidayGroupPlayPrice string `json:"holidayGroupPlayPrice"` + ShopSource int `json:"shopSource"` + ShopHotValue int `json:"shopHotValue"` + CouponInfoList []struct { + CouponDiscountType int `json:"couponDiscountType"` + CouponDiscountRatio int `json:"couponDiscountRatio"` + CouponAmount string `json:"couponAmount"` + } `json:"couponInfoList"` + } +) + +const shopListUrl = `https://api.h5.helloaba.cn/shop/v3/getScriptMatchShopList` + +type ShopInfo struct { + ID int `json:"id" gorm:"column:id"` + Resp ShopResp `json:"resp" gorm:"column:resp"` +} + +func (m *ShopInfo) TableName() string { + return "shop_info" +} + +func (p ShopResp) Value() (driver.Value, error) { + return json.Marshal(p) +} + +func (p *ShopResp) Scan(input interface{}) error { + return json.Unmarshal(input.([]byte), &p) +} + +func ShopMarshal(req, body []byte) (resp interface{}, err error) { + r := new(ShopResp) + err = json.Unmarshal(body, r) + if err != nil { + ctxLogger.Error(nil, "json UnmarshalError", zap.String("resp body", string(body))) + } + if r.Head.Code != 200 || r.Head.Msg != "成功" { + ctxLogger.Error(nil, "net wrok error", zap.String("resq body", string(req)), zap.String("resp body", string(body))) + } + return r, err +} + +// ShopLKvStr todo:抽象 +// ShopLKvStr 按照顺序对查询的key排序 +func ShopLKvStr(body ShopReq) string { + //strings := []string{"pageNum", "pageSize", "userLongitude", "userLatitude", "cityCode", "querySource"} + //sort.Strings(strings) + //cityCode pageNum pageSize querySource userLatitude userLongitude + var s = "" + s += fmt.Sprintf("%v=%v&", "cityCode", body.CityCode) + s += fmt.Sprintf("%v=%v&", "pageNum", body.PageNum) + s += fmt.Sprintf("%v=%v&", "pageSize", body.PageSize) + s += fmt.Sprintf("%v=%v&", "querySource", body.QuerySource) + return s +} + +func shopList(body ShopReq) { + dto, err := Attach(shopListUrl, GetCheckSum(ShopLKvStr(body)), body, M, ShopMarshal) + if err != nil { + ctxLogger.Error(nil, "net error record") + } + if s, ok := dto.(*ShopResp); !ok { + ctxLogger.Error(nil, "assertion error") + } else { + info := ShopInfo{Resp: *s} + DB.Create(&info) + ctxLogger.Info(nil, "detailOk", zap.Int("page", s.Data.Pages)) + time.Sleep(time.Duration(1) * time.Second) + } +} +func MultiShopList() { + req := ShopReq{ + PageNum: 1, + PageSize: 10, + UserLongitude: 121.58372497558594, + UserLatitude: 31.347728729248047, + CityCode: "310000", + QuerySource: 1, + } + shopList(req) +} diff --git a/api/shop_detail.go b/api/shop_detail.go new file mode 100644 index 0000000..54159ef --- /dev/null +++ b/api/shop_detail.go @@ -0,0 +1,95 @@ +package api + +import ( + "database/sql/driver" + "encoding/json" + "fmt" + ctxLogger "github.com/luizsuper/ctxLoggers" + "go.uber.org/zap" + "time" +) + +type ( + ShopDetailReq struct { + ShopId string `json:"shopId"` + SceneType int `json:"sceneType"` + } + ShopDResp struct { + Head struct { + Msg string `json:"msg"` + Code int `json:"code"` + } `json:"head"` + Data struct { + ShopId string `json:"shopId"` + ShopName string `json:"shopName"` + ShopScore float64 `json:"shopScore"` + ShopAddr string `json:"shopAddr"` + ShopTagName interface{} `json:"shopTagName"` + ShopContractTelNumOne string `json:"shopContractTelNumOne"` + ShopContractTelNumTwo string `json:"shopContractTelNumTwo"` + ConsumptionUserSuccCount int `json:"consumptionUserSuccCount"` + ShopLongitude string `json:"shopLongitude"` + ShopLatitude string `json:"shopLatitude"` + ShopCoverUrl string `json:"shopCoverUrl"` + ShopLogoUrl string `json:"shopLogoUrl"` + BannerList []interface{} `json:"bannerList"` + RecommendScriptList []interface{} `json:"recommendScriptList"` + NewScriptList []interface{} `json:"newScriptList"` + } `json:"data"` + } +) + +const ShopDetailUrl = `https://api.h5.helloaba.cn/shop/shopDetail_V2` + +type ShopDetailInfo struct { + ID int `json:"id" gorm:"column:id"` + Resp ShopDResp `json:"resp" gorm:"column:resp"` +} + +func (m *ShopDetailInfo) TableName() string { + return "shop_detail_info" +} + +func (p ShopDResp) Value() (driver.Value, error) { + return json.Marshal(p) +} + +func (p *ShopDResp) Scan(input interface{}) error { + return json.Unmarshal(input.([]byte), &p) +} + +func ShopDMarshal(req, body []byte) (resp interface{}, err error) { + r := new(ShopDResp) + err = json.Unmarshal(body, r) + if err != nil { + ctxLogger.Error(nil, "json UnmarshalError", zap.String("resp body", string(body))) + } + if r.Head.Code != 200 || r.Head.Msg != "成功" { + ctxLogger.Error(nil, "net wrok error", zap.String("resq body", string(req)), zap.String("resp body", string(body))) + } + return r, err +} + +// ShopDKvStr todo:抽象 +// ShopDKvStr 按照顺序对查询的key排序 +func ShopDKvStr(body ShopDetailReq) string { + var s = "" + s += fmt.Sprintf("%v=%v&", "sceneType", body.SceneType) + s += fmt.Sprintf("%v=%v", "shopId", body.ShopId) + return s +} + +func shopDetail(body ShopDetailReq) { + dto, err := Attach(ShopDetailUrl, GetCheckSum(ShopDKvStr(body)), body, M, ShopDMarshal) + if err != nil { + ctxLogger.Error(nil, "net error record") + } + if s, ok := dto.(*ShopDResp); !ok { + ctxLogger.Error(nil, "assertion error") + } else { + info := ShopDetailInfo{Resp: *s} + DB.Create(&info) + ctxLogger.Info(nil, "detailOk", zap.String("ShopId", s.Data.ShopId)) + time.Sleep(time.Duration(1) * time.Second) + } +} diff --git a/api/shop_detail_test.go b/api/shop_detail_test.go new file mode 100644 index 0000000..342abfc --- /dev/null +++ b/api/shop_detail_test.go @@ -0,0 +1,11 @@ +package api + +import "testing" + +func TestShopDetail(t *testing.T) { + req := ShopDetailReq{ + ShopId: "108393734623781888", + SceneType: 1, + } + shopDetail(req) +} diff --git a/api/shop_test.go b/api/shop_test.go new file mode 100644 index 0000000..94aa295 --- /dev/null +++ b/api/shop_test.go @@ -0,0 +1,26 @@ +package api + +import ( + "fmt" + "sort" + "testing" +) + +func TestOrder(t *testing.T) { + strings := []string{"pageNum", "pageSize", "userLongitude", "userLatitude", "cityCode", "querySource"} + sort.Strings(strings) + for _, s := range strings { + fmt.Println(s) + } +} +func TestShopList(t *testing.T) { + req := ShopReq{ + PageNum: 1, + PageSize: 10, + UserLongitude: 121.58372497558594, + UserLatitude: 31.347728729248047, + CityCode: "310000", + QuerySource: 1, + } + shopList(req) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..f4dd502 --- /dev/null +++ b/go.mod @@ -0,0 +1,37 @@ +module infoGetter + +go 1.17 + +require ( + github.com/luizsuper/ctxLoggers v1.0.1 + github.com/spf13/cast v1.4.1 + go.uber.org/zap v1.19.1 + gorm.io/driver/mysql v1.2.1 + gorm.io/gorm v1.22.4 +) + +require ( + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/gin-gonic/gin v1.7.7 // indirect + github.com/go-playground/locales v0.13.0 // indirect + github.com/go-playground/universal-translator v0.17.0 // indirect + github.com/go-playground/validator/v10 v10.4.1 // indirect + github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/golang/protobuf v1.3.3 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.3 // indirect + github.com/json-iterator/go v1.1.9 // indirect + github.com/leodido/go-urn v1.2.0 // indirect + github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect + github.com/lestrrat-go/strftime v1.0.5 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect + github.com/pkg/errors v0.8.1 // indirect + github.com/ugorji/go/codec v1.1.7 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + gopkg.in/yaml.v2 v2.2.8 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ee0e0bf --- /dev/null +++ b/go.sum @@ -0,0 +1,119 @@ +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= +github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.3 h1:PlHq1bSCSZL9K0wUhbm2pGLoTWs2GwVhsP6emvGV/ZI= +github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8= +github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= +github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4= +github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA= +github.com/lestrrat-go/strftime v1.0.5 h1:A7H3tT8DhTz8u65w+JRpiBxM4dINQhUXAZnhBa2xeOE= +github.com/lestrrat-go/strftime v1.0.5/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR76fd03sz+Qz4g= +github.com/luizsuper/ctxLoggers v1.0.1 h1:xSyucakwWv1WccBiWZPSll2+oS4uzQ84awYegq5nNhc= +github.com/luizsuper/ctxLoggers v1.0.1/go.mod h1:C8zLwVhfLdT7728BELNIbDCkiWxkEls0rgk0VlP8gkQ= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= +github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723 h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.2.1 h1:h+3f1l9Ng2C072Y2tIiLgPpWN78r1KXL7bHJ0nTjlhU= +gorm.io/driver/mysql v1.2.1/go.mod h1:qsiz+XcAyMrS6QY+X3M9R6b/lKM1imKmcuK9kac5LTo= +gorm.io/gorm v1.22.4 h1:8aPcyEJhY0MAt8aY6Dc524Pn+pO29K+ydu+e/cXSpQM= +gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk= diff --git a/main.go b/main.go new file mode 100644 index 0000000..42cb695 --- /dev/null +++ b/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("123") +}