Эх сурвалжийг харах

feat:商品增上改查、sku增删改查

zhangxinlei1996 3 жил өмнө
parent
commit
f05c2d5c7c

+ 227 - 0
public/entity/base_goods.go

@@ -0,0 +1,227 @@
+package entity
+
+import (
+	"database/sql"
+	"errors"
+	"strconv"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/service"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
+	. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/db"
+)
+
+var Base_goods = Base_goods_struct{}
+
+//商品库
+type Base_goods_struct struct {
+	Id                     int64
+	Appid                  string
+	Name                   string //商品名称
+	Code                   string //商品代码
+	Describe               string //描述
+	Stand_classify_code    string //标准分类代码
+	Business_classify_code string //商户分类代码
+	Business_id            string //商家id
+	Pc_landpage            string //pc端落地页
+	Wx_landpage            string //wx端落地页
+	App_landpage           string //app端落地页
+	Logo                   string //产品logo
+	Version                string //版本号
+	Introduce_img_1        string //产品介绍图1
+	Introduce_img_2        string //产品介绍图
+	Introduce_img_3        string //产品介绍图
+	Detail                 string //详情
+	Status                 string //状态
+	Create_time            string
+	Create_persion         string
+	Update_time            string
+	Update_person          string
+	Label                  string //标签 多个,隔开
+	Attribute              string //1:资源包类型 2:权益类型
+}
+
+//新增商品
+func (b *Base_goods_struct) Add() (int64, error) {
+	if b.Appid == "" || b.Name == "" || b.Code == "" || b.Create_persion == "" {
+		return 0, errors.New("缺失参数,请检查必要参数")
+	}
+	status, _ := strconv.Atoi(b.Status)
+	business_id, _ := strconv.Atoi(b.Business_id)
+	attribute, _ := strconv.Atoi(b.Attribute)
+	ok := Mysql_BaseService.ExecTx("新增商品", func(tx *sql.Tx) bool {
+		goods_id := Mysql_BaseService.InsertByTx(tx, "base_goods", map[string]interface{}{
+			"appid":                  b.Appid,
+			"name":                   b.Name,
+			"code":                   b.Code,
+			"create_time":            b.Create_time,
+			"create_persion":         b.Create_persion,
+			"update_time":            b.Update_time,
+			"update_person":          b.Update_person,
+			"stand_classify_code":    b.Stand_classify_code,
+			"business_classify_code": b.Business_classify_code,
+			"business_id":            business_id,
+			"pc_landpage":            b.Pc_landpage,
+			"wx_landpage":            b.Wx_landpage,
+			"app_landpage":           b.App_landpage,
+			"logo":                   b.Logo,
+			"version":                b.Version,
+			"introduce_img_1":        b.Introduce_img_1,
+			"introduce_img_2":        b.Introduce_img_2,
+			"introduce_img_3":        b.Introduce_img_3,
+			"detail":                 b.Detail,
+			"status":                 status,
+			"describes":              b.Describe,
+			"attribute":              attribute,
+			"delete_status":          0,
+		})
+		//商品扩展表
+		goods_extend_id := Mysql_BaseService.InsertByTx(tx, "base_goods_extend", map[string]interface{}{
+			"appid":              b.Appid,
+			"goods_code":         b.Code,  //商品id
+			"score":              0,       //评分
+			"service_attitude":   0,       //服务态度
+			"work_progress":      0,       //工作进度
+			"completion_quality": 0,       //完成质量
+			"label":              b.Label, //标签
+			"iscan_evaluate":     0,       //评论是否可用0:不可用 1:可用
+			"sales_volume":       0,       //销售量
+			"collection_volume":  0,       //收藏量
+		})
+		return goods_id > 0 && goods_extend_id > 0
+	})
+	if ok {
+		return 1, nil
+	}
+	return 0, errors.New("新增失败")
+}
+
+//删除商品
+func (b *Base_goods_struct) Del() (int64, error) {
+	if b.Appid == "" || b.Id == 0 {
+		return 0, errors.New("缺失参数,请检查必要参数")
+	}
+	snapshot_data := Mysql_BaseService.SelectBySql(`select * from base_goods where id =? limit 1`, b.Id)
+	if snapshot_data == nil || len(*snapshot_data) == 0 {
+		return 0, errors.New("未查询到商品")
+	}
+	ok := Mysql_BaseService.ExecTx("删除商品", func(tx *sql.Tx) bool {
+		data := (*snapshot_data)[0]
+		delete(data, "id")
+		data["goods_id"] = b.Id
+		ok1 := Mysql_BaseService.UpdateByTx(tx, "base_goods", map[string]interface{}{
+			"id": b.Id,
+		}, map[string]interface{}{
+			"delete_status": 1,
+		})
+		id1 := Mysql_BaseService.InsertByTx(tx, "base_goods_snapshot", data)
+		return ok1 && id1 > 0
+	})
+	if ok {
+		return 1, nil
+	}
+	return 0, errors.New("删除失败")
+}
+
+//修改商品
+func (b *Base_goods_struct) Update() (int64, error) {
+	if b.Appid == "" || b.Id == 0 || b.Update_person == "" {
+		return 0, errors.New("缺失参数,请检查必要参数")
+	}
+	snapshot_data := Mysql_BaseService.SelectBySql(`select * from base_goods where id =? and appid=? limit 1`, b.Id, b.Appid)
+	if snapshot_data == nil || len(*snapshot_data) == 0 {
+		return 0, errors.New("未查询到商品")
+	}
+	updateMap := map[string]interface{}{
+		"version":       service.Version(),
+		"update_time":   date.NowFormat(date.Date_Full_Layout),
+		"update_person": b.Update_person,
+	}
+	if b.Name != "" {
+		updateMap["name"] = b.Name
+	}
+	//TODO 商品代码是否支持修改? 如果需要修改 需要同步修改 相关 goods_code字段
+	// if b.Code != "" {
+	// 	updateMap["code"] = b.Code
+	// }
+	if b.Stand_classify_code != "" {
+		updateMap["stand_classify_code"] = b.Stand_classify_code
+	}
+	if b.Business_classify_code != "" {
+		updateMap["business_classify_code"] = b.Business_classify_code
+	}
+	if b.Business_id != "" {
+		business_id, _ := strconv.Atoi(b.Business_id)
+		updateMap["business_id"] = business_id
+	}
+	if b.Pc_landpage != "" {
+		updateMap["pc_landpage"] = b.Pc_landpage
+	}
+	if b.Wx_landpage != "" {
+		updateMap["wx_landpage"] = b.Wx_landpage
+	}
+	if b.App_landpage != "" {
+		updateMap["app_landpage"] = b.App_landpage
+	}
+	if b.Logo != "" {
+		updateMap["logo"] = b.Logo
+	}
+	if b.Introduce_img_1 != "" {
+		updateMap["introduce_img_1"] = b.Introduce_img_1
+	}
+	if b.Introduce_img_2 != "" {
+		updateMap["introduce_img_2"] = b.Introduce_img_2
+	}
+	if b.Introduce_img_3 != "" {
+		updateMap["introduce_img_3"] = b.Introduce_img_3
+	}
+	if b.Detail != "" {
+		updateMap["detail"] = b.Detail
+	}
+	if b.Status != "" {
+		status, _ := strconv.Atoi(b.Status)
+		updateMap["status"] = status
+	}
+	if b.Attribute != "" {
+		attribute, _ := strconv.Atoi(b.Attribute)
+		updateMap["attribute"] = attribute
+	}
+	if b.Label != "" {
+		updateMap["label"] = b.Label
+	}
+
+	//修改商品
+	ok := Mysql_BaseService.ExecTx("修改商品", func(tx *sql.Tx) bool {
+		data := (*snapshot_data)[0]
+		delete(data, "id")
+		data["goods_id"] = b.Id
+		ok1 := Mysql_BaseService.UpdateByTx(tx, "base_goods", map[string]interface{}{
+			"id":    b.Id,
+			"appid": b.Appid,
+		}, updateMap)
+		//快照
+		id1 := Mysql_BaseService.InsertByTx(tx, "base_goods_snapshot", data)
+		return ok1 && id1 > 0
+	})
+	if ok {
+		return 1, nil
+	}
+	return 0, errors.New("修改失败")
+}
+
+//查看商品
+func (b *Base_goods_struct) Get() (*Base_goods_struct, error) {
+	base_goods_data := &Base_goods_struct{}
+	if b.Appid == "" || b.Id == 0 {
+		return base_goods_data, errors.New("缺失参数,请检查必要参数")
+	}
+	//TODO 关联其他表查询
+	data := Mysql_BaseService.SelectBySql(`select name,code,stand_classify_code,business_classify_code,pc_landpage,wx_landpage,app_landpage,logo,introduce_img_1,introduce_img_2,introduce_img_3,detail,status,attribute,create_persion,update_person from base_goods where id =? and appid = ?  limit 1`, b.Id, b.Appid)
+	if data == nil || len(*data) == 0 {
+		return base_goods_data, errors.New("未查询到商品")
+	}
+	r := (*data)[0]
+	base_goods_data = common.JsonUnmarshal(r, &Base_goods_struct{}).(*Base_goods_struct)
+	return base_goods_data, nil
+}

