Commit 3bc44578 by hcy

label_op

parent 57a29d40
Showing with 9 additions and 7 deletions
......@@ -60,6 +60,7 @@ type ApiGoods struct {
BatchSn string `json:"batch_sn"`
Canal string `json:"canal"`
CpTime int `json:"cp_time"`
LabelOp int64 `json:"label_op"` //操作按钮
Coefficient Coefficient `json:"coefficient,omitempty"`
OriginalPrice []OriginalPrice `json:"original_price,omitempty"`
SuppExtendFee SuppExtendFee `json:"supp_extend_fee,omitempty"`
......@@ -84,7 +85,7 @@ type ZiyinGoodsInfo struct {
DullGoodsData
}
//经过处理后的商品数据
// 经过处理后的商品数据
type DullGoodsData struct {
ApiGoods
//额外增加的字段
......
......@@ -14,7 +14,7 @@ import (
"strings"
)
//获取商品信息,需要传入userId用于判断是否登陆
// 获取商品信息,需要传入userId用于判断是否登陆
func GetGoodsInfo(ctx *gin.Context, goodsIds []string) (goodsList []model.ApiGoods, err error) {
var userIdStr string
userIdStr, _ = ctx.Cookie("Yo4teW_uid")
......@@ -35,7 +35,7 @@ func GetGoodsInfo(ctx *gin.Context, goodsIds []string) (goodsList []model.ApiGoo
return
}
//获取商品信息
// 获取商品信息
func GetGoodsInfoByApi(ctx *gin.Context, goodsIdsStr string) (goodsList []model.ApiGoods, err error) {
params := req.Param{
"goods_id": goodsIdsStr,
......@@ -45,7 +45,7 @@ func GetGoodsInfoByApi(ctx *gin.Context, goodsIdsStr string) (goodsList []model.
}
//isMap:是否以字典形式返回值,默认是数组
// isMap:是否以字典形式返回值,默认是数组
func CurlGoodsInfo(ctx *gin.Context, goodsIdsStr string, params req.Param) (goodsList []model.ApiGoods, goodsListMap map[string]model.ApiGoods, err error) {
goodsIdList := strings.Split(goodsIdsStr, ",")
if len(goodsIdList) == 0 {
......@@ -137,6 +137,7 @@ func CurlGoodsInfo(ctx *gin.Context, goodsIdsStr string, params req.Param) (good
goods.GoodsUnit = data.Get("goods_unit").String()
goods.GoodsImages = data.Get("goods_images").String()
goods.GoodsBrief = data.Get("goods_brief").String()
goods.LabelOp = data.Get("label_op").Int()
goods.StandardBrand = data.Get("standard_brand").String()
goods.Mpl = int(data.Get("mpl").Int())
goods.MplStr = int(data.Get("mpl").Int())
......@@ -244,7 +245,7 @@ func CurlGoodsInfo(ctx *gin.Context, goodsIdsStr string, params req.Param) (good
return
}
//判断是否是新客价
// 判断是否是新客价
func CheckIsNewCustomer(userId int) (isNewCustomer, isMember bool) {
//判断新客价
if userId != 0 {
......@@ -269,7 +270,7 @@ func CheckIsNewCustomer(userId int) (isNewCustomer, isMember bool) {
return
}
//将供应商信息放到数据最外层,同时整合es相关数据
// 将供应商信息放到数据最外层,同时整合es相关数据
func GetReturnSupplierData(dullData []model.DullGoodsData) (result map[string]interface{}) {
result = make(map[string]interface{})
result["data"] = dullData
......@@ -287,7 +288,7 @@ func GetReturnSupplierData(dullData []model.DullGoodsData) (result map[string]in
return result
}
//根据es的结果获取goods_id列表
// 根据es的结果获取goods_id列表
func GetGoodsIdsByEs(res string) (goodsIds []string) {
//直接用gjson去获取goods_id列表
gjArray := gjson.Get(res, "hits.hits.#._source.goods_id").Array()
......
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