diff --git a/app/admin/md/good_list_resp.go b/app/admin/md/good_list_resp.go index 2df6bf4..d1b31c8 100644 --- a/app/admin/md/good_list_resp.go +++ b/app/admin/md/good_list_resp.go @@ -12,6 +12,6 @@ type MallGoodListResp struct { Image string `json:"image"` SaleStateText string `json:"state_text"` SaleState int `json:"sale_state"` - StateCode int `json:"state_code"` CategoryId string `json:"category_id"` + Sales int `json:"sales"` } diff --git a/app/admin/svc/goods/svc_goods_list.go b/app/admin/svc/goods/svc_goods_list.go index d0af935..b242050 100644 --- a/app/admin/svc/goods/svc_goods_list.go +++ b/app/admin/svc/goods/svc_goods_list.go @@ -29,6 +29,7 @@ func GetMallGoodsList(c *gin.Context, req *md.MallGoodsListReq) (interface{}, in var goods md.MallGoodListResp goods.GoodsId = item["goods_id"] goods.SaleState = utils.StrToInt(item["sale_state"]) + goods.Sales = utils.StrToInt(item["sales"]) goods.CreateAt = item["create_at"] // 商品主图 @@ -46,6 +47,16 @@ func GetMallGoodsList(c *gin.Context, req *md.MallGoodsListReq) (interface{}, in goods.UpdateAt = item["update_at"] goods.Title = item["title"] + // 状态 + switch utils.StrToInt64(item["sale_state"]) { + case 1.00: + goods.SaleStateText = "銷售中" + break + case 2.00: + goods.SaleStateText = "下架" + break + } + // sku for _, skuItem := range skus { if skuItem.GoodsId == utils.StrToInt64(item["goods_id"]) { diff --git a/app/db/model/goods.go b/app/db/model/goods.go index 6bb8f4d..35b6c05 100644 --- a/app/db/model/goods.go +++ b/app/db/model/goods.go @@ -10,6 +10,7 @@ type Goods struct { Detail string `json:"detail" xorm:"comment('商品详情') TEXT"` Price string `json:"price" xorm:"comment('起底价') DECIMAL(10,2)"` Sort int `json:"sort" xorm:"not null default 0 comment('排序') INT(11)"` + Sales int `json:"sales" xorm:"not null default 0 comment('销量') INT(11)"` CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"` DeleteAt string `json:"delete_at" xorm:"comment('商品删除字段,不为null时,表示删除') DATETIME"` diff --git a/app/customer/lib/auth/auth.go b/app/ipad/lib/auth/auth.go similarity index 100% rename from app/customer/lib/auth/auth.go rename to app/ipad/lib/auth/auth.go diff --git a/app/customer/lib/auth/base.go b/app/ipad/lib/auth/base.go similarity index 100% rename from app/customer/lib/auth/base.go rename to app/ipad/lib/auth/base.go diff --git a/app/customer/lib/validate/validate_comm.go b/app/ipad/lib/validate/validate_comm.go similarity index 100% rename from app/customer/lib/validate/validate_comm.go rename to app/ipad/lib/validate/validate_comm.go diff --git a/app/customer/md/md_app_redis_key.go b/app/ipad/md/md_app_redis_key.go similarity index 100% rename from app/customer/md/md_app_redis_key.go rename to app/ipad/md/md_app_redis_key.go diff --git a/app/customer/md/md_login.go b/app/ipad/md/md_login.go similarity index 100% rename from app/customer/md/md_login.go rename to app/ipad/md/md_login.go diff --git a/app/customer/md/md_sys_cfg.go b/app/ipad/md/md_sys_cfg.go similarity index 100% rename from app/customer/md/md_sys_cfg.go rename to app/ipad/md/md_sys_cfg.go diff --git a/app/customer/mw/mw_cors.go b/app/ipad/mw/mw_cors.go similarity index 100% rename from app/customer/mw/mw_cors.go rename to app/ipad/mw/mw_cors.go diff --git a/app/customer/mw/mw_customer_auth.go b/app/ipad/mw/mw_customer_auth.go similarity index 95% rename from app/customer/mw/mw_customer_auth.go rename to app/ipad/mw/mw_customer_auth.go index a4f1abd..fb7c147 100644 --- a/app/customer/mw/mw_customer_auth.go +++ b/app/ipad/mw/mw_customer_auth.go @@ -1,8 +1,8 @@ package mw import ( - "applet/app/customer/svc" "applet/app/e" + "applet/app/ipad/svc" "github.com/gin-gonic/gin" ) diff --git a/app/customer/mw/mw_limiter.go b/app/ipad/mw/mw_limiter.go similarity index 100% rename from app/customer/mw/mw_limiter.go rename to app/ipad/mw/mw_limiter.go diff --git a/app/customer/mw/mw_recovery.go b/app/ipad/mw/mw_recovery.go similarity index 100% rename from app/customer/mw/mw_recovery.go rename to app/ipad/mw/mw_recovery.go diff --git a/app/customer/svc/svc_auth.go b/app/ipad/svc/svc_auth.go similarity index 97% rename from app/customer/svc/svc_auth.go rename to app/ipad/svc/svc_auth.go index d364589..07418d7 100644 --- a/app/customer/svc/svc_auth.go +++ b/app/ipad/svc/svc_auth.go @@ -1,9 +1,9 @@ package svc import ( - "applet/app/customer/lib/auth" "applet/app/db" "applet/app/db/model" + "applet/app/ipad/lib/auth" "errors" "github.com/gin-gonic/gin" "strings" diff --git a/app/customer/svc/svc_login.go b/app/ipad/svc/svc_login.go similarity index 91% rename from app/customer/svc/svc_login.go rename to app/ipad/svc/svc_login.go index 23d2c38..a21e4df 100644 --- a/app/customer/svc/svc_login.go +++ b/app/ipad/svc/svc_login.go @@ -1,9 +1,9 @@ package svc import ( - "applet/app/customer/lib/auth" - "applet/app/customer/md" "applet/app/db/model" + "applet/app/ipad/lib/auth" + "applet/app/ipad/md" "applet/app/utils/cache" "applet/app/utils/logx" ) diff --git a/app/router/ipad_router.go b/app/router/ipad_router.go index 826a5ae..5ac95f3 100644 --- a/app/router/ipad_router.go +++ b/app/router/ipad_router.go @@ -1,7 +1,7 @@ package router import ( - "applet/app/customer/mw" + "applet/app/ipad/mw" "github.com/gin-gonic/gin" )