+ 58 - 0
public/entity/base_goods_function_define.go

@@ -0,0 +1,58 @@
+package entity
+
+import (
+	"database/sql"
+	"errors"
+
+	"app.yhyue.com/moapp/jybase/date"
+	. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/db"
+)
+
+var Base_goods_function_define = Base_goods_function_define_struct{}
+
+//商品库
+type Base_goods_function_define_struct struct {
+	Goods_code        string
+	Name              string
+	Appid             string
+	Function_code     string
+	Function_code_arr []string
+}
+
+//新增商品功能
+func (b *Base_goods_function_define_struct) Add() (int64, error) {
+	now := date.NowFormat(date.Date_Full_Layout)
+	if b.Appid == "" || b.Name == "" || b.Goods_code == "" {
+		return 0, errors.New("缺失参数,请检查必要参数")
+	}
+	if c := Mysql_BaseService.CountBySql(`select count(1) from base_goods where code = ?`, b.Goods_code); c <= 0 {
+		return 0, errors.New("请确认商品代码是否正确")
+	}
+	//商品功能定义明细表需要字段
+	base_goods_function_detail_fields := []string{"appid", "goods_function_define_id", "function_code"}
+	base_goods_function_detail_values := []interface{}{}
+	//多个功能代码
+
+	//新增商品功能定义表、商品功能定义明细表
+	ok := Mysql_BaseService.ExecTx("新增商品功能", func(tx *sql.Tx) bool {
+		//商品功能定义表
+		id1 := Mysql_BaseService.InsertByTx(tx, "base_goods_function_define", map[string]interface{}{
+			"appid":       b.Appid,
+			"goods_code":  b.Goods_code,
+			"name":        b.Name,
+			"create_time": now,
+		})
+		for _, v := range b.Function_code_arr {
+			base_goods_function_detail_values = append(base_goods_function_detail_values, b.Appid)
+			base_goods_function_detail_values = append(base_goods_function_detail_values, id1)
+			base_goods_function_detail_values = append(base_goods_function_detail_values, v)
+		}
+		//商品功能定义明细表
+		id2, id3 := Mysql_BaseService.InsertIgnoreBatch("base_goods_function_define_detail", base_goods_function_detail_fields, base_goods_function_detail_values)
+		return id1 > 0 && id2 != -1 && id3 != -1
+	})
+	if ok {
+		return 1, nil
+	}
+	return 0, errors.New("新增失败")
+}

+ 217 - 0
public/entity/base_goods_spec.go

