diff --git a/ddl/fs_product_template_tags.sql b/ddl/fs_product_template_tags.sql new file mode 100644 index 00000000..f7971864 --- /dev/null +++ b/ddl/fs_product_template_tags.sql @@ -0,0 +1,9 @@ +-- fusentest.fs_product_template_tags definition + +CREATE TABLE `fs_product_template_tags` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', + `title` varchar(25) NOT NULL COMMENT '标题', + `status` tinyint(1) unsigned NOT NULL COMMENT '状态 1:可用', + `create_at` int(10) unsigned NOT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT=' 模板标签表'; \ No newline at end of file diff --git a/model/fsproductmodel3dmodel_gen.go b/model/fsproductmodel3dmodel_gen.go index 9e2c9c2b..1e0b4788 100755 --- a/model/fsproductmodel3dmodel_gen.go +++ b/model/fsproductmodel3dmodel_gen.go @@ -95,14 +95,7 @@ func (m *defaultFsProductModel3dModel) Update(ctx context.Context, data *FsProdu _, err := m.conn.ExecCtx(ctx, query, data.ProductId, data.Tag, data.Title, data.Name, data.ModelInfo, data.MaterialId, data.SizeId, data.Sort, data.Light, data.LightList, data.PartId, data.PartList, data.Status, data.Ctime, data.OptionTemplate, data.Price, data.Sku, data.Id) return err } -func (m *defaultFsProductModel3dModel) ListBySizeIdsTag(ctx context.Context, sizeIds []string, tag int) (resp []FsProductModel3d, err error) { - query := fmt.Sprintf("select %s from %s where `size_id` in (?) and `tag` = ?", fsProductModel3dRows, m.table) - err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(sizeIds, ","), tag) - if err != nil { - return nil, err - } - return -} + func (m *defaultFsProductModel3dModel) tableName() string { return m.table } diff --git a/model/fsproductmodel_gen.go b/model/fsproductmodel_gen.go index 8f434238..86bc2bb1 100755 --- a/model/fsproductmodel_gen.go +++ b/model/fsproductmodel_gen.go @@ -122,24 +122,6 @@ func (m *defaultFsProductModel) Update(ctx context.Context, newData *FsProduct) return err } -func (m *defaultFsProductModel) GetProductListByConditions(ctx context.Context, productType int, isDel int, isShelf int, sort string) (resp []FsProduct, err error) { - query := fmt.Sprintf("select %s from %s where `type` = ? and `is_del` =? and `is_shelf` = ?", - fsProductRows, m.table) - switch sort { - case "sort-asc": - query = fmt.Sprintf("%s order by sort ASC", query) - case "sort-desc": - query = fmt.Sprintf("%s order by sort DESC", query) - default: - query = fmt.Sprintf("%s order by sort DESC", query) - } - err = m.conn.QueryRowsCtx(ctx, &resp, query, productType, isDel, isShelf) - if err != nil { - return nil, err - } - return -} - func (m *defaultFsProductModel) tableName() string { return m.table } diff --git a/model/fsproductpricemodel_gen.go b/model/fsproductpricemodel_gen.go index f95facf8..7b5280d5 100755 --- a/model/fsproductpricemodel_gen.go +++ b/model/fsproductpricemodel_gen.go @@ -106,18 +106,6 @@ func (m *defaultFsProductPriceModel) Update(ctx context.Context, newData *FsProd return err } -type GetPriceListRsp struct { - ProductId int64 `json:"product_id"` - Price string `json:"price"` -} - -func (m *defaultFsProductPriceModel) GetPriceList(ctx context.Context, productIds []string) (resp []GetPriceListRsp, err error) { - query := fmt.Sprintf("select %s from %s where `product_id` in (?) and `status` = ? group by product_id", "product_id,group_concat(step_price) as price ", m.table) - if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 1); err != nil { - return nil, err - } - return -} func (m *defaultFsProductPriceModel) tableName() string { return m.table } diff --git a/model/fsproductsizemodel_gen.go b/model/fsproductsizemodel_gen.go index fcd125d0..9ff3a983 100755 --- a/model/fsproductsizemodel_gen.go +++ b/model/fsproductsizemodel_gen.go @@ -88,28 +88,7 @@ func (m *defaultFsProductSizeModel) Update(ctx context.Context, data *FsProductS _, err := m.conn.ExecCtx(ctx, query, data.ProductId, data.Title, data.Cover, data.CoverImg, data.Capacity, data.Status, data.Sort, data.Remark, data.PartsCanDeleted, data.Id) return err } -func (m *defaultFsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int, err error) { - query := fmt.Sprintf("select %s from %s where `status` = ? limit 1", "count(*) as num", m.table) - err = m.conn.QueryRowCtx(ctx, &total, query, status) - if err != nil { - return 0, err - } - return -} -func (m *defaultFsProductSizeModel) FindAllByStatus(ctx context.Context, status int, sort int) (resp []FsProductSize, err error) { - query := fmt.Sprintf("select %s from %s where `status` = ? ", fsProductSizeRows, m.table) - switch sort { - case 1: - query = fmt.Sprintf("%s order by `sort` ASC", query) - case 2: - query = fmt.Sprintf("%s order by `sort` DESC", query) - } - err = m.conn.QueryRowsCtx(ctx, &resp, query, status) - if err != nil { - return nil, err - } - return -} + func (m *defaultFsProductSizeModel) tableName() string { return m.table } diff --git a/model/fsproducttemplatetagsmodel.go b/model/fsproducttemplatetagsmodel.go new file mode 100755 index 00000000..7f162d97 --- /dev/null +++ b/model/fsproducttemplatetagsmodel.go @@ -0,0 +1,24 @@ +package model + +import "github.com/zeromicro/go-zero/core/stores/sqlx" + +var _ FsProductTemplateTagsModel = (*customFsProductTemplateTagsModel)(nil) + +type ( + // FsProductTemplateTagsModel is an interface to be customized, add more methods here, + // and implement the added methods in customFsProductTemplateTagsModel. + FsProductTemplateTagsModel interface { + fsProductTemplateTagsModel + } + + customFsProductTemplateTagsModel struct { + *defaultFsProductTemplateTagsModel + } +) + +// NewFsProductTemplateTagsModel returns a model for the database table. +func NewFsProductTemplateTagsModel(conn sqlx.SqlConn) FsProductTemplateTagsModel { + return &customFsProductTemplateTagsModel{ + defaultFsProductTemplateTagsModel: newFsProductTemplateTagsModel(conn), + } +} diff --git a/model/fsproducttemplatetagsmodel_gen.go b/model/fsproducttemplatetagsmodel_gen.go new file mode 100755 index 00000000..0570b684 --- /dev/null +++ b/model/fsproducttemplatetagsmodel_gen.go @@ -0,0 +1,87 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "github.com/zeromicro/go-zero/core/stringx" +) + +var ( + fsProductTemplateTagsFieldNames = builder.RawFieldNames(&FsProductTemplateTags{}) + fsProductTemplateTagsRows = strings.Join(fsProductTemplateTagsFieldNames, ",") + fsProductTemplateTagsRowsExpectAutoSet = strings.Join(stringx.Remove(fsProductTemplateTagsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + fsProductTemplateTagsRowsWithPlaceHolder = strings.Join(stringx.Remove(fsProductTemplateTagsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" +) + +type ( + fsProductTemplateTagsModel interface { + Insert(ctx context.Context, data *FsProductTemplateTags) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*FsProductTemplateTags, error) + Update(ctx context.Context, data *FsProductTemplateTags) error + Delete(ctx context.Context, id int64) error + ListByIds(ctx context.Context, ids []string) (resp []FsProductTemplateTags, err error) + } + + defaultFsProductTemplateTagsModel struct { + conn sqlx.SqlConn + table string + } + + FsProductTemplateTags struct { + Id int64 `db:"id"` // ID + Title string `db:"title"` // 标题 + Status int64 `db:"status"` // 状态 1:可用 + CreateAt int64 `db:"create_at"` // 创建时间 + } +) + +func newFsProductTemplateTagsModel(conn sqlx.SqlConn) *defaultFsProductTemplateTagsModel { + return &defaultFsProductTemplateTagsModel{ + conn: conn, + table: "`fs_product_template_tags`", + } +} + +func (m *defaultFsProductTemplateTagsModel) Delete(ctx context.Context, id int64) error { + query := fmt.Sprintf("delete from %s where `id` = ?", m.table) + _, err := m.conn.ExecCtx(ctx, query, id) + return err +} + +func (m *defaultFsProductTemplateTagsModel) FindOne(ctx context.Context, id int64) (*FsProductTemplateTags, error) { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", fsProductTemplateTagsRows, m.table) + var resp FsProductTemplateTags + err := m.conn.QueryRowCtx(ctx, &resp, query, id) + switch err { + case nil: + return &resp, nil + case sqlc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultFsProductTemplateTagsModel) Insert(ctx context.Context, data *FsProductTemplateTags) (sql.Result, error) { + query := fmt.Sprintf("insert into %s (%s) values (?, ?)", m.table, fsProductTemplateTagsRowsExpectAutoSet) + ret, err := m.conn.ExecCtx(ctx, query, data.Title, data.Status) + return ret, err +} + +func (m *defaultFsProductTemplateTagsModel) Update(ctx context.Context, data *FsProductTemplateTags) error { + query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, fsProductTemplateTagsRowsWithPlaceHolder) + _, err := m.conn.ExecCtx(ctx, query, data.Title, data.Status, data.Id) + return err +} + +func (m *defaultFsProductTemplateTagsModel) tableName() string { + return m.table +} diff --git a/model/fsproducttemplatev2model_gen.go b/model/fsproducttemplatev2model_gen.go index c7e4ffac..d3cd0ef2 100755 --- a/model/fsproducttemplatev2model_gen.go +++ b/model/fsproducttemplatev2model_gen.go @@ -94,26 +94,6 @@ func (m *defaultFsProductTemplateV2Model) Update(ctx context.Context, data *FsPr _, err := m.conn.ExecCtx(ctx, query, data.ProductId, data.ModelId, data.Title, data.Name, data.CoverImg, data.TemplateInfo, data.MaterialImg, data.Sort, data.LogoWidth, data.LogoHeight, data.IsPublic, data.Status, data.Ctime, data.Tag, data.IsDel, data.Id) return err } -func (m *defaultFsProductTemplateV2Model) FindAllByCondition(ctx context.Context, productIds []string) (resp []FsProductTemplateV2, err error) { - query := fmt.Sprintf("select %s from %s where `id` in (?) and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table) - if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 0, 1); err != nil { - return nil, err - } - return -} -func (m *defaultFsProductTemplateV2Model) FindAllByModelIdsProduct(ctx context.Context, modelIds []string, productId int64, sort int) (resp []FsProductTemplateV2, err error) { - query := fmt.Sprintf("select %s from %s where `model_id` in (?) and `product_id` = ? and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table) - switch sort { - case 1: - query = fmt.Sprintf("%s order by `sort` ASC") - case 2: - query = fmt.Sprintf("%s order by `sort` DESC") - } - if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(modelIds, ","), productId, 0, 1); err != nil { - return nil, err - } - return -} func (m *defaultFsProductTemplateV2Model) tableName() string { return m.table } diff --git a/model/self_fsproductmodel.go b/model/self_fsproductmodel.go new file mode 100755 index 00000000..9384d052 --- /dev/null +++ b/model/self_fsproductmodel.go @@ -0,0 +1,26 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + "fmt" +) + +func (m *defaultFsProductModel) GetProductListByConditions(ctx context.Context, productType int, isDel int, isShelf int, sort string) (resp []FsProduct, err error) { + query := fmt.Sprintf("select %s from %s where `type` = ? and `is_del` =? and `is_shelf` = ?", + fsProductRows, m.table) + switch sort { + case "sort-asc": + query = fmt.Sprintf("%s order by sort ASC", query) + case "sort-desc": + query = fmt.Sprintf("%s order by sort DESC", query) + default: + query = fmt.Sprintf("%s order by sort DESC", query) + } + err = m.conn.QueryRowsCtx(ctx, &resp, query, productType, isDel, isShelf) + if err != nil { + return nil, err + } + return +} diff --git a/model/self_fsproductmodel3dmodel.go b/model/self_fsproductmodel3dmodel.go new file mode 100755 index 00000000..6967e4ad --- /dev/null +++ b/model/self_fsproductmodel3dmodel.go @@ -0,0 +1,21 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + "fmt" + "strings" +) + +func (m *defaultFsProductModel3dModel) ListBySizeIdsTag(ctx context.Context, sizeIds []string, tag int) (resp []FsProductModel3d, err error) { + if len(sizeIds) == 0 { + return nil, nil + } + query := fmt.Sprintf("select %s from %s where `size_id` in (?) and `tag` = ?", fsProductModel3dRows, m.table) + err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(sizeIds, ","), tag) + if err != nil { + return nil, err + } + return +} diff --git a/model/self_fsproductpricemodel.go b/model/self_fsproductpricemodel.go new file mode 100755 index 00000000..63478230 --- /dev/null +++ b/model/self_fsproductpricemodel.go @@ -0,0 +1,26 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + + "fmt" + "strings" +) + +type GetPriceListRsp struct { + ProductId int64 `json:"product_id"` + Price string `json:"price"` +} + +func (m *defaultFsProductPriceModel) GetPriceList(ctx context.Context, productIds []string) (resp []GetPriceListRsp, err error) { + if len(productIds) == 0 { + return nil, nil + } + query := fmt.Sprintf("select %s from %s where `product_id` in (?) and `status` = ? group by product_id", "product_id,group_concat(step_price) as price ", m.table) + if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 1); err != nil { + return nil, err + } + return +} diff --git a/model/self_fsproductsizemodel.go b/model/self_fsproductsizemodel.go new file mode 100755 index 00000000..ea61699c --- /dev/null +++ b/model/self_fsproductsizemodel.go @@ -0,0 +1,31 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + "fmt" +) + +func (m *defaultFsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int, err error) { + query := fmt.Sprintf("select %s from %s where `status` = ? limit 1", "count(*) as num", m.table) + err = m.conn.QueryRowCtx(ctx, &total, query, status) + if err != nil { + return 0, err + } + return +} +func (m *defaultFsProductSizeModel) FindAllByStatus(ctx context.Context, status int, sort int) (resp []FsProductSize, err error) { + query := fmt.Sprintf("select %s from %s where `status` = ? ", fsProductSizeRows, m.table) + switch sort { + case 1: + query = fmt.Sprintf("%s order by `sort` ASC", query) + case 2: + query = fmt.Sprintf("%s order by `sort` DESC", query) + } + err = m.conn.QueryRowsCtx(ctx, &resp, query, status) + if err != nil { + return nil, err + } + return +} diff --git a/model/self_fsproducttemplatetagsmodel.go b/model/self_fsproducttemplatetagsmodel.go new file mode 100755 index 00000000..f8014603 --- /dev/null +++ b/model/self_fsproducttemplatetagsmodel.go @@ -0,0 +1,20 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + "fmt" +) + +func (m *defaultFsProductTemplateTagsModel) ListByIds(ctx context.Context, ids []string) (resp []FsProductTemplateTags, err error) { + if len(ids) == 0 { + return nil, nil + } + query := fmt.Sprintf("select %s from %s where `id` in (?) ", fsProductTemplateTagsRows, m.table) + err = m.conn.QueryRowsCtx(ctx, &resp, query, ids) + if err != nil { + return nil, err + } + return +} diff --git a/model/self_fsproducttemplatev2model.go b/model/self_fsproducttemplatev2model.go new file mode 100755 index 00000000..b5ac10d1 --- /dev/null +++ b/model/self_fsproducttemplatev2model.go @@ -0,0 +1,33 @@ +// Code generated by goctl. DO NOT EDIT. + +package model + +import ( + "context" + "fmt" + "strings" +) + +func (m *defaultFsProductTemplateV2Model) FindAllByCondition(ctx context.Context, productIds []string) (resp []FsProductTemplateV2, err error) { + query := fmt.Sprintf("select %s from %s where `id` in (?) and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table) + if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 0, 1); err != nil { + return nil, err + } + return +} +func (m *defaultFsProductTemplateV2Model) FindAllByModelIdsProduct(ctx context.Context, modelIds []string, productId int64, sort int) (resp []FsProductTemplateV2, err error) { + if len(modelIds) == 0 { + return + } + query := fmt.Sprintf("select %s from %s where `model_id` in (?) and `product_id` = ? and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table) + switch sort { + case 1: + query = fmt.Sprintf("%s order by `sort` ASC", query) + case 2: + query = fmt.Sprintf("%s order by `sort` DESC", query) + } + if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(modelIds, ","), productId, 0, 1); err != nil { + return nil, err + } + return +} diff --git a/model/self_fstagsmodel.go b/model/self_fstagsmodel.go new file mode 100755 index 00000000..9695915d --- /dev/null +++ b/model/self_fstagsmodel.go @@ -0,0 +1,3 @@ +// Code generated by goctl. DO NOT EDIT. + +package model diff --git a/product/internal/logic/getproductinfologic.go b/product/internal/logic/getproductinfologic.go index 45c5a5ea..e79e0c98 100644 --- a/product/internal/logic/getproductinfologic.go +++ b/product/internal/logic/getproductinfologic.go @@ -2,9 +2,16 @@ package logic import ( "context" + "errors" + "fmt" + "fusenapi/model" "fusenapi/product/internal/svc" "fusenapi/product/internal/types" "fusenapi/utils/auth" + "fusenapi/utils/image" + "github.com/zeromicro/go-zero/core/stores/sqlc" + "strings" + "github.com/zeromicro/go-zero/core/logx" ) @@ -24,8 +31,9 @@ func NewGetProductInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge // 获取产品详情 func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, loginInfo auth.UserInfo) (resp *types.Response) { + loginInfo.UserId = 83 //校验前台登录情况 - /*if loginInfo.UserId == 0 { + if loginInfo.UserId == 0 { return &types.Response{Code: 402, Message: "please sign in"} } req.Pid = strings.Trim(req.Pid, " ") @@ -44,12 +52,12 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, login return &types.Response{Code: 510, Message: "product not found"} } //获取产品标签 - tagModel := model.NewFsTagsModel(l.svcCtx.MysqlConn) + /*tagModel := model.NewFsTagsModel(l.svcCtx.MysqlConn) tagInfo, err := tagModel.FindOne(l.ctx, productInfo.Type) if err != nil { logx.Error(err) return &types.Response{Code: 510, Message: "failed to get product tag"} - } + }*/ //获取产品尺寸列表 productSizeModel := model.NewFsProductSizeModel(l.svcCtx.MysqlConn) productSizeList, err := productSizeModel.FindAllByStatus(l.ctx, 1, 1) @@ -69,8 +77,10 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, login return &types.Response{Code: 510, Message: "failed to get product models"} } modelIds := make([]string, 0, len(models)) + optionTemplateIds := make([]string, 0, len(models)) for _, v := range models { modelIds = append(modelIds, fmt.Sprintf("%d", v.Id)) + optionTemplateIds = append(optionTemplateIds, fmt.Sprintf("%d", v.OptionTemplate.Int64)) } //通过产品id和模型id获取模板信息 productTemplateV2Model := model.NewFsProductTemplateV2Model(l.svcCtx.MysqlConn) @@ -80,9 +90,38 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, login return &types.Response{Code: 510, Message: "failed to get templates"} } //获取模板包含的model_id - templateModelIds := make([]string, 0, len(templateV2List)) + mapTemplateModelId := make(map[int64]struct{}) + tagIds := make([]string, 0, len(templateV2List)) for _, v := range templateV2List { - templateModelIds = append(templateModelIds, fmt.Sprintf("%d", v.ModelId)) + mapTemplateModelId[v.ModelId] = struct{}{} + tagIds = append(tagIds, v.Tag) + } + /*//获取模板分类类表 + templateTagsModel := model.NewFsProductTemplateTagsModel(l.svcCtx.MysqlConn) + templateTags, err := templateTagsModel.ListByIds(l.ctx, tagIds) + if err != nil { + logx.Error(err) + return &types.Response{Code: 510, Message: "failed to get template tags"} + } + //TODO 组装sizes + sizesRsp := make([]types.Sizes, 0, len(productSizeList)) + for _, v := range productSizeList { + //没有模型信息跳过 + if _, ok := mapTemplateModelId[v.Id]; !ok { + continue + } + var title types.SizeTitle + if err = json.Unmarshal([]byte(v.Title), &title); err != nil { + logx.Error(err) + return &types.Response{Code: 510, Message: "err title format"} + } + sizesRsp = append(sizesRsp, types.Sizes{ + Id: v.Id, + Title: title, + Capacity: v.Capacity, + Cover: v.Cover.String, + }) }*/ - return + //组装材料 + return &types.Response{} } diff --git a/product/internal/types/types.go b/product/internal/types/types.go index 9faf564b..a272da22 100644 --- a/product/internal/types/types.go +++ b/product/internal/types/types.go @@ -57,10 +57,10 @@ type Items struct { } type GetProductInfoReq struct { - Pid string `json:"pid"` //sn - Size uint32 `json:"size"` //图片尺寸 - ClientNo string `json:"clientNo"` //页面标识 - HaveCloudRendering bool `json:"haveCloudRendering"` //是否显示云渲染开关 + Pid string `form:"pid"` //sn + Size uint32 `form:"size"` //图片尺寸 + ClientNo string `form:"clientNo"` //页面标识 + HaveCloudRendering bool `form:"haveCloudRendering"` //是否显示云渲染开关 } type GetProductInfoRsp struct { @@ -164,11 +164,6 @@ type Response struct { Data interface{} `json:"data"` } -type Auth struct { - AccessSecret string `json:"AccessSecret"` - AccessExpire int `json:"AccessExpire"` -} - // Set 设置Response的Code和Message值 func (resp *Response) Set(Code int, Message string) { resp.Code = Code diff --git a/server_api/product.api b/server_api/product.api index 200e2c57..c223fda0 100644 --- a/server_api/product.api +++ b/server_api/product.api @@ -65,10 +65,10 @@ type Items { } //获取产品详情 type GetProductInfoReq { - Pid string `json:"pid"` //sn - Size uint32 `json:"size"` //图片尺寸 - ClientNo string `json:"clientNo"` //页面标识 - HaveCloudRendering bool `json:"haveCloudRendering"` //是否显示云渲染开关 + Pid string `form:"pid"` //sn + Size uint32 `form:"size"` //图片尺寸 + ClientNo string `form:"clientNo"` //页面标识 + HaveCloudRendering bool `form:"haveCloudRendering"` //是否显示云渲染开关 } type GetProductInfoRsp { Id int64 `json:"id"`