From 9956caeabac8b38bff80f84b33f8d4189bc06730 Mon Sep 17 00:00:00 2001 From: li Date: Fri, 25 Aug 2023 09:53:23 +0800 Subject: [PATCH] fix: --- controller/activity.go | 12 +- controller/recycle_card.go | 216 +++++++++++++++++++++++ lib/xianmai/xian.go | 113 ++++++++++++ lib/xianmai/xian_http.go | 99 +++++++++++ model/mall.go | 1 - model/model_test.go | 98 ++++++++++- model/order.go | 3 +- model/redeem_code.go | 41 ++++- model/sanmai.go | 348 +++++++++++++++++++++++++++++++++++++ router/router_app.go | 12 ++ 10 files changed, 932 insertions(+), 11 deletions(-) create mode 100644 model/sanmai.go diff --git a/controller/activity.go b/controller/activity.go index 45210c3..a2fba9b 100644 --- a/controller/activity.go +++ b/controller/activity.go @@ -14,13 +14,21 @@ import ( ) func UserRedeemCodeList(c *gin.Context) { - + req := &struct { + Status string `json:"status"` + }{} + if c.ShouldBindJSON(req) != nil { + logger.Errorf("para err") + RespJson(c, status.BadRequest, nil) + return + } uc := auth.GetCurrentUser(c) if uc == nil { RespJson(c, status.Unauthorized, nil) return } - codeList, err := model.UserRedeemCodeList(uc.Uid) + + codeList, err := model.UserRedeemCodeList(uc.Uid, req.Status) if err != nil { logger.Errorf("err:%#v", err) RespJson(c, status.InternalServerError, nil) diff --git a/controller/recycle_card.go b/controller/recycle_card.go index 2c174d2..a0426e2 100644 --- a/controller/recycle_card.go +++ b/controller/recycle_card.go @@ -413,3 +413,219 @@ func ConsoleRecycleCardOrderList(c *gin.Context) { RespOK(c, ret) return } + +func RecycleCardBrandList(c *gin.Context) { + req := xianmai.SmBrandListReq{ + CategoryId: 10, + } + resp, err := req.List() + if err != nil { + logger.Error("List err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardGoodsList(c *gin.Context) { + req := xianmai.SmGoodsListReq{ + CategoryId: 10, + } + resp, err := req.List() + if err != nil { + logger.Error("List err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardProblemSkuList(c *gin.Context) { + req := model.ProblemSkuListReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: map[string]interface{}{ + "goodsId": req.GoodsId, + }, + ApiRoute: "/openapi/order/queryProblemSkuList", + } + resp := &model.ProblemSkuListResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("ProblemSkuListResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardSubmitOrderEvaluation(c *gin.Context) { + req := model.SubmitOrderEvaluationReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: req, + ApiRoute: "/openapi/order/submitOrderEvaluation", + } + resp := &model.SubmitOrderEvaluationResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("SubmitOrderEvaluationResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardSubmitOrderDelivery(c *gin.Context) { + req := model.SubmitOrderDeliveryReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: req, + ApiRoute: "/openapi/order/submitOrderDelivery", + } + resp := &model.SubmitOrderDeliveryResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("SubmitOrderDeliveryResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardCancelOrderDelivery(c *gin.Context) { + req := model.CancelOrderDeliveryReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: req, + ApiRoute: "/openapi/order/cancelOrderDelivery", + } + resp := &model.CancelOrderDeliveryResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("CancelOrderDeliveryResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardQueryMemberOrderList(c *gin.Context) { + req := model.QueryMemberOrderListReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: req, + ApiRoute: "/openapi/order/queryMemberOrderList", + } + resp := &model.QueryMemberOrderListResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("QueryMemberOrderListResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardQueryMemberOrderdetail(c *gin.Context) { + req := model.QueryMemberOrderdetailReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: req, + ApiRoute: "/openapi/order/queryMemberOrderdetail", + } + resp := &model.QueryMemberOrderdetailResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("QueryMemberOrderdetailResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardQueryMemberOrderDelivery(c *gin.Context) { + req := model.QueryMemberOrderDeliveryReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: req, + ApiRoute: "/openapi/order/queryMemberOrderDelivery", + } + resp := &model.QueryMemberOrderDeliveryResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("QueryMemberOrderDeliveryResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, resp.Data) + return +} + +func RecycleCardSubmitConfirmPrice(c *gin.Context) { + req := model.SubmitConfirmPriceReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Error("ShouldBindJSON err") + RespJson(c, status.BadRequest, nil) + return + } + smExternal := &xianmai.SmExternal{ + ParaMap: req, + ApiRoute: "/openapi/order/submitConfirmPrice", + } + resp := &model.SubmitConfirmPriceResp{} + err := smExternal.Pulling(resp) + if err != nil { + logger.Error("QueryMemberOrderDeliveryResp err:", err) + RespJson(c, status.InternalServerError, nil) + return + } + + RespOK(c, nil) + return +} diff --git a/lib/xianmai/xian.go b/lib/xianmai/xian.go index 373df7c..f2258e1 100644 --- a/lib/xianmai/xian.go +++ b/lib/xianmai/xian.go @@ -145,3 +145,116 @@ func (m *GameEvaluationReq) Evaluation() (int, error) { return resp.Data, nil } + +type SmBrandListReq struct { + CategoryId uint32 `json:"categoryId"` +} +type SmBrandListResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 interface{} `json:"data1"` + Data []struct { + Id int `json:"id"` + CategoryId int `json:"categoryId"` + Name string `json:"name"` + Img string `json:"img"` + Status int `json:"status"` + CreateTime string `json:"createTime"` + UpdateTime string `json:"updateTime"` + Deleted int `json:"deleted"` + CategoryName interface{} `json:"categoryName"` + Tindex int `json:"tindex"` + } `json:"data"` +} + +func (m *SmBrandListReq) List() (*SmBrandListResp, error) { + paraMap := map[string]interface{}{ + "categoryId": m.CategoryId, + } + resp := &SmBrandListResp{} + err := GetSanMaiClient().post("/openapi/order/queryBrandList", paraMap, resp) + if err != nil { + logger.Error("post err:", err) + return resp, err + } + return resp, nil +} + +type SmGoodsListReq struct { + BrandId int `json:"brandId"` + PageNum int `json:"pageNum"` + PageSize int `json:"pageSize"` + CategoryId int `json:"categoryId"` + GoodsName string `json:"goodsName"` +} +type SmGoodsListResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 struct { + Records []struct { + Id int `json:"id"` + Name string `json:"name"` + CategoryId int `json:"categoryId"` + BrandId int `json:"brandId"` + Status int `json:"status"` + Gallery string `json:"gallery"` + Keyword string `json:"keyword"` + CreateTime string `json:"createTime"` + UpdateTime string `json:"updateTime"` + Deleted int `json:"deleted"` + Price int `json:"price"` + PriceHigh int `json:"priceHigh"` + PriceAvg int `json:"priceAvg"` + PriceCycle int `json:"priceCycle"` + OverdueDays int `json:"overdueDays"` + PriceAdjustmentTime string `json:"priceAdjustmentTime"` + TemlateId int `json:"temlateId"` + TemplateName string `json:"templateName"` + BrandName string `json:"brandName"` + CategoryName string `json:"categoryName"` + IsBindCoupon bool `json:"isBindCoupon"` + Tindex int `json:"tindex"` + } `json:"records"` + Total int `json:"total"` + Size int `json:"size"` + Current int `json:"current"` + Orders []interface{} `json:"orders"` + SearchCount bool `json:"searchCount"` + Pages int `json:"pages"` + } `json:"data1"` + Data interface{} `json:"data"` +} + +func (m *SmGoodsListReq) List() (*SmGoodsListResp, error) { + paraMap := map[string]interface{}{ + "brandId": m.BrandId, + "pageNum": m.PageNum, + "pageSize": m.PageSize, + "goodsName": m.GoodsName, + } + + resp := &SmGoodsListResp{} + err := GetSanMaiClient().post("/openapi/order/queryGoodsList", paraMap, resp) + if err != nil { + logger.Error("post err:", err) + return resp, err + } + return resp, nil +} + +type SmExternal struct { + ParaMap interface{} + ApiRoute string `json:"api_route"` + //Resp interface{} +} + +func (m *SmExternal) Pulling(resp interface{}) error { + err := GetSanMaiClient().post(m.ApiRoute, m.ParaMap, resp) + if err != nil { + logger.Error("post err:", err) + return err + } + return nil +} diff --git a/lib/xianmai/xian_http.go b/lib/xianmai/xian_http.go index ebf9947..712567f 100644 --- a/lib/xianmai/xian_http.go +++ b/lib/xianmai/xian_http.go @@ -1,8 +1,11 @@ package xianmai import ( + "bytes" "encoding/json" "fmt" + "github.com/codinl/go-logger" + "io" "io/ioutil" "net/http" "strings" @@ -173,3 +176,99 @@ type GameEvaluationResp struct { Data1 interface{} `json:"data1"` Data int `json:"data"` } + +type SanMaiClient struct { + Authentication string `json:"authentication"` + BaseURL string `json:"base_url"` +} + +var sanMaiClient *SanMaiClient + +func GetSanMaiClient() *SanMaiClient { + if sanMaiClient == nil { + sanMaiClient = &SanMaiClient{ + Authentication: "", + //BaseURL: "https://xianmai.net.cn/", + BaseURL: "https://test.xianmai.net.cn/", + } + } + return sanMaiClient +} + +//func (m *SanMaiClient) post(xmApi string, params map[string]interface{}, resp interface{}) error { +// uri := m.BaseURL + xmApi +// data, err := json.Marshal(params) +// if err != nil { +// logger.Error("Marshal params err:", err) +// return err +// } +// +// req, err := http.NewRequest("POST", uri, bytes.NewReader(data)) +// if err != nil { +// logger.Error("NewRequest err:", err) +// return err +// } +// req.Header.Add("Content-Type", "application/json;charset=utf-8") +// req.Header.Add("Authentication", m.Authentication) +// +// res, err := http.DefaultClient.Do(req) +// if err != nil { +// logger.Error("Request err:", err) +// return err +// } +// +// defer res.Body.Close() +// +// dataRsp, err := io.ReadAll(res.Body) +// if err != nil { +// fmt.Println(err) +// return err +// } +// +// fmt.Println("dataRsp:", string(dataRsp)) +// if err = json.Unmarshal(dataRsp, resp); err != nil { +// fmt.Println(err) +// return err +// } +// +// return nil +//} + +func (m *SanMaiClient) post(xmApi string, params interface{}, resp interface{}) error { + uri := m.BaseURL + xmApi + data, err := json.Marshal(params) + if err != nil { + logger.Error("Marshal params err:", err) + return err + } + + req, err := http.NewRequest("POST", uri, bytes.NewReader(data)) + if err != nil { + logger.Error("NewRequest err:", err) + return err + } + req.Header.Add("Content-Type", "application/json;charset=utf-8") + req.Header.Add("Authentication", m.Authentication) + + res, err := http.DefaultClient.Do(req) + if err != nil { + logger.Error("Request err:", err) + return err + } + + defer res.Body.Close() + + dataRsp, err := io.ReadAll(res.Body) + if err != nil { + fmt.Println(err) + return err + } + + fmt.Println("dataRsp:", string(dataRsp)) + if err = json.Unmarshal(dataRsp, resp); err != nil { + fmt.Println(err) + return err + } + + return nil +} diff --git a/model/mall.go b/model/mall.go index 4ebb3e4..51d9a9b 100644 --- a/model/mall.go +++ b/model/mall.go @@ -141,7 +141,6 @@ type GoodsAttributeCombo struct { ComboName string `json:"combo_name"` // 名称 PriceVm uint32 `json:"price_vm"` // 积分价格 PriceRm uint32 `json:"price_rm"` // 人民币价格 - } //type GoodsSpec struct { diff --git a/model/model_test.go b/model/model_test.go index 0d4371b..f4e76ff 100644 --- a/model/model_test.go +++ b/model/model_test.go @@ -167,6 +167,7 @@ func InitTestDB() { &UserInvite{}, &UserInviteRecord{}, &User{}, + &UserRedeemCode{}, ) fmt.Println("DB init success") @@ -218,6 +219,7 @@ func InitDBProd() { &UserInvite{}, &UserInviteRecord{}, &User{}, + &UserRedeemCode{}, ) if err := DBProd.DB().Ping(); err != nil { @@ -2589,7 +2591,7 @@ func GetMonth(date string) string { return date[len(date)-2:] + "月份" } -// 拉新锁卡数据 +// 拉新锁卡数据5 func TestLachineCardInfo(t *testing.T) { InitDBProd() DB = DBProd @@ -2668,3 +2670,97 @@ func UserCardStock() { // 1. } + +// 拉新锁卡数据5 +func TestUserMemberInfo(t *testing.T) { + InitDBProd() + DB = DBProd + LachineCardInfo() +} + +func TestUserMemberGenreInfo(t *testing.T) { + InitDBProd() + DB = DBProd + UserMemberGenreInfo() +} + +// 拉新锁卡数据 +func UserMemberGenreInfo() { + DB = DBProd + var cards []User + err := DBProd.Raw("SELECT id,uid,wx_name,member_genre,store_id,member_expire FROM user WHERE member_level =2 AND member_genre !=0;").Scan(&cards).Error + if err != nil { + logger.Error("err:", err) + } + //storeIds := make([]uint32, 0, len(cards)) + //gameIds := make([]uint32, 0, len(cards)) + //accountUids := []uint32{41062552, 61322858, 79502493, 5151314, 75683046, 92301496, 84098843} + //accountUserMap, _ := GetUserMap(accountUids) + //for _, user := range accountUserMap { + // storeIds = append(storeIds, uint32(user.StoreId)) + //} + //for i, _ := range cards { + // //storeIds = append(storeIds, cards[i].StoreId) + // gameIds = append(gameIds, cards[i].GameCardId) + //} + //storeMap, err := GetStoreMap(storeIds) + //if err != nil { + // logger.Error("err:", err) + //} + //gameMap := GetGameCardMap(gameIds) + file := excelize.NewFile() + streamWriter, err := file.NewStreamWriter("Sheet1") + if err != nil { + fmt.Println(err) + } + + fileName := time.Now().Format(TimeFormat) + "短期会员" + ".xlsx" + + title := []interface{}{"用户uid", "昵称", "开通时间", "到期时间", "会员类型"} + cell, _ := excelize.CoordinatesToCellName(1, 1) + if err = streamWriter.SetRow(cell, title); err != nil { + fmt.Println(err) + } + list := cards + var row []interface{} + for rowId := 0; rowId < len(list); rowId++ { + //accountUser, _ := accountUserMap[list[rowId].Uid] + //store, _ := storeMap[uint32(accountUser.StoreId)] + //store, _ := storeMap[uint32(list[rowId].StoreId)] + //gameCard := gameMap[list[rowId].GameCardId] + memberType := "90天" + memberLength := 90 + if list[rowId].MemberGenre == 202 { + memberType = "180天" + memberLength = 180 + } + open := list[rowId].MemberExpire.AddDate(0, 0, (-1)*memberLength) + + row = []interface{}{list[rowId].Uid, list[rowId].WxName, open, list[rowId].MemberExpire, + memberType, + } + cell, _ := excelize.CoordinatesToCellName(1, rowId+2) + if err := streamWriter.SetRow(cell, row); err != nil { + fmt.Println(err) + } + } + if err := streamWriter.Flush(); err != nil { + fmt.Println(err) + } + //if err := file.SaveAs("/www/server/images/export/" + fileName); err != nil { + if err := file.SaveAs("./" + fileName); err != nil { + fmt.Println(err) + } + + return +} + +func TestEvaluation(t *testing.T) { + cassetteList, i, err := xianmai.GameCassetteList("", 1, 20) + if err != nil { + fmt.Println("err:", err) + } + fmt.Println("cassetteList:", cassetteList) + fmt.Println("i:", i) + +} diff --git a/model/order.go b/model/order.go index 88a2db0..40e63b5 100644 --- a/model/order.go +++ b/model/order.go @@ -30,8 +30,9 @@ const ( PayStatusPaid = 2 // 已支付 ) -//go:generate goqueryset -in order.go // gen:qs +// +//go:generate goqueryset -in order.go type Order struct { Model diff --git a/model/redeem_code.go b/model/redeem_code.go index 7d3baea..420b442 100644 --- a/model/redeem_code.go +++ b/model/redeem_code.go @@ -37,8 +37,9 @@ const ( ) -//go:generate goqueryset -in redeem_code.go // gen:qs +// +//go:generate goqueryset -in redeem_code.go type RedeemCode struct { Model @@ -53,16 +54,21 @@ type RedeemCode struct { //Remark string `json:"remark"` } +const ( + UserRedeemCodeStatsExpired = "expired" +) + // gen:qs type UserRedeemCode struct { Model Uid uint32 `json:"uid" gorm:"index;comment:'用户id'"` - Status string `json:"status" gorm:"index;comment:'兑换状态'"` // user-hold used + Status string `json:"status" gorm:"index;comment:'兑换状态'"` // user-hold used expired StoreId uint32 `json:"store_id" gorm:"index"` // 门店id SerialCode string `json:"serial_code" gorm:"index;comment:'兑换编码'"` // 兑换编码 CodeType string `json:"code_type"` // memberCard ConvertTime time.Time `json:"convert_time"` // 绑定时间 ActivityType uint32 `json:"activity_type"` // 1-门店赠送 2-用户邀请 + ExpiredTime time.Time `json:"expired_time"` // 过期时间: } //type BindingRedeemCodeRecord struct { @@ -85,9 +91,17 @@ func RedeemSecretCode(redeem string) string { return hs[:7] } -func UserRedeemCodeList(uid uint32) ([]UserRedeemCode, error) { +func UserRedeemCodeList(uid uint32, status string) ([]UserRedeemCode, error) { var userRedeems []UserRedeemCode - err := NewUserRedeemCodeQuerySet(DB).UidEq(uid).OrderDescByID().All(&userRedeems) + qs := NewUserRedeemCodeQuerySet(DB).UidEq(uid) + //if status != "" { + //} + if status == UserRedeemCodeStatsExpired { + qs = qs.StatusEq(status) + } else { + qs = qs.StatusNe(UserRedeemCodeStatsExpired) + } + err := qs.OrderDescByID().All(&userRedeems) if err != nil && err != RecordNotFound { logger.Error("user redeem code err:", err) return userRedeems, err @@ -95,16 +109,31 @@ func UserRedeemCodeList(uid uint32) ([]UserRedeemCode, error) { if len(userRedeems) == 0 { return userRedeems, nil } + nowTime := time.Now() holdList := make([]UserRedeemCode, 0) usedList := make([]UserRedeemCode, 0) + expiredIds := make([]uint32, 0) for i, _ := range userRedeems { + if userRedeems[i].ExpiredTime.Year() == 1 { + userRedeems[i].ExpiredTime = userRedeems[i].CreatedAt.AddDate(1, 0, 0) + } if userRedeems[i].Status == UserRedeemCodeStatusHold { - //holdList = append(holdList, userRedeems[i]) + holdList = append(holdList, userRedeems[i]) + if userRedeems[i].CreatedAt.AddDate(1, 0, 0).Before(nowTime) { + expiredIds = append(expiredIds, userRedeems[i].ID) + } } else { usedList = append(usedList, userRedeems[i]) } - } + } + if len(expiredIds) != 0 { + err = NewUserRedeemCodeQuerySet(DB).IDIn(expiredIds...).GetUpdater(). + SetStatus(UserRedeemCodeStatsExpired).Update() + if err != nil { + logger.Error("updater user redeem code status err:", err) + } + } return append(holdList, usedList...), nil } diff --git a/model/sanmai.go b/model/sanmai.go new file mode 100644 index 0000000..2a2910e --- /dev/null +++ b/model/sanmai.go @@ -0,0 +1,348 @@ +package model + +type ProblemSkuListReq struct { + GoodsId int `json:"goodsId"` +} +type ProblemSkuListResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 interface{} `json:"data1"` + Data struct { + ProblemPackList []struct { + TIndex int `json:"tIndex"` + Toption int `json:"toption"` + Interval int `json:"interval"` + ProblemName string `json:"problemName"` + ProblemId int `json:"problemId"` + List []struct { + ProblemValueId string `json:"problemValueId"` + ProblemValueName string `json:"problemValueName"` + } `json:"list"` + } `json:"problemPackList"` + ProblemSkuList []struct { + TIndex int `json:"tIndex"` + Toption int `json:"toption"` + Interval int `json:"interval"` + ProblemName string `json:"problemName"` + ProblemId int `json:"problemId"` + List []struct { + ProblemValueId string `json:"problemValueId"` + ProblemValueName string `json:"problemValueName"` + } `json:"list"` + } `json:"problemSkuList"` + GoodsInfo struct { + Id int `json:"id"` + Name string `json:"name"` + CategoryId int `json:"categoryId"` + BrandId int `json:"brandId"` + Status int `json:"status"` + Gallery string `json:"gallery"` + Keyword string `json:"keyword"` + CreateTime string `json:"createTime"` + UpdateTime string `json:"updateTime"` + Deleted int `json:"deleted"` + Price int `json:"price"` + PriceHigh int `json:"priceHigh"` + PriceAvg int `json:"priceAvg"` + PriceCycle int `json:"priceCycle"` + OverdueDays int `json:"overdueDays"` + PriceAdjustmentTime string `json:"priceAdjustmentTime"` + TemlateId int `json:"temlateId"` + TemplateName string `json:"templateName"` + BrandName string `json:"brandName"` + CategoryName string `json:"categoryName"` + IsBindCoupon bool `json:"isBindCoupon"` + Tindex int `json:"tindex"` + } `json:"goodsInfo"` + } `json:"data"` +} + +type SubmitOrderEvaluationReq struct { + GoodsId int `json:"goodsId"` + ProblemAttrList []struct { + ProblemAttrId string `json:"problemAttrId"` + ProblemAttrValueId string `json:"problemAttrValueId"` + } `json:"problemAttrList"` + SkuList []struct { + ProblemAttrId string `json:"problemAttrId"` + ProblemAttrValueId string `json:"problemAttrValueId"` + } `json:"skuList"` +} + +type SubmitOrderEvaluationResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 interface{} `json:"data1"` + Data struct { + ReviewLevel string `json:"reviewLevel"` + SkuPrice float64 `json:"skuPrice"` + RatingPackId int `json:"ratingPackId"` + TempPrice int `json:"tempPrice"` + OrderId int `json:"orderId"` + OrderNo string `json:"orderNo"` + } `json:"data"` +} + +type SubmitOrderDeliveryReq struct { + OrderId int `json:"orderId"` + SenderName string `json:"senderName"` + SenderMobile string `json:"senderMobile"` + SenderAddress string `json:"senderAddress"` + SendStartTime string `json:"sendStartTime"` + SendEndTime string `json:"sendEndTime"` + ZfbAccount string `json:"zfbAccount"` + ZfbRealName string `json:"zfbRealName"` +} + +type SubmitOrderDeliveryResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 interface{} `json:"data1"` + Data string `json:"data"` +} + +type CancelOrderDeliveryReq struct { + OrderId int `json:"orderId"` +} +type CancelOrderDeliveryResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 interface{} `json:"data1"` + Data string `json:"data"` +} + +type QueryMemberOrderListReq struct { + DataType int `json:"dataType"` + PageNum string `json:"pageNum"` + PageSize string `json:"pageSize"` +} +type QueryMemberOrderListResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 interface{} `json:"data1"` + Data struct { + Total int `json:"total"` + List []struct { + Id int `json:"id"` + OrderNo string `json:"orderNo"` + State int `json:"state"` + Status int `json:"status"` + GoodsId int `json:"goodsId"` + GoodsName string `json:"goodsName"` + GoodsImg string `json:"goodsImg"` + GoodsNum int `json:"goodsNum"` + CourierNumber interface{} `json:"courierNumber"` + Imei string `json:"imei"` + Price int `json:"price"` + EvaluationPrice int `json:"evaluationPrice"` + AddTime string `json:"addTime"` + } `json:"list"` + PageNum int `json:"pageNum"` + PageSize int `json:"pageSize"` + Size int `json:"size"` + StartRow int `json:"startRow"` + EndRow int `json:"endRow"` + Pages int `json:"pages"` + PrePage int `json:"prePage"` + NextPage int `json:"nextPage"` + IsFirstPage bool `json:"isFirstPage"` + IsLastPage bool `json:"isLastPage"` + HasPreviousPage bool `json:"hasPreviousPage"` + HasNextPage bool `json:"hasNextPage"` + NavigatePages int `json:"navigatePages"` + NavigatepageNums []int `json:"navigatepageNums"` + NavigateFirstPage int `json:"navigateFirstPage"` + NavigateLastPage int `json:"navigateLastPage"` + } `json:"data"` +} + +type QueryMemberOrderdetailReq struct { + OrderId int `json:"orderId"` +} +type QueryMemberOrderdetailResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data1 interface{} `json:"data1"` + Data struct { + OrderProblemList []struct { + TIndex int `json:"tIndex"` + Toption int `json:"toption"` + Interval interface{} `json:"interval"` + ProblemName string `json:"problemName"` + ProblemId int `json:"problemId"` + List []struct { + ProblemValueId string `json:"problemValueId"` + ProblemValueName string `json:"problemValueName"` + } `json:"list"` + } `json:"orderProblemList"` + OrderInfo struct { + Id int `json:"id"` + HeadOfficeId int `json:"headOfficeId"` + BranchOfficeId int `json:"branchOfficeId"` + ShopownerId interface{} `json:"shopownerId"` + ShopAssistantId interface{} `json:"shopAssistantId"` + GoodsId int `json:"goodsId"` + MemberId int `json:"memberId"` + StoreId int `json:"storeId"` + EvaluationPrice int `json:"evaluationPrice"` + QcPrice interface{} `json:"qcPrice"` + PlatformPrice interface{} `json:"platformPrice"` + ChangeNewPrice interface{} `json:"changeNewPrice"` + TimeLimitSubsidy interface{} `json:"timeLimitSubsidy"` + State int `json:"state"` + Status int `json:"status"` + AppointmentData interface{} `json:"appointmentData"` + AppointmentTime interface{} `json:"appointmentTime"` + AddTime string `json:"addTime"` + UpdateTime interface{} `json:"updateTime"` + Deleted bool `json:"deleted"` + Phone interface{} `json:"phone"` + MemberMachineId interface{} `json:"memberMachineId"` + CouponUserId interface{} `json:"couponUserId"` + OrderId string `json:"orderId"` + Consignor interface{} `json:"consignor"` + CourierCompany interface{} `json:"courierCompany"` + CourierNumber interface{} `json:"courierNumber"` + DeliverGoodsTime interface{} `json:"deliverGoodsTime"` + ReceivedGoodsTime interface{} `json:"receivedGoodsTime"` + ConfirmTime interface{} `json:"confirmTime"` + AbnormalTime interface{} `json:"abnormalTime"` + Address interface{} `json:"address"` + HouseNumber interface{} `json:"houseNumber"` + PayeeName interface{} `json:"payeeName"` + Reason interface{} `json:"reason"` + ErId interface{} `json:"erId"` + CustomerServiceExamineId interface{} `json:"customerServiceExamineId"` + CustomerServiceExamineState int `json:"customerServiceExamineState"` + CustomerServiceExamineTime interface{} `json:"customerServiceExamineTime"` + BranchOfficeExamineState int `json:"branchOfficeExamineState"` + BranchOfficeExamineTime interface{} `json:"branchOfficeExamineTime"` + ShopownerExamineState int `json:"shopownerExamineState"` + ShopownerExamineTime interface{} `json:"shopownerExamineTime"` + TemplateId int `json:"templateId"` + TemplatePackId int `json:"templatePackId"` + GoodsName string `json:"goodsName"` + CategoryId int `json:"categoryId"` + CategoryName string `json:"categoryName"` + BrandId int `json:"brandId"` + BrandName string `json:"brandName"` + TemplateName interface{} `json:"templateName"` + TemplatePackName interface{} `json:"templatePackName"` + Price int `json:"price"` + Img string `json:"img"` + AboutPic interface{} `json:"aboutPic"` + ScrewHolePic interface{} `json:"screwHolePic"` + BlackScreenPic interface{} `json:"blackScreenPic"` + UserName interface{} `json:"userName"` + SfzNumber interface{} `json:"sfzNumber"` + SfzPositivePic interface{} `json:"sfzPositivePic"` + SfzSidePic interface{} `json:"sfzSidePic"` + Autograph interface{} `json:"autograph"` + FuselageBackplaneOnePic interface{} `json:"fuselageBackplaneOnePic"` + FuselageBackplaneTwoPic interface{} `json:"fuselageBackplaneTwoPic"` + SixPic interface{} `json:"sixPic"` + OtherPic interface{} `json:"otherPic"` + Code string `json:"code"` + ShopAssistantName interface{} `json:"shopAssistantName"` + HeadOfficeName interface{} `json:"headOfficeName"` + BranchOfficeName interface{} `json:"branchOfficeName"` + ShopownerName interface{} `json:"shopownerName"` + Message interface{} `json:"message"` + RejectionId interface{} `json:"rejectionId"` + RejectionName interface{} `json:"rejectionName"` + PayEmpId interface{} `json:"payEmpId"` + Paystatus int `json:"paystatus"` + PayStatusTime interface{} `json:"payStatusTime"` + SubMsg interface{} `json:"subMsg"` + ZfbAccount interface{} `json:"zfbAccount"` + ZfbName interface{} `json:"zfbName"` + RefundMessage interface{} `json:"refundMessage"` + RefundApplyTime interface{} `json:"refundApplyTime"` + RefundApproveOpinion interface{} `json:"refundApproveOpinion"` + RefundTime interface{} `json:"refundTime"` + RefundImg interface{} `json:"refundImg"` + RefundMoney interface{} `json:"refundMoney"` + Imei string `json:"imei"` + CompletionTime interface{} `json:"completionTime"` + SellStatus int `json:"sellStatus"` + StoreName interface{} `json:"storeName"` + ConsignorPhone interface{} `json:"consignorPhone"` + DocumentType interface{} `json:"documentType"` + ReviewPrice interface{} `json:"reviewPrice"` + PayMent interface{} `json:"payMent"` + Commission interface{} `json:"commission"` + AcceptType int `json:"acceptType"` + ReviewDescn string `json:"reviewDescn"` + FirstTrialDescn string `json:"firstTrialDescn"` + ReviewLevel interface{} `json:"reviewLevel"` + SecondQcDescn interface{} `json:"secondQcDescn"` + GoodsNum interface{} `json:"goodsNum"` + BatchNo interface{} `json:"batchNo"` + MemberAddressId interface{} `json:"memberAddressId"` + } `json:"orderInfo"` + OrderSkuList []struct { + TIndex int `json:"tIndex"` + Toption int `json:"toption"` + Interval interface{} `json:"interval"` + ProblemName string `json:"problemName"` + ProblemId int `json:"problemId"` + List []struct { + ProblemValueId string `json:"problemValueId"` + ProblemValueName string `json:"problemValueName"` + } `json:"list"` + } `json:"orderSkuList"` + ClickImages []interface{} `json:"clickImages"` + } `json:"data"` +} + +type QueryMemberOrderDeliveryReq struct { + OrderId int `json:"orderId"` +} +type QueryMemberOrderDeliveryResp struct { + Flag bool `json:"flag"` + Code int `json:"code"` + Message string `json:"message"` + Data struct { + Id int `json:"id"` + OrderNo string `json:"orderNo"` + GoodsId interface{} `json:"goodsId"` + GoodsName string `json:"goodsName"` + GoodsImg string `json:"goodsImg"` + Imei string `json:"imei"` + Price int `json:"price"` + EvaluationPrice int `json:"evaluationPrice"` + State int `json:"state"` + Status int `json:"status"` + LogistDescn string `json:"logistDescn"` + LinkAddress string `json:"linkAddress"` + LinkMan string `json:"linkMan"` + Mobile string `json:"mobile"` + CourierNumber string `json:"courierNumber"` + IsCancelOrder bool `json:"isCancelOrder"` + AddTime string `json:"addTime"` + CancelTime string `json:"cancelTime"` + OrderStatus int `json:"orderStatus"` + RouteDataList []struct { + AcceptTime string `json:"acceptTime"` + AcceptAddress string `json:"acceptAddress"` + Opcode interface{} `json:"opcode"` + Remark string `json:"remark"` + } `json:"routeDataList"` + } `json:"data"` + Data1 interface{} `json:"data1"` +} + +type SubmitConfirmPriceReq struct { + OrderId int `json:"orderId"` +} +type SubmitConfirmPriceResp struct { + Code int `json:"code"` + Flag bool `json:"flag"` + Message string `json:"message"` +} diff --git a/router/router_app.go b/router/router_app.go index e484f6a..d83d14f 100644 --- a/router/router_app.go +++ b/router/router_app.go @@ -261,6 +261,18 @@ func ConfigAppRouter(r gin.IRouter) { } recycle := api.Group("recycle_card") { + + recycle.POST("query_brand_list", controller.RecycleCardBrandList) + recycle.POST("query_goods_list", controller.RecycleCardGoodsList) + recycle.POST("query_problem_sku_list", controller.RecycleCardProblemSkuList) + recycle.POST("submit_order_evaluation", controller.RecycleCardSubmitOrderEvaluation) + recycle.POST("submit_order_delivery", controller.RecycleCardSubmitOrderDelivery) + recycle.POST("cancel_order_delivery", controller.RecycleCardCancelOrderDelivery) + recycle.POST("query_member_order_list", controller.RecycleCardQueryMemberOrderList) + recycle.POST("query_member_orderdetail", controller.RecycleCardQueryMemberOrderdetail) + recycle.POST("query_member_order_delivery", controller.RecycleCardQueryMemberOrderDelivery) + recycle.POST("submit_confirm_price", controller.RecycleCardSubmitConfirmPrice) + recycle.Use(auth.UserAccessAuth) recycle.POST("cassette/list", controller.GameCassetteList) recycle.POST("check/goods", controller.GameCheckGoods)