This commit is contained in:
laodaming 2023-06-06 15:08:17 +08:00
parent cf3a02ae7e
commit 045aa81899
2 changed files with 277 additions and 283 deletions

View File

@ -0,0 +1,271 @@
package constants
// 产品列表demo
const PRODUCT_LIST_DEMO = `{
"ob": {
"items": [
{
"id": 25,
"sn": "P1ELZGHU",
"title": "Packing box",
"cover": "/icon/icon_25_800.png",
"intro": "打包盒卡纸",
"cover_img": "/uploads/ognhdc6q_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 28,
"sn": "P9KVYAUS",
"title": "Pizza box",
"cover": "/icon/9dmom0g7_800.png",
"intro": "披萨盒 瓦楞纸",
"cover_img": "/uploads/9xf1olkl_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 30,
"sn": "PZWDSROX",
"title": "Paper bag with handle",
"cover": "/icon/iz44vraw_800.png",
"intro": "有提手纸袋牛皮纸",
"cover_img": "/uploads/rpwntxcq_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 20,
"sn": "PNACHNUK",
"title": "Four cups of milk tea cup",
"cover": "/icon/plz43wpo_800.png",
"intro": "卡纸",
"cover_img": "/uploads/9tqgsjqi_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 2,
"miniPrice": 2
},
{
"id": 19,
"sn": "PHHVEXRW",
"title": "Milk tea cup holder double cup",
"cover": "/icon/ipohmmcj_800.png",
"intro": "奶茶杯托奶茶杯托两杯袋",
"cover_img": "/uploads/57ogzeq5_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 11,
"sn": "P7N4D0MK",
"title": "Cup double layer",
"cover": "/icon/nrmzz4du_800.png",
"intro": "牛皮纸双层",
"cover_img": "/uploads/oqjm5own_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 33,
"sn": "P0NFP19Y",
"title": "High paper bowl",
"cover": "/icon/cla4k6om_800.png",
"intro": "牛皮纸",
"cover_img": "/uploads/dt1qjkzg_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 32,
"sn": "PDZ3HIUL",
"title": "Flat paper bowl",
"cover": "/icon/jy14adqz_800.png",
"intro": "牛皮纸",
"cover_img": "/uploads/bzwbxduc_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 3,
"miniPrice": 2
},
{
"id": 31,
"sn": "PEVSMU7I",
"title": "Paper bag without handle",
"cover": "/icon/osdsegor_800.png",
"intro": "牛皮纸",
"cover_img": "/uploads/ouvayny7_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 2,
"miniPrice": 2
},
{
"id": 29,
"sn": "P58ZZOTI",
"title": "plastic bag",
"cover": "/icon/dvsvddks_800.png",
"intro": "塑料袋",
"cover_img": "/uploads/qvvuzkzx_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 24,
"sn": "PG7XIXII",
"title": "Hamburger box",
"cover": "/icon/icon_24_800.png",
"intro": "汉堡盒 卡纸",
"cover_img": "/uploads/fm1itgge_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 23,
"sn": "PIJ2OVUE",
"title": "Milk tea ring portable double cup",
"cover": "/icon/nxb6hjln_800.png",
"intro": "卡纸",
"cover_img": "/uploads/52fash1n_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 21,
"sn": "PMHXGUL6",
"title": "Milk tea ring portable single cup",
"cover": "/icon/qoaf5mtp_800.png",
"intro": "卡纸",
"cover_img": "/uploads/epvkzvyf_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 18,
"sn": "PFCM8KNF",
"title": "Tableware set chopsticks",
"cover": "/icon/tcspod4b_800.png",
"intro": "餐具套装筷子厚牛皮纸包装",
"cover_img": "/uploads/5jgrgzvh_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 3,
"miniPrice": 2
},
{
"id": 17,
"sn": "PQKIQMIK",
"title": "Tableware set four piece set",
"cover": "/icon/mdo0vu1u_800.png",
"intro": "牛皮纸包装",
"cover_img": "/uploads/szsekvbw_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 16,
"sn": "PBFOIOFH",
"title": "Tableware set four piece set",
"cover": "/icon/dzrf59cp_800.png",
"intro": "餐具套装",
"cover_img": "/uploads/svfoebf1_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 15,
"sn": "P02V10AB",
"title": " Hot drink cup holder",
"cover": "/icon/icon_15_800.png",
"intro": "杯托、瓦楞纸",
"cover_img": "/uploads/4qbdid7i_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 13,
"sn": "PER6WLAV",
"title": " Cup pet",
"cover": "/icon/icon_13_800.png",
"intro": "pet",
"cover_img": "/uploads/kfxehwjd_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 12,
"sn": "PGFWRMAU",
"title": " Cup PP",
"cover": "/icon/icon_12_800.png",
"intro": "pp",
"cover_img": "/uploads/azp8uwhz_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 2,
"miniPrice": 2
},
{
"id": 10,
"sn": "P4ZXDVHS",
"title": "Cup monolayer",
"cover": "/icon/icon_10_800.png",
"intro": "牛皮纸单层",
"cover_img": "/uploads/onuzax6l_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
}
],
"_links": {
"self": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=1&is_demo=1"
},
"first": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=1&is_demo=1"
},
"last": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=2&is_demo=1"
},
"next": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=2&is_demo=1"
}
},
"_meta": {
"totalCount": 21,
"pageCount": 2,
"currentPage": 1,
"perPage": 20
}
},
"typeName": "Boxes",
"description": ""
}`