@@ -0,0 +1,217 @@
+package entity
+
+import (
+	"database/sql"
+	"errors"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/service"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/goodscenter"
+
+	"app.yhyue.com/moapp/jybase/date"
+	. "bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/db"
+)
+
+var Base_goods_spec = Base_goods_spec_struct{}
+
+//商品库
+type Base_goods_spec_struct struct {
+	Id                  int64
+	Appid               string
+	Name                string //规格名称
+	Goods_code          string //商品代码
+	Origin_price        int64  //原价,仅用来显示
+	Actual_price        int64  //实际价格
+	Sku_max             int64  //sku最大份数
+	Calculation_type    int64  //权益计算类型 1:按量 2:sku(个人默认授权,企业手动需要授权)
+	Calculation_formula string //单价计算,sku*单价 $number * $price
+	Calculation_mode    int64  //1:一口价 2:公式计价 3:阶梯计价
+	Tag                 string //标签、自定义值 用于分组
+	Remark              string //备注
+	Googds_spec         []*goodscenter.GoodsSpec
+	Create_time         string
+	Update_time         string
+}
+
+//新增商品规格
+func (b *Base_goods_spec_struct) Add() (int64, error) {
+	now := date.NowFormat(date.Date_Full_Layout)
+	if b.Appid == "" || b.Name == "" || b.Goods_code == "" {
+		return 0, errors.New("缺失参数,请检查必要参数")
+	}
+	if c := Mysql_BaseService.CountBySql(`select count(1) from base_goods where code = ?`, b.Goods_code); c <= 0 {
+		return 0, errors.New("请确认商品代码是否正确")
+	}
+	//新增商品功能定义表、商品功能定义明细表
+	ok := Mysql_BaseService.ExecTx("新增商品功能", func(tx *sql.Tx) bool {
+		//商品功能定义表
+		id1 := Mysql_BaseService.InsertByTx(tx, "base_goods_spec", map[string]interface{}{
+			"appid":               b.Appid,
+			"name":                b.Name,
+			"goods_code":          b.Goods_code,
+			"origin_price":        b.Origin_price,
+			"actual_price":        b.Actual_price,
+			"sku_max":             b.Sku_max,
+			"calculation_type":    b.Calculation_type,
+			"calculation_formula": b.Calculation_formula,
+			"calculation_mode":    b.Calculation_mode,
+			"version":             service.Version(),
+			"tag":                 b.Tag,
+			"remark":              b.Remark,
+			"create_time":         now,
+			"updateTime":          now,
+		})
+		Recursion(id1, b.Googds_spec)
+		return id1 > 0
+	})
+	if ok {
+		return 1, nil
+	}
+	return 0, errors.New("新增失败")
+}
+
+//递归、生成父子关系
+func Recursion(fid int64, arr []*goodscenter.GoodsSpec) {
+	now := date.NowFormat(date.Date_Full_Layout)
+	if len(arr) == 0 {
+		return
+	}
+	for _, v := range arr {
+		Mysql_BaseService.ExecTx("添加商品规格", func(tx *sql.Tx) bool {
+			id1 := Mysql_BaseService.InsertByTx(tx, "base_goods_spec", map[string]interface{}{
+				"appid":               v.Appid,
+				"name":                v.Name,
+				"goods_code":          v.GoodsCode,
+				"origin_price":        v.OriginPrice,
+				"actual_price":        v.ActualPrice,
+				"sku_max":             v.SkuMax,
+				"calculation_type":    v.CalculationType,
+				"calculation_formula": v.CalculationFormula,
+				"calculation_mode":    v.CalculationMode,
+				"version":             service.Version(),
+				"tag":                 v.Tag,
+				"remark":              v.Remark,
+				"create_time":         now,
+				"updateTime":          now,
+			})
+			bl := true
+			if fid > 0 {
+				bl = Mysql_BaseService.InsertByTx(tx, "base_goods_spec_relation", map[string]interface{}{
+					"appid": v.Appid,
+					"pid":   fid,
+					"cid":   id1,
+				}) > 0
+			}
+			Recursion(id1, v.GoodsSpecChild)
+			return id1 > 0 && bl
+		})
+	}
+}
+
+//查看商品规格
+func (b *Base_goods_spec_struct) Get() (*Base_goods_spec_struct, error) {
+	base_goods_spec := &Base_goods_spec_struct{}
+	if b.Appid == "" || b.Id == 0 {
+		return base_goods_spec, errors.New("缺失参数,请检查必要参数")
+	}
+	//TODO 关联其他表查询
+	data := Mysql_BaseService.SelectBySql(`select * from base_goods_spec where id =? and appid = ?  limit 1`, b.Id, b.Appid)
+	if data == nil || len(*data) == 0 {
+		return base_goods_spec, errors.New("未查询到商品")
+	}
+	r := (*data)[0]
+	base_goods_spec = common.JsonUnmarshal(r, &Base_goods_spec_struct{}).(*Base_goods_spec_struct)
+	return base_goods_spec, nil
+}
+
+func (b *Base_goods_spec_struct) Del() (int64, error) {
+	if b.Appid == "" || b.Id == 0 {
+		return 0, errors.New("缺失参数,请检查必要参数")
+	}
+	data := Mysql_BaseService.SelectBySql(`select * from base_goods_spec where id =? and appid =? limit 1`, b.Id, b.Appid)
+	if data == nil || len(*data) == 0 {
+		return 0, errors.New("未找到该商品规格")
+	}
+
+	rdata := (*data)[0]
+	rdata["goods_spec_id"] = rdata["id"]
+	delete(rdata, "id")
+	now := date.NowFormat(date.Date_Full_Layout)
+	ok := Mysql_BaseService.ExecTx("添加商品规格", func(tx *sql.Tx) bool {
+		//查看规格、存入快照
+		id1 := Mysql_BaseService.InsertByTx(tx, "base_goods_spec_snapshot", rdata)
+		bl := Mysql_BaseService.UpdateByTx(tx, "base_goods_spec", map[string]interface{}{
+			"appid": b.Appid,
+			"id":    b.Id,
+		}, map[string]interface{}{
+			"delete_status": 1,
+			"update_time":   now,
+		})
+		return id1 > 0 && bl
+	})
+	if ok {
+		return 1, nil
+	}
+	return 0, errors.New("删除失败")
+}
+
+//修改
+func (b *Base_goods_spec_struct) Upd() (int64, error) {
+	if b.Appid == "" || b.Id == 0 {
+		return 0, errors.New("缺失参数,请检查必要参数")
+	}
+	data := Mysql_BaseService.SelectBySql(`select * from base_goods_spec where id =? and appid =? limit 1`, b.Id, b.Appid)
+	if data == nil || len(*data) == 0 {
+		return 0, errors.New("未找到该商品规格")
+	}
+
+	rdata := (*data)[0]
+	rdata["goods_spec_id"] = rdata["id"]
+	delete(rdata, "id")
+	updateMap := map[string]interface{}{
+		"update_time": date.NowFormat(date.Date_Full_Layout),
+		"version":     service.Version(),
+	}
+	if b.Name != "" {
+		updateMap["name"] = b.Name
+	}
+	if b.Origin_price != 0 {
+		updateMap["origin_price"] = b.Origin_price
+	}
+	if b.Actual_price != 0 {
+		updateMap["actual_price"] = b.Actual_price
+	}
+	if b.Sku_max != 0 {
+		updateMap["sku_max"] = b.Sku_max
+	}
+	if b.Calculation_type != 0 {
+		updateMap["calculation_type"] = b.Calculation_type
+	}
+	if b.Calculation_formula != "" {
+		updateMap["calculation_formula"] = b.Calculation_formula
+	}
+	if b.Calculation_mode != 0 {
+		updateMap["calculation_mode"] = b.Calculation_mode
+	}
+	if b.Tag != "" {
+		updateMap["tag"] = b.Tag
+	}
+	if b.Remark != "" {
+		updateMap["remark"] = b.Remark
+	}
+
+	//修改商品
+	ok := Mysql_BaseService.ExecTx("修改商品规格", func(tx *sql.Tx) bool {
+		ok1 := Mysql_BaseService.UpdateByTx(tx, "base_goods_spec", map[string]interface{}{
+			"id":    b.Id,
+			"appid": b.Appid,
+		}, updateMap)
+		//快照
+		id1 := Mysql_BaseService.InsertByTx(tx, "base_goods_spec_snapshot", rdata)
+		return ok1 && id1 > 0
+	})
+	if ok {
+		return 1, nil
+	}
+	return 0, errors.New("修改失败")
+}

+ 1 - 1
public/entity/base_goods_stand_classify.go

