|
|
/**
|
|
|
* @Auth:ShenZ
|
|
|
* @Description:
|
|
|
*/
|
|
|
syntax = "proto3"; // 版本号
|
|
|
option go_package="./;proto"; //参数1 表示生成到哪个目录 ,参数2 表示生成的文件的package
|
|
|
package proto ; //默认在哪个包
|
|
|
|
|
|
|
|
|
//结构体
|
|
|
/*
|
|
|
ID int32 `json:"id"`
|
|
|
UserId int32 `json:"userId"`
|
|
|
ProductId int32 `gorm:"product_id" json:"productId"`
|
|
|
ProductSkuId int32 `gorm:"product_sku_id" json:"productSkuId"`
|
|
|
ProductName string `json:"productName"`
|
|
|
ProductMainPicture string `gorm:"product_main_picture" json:"productMainPicture"`
|
|
|
Number int32 `gorm:"default:1" json:"number"`
|
|
|
CreateUser int32 `gorm:"default:1" json:"createUser"`
|
|
|
CreateTime time.Time `json:"createTime"`
|
|
|
UpdateUser int32 `json:"updateUser"`
|
|
|
UpdateTime time.Time `json:"updateTime"`
|
|
|
IsDeleted bool `json:"isDeleted"`
|
|
|
*/
|
|
|
message ShoppingCart {
|
|
|
int32 id = 1;
|
|
|
int32 userId = 2;
|
|
|
int32 productId =3;
|
|
|
int32 productSkuId = 4;
|
|
|
string productName = 5;
|
|
|
string productMainPicture = 6;
|
|
|
int32 number = 7;
|
|
|
}
|
|
|
/**
|
|
|
前端请求信息 新增购物车
|
|
|
{
|
|
|
"number": 0,
|
|
|
"productId": 0,
|
|
|
"productSkuId": 0
|
|
|
}
|
|
|
**/
|
|
|
//请求 request struct
|
|
|
message AddCartReq {
|
|
|
int32 number = 1;
|
|
|
int32 productId = 2;
|
|
|
int32 productSkuId =3;
|
|
|
string productName = 4;
|
|
|
string productMainPicture = 5;
|
|
|
int32 userId =6;
|
|
|
}
|
|
|
//响应 resp struct
|
|
|
/**
|
|
|
"productSimple": {
|
|
|
"id": 15,
|
|
|
"name": "SKG K3颈椎按摩仪护颈仪颈部按摩器礼品",
|
|
|
"startingPrice": 259.00,
|
|
|
"mainPicture": "https://msb-edu-prod.oss-cn-beijing.aliyuncs.com/mall-product/productyou.mashibing.com_goods_detail_15.png",
|
|
|
"labelList": null,
|
|
|
"singleBuyLimit": 0,
|
|
|
"isEnable": true,
|
|
|
"productType": 1
|
|
|
},
|
|
|
"productSkuSimple": {
|
|
|
"skuId": 31,
|
|
|
"attributeSymbolList": "8",
|
|
|
"name": "SKG 4098蓝牙款颈椎仪",
|
|
|
"sellPrice": 359.00,
|
|
|
"stock": 100
|
|
|
},
|
|
|
"shoppingCartNumber": 2, //增加购物车数量
|
|
|
"canSetShoppingCartNumber": 2, //实际最大可设置购物车数量
|
|
|
"isBeyondMaxLimit": false //是否超出最大限制
|
|
|
**/
|
|
|
message AddCartResp{
|
|
|
ProductDetail productSimple = 1;
|
|
|
ProductSku productSkuSimple =2;
|
|
|
int64 shoppingCartNumber = 3;
|
|
|
int64 canSetShoppingCartNumber = 4;
|
|
|
bool isBeyondMaxLimit = 5;
|
|
|
}
|
|
|
//RPC 服务 接口
|
|
|
service AddCart {
|
|
|
//rpc 服务
|
|
|
rpc AddCart (AddCartReq) returns (AddCartResp){}
|
|
|
}
|
|
|
message Product {
|
|
|
int32 id = 1;
|
|
|
string name = 2;
|
|
|
int32 startingPrice =3;
|
|
|
string mainPicture = 4;
|
|
|
map<string,string> labelList = 5;
|
|
|
int32 singleBuyLimit = 6;
|
|
|
string token = 7;
|
|
|
bool isEnable = 8;
|
|
|
int32 productType = 9;
|
|
|
}
|
|
|
/**
|
|
|
前端请求信息
|
|
|
{
|
|
|
"clientId": 0,
|
|
|
"phone": "",
|
|
|
"systemId": 0,
|
|
|
"verificationCode": ""
|
|
|
}
|
|
|
**/
|
|
|
//请求 request struct
|
|
|
message PageReq {
|
|
|
int32 length = 1;
|
|
|
int32 pageIndex = 2;
|
|
|
}
|
|
|
//响应 resp struct
|
|
|
/**
|
|
|
|
|
|
**/
|
|
|
message PageResp{
|
|
|
repeated Product product = 1;
|
|
|
int64 total =2;
|
|
|
int64 rows = 3;
|
|
|
}
|
|
|
//RPC 服务 接口
|
|
|
service Page {
|
|
|
//rpc 服务
|
|
|
rpc Page (PageReq) returns (PageResp){}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
ID int32 `json:"id"`
|
|
|
Name string `json:"name"`
|
|
|
ProductType int32 `gorm:"default:1" json:"productType"`
|
|
|
CategoryId int32 `json:"categoryId"`
|
|
|
StartingPrice float32 `json:"startingPrice"`
|
|
|
TotalStock int32 `gorm:"default:1234" json:"totalStock"`
|
|
|
MainPicture string `gorm:"default:1" json:"mainPicture"`
|
|
|
RemoteAreaPostage float32 `json:"remoteAreaPostage"`
|
|
|
SingleBuyLimit int32 `json:"singleBuyLimit"`
|
|
|
IsEnable bool `json:"isEnable"`
|
|
|
Remark string `gorm:"default:1" json:"remark"`
|
|
|
CreateUser int32 `gorm:"default:1" json:"createUser"`
|
|
|
CreateTime time.Time `json:"createTime"`
|
|
|
UpdateUser int32 `json:"updateUser"`
|
|
|
UpdateTime time.Time `json:"updateTime"`
|
|
|
IsDeleted bool `json:"isDeleted"`
|
|
|
Detail string `gorm:"dtail" json:"detail"` //商品详情页面
|
|
|
PictureList []string `gorm:"pictureList" json:"pictureList"` //商品详情需要的图片
|
|
|
*/
|
|
|
message ProductDetail {
|
|
|
int32 id = 1;
|
|
|
string name = 2;
|
|
|
int32 productType =3;
|
|
|
int32 categoryId = 4;
|
|
|
float startingPrice =5;
|
|
|
int32 totalStock = 6;
|
|
|
string mainPicture =7;
|
|
|
float remoteAreaPostage = 8;
|
|
|
int32 singleBuyLimit =9;
|
|
|
bool isEnable =10;
|
|
|
string remark =11;
|
|
|
int32 createUser =12 ;
|
|
|
string createTime = 13; //go get google.golang.org/protobuf/ptypes/timestamp
|
|
|
int32 updateUser =14;
|
|
|
string updateTime =15;
|
|
|
bool IsDeleted =16;
|
|
|
string detail =17;
|
|
|
string pictureList =18;
|
|
|
}
|
|
|
//请求 request struct
|
|
|
message ProductDetailReq {
|
|
|
int32 id = 1;
|
|
|
}
|
|
|
//响应 resp struct
|
|
|
/**
|
|
|
|
|
|
**/
|
|
|
message ProductDetailResp{
|
|
|
repeated ProductDetail productDetail = 1;
|
|
|
}
|
|
|
//RPC 服务 接口
|
|
|
service ShowProductDetail {
|
|
|
//rpc 服务
|
|
|
rpc ShowProductDetail (ProductDetailReq) returns (ProductDetailResp){}
|
|
|
}
|
|
|
/*
|
|
|
SkuId int32 `gorm:"column:id" json:"skuId"`
|
|
|
Name string
|
|
|
AttributeSymbolList string `gorm:"column:attribute_symbolList" json:"attributeSymbolList"`
|
|
|
SellPrice float32 `gorm:"column:sell_price" json:"sellPrice"`
|
|
|
Stock int32 `gorm:"default:1"`
|
|
|
*/
|
|
|
message ProductSku {
|
|
|
int32 skuId = 1;
|
|
|
string name = 2;
|
|
|
string attributeSymbolList =3;
|
|
|
float sellPrice = 4;
|
|
|
int32 stock =5;
|
|
|
}
|
|
|
//请求 request struct
|
|
|
message ProductSkuReq {
|
|
|
int32 productId = 1;
|
|
|
}
|
|
|
//响应 resp struct
|
|
|
/**
|
|
|
|
|
|
**/
|
|
|
message ProductSkuResp{
|
|
|
repeated ProductSku productSku = 1;
|
|
|
}
|
|
|
//RPC 服务 接口
|
|
|
service ShowProductSku {
|
|
|
//rpc 服务
|
|
|
rpc ShowProductSku (ProductSkuReq) returns (ProductSkuResp){}
|
|
|
}
|