View File

@ -43,7 +43,7 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, login
//如果是demo
if req.IsDemo == 1 {
var demo types.GetProductListRsp
if err := json.Unmarshal([]byte(l.DemoProductList()), &demo); err != nil {
if err := json.Unmarshal([]byte(constants.PRODUCT_LIST_DEMO), &demo); err != nil {
logx.Error(err)
return &types.Response{Code: 510, Message: "demo data format err"}
}
@ -176,287 +176,10 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, login
}
itemList = append(itemList, item)
}
return &types.Response{
Code: 200,
Message: "success",
Data: types.GetProductListRsp{
Ob: types.Ob{
Items: itemList,
},
TypeName: tagInfo.Title,
Description: tagInfo.Description,
}}
return &types.Response{Code: 200, Message: "success", Data: types.GetProductListRsp{
Ob: types.Ob{
Items: itemList,
}, TypeName: tagInfo.Title, Description: tagInfo.Description,
}}
return
}
// 样本产品列表
func (l *GetProductListLogic) DemoProductList() string {
return `{
"ob": {
"items": [
{
"id": 25,
"sn": "P1ELZGHU",
"title": "Packing box",
"cover": "/icon/icon_25_800.png",
"intro": "打包盒卡纸",
"cover_img": "/uploads/ognhdc6q_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 28,
"sn": "P9KVYAUS",
"title": "Pizza box",
"cover": "/icon/9dmom0g7_800.png",
"intro": "披萨盒 瓦楞纸",
"cover_img": "/uploads/9xf1olkl_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 30,
"sn": "PZWDSROX",
"title": "Paper bag with handle",
"cover": "/icon/iz44vraw_800.png",
"intro": "有提手纸袋牛皮纸",
"cover_img": "/uploads/rpwntxcq_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 20,
"sn": "PNACHNUK",
"title": "Four cups of milk tea cup",
"cover": "/icon/plz43wpo_800.png",
"intro": "卡纸",
"cover_img": "/uploads/9tqgsjqi_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 2,
"miniPrice": 2
},
{
"id": 19,
"sn": "PHHVEXRW",
"title": "Milk tea cup holder double cup",
"cover": "/icon/ipohmmcj_800.png",
"intro": "奶茶杯托奶茶杯托两杯袋",
"cover_img": "/uploads/57ogzeq5_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 11,
"sn": "P7N4D0MK",
"title": "Cup double layer",
"cover": "/icon/nrmzz4du_800.png",
"intro": "牛皮纸双层",
"cover_img": "/uploads/oqjm5own_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 33,
"sn": "P0NFP19Y",
"title": "High paper bowl",
"cover": "/icon/cla4k6om_800.png",
"intro": "牛皮纸",
"cover_img": "/uploads/dt1qjkzg_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 32,
"sn": "PDZ3HIUL",
"title": "Flat paper bowl",
"cover": "/icon/jy14adqz_800.png",
"intro": "牛皮纸",
"cover_img": "/uploads/bzwbxduc_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 3,
"miniPrice": 2
},
{
"id": 31,
"sn": "PEVSMU7I",
"title": "Paper bag without handle",
"cover": "/icon/osdsegor_800.png",
"intro": "牛皮纸",
"cover_img": "/uploads/ouvayny7_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 2,
"miniPrice": 2
},
{
"id": 29,
"sn": "P58ZZOTI",
"title": "plastic bag",
"cover": "/icon/dvsvddks_800.png",
"intro": "塑料袋",
"cover_img": "/uploads/qvvuzkzx_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 24,
"sn": "PG7XIXII",
"title": "Hamburger box",
"cover": "/icon/icon_24_800.png",
"intro": "汉堡盒 卡纸",
"cover_img": "/uploads/fm1itgge_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 23,
"sn": "PIJ2OVUE",
"title": "Milk tea ring portable double cup",
"cover": "/icon/nxb6hjln_800.png",
"intro": "卡纸",
"cover_img": "/uploads/52fash1n_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 21,
"sn": "PMHXGUL6",
"title": "Milk tea ring portable single cup",
"cover": "/icon/qoaf5mtp_800.png",
"intro": "卡纸",
"cover_img": "/uploads/epvkzvyf_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 18,
"sn": "PFCM8KNF",
"title": "Tableware set chopsticks",
"cover": "/icon/tcspod4b_800.png",
"intro": "餐具套装筷子厚牛皮纸包装",
"cover_img": "/uploads/5jgrgzvh_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 3,
"miniPrice": 2
},
{
"id": 17,
"sn": "PQKIQMIK",
"title": "Tableware set four piece set",
"cover": "/icon/mdo0vu1u_800.png",
"intro": "牛皮纸包装",
"cover_img": "/uploads/szsekvbw_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 4,
"miniPrice": 2
},
{
"id": 16,
"sn": "PBFOIOFH",
"title": "Tableware set four piece set",
"cover": "/icon/dzrf59cp_800.png",
"intro": "餐具套装",
"cover_img": "/uploads/svfoebf1_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 15,
"sn": "P02V10AB",
"title": " Hot drink cup holder",
"cover": "/icon/icon_15_800.png",
"intro": "杯托、瓦楞纸",
"cover_img": "/uploads/4qbdid7i_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 5,
"miniPrice": 2
},
{
"id": 13,
"sn": "PER6WLAV",
"title": " Cup pet",
"cover": "/icon/icon_13_800.png",
"intro": "pet",
"cover_img": "/uploads/kfxehwjd_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
},
{
"id": 12,
"sn": "PGFWRMAU",
"title": " Cup PP",
"cover": "/icon/icon_12_800.png",
"intro": "pp",
"cover_img": "/uploads/azp8uwhz_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 2,
"miniPrice": 2
},
{
"id": 10,
"sn": "P4ZXDVHS",
"title": "Cup monolayer",
"cover": "/icon/icon_10_800.png",
"intro": "牛皮纸单层",
"cover_img": "/uploads/onuzax6l_800.png",
"isEnv": 1,
"isMicro": 1,
"sizeNum": 1,
"miniPrice": 2
}
],
"_links": {
"self": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=1&is_demo=1"
},
"first": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=1&is_demo=1"
},
"last": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=2&is_demo=1"
},
"next": {
"href": "https://fusenapi.kayue.cn:8010/product/list?cid=13&size=620&page=2&is_demo=1"
}
},
"_meta": {
"totalCount": 21,
"pageCount": 2,
"currentPage": 1,
"perPage": 20
}
},
"typeName": "Boxes",
"description": ""
}`
}