@@ -11,7 +11,7 @@ import (
 
 var Base_goods_stand_classify = base_goods_stand_classify{}
 
-//企业/用户权益表
+//标准商品分类树
 type base_goods_stand_classify struct {
 	Id    int64
 	Appid string

+ 0 - 20
public/service/base_goods_stand_classify.go

@@ -1,20 +0,0 @@
-package service
-
-import (
-	"errors"
-
-	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
-	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/goodscenter"
-)
-
-var GoodsCenterRpc goodscenter.GoodsCenter
-
-//返回的分类树
-//状态成功1 失败0
-func GetBaseGoodsStandClassify(appid string) ([]*goodscenter.Classify, int64, error) {
-	if appid == "" {
-		return nil, 0, errors.New("appid有误")
-	}
-	ret := entity.Base_goods_stand_classify.GetBaseGoodsStandClass(appid)
-	return ret, 1, nil
-}

+ 11 - 0
public/service/util.go

@@ -0,0 +1,11 @@
+package service
+
+import (
+	"strconv"
+	"time"
+)
+
+//版本号 时间戳
+func Version() string {
+	return strconv.Itoa(int(time.Now().Unix()))
+}

+ 2 - 1
rpc/etc/goodscenter.yaml

@@ -13,7 +13,8 @@ Mysql:
     MaxOpenConns: 5
     MaxIdleConns: 5
 Logx:
-  Mode: console #console|file|volume
+  Mode: file #console|file|volume
   Path: ./logs
   Level: info #info|error|severe
   KeepDays: 100
+Timeout:  5000

+ 153 - 1
rpc/goodsCenter.proto

@@ -18,12 +18,164 @@ message Classify{
 //查看标准商品分类出参
 message ClassifyResp{
 	string error_msg = 1;
-	int64 error_status = 2; 
+	int64 error_code = 2; 
 	repeated Classify classify = 3;
 }
 
+//新增商品入参
+message GoodsAddReq {
+	string appid = 1;
+	string name = 2; //商品名称
+	string code = 3; //商品代码
+	string stand_classify_code = 4; //标准分类代码
+	string business_classify_code = 5;//商户分类代码
+	string  business_id = 6;//商家id
+	string pc_landpage = 7;//pc端落地页
+	string wx_landpage = 8;//wx端落地页
+	string app_landpage = 9;//app端落地页
+	string logo = 10;//产品logo
+	string version = 11;//商品版本号
+	string introduce_img_1 = 12;//产品介绍图1
+	string introduce_img_2 = 13;//产品介绍图2
+	string introduce_img_3 = 14;//产品介绍图3
+	string detail = 15; //详情
+	string status = 16; //0下架  1上架
+	string create_persion = 17;//创建人
+	string update_person = 18;//更新人
+	string describe =19;//描述
+	string label=20;//标签
+	string attributes=21;//商品属性  //1:资源包类型 2:权益类型
+	int64 id =22; 
+}
+
+message GoodsAddResp {
+	int64 status = 1; //0失败  1成功 
+	string error_msg = 2;
+	int64 error_code = 3; 
+}
+
+message GoodsFunctionAddReq{
+	string appid = 1;
+	string goods_code =2;
+	string name =3;
+}
+
+message GoodsDelReq{
+	string appid = 1;
+	int64 id = 2;
+}
+
+message StatusResp {
+	int64 status = 1; //0失败  1成功 
+	string error_msg = 2;
+	int64 error_code = 3; 
+}
+
+message GoodsGetReq{
+	string appid = 1;
+	int64 id = 2;
+}
+
+message GoodsGetResp{
+	string appid = 1;
+	string name =2;
+	string code =3;
+	string stand_classify_code =4;
+	string business_classify_code =5;
+	string business_id =6;
+	string pc_landpage =7;
+	string wx_landpage =8;
+	string app_landpage=9;
+	string logo=10;
+	string version =11;
+	string introduce_img_1 =12;
+	string introduce_img_2 =13;
+	string introduce_img_3 =14;
+	string detail=15;
+	string status=16;
+	string attributes=17;
+	string create_time=18;
+	string create_persion=19;
+	string update_time=20;
+	string update_person =21;
+	int64 id= 22;
+	string error_msg = 23;
+	int64 error_code = 24; 
+}
+
+//
+message FunctionDefineReq{
+	string goods_code = 1;
+	string appid = 2;
+	repeated string function_code_arr = 3;
+	string name = 4;
+}
+
+message GoodsSpec{
+	string appid =1;
+	string name =2;//规格名称
+	string goods_code =3;//商品代码
+	int64 origin_price =4;//原价
+    int64 sku_max=5;//sku最大份数
+    int64 calculation_type =6;//1:按量 2:sku(个人默认授权,企业手动需要授权)
+    string calculation_formula =7;//价格的计算公式
+    int64 calculation_mode=8;//1:一口价 2:公式计价 3:阶梯计价
+    string tag=9;//自定义值,用于分组
+    string remark=10;//备注
+    int64 actual_price=11;//实际价格
+    repeated GoodsSpec goods_spec_child=12;
+    int64 id=13;//主键id
+}
+
+//商品规格 递归父子关系
+message GoodsSpecAddReq {
+	GoodsSpec goods_spec =1;
+}
+
+//
+message GoodsSpecGetReq{
+	int64 spec_id =1;
+	string appid =2;
+}
+
+message GoodsSpecGetResp{
+	int64 spec_id =1;//规格id
+	string name =2; //规格名称
+	string goods_code=3;//商品代码
+	int64 origin_price=4;//原价
+	int64 actual_price=5;//实际价
+	int64 sku_max=6;//sku最大值
+	int64 calculation_type=7;//权益计算类型
+	string calculation_formula=8;//价格计算公式
+	int64 calculation_mode=9;//1:一口价 2:公式计价 3:阶梯计价
+	string tag=10;//标签 用于分组
+	string remark=11;//备注
+	string create_time =12;//创建时间
+	string updateTime=13;//修改时间
+	string error_msg = 14;
+	int64 error_code = 15; 
+
+}
 
 service GoodsCenter {
   //查看标准商品分类
   rpc GetBaseGoodsStandClassify(ClassifyReq) returns(ClassifyResp);
+  //添加商品
+  rpc GoodsAdd(GoodsAddReq) returns (GoodsAddResp);
+  //删除商品
+  rpc GoodsDel(GoodsDelReq) returns (StatusResp);
+  //修改商品
+  rpc GoodsUpd(GoodsAddReq) returns (StatusResp);
+  //查看商品
+  rpc GoodsGet(GoodsGetReq) returns (GoodsGetResp);
+  //新增商品功能定义、功能定义明细表
+  rpc FunctionDefineAdd(FunctionDefineReq) returns(StatusResp);
+  //新增商品规格
+  rpc GoodsSpecAdd(GoodsSpecAddReq) returns (StatusResp);
+  //查看商品规格
+  rpc GoodsSpecGet(GoodsSpecGetReq) returns (GoodsSpecGetResp);
+  //删除商品规格
+  rpc GoodsSpecDel(GoodsSpecGetReq)returns (StatusResp);
+  //修改商品规格
+  rpc GoodsSpecUpd(GoodsSpecAddReq)returns (StatusResp);
 }

+ 87 - 3
rpc/goodscenter/goodscenter.go

@@ -13,13 +13,43 @@ import (
 )
 
 type (
-	Classify     = pb.Classify
-	ClassifyReq  = pb.ClassifyReq
-	ClassifyResp = pb.ClassifyResp
+	Classify            = pb.Classify
+	ClassifyReq         = pb.ClassifyReq
+	ClassifyResp        = pb.ClassifyResp
+	FunctionDefineReq   = pb.FunctionDefineReq
+	GoodsAddReq         = pb.GoodsAddReq
+	GoodsAddResp        = pb.GoodsAddResp
+	GoodsDelReq         = pb.GoodsDelReq
+	GoodsFunctionAddReq = pb.GoodsFunctionAddReq
+	GoodsGetReq         = pb.GoodsGetReq
+	GoodsGetResp        = pb.GoodsGetResp
+	GoodsSpec           = pb.GoodsSpec
+	GoodsSpecAddReq     = pb.GoodsSpecAddReq
+	GoodsSpecGetReq     = pb.GoodsSpecGetReq
+	GoodsSpecGetResp    = pb.GoodsSpecGetResp
+	StatusResp          = pb.StatusResp
 
 	GoodsCenter interface {
 		// 查看标准商品分类
 		GetBaseGoodsStandClassify(ctx context.Context, in *ClassifyReq, opts ...grpc.CallOption) (*ClassifyResp, error)
+		// 添加商品
+		GoodsAdd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*GoodsAddResp, error)
+		// 删除商品
+		GoodsDel(ctx context.Context, in *GoodsDelReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 修改商品
+		GoodsUpd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 查看商品
+		GoodsGet(ctx context.Context, in *GoodsGetReq, opts ...grpc.CallOption) (*GoodsGetResp, error)
+		// 新增商品功能定义、功能定义明细表
+		FunctionDefineAdd(ctx context.Context, in *FunctionDefineReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 新增商品规格
+		GoodsSpecAdd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 查看商品规格
+		GoodsSpecGet(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*GoodsSpecGetResp, error)
+		// 删除商品规格
+		GoodsSpecDel(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 修改商品规格
+		GoodsSpecUpd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error)
 	}
 
 	defaultGoodsCenter struct {
@@ -38,3 +68,57 @@ func (m *defaultGoodsCenter) GetBaseGoodsStandClassify(ctx context.Context, in *
 	client := pb.NewGoodsCenterClient(m.cli.Conn())
 	return client.GetBaseGoodsStandClassify(ctx, in, opts...)
 }
+
+// 添加商品
+func (m *defaultGoodsCenter) GoodsAdd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*GoodsAddResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsAdd(ctx, in, opts...)
+}
+
+// 删除商品
+func (m *defaultGoodsCenter) GoodsDel(ctx context.Context, in *GoodsDelReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsDel(ctx, in, opts...)
+}
+
+// 修改商品
+func (m *defaultGoodsCenter) GoodsUpd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsUpd(ctx, in, opts...)
+}
+
+// 查看商品
+func (m *defaultGoodsCenter) GoodsGet(ctx context.Context, in *GoodsGetReq, opts ...grpc.CallOption) (*GoodsGetResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsGet(ctx, in, opts...)
+}
+
+// 新增商品功能定义、功能定义明细表
+func (m *defaultGoodsCenter) FunctionDefineAdd(ctx context.Context, in *FunctionDefineReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.FunctionDefineAdd(ctx, in, opts...)
+}
+
+// 新增商品规格
+func (m *defaultGoodsCenter) GoodsSpecAdd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsSpecAdd(ctx, in, opts...)
+}
+
+// 查看商品规格
+func (m *defaultGoodsCenter) GoodsSpecGet(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*GoodsSpecGetResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsSpecGet(ctx, in, opts...)
+}
+
+// 删除商品规格
+func (m *defaultGoodsCenter) GoodsSpecDel(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsSpecDel(ctx, in, opts...)
+}
+
+// 修改商品规格
+func (m *defaultGoodsCenter) GoodsSpecUpd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := pb.NewGoodsCenterClient(m.cli.Conn())
+	return client.GoodsSpecUpd(ctx, in, opts...)
+}

+ 46 - 0
rpc/internal/logic/functiondefineaddlogic.go

@@ -0,0 +1,46 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FunctionDefineAddLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewFunctionDefineAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FunctionDefineAddLogic {
+	return &FunctionDefineAddLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 新增商品功能定义、功能定义明细表
+func (l *FunctionDefineAddLogic) FunctionDefineAdd(in *pb.FunctionDefineReq) (*pb.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.StatusResp{}
+	funtion_define := &entity.Base_goods_function_define_struct{
+		Goods_code:        in.GoodsCode,
+		Name:              in.Name,
+		Appid:             in.Appid,
+		Function_code_arr: in.FunctionCodeArr,
+	}
+	status, err := funtion_define.Add()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Status = status
+	return resp, nil
+}

+ 68 - 0
rpc/internal/logic/goodsaddlogic.go

@@ -0,0 +1,68 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+	"time"
+
+	"app.yhyue.com/moapp/jybase/date"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsAddLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsAddLogic {
+	return &GoodsAddLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 添加商品
+func (l *GoodsAddLogic) GoodsAdd(in *pb.GoodsAddReq) (*pb.GoodsAddResp, error) {
+	resp := &pb.GoodsAddResp{}
+	now := time.Now().Format(date.Date_Full_Layout)
+	// todo: add your logic here and delete this line
+	basegoods := &entity.Base_goods_struct{
+		Appid:                  in.Appid,
+		Name:                   in.Name,                 //商品名称
+		Code:                   in.Code,                 //商品代码
+		Describe:               in.Describe,             //描述
+		Stand_classify_code:    in.StandClassifyCode,    //标准分类代码
+		Business_classify_code: in.BusinessClassifyCode, //商户分类代码
+		Business_id:            in.BusinessId,           //商家id
+		Pc_landpage:            in.PcLandpage,           //pc端落地页
+		Wx_landpage:            in.WxLandpage,           //wx端落地页
+		App_landpage:           in.AppLandpage,          //app端落地页
+		Logo:                   in.Logo,                 //产品logo
+		Version:                in.Version,              //版本号
+		Introduce_img_1:        in.IntroduceImg_1,       //产品介绍图1
+		Introduce_img_2:        in.IntroduceImg_2,       //产品介绍图
+		Introduce_img_3:        in.IntroduceImg_3,       //产品介绍图
+		Detail:                 in.Detail,               //详情
+		Status:                 in.Status,               //状态
+		Create_time:            now,
+		Create_persion:         in.CreatePersion,
+		Update_time:            now,
+		Update_person:          in.CreatePersion,
+		Label:                  in.Label, //标签 多个,隔开
+		Attribute:              in.Attributes,
+	}
+	status, err := basegoods.Add()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Status = status
+	return resp, nil
+}

+ 45 - 0
rpc/internal/logic/goodsdellogic.go

@@ -0,0 +1,45 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsDelLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsDelLogic {
+	return &GoodsDelLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 删除商品
+func (l *GoodsDelLogic) GoodsDel(in *pb.GoodsDelReq) (*pb.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.StatusResp{}
+	basegoods := entity.Base_goods_struct{
+		Id:    in.Id,
+		Appid: in.Appid,
+	}
+	status, err := basegoods.Del()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Status = status
+	return resp, nil
+}

+ 31 - 0
rpc/internal/logic/goodsfunctionaddlogic.go

@@ -0,0 +1,31 @@
+package logic
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsFunctionAddLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsFunctionAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsFunctionAddLogic {
+	return &GoodsFunctionAddLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 添加商品功能
+func (l *GoodsFunctionAddLogic) GoodsFunctionAdd(in *pb.GoodsFunctionAddReq) (*pb.StatusResp, error) {
+	// todo: add your logic here and delete this line
+
+	return &pb.StatusResp{}, nil
+}

+ 63 - 0
rpc/internal/logic/goodsgetlogic.go

@@ -0,0 +1,63 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsGetLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsGetLogic {
+	return &GoodsGetLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 查看商品
+func (l *GoodsGetLogic) GoodsGet(in *pb.GoodsGetReq) (*pb.GoodsGetResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.GoodsGetResp{
+		ErrorCode: 0,
+	}
+	basegoods := entity.Base_goods_struct{
+		Id:    in.Id,
+		Appid: in.Appid,
+	}
+	goods_detail, err := basegoods.Get()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Appid = goods_detail.Appid
+	resp.Name = goods_detail.Name
+	resp.Code = goods_detail.Code
+	resp.StandClassifyCode = goods_detail.Stand_classify_code
+	resp.BusinessClassifyCode = goods_detail.Business_classify_code
+	resp.PcLandpage = goods_detail.Pc_landpage
+	resp.WxLandpage = goods_detail.Wx_landpage
+	resp.AppLandpage = goods_detail.App_landpage
+	resp.Logo = goods_detail.Logo
+	resp.IntroduceImg_1 = goods_detail.Introduce_img_1
+	resp.IntroduceImg_2 = goods_detail.Introduce_img_2
+	resp.IntroduceImg_3 = goods_detail.Introduce_img_3
+	resp.Detail = goods_detail.Detail
+	resp.Status = goods_detail.Status
+	resp.Attributes = goods_detail.Attribute
+	resp.CreatePersion = goods_detail.Create_persion
+	resp.UpdatePerson = goods_detail.Update_person
+	return resp, nil
+}

+ 55 - 0
rpc/internal/logic/goodsspecaddlogic.go

@@ -0,0 +1,55 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsSpecAddLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsSpecAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecAddLogic {
+	return &GoodsSpecAddLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 新增商品规格
+func (l *GoodsSpecAddLogic) GoodsSpecAdd(in *pb.GoodsSpecAddReq) (*pb.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.StatusResp{}
+	goods_spec := &entity.Base_goods_spec_struct{
+		Appid:               in.GoodsSpec.Appid,
+		Name:                in.GoodsSpec.Name,
+		Goods_code:          in.GoodsSpec.GoodsCode,
+		Origin_price:        in.GoodsSpec.OriginPrice,
+		Actual_price:        in.GoodsSpec.ActualPrice,        //实际价格
+		Sku_max:             in.GoodsSpec.SkuMax,             //sku最大份数
+		Calculation_type:    in.GoodsSpec.CalculationType,    //权益计算类型 1:按量 2:sku(个人默认授权,企业手动需要授权)
+		Calculation_formula: in.GoodsSpec.CalculationFormula, //单价计算,sku*单价 $number * $price
+		Calculation_mode:    in.GoodsSpec.CalculationMode,    //1:一口价 2:公式计价 3:阶梯计价
+		Tag:                 in.GoodsSpec.Tag,                //标签、自定义值 用于分组
+		Remark:              in.GoodsSpec.Remark,             //备注
+		Googds_spec:         in.GoodsSpec.GoodsSpecChild,
+	}
+	status, err := goods_spec.Add()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Status = status
+	return resp, nil
+}

+ 45 - 0
rpc/internal/logic/goodsspecdellogic.go

@@ -0,0 +1,45 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsSpecDelLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsSpecDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecDelLogic {
+	return &GoodsSpecDelLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 删除商品规格
+func (l *GoodsSpecDelLogic) GoodsSpecDel(in *pb.GoodsSpecGetReq) (*pb.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.StatusResp{}
+	goods_spec := &entity.Base_goods_spec_struct{
+		Id:    in.SpecId,
+		Appid: in.Appid,
+	}
+	status, err := goods_spec.Del()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Status = status
+	return resp, nil
+}

+ 56 - 0
rpc/internal/logic/goodsspecgetlogic.go

@@ -0,0 +1,56 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsSpecGetLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsSpecGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecGetLogic {
+	return &GoodsSpecGetLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 查看商品规格
+func (l *GoodsSpecGetLogic) GoodsSpecGet(in *pb.GoodsSpecGetReq) (*pb.GoodsSpecGetResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.GoodsSpecGetResp{}
+	goods_spec := &entity.Base_goods_spec_struct{
+		Appid: in.Appid,
+		Id:    in.SpecId,
+	}
+	goods_spec_detail, err := goods_spec.Get()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.SpecId = goods_spec_detail.Id
+	resp.ActualPrice = goods_spec_detail.Actual_price
+	resp.CalculationFormula = goods_spec_detail.Calculation_formula
+	resp.CalculationMode = goods_spec_detail.Calculation_mode
+	resp.CalculationType = goods_spec_detail.Calculation_mode
+	resp.CreateTime = goods_spec_detail.Create_time
+	resp.GoodsCode = goods_spec_detail.Goods_code
+	resp.Name = goods_spec_detail.Name
+	resp.OriginPrice = goods_spec_detail.Origin_price
+	resp.Remark = goods_spec_detail.Remark
+	resp.SkuMax = goods_spec_detail.Sku_max
+	resp.Tag = goods_spec_detail.Tag
+	return resp, nil
+}

+ 55 - 0
rpc/internal/logic/goodsspecupdlogic.go

@@ -0,0 +1,55 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsSpecUpdLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsSpecUpdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsSpecUpdLogic {
+	return &GoodsSpecUpdLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 修改商品规格
+func (l *GoodsSpecUpdLogic) GoodsSpecUpd(in *pb.GoodsSpecAddReq) (*pb.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.StatusResp{}
+	goods_spec := &entity.Base_goods_spec_struct{
+		Id:                  in.GoodsSpec.Id,
+		Appid:               in.GoodsSpec.Appid,
+		Name:                in.GoodsSpec.Name,
+		Goods_code:          in.GoodsSpec.GoodsCode,
+		Origin_price:        in.GoodsSpec.OriginPrice,
+		Actual_price:        in.GoodsSpec.ActualPrice,        //实际价格
+		Sku_max:             in.GoodsSpec.SkuMax,             //sku最大份数
+		Calculation_type:    in.GoodsSpec.CalculationType,    //权益计算类型 1:按量 2:sku(个人默认授权,企业手动需要授权)
+		Calculation_formula: in.GoodsSpec.CalculationFormula, //单价计算,sku*单价 $number * $price
+		Calculation_mode:    in.GoodsSpec.CalculationMode,    //1:一口价 2:公式计价 3:阶梯计价
+		Tag:                 in.GoodsSpec.Tag,                //标签、自定义值 用于分组
+		Remark:              in.GoodsSpec.Remark,             //备注
+	}
+	status, err := goods_spec.Upd()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Status = status
+	return resp, nil
+}

+ 65 - 0
rpc/internal/logic/goodsupdlogic.go

@@ -0,0 +1,65 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/public/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/goodsCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GoodsUpdLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGoodsUpdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsUpdLogic {
+	return &GoodsUpdLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 修改商品
+func (l *GoodsUpdLogic) GoodsUpd(in *pb.GoodsAddReq) (*pb.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	resp := &pb.StatusResp{}
+	// todo: add your logic here and delete this line
+	basegoods := &entity.Base_goods_struct{
+		Id:                     in.Id,
+		Appid:                  in.Appid,
+		Name:                   in.Name,                 //商品名称
+		Code:                   in.Code,                 //商品代码
+		Describe:               in.Describe,             //描述
+		Stand_classify_code:    in.StandClassifyCode,    //标准分类代码
+		Business_classify_code: in.BusinessClassifyCode, //商户分类代码
+		Business_id:            in.BusinessId,           //商家id
+		Pc_landpage:            in.PcLandpage,           //pc端落地页
+		Wx_landpage:            in.WxLandpage,           //wx端落地页
+		App_landpage:           in.AppLandpage,          //app端落地页
+		Logo:                   in.Logo,                 //产品logo
+		Version:                in.Version,              //版本号
+		Introduce_img_1:        in.IntroduceImg_1,       //产品介绍图1
+		Introduce_img_2:        in.IntroduceImg_2,       //产品介绍图
+		Introduce_img_3:        in.IntroduceImg_3,       //产品介绍图
+		Detail:                 in.Detail,               //详情
+		Status:                 in.Status,               //状态
+		Update_person:          in.UpdatePerson,
+		Label:                  in.Label, //标签 多个,隔开
+		Attribute:              in.Attributes,
+	}
+	status, err := basegoods.Update()
+	if err != nil {
+		l.Error(fmt.Sprintf("%+v", in), err.Error())
+		resp.ErrorMsg = err.Error()
+		resp.ErrorCode = -1
+	}
+	resp.Status = status
+	return resp, nil
+}

+ 54 - 0
rpc/internal/server/goodscenterserver.go

@@ -27,3 +27,57 @@ func (s *GoodsCenterServer) GetBaseGoodsStandClassify(ctx context.Context, in *p
 	l := logic.NewGetBaseGoodsStandClassifyLogic(ctx, s.svcCtx)
 	return l.GetBaseGoodsStandClassify(in)
 }
+
+// 添加商品
+func (s *GoodsCenterServer) GoodsAdd(ctx context.Context, in *pb.GoodsAddReq) (*pb.GoodsAddResp, error) {
+	l := logic.NewGoodsAddLogic(ctx, s.svcCtx)
+	return l.GoodsAdd(in)
+}
+
+// 删除商品
+func (s *GoodsCenterServer) GoodsDel(ctx context.Context, in *pb.GoodsDelReq) (*pb.StatusResp, error) {
+	l := logic.NewGoodsDelLogic(ctx, s.svcCtx)
+	return l.GoodsDel(in)
+}
+
+// 修改商品
+func (s *GoodsCenterServer) GoodsUpd(ctx context.Context, in *pb.GoodsAddReq) (*pb.StatusResp, error) {
+	l := logic.NewGoodsUpdLogic(ctx, s.svcCtx)
+	return l.GoodsUpd(in)
+}
+
+// 查看商品
+func (s *GoodsCenterServer) GoodsGet(ctx context.Context, in *pb.GoodsGetReq) (*pb.GoodsGetResp, error) {
+	l := logic.NewGoodsGetLogic(ctx, s.svcCtx)
+	return l.GoodsGet(in)
+}
+
+// 新增商品功能定义、功能定义明细表
+func (s *GoodsCenterServer) FunctionDefineAdd(ctx context.Context, in *pb.FunctionDefineReq) (*pb.StatusResp, error) {
+	l := logic.NewFunctionDefineAddLogic(ctx, s.svcCtx)
+	return l.FunctionDefineAdd(in)
+}
+
+// 新增商品规格
+func (s *GoodsCenterServer) GoodsSpecAdd(ctx context.Context, in *pb.GoodsSpecAddReq) (*pb.StatusResp, error) {
+	l := logic.NewGoodsSpecAddLogic(ctx, s.svcCtx)
+	return l.GoodsSpecAdd(in)
+}
+
+// 查看商品规格
+func (s *GoodsCenterServer) GoodsSpecGet(ctx context.Context, in *pb.GoodsSpecGetReq) (*pb.GoodsSpecGetResp, error) {
+	l := logic.NewGoodsSpecGetLogic(ctx, s.svcCtx)
+	return l.GoodsSpecGet(in)
+}
+
+// 删除商品规格
+func (s *GoodsCenterServer) GoodsSpecDel(ctx context.Context, in *pb.GoodsSpecGetReq) (*pb.StatusResp, error) {
+	l := logic.NewGoodsSpecDelLogic(ctx, s.svcCtx)
+	return l.GoodsSpecDel(in)
+}
+
+// 修改商品规格
+func (s *GoodsCenterServer) GoodsSpecUpd(ctx context.Context, in *pb.GoodsSpecAddReq) (*pb.StatusResp, error) {
+	l := logic.NewGoodsSpecUpdLogic(ctx, s.svcCtx)
+	return l.GoodsSpecUpd(in)
+}

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1229 - 5
rpc/pb/goodsCenter.pb.go


+ 342 - 0
rpc/pb/goodsCenter_grpc.pb.go

@@ -24,6 +24,24 @@ const _ = grpc.SupportPackageIsVersion7
 type GoodsCenterClient interface {
 	//查看标准商品分类
 	GetBaseGoodsStandClassify(ctx context.Context, in *ClassifyReq, opts ...grpc.CallOption) (*ClassifyResp, error)
+	//添加商品
+	GoodsAdd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*GoodsAddResp, error)
+	//删除商品
+	GoodsDel(ctx context.Context, in *GoodsDelReq, opts ...grpc.CallOption) (*StatusResp, error)
+	//修改商品
+	GoodsUpd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*StatusResp, error)
+	//查看商品
+	GoodsGet(ctx context.Context, in *GoodsGetReq, opts ...grpc.CallOption) (*GoodsGetResp, error)
+	//新增商品功能定义、功能定义明细表
+	FunctionDefineAdd(ctx context.Context, in *FunctionDefineReq, opts ...grpc.CallOption) (*StatusResp, error)
+	//新增商品规格
+	GoodsSpecAdd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error)
+	//查看商品规格
+	GoodsSpecGet(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*GoodsSpecGetResp, error)
+	//删除商品规格
+	GoodsSpecDel(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*StatusResp, error)
+	//修改商品规格
+	GoodsSpecUpd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error)
 }
 
 type goodsCenterClient struct {
@@ -43,12 +61,111 @@ func (c *goodsCenterClient) GetBaseGoodsStandClassify(ctx context.Context, in *C
 	return out, nil
 }
 
+func (c *goodsCenterClient) GoodsAdd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*GoodsAddResp, error) {
+	out := new(GoodsAddResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsAdd", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) GoodsDel(ctx context.Context, in *GoodsDelReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsDel", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) GoodsUpd(ctx context.Context, in *GoodsAddReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsUpd", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) GoodsGet(ctx context.Context, in *GoodsGetReq, opts ...grpc.CallOption) (*GoodsGetResp, error) {
+	out := new(GoodsGetResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsGet", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) FunctionDefineAdd(ctx context.Context, in *FunctionDefineReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/FunctionDefineAdd", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) GoodsSpecAdd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsSpecAdd", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) GoodsSpecGet(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*GoodsSpecGetResp, error) {
+	out := new(GoodsSpecGetResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsSpecGet", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) GoodsSpecDel(ctx context.Context, in *GoodsSpecGetReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsSpecDel", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *goodsCenterClient) GoodsSpecUpd(ctx context.Context, in *GoodsSpecAddReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/GoodsCenter/GoodsSpecUpd", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // GoodsCenterServer is the server API for GoodsCenter service.
 // All implementations must embed UnimplementedGoodsCenterServer
 // for forward compatibility
 type GoodsCenterServer interface {
 	//查看标准商品分类
 	GetBaseGoodsStandClassify(context.Context, *ClassifyReq) (*ClassifyResp, error)
+	//添加商品
+	GoodsAdd(context.Context, *GoodsAddReq) (*GoodsAddResp, error)
+	//删除商品
+	GoodsDel(context.Context, *GoodsDelReq) (*StatusResp, error)
+	//修改商品
+	GoodsUpd(context.Context, *GoodsAddReq) (*StatusResp, error)
+	//查看商品
+	GoodsGet(context.Context, *GoodsGetReq) (*GoodsGetResp, error)
+	//新增商品功能定义、功能定义明细表
+	FunctionDefineAdd(context.Context, *FunctionDefineReq) (*StatusResp, error)
+	//新增商品规格
+	GoodsSpecAdd(context.Context, *GoodsSpecAddReq) (*StatusResp, error)
+	//查看商品规格
+	GoodsSpecGet(context.Context, *GoodsSpecGetReq) (*GoodsSpecGetResp, error)
+	//删除商品规格
+	GoodsSpecDel(context.Context, *GoodsSpecGetReq) (*StatusResp, error)
+	//修改商品规格
+	GoodsSpecUpd(context.Context, *GoodsSpecAddReq) (*StatusResp, error)
 	mustEmbedUnimplementedGoodsCenterServer()
 }
 
@@ -59,6 +176,33 @@ type UnimplementedGoodsCenterServer struct {
 func (UnimplementedGoodsCenterServer) GetBaseGoodsStandClassify(context.Context, *ClassifyReq) (*ClassifyResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetBaseGoodsStandClassify not implemented")
 }
+func (UnimplementedGoodsCenterServer) GoodsAdd(context.Context, *GoodsAddReq) (*GoodsAddResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsAdd not implemented")
+}
+func (UnimplementedGoodsCenterServer) GoodsDel(context.Context, *GoodsDelReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsDel not implemented")
+}
+func (UnimplementedGoodsCenterServer) GoodsUpd(context.Context, *GoodsAddReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsUpd not implemented")
+}
+func (UnimplementedGoodsCenterServer) GoodsGet(context.Context, *GoodsGetReq) (*GoodsGetResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsGet not implemented")
+}
+func (UnimplementedGoodsCenterServer) FunctionDefineAdd(context.Context, *FunctionDefineReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method FunctionDefineAdd not implemented")
+}
+func (UnimplementedGoodsCenterServer) GoodsSpecAdd(context.Context, *GoodsSpecAddReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsSpecAdd not implemented")
+}
+func (UnimplementedGoodsCenterServer) GoodsSpecGet(context.Context, *GoodsSpecGetReq) (*GoodsSpecGetResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsSpecGet not implemented")
+}
+func (UnimplementedGoodsCenterServer) GoodsSpecDel(context.Context, *GoodsSpecGetReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsSpecDel not implemented")
+}
+func (UnimplementedGoodsCenterServer) GoodsSpecUpd(context.Context, *GoodsSpecAddReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GoodsSpecUpd not implemented")
+}
 func (UnimplementedGoodsCenterServer) mustEmbedUnimplementedGoodsCenterServer() {}
 
 // UnsafeGoodsCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -90,6 +234,168 @@ func _GoodsCenter_GetBaseGoodsStandClassify_Handler(srv interface{}, ctx context
 	return interceptor(ctx, in, info, handler)
 }
 
+func _GoodsCenter_GoodsAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsAddReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsAdd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsAdd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsAdd(ctx, req.(*GoodsAddReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_GoodsDel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsDelReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsDel(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsDel",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsDel(ctx, req.(*GoodsDelReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_GoodsUpd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsAddReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsUpd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsUpd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsUpd(ctx, req.(*GoodsAddReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_GoodsGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsGetReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsGet(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsGet",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsGet(ctx, req.(*GoodsGetReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_FunctionDefineAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(FunctionDefineReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).FunctionDefineAdd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/FunctionDefineAdd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).FunctionDefineAdd(ctx, req.(*FunctionDefineReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_GoodsSpecAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsSpecAddReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsSpecAdd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsSpecAdd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsSpecAdd(ctx, req.(*GoodsSpecAddReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_GoodsSpecGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsSpecGetReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsSpecGet(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsSpecGet",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsSpecGet(ctx, req.(*GoodsSpecGetReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_GoodsSpecDel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsSpecGetReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsSpecDel(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsSpecDel",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsSpecDel(ctx, req.(*GoodsSpecGetReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _GoodsCenter_GoodsSpecUpd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GoodsSpecAddReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(GoodsCenterServer).GoodsSpecUpd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/GoodsCenter/GoodsSpecUpd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(GoodsCenterServer).GoodsSpecUpd(ctx, req.(*GoodsSpecAddReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // GoodsCenter_ServiceDesc is the grpc.ServiceDesc for GoodsCenter service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -101,6 +407,42 @@ var GoodsCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GetBaseGoodsStandClassify",
 			Handler:    _GoodsCenter_GetBaseGoodsStandClassify_Handler,
 		},
+		{
+			MethodName: "GoodsAdd",
+			Handler:    _GoodsCenter_GoodsAdd_Handler,
+		},
+		{
+			MethodName: "GoodsDel",
+			Handler:    _GoodsCenter_GoodsDel_Handler,
+		},
+		{
+			MethodName: "GoodsUpd",
+			Handler:    _GoodsCenter_GoodsUpd_Handler,
+		},
+		{
+			MethodName: "GoodsGet",
+			Handler:    _GoodsCenter_GoodsGet_Handler,
+		},
+		{
+			MethodName: "FunctionDefineAdd",
+			Handler:    _GoodsCenter_FunctionDefineAdd_Handler,
+		},
+		{
+			MethodName: "GoodsSpecAdd",
+			Handler:    _GoodsCenter_GoodsSpecAdd_Handler,
+		},
+		{
+			MethodName: "GoodsSpecGet",
+			Handler:    _GoodsCenter_GoodsSpecGet_Handler,
+		},
+		{
+			MethodName: "GoodsSpecDel",
+			Handler:    _GoodsCenter_GoodsSpecDel_Handler,
+		},
+		{
+			MethodName: "GoodsSpecUpd",
+			Handler:    _GoodsCenter_GoodsSpecUpd_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "goodsCenter.proto",

+ 190 - 0
rpc/test/goods_test.go

@@ -39,3 +39,193 @@ func Test_GetBaseGoodsStandClassify(t *testing.T) {
 	class, _ := json.Marshal(res.Classify)
 	log.Println(string(class))
 }
+
+// go test -v -run Test_GoodsAdd
+func Test_GoodsAdd(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsAddReq{
+		Appid:                "10000",
+		Name:                 "超级无敌订阅",
+		Code:                 "superVip",
+		StandClassifyCode:    "标准商品分类code",
+		BusinessClassifyCode: "商家分类code",
+		BusinessId:           "1",
+		PcLandpage:           "https://www.jianyu360.cn",
+		WxLandpage:           "https://www.jianyu360.cn",
+		AppLandpage:          "https://www.jianyu360.cn",
+		Logo:                 "https://cdn-ali2.jianyu360.com/images/subscribe/new-banner.png?v=24300",
+		Version:              "1",
+		IntroduceImg_1:       "https://www.jianyu360.cn/front/subscribe.html",
+		IntroduceImg_2:       "https://www.jianyu360.cn/front/subscribe.html",
+		IntroduceImg_3:       "https://www.jianyu360.cn/front/subscribe.html",
+		Detail:               "这是详情",
+		Status:               "1",
+		CreatePersion:        "任正非",
+		UpdatePerson:         "任正非",
+		Describe:             "这是描述",
+		Label:                "超级,无敌,订阅",
+	}
+	res, err := FileSystem.GoodsAdd(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+// go test -v -run Test_GoodsDel
+func Test_GoodsDel(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsDelReq{
+		Appid: "10000",
+		Id:    13,
+	}
+	res, err := FileSystem.GoodsDel(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+// go test -v -run Test_GoodsUpd
+func Test_GoodsUpd(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsAddReq{
+		Appid:        "10000",
+		Name:         "超级无敌订阅222",
+		UpdatePerson: "张三丰",
+		Id:           13,
+	}
+	res, err := FileSystem.GoodsUpd(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+// go test -v -run Test_GoodsGet
+func Test_GoodsGet(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsGetReq{
+		Appid: "10000",
+		Id:    13,
+	}
+	res, err := FileSystem.GoodsGet(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+//go test -v -run Test_FunctionDeAdd
+func Test_FunctionDeAdd(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.FunctionDefineReq{
+		Appid:           "10000",
+		GoodsCode:       "superVip",
+		FunctionCodeArr: []string{"dingyue1", "dingyue2"},
+		Name:            "订阅",
+	}
+	res, err := FileSystem.FunctionDefineAdd(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+//go test -v -run Test_GoodsSpecAdd
+func Test_GoodsSpecAdd(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsSpecAddReq{
+		GoodsSpec: &goodspb.GoodsSpec{
+			Appid:              "10000",
+			Name:               "导出",
+			GoodsCode:          "order_export",
+			OriginPrice:        10000,
+			SkuMax:             20000,
+			CalculationType:    1,
+			CalculationFormula: "",
+			CalculationMode:    1,
+			Tag:                "数据导出",
+			Remark:             "备注",
+			ActualPrice:        5000,
+			GoodsSpecChild: []*goodspb.GoodsSpec{
+				&goodspb.GoodsSpec{
+					Appid:              "10000",
+					Name:               "标准导出",
+					GoodsCode:          "order_export",
+					OriginPrice:        10000,
+					SkuMax:             20000,
+					CalculationType:    1,
+					CalculationFormula: "",
+					CalculationMode:    1,
+					Tag:                "标准数据导出",
+					Remark:             "备注",
+					ActualPrice:        5000,
+				},
+				&goodspb.GoodsSpec{
+					Appid:              "10000",
+					Name:               "高级导出",
+					GoodsCode:          "order_export",
+					OriginPrice:        10000,
+					SkuMax:             20000,
+					CalculationType:    1,
+					CalculationFormula: "",
+					CalculationMode:    1,
+					Tag:                "高级数据导出",
+					Remark:             "备注",
+					ActualPrice:        5000,
+				},
+			},
+		},
+	}
+	res, err := FileSystem.GoodsSpecAdd(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+//go test -v -run Test_GoodsspecGet
+func Test_GoodsspecGet(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsSpecGetReq{
+		Appid:  "10000",
+		SpecId: 1,
+	}
+	res, err := FileSystem.GoodsSpecGet(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+//go test -v -run Test_GoodsspecDel
+func Test_GoodsspecDel(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsSpecGetReq{
+		Appid:  "10000",
+		SpecId: 1,
+	}
+	res, err := FileSystem.GoodsSpecDel(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
+//go test -v -run Test_GoodsspecUpd
+func Test_GoodsspecUpd(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+	FileSystem := goodscenter.NewGoodsCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &goodspb.GoodsSpecAddReq{
+		GoodsSpec: &goodspb.GoodsSpec{
+			Appid:       "10000",
+			Name:        "导出啊 啊啊",
+			GoodsCode:   "order_export2",
+			OriginPrice: 20000,
+			Id:          1,
+		},
+	}
+	res, err := FileSystem.GoodsSpecUpd(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно