优化开放接口日志分类
This commit is contained in:
@@ -23,6 +23,7 @@ func NewOpenHandler(fulfillmentSvc *service.FulfillmentService) *OpenHandler {
|
||||
// QueryOrder GET /api/open/v1/orders/:order_no
|
||||
// 上游输入店铺订单号,查询商品与是否可发货
|
||||
func (h *OpenHandler) QueryOrder(c *gin.Context) {
|
||||
openlog.SetAction(c, openlog.ActionQuery)
|
||||
orderNo := c.Param("order_no")
|
||||
if orderNo == "" {
|
||||
orderNo = c.Query("order_no")
|
||||
@@ -67,6 +68,7 @@ type shipNotifyReq struct {
|
||||
// ShipNotify POST /api/open/v1/orders/ship-notify
|
||||
// 上游发货后推送结果,同步订单状态
|
||||
func (h *OpenHandler) ShipNotify(c *gin.Context) {
|
||||
openlog.SetAction(c, openlog.ActionPush)
|
||||
var req shipNotifyReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
openlog.Warn(c, "ship_notify bind_fail err=%v", err)
|
||||
|
||||
@@ -25,6 +25,7 @@ func NewOpenV1Handler(merchantSvc *service.MerchantService, fulfillmentSvc *serv
|
||||
}
|
||||
|
||||
func (h *OpenV1Handler) ListProducts(c *gin.Context) {
|
||||
openlog.SetAction(c, openlog.ActionList)
|
||||
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
|
||||
size, _ := strconv.Atoi(c.DefaultQuery("size", "20"))
|
||||
openlog.Info(c, "list_products start page=%d size=%d", page, size)
|
||||
@@ -47,6 +48,7 @@ type openCreateOrderReq struct {
|
||||
}
|
||||
|
||||
func (h *OpenV1Handler) CreateOrder(c *gin.Context) {
|
||||
openlog.SetAction(c, openlog.ActionCreate)
|
||||
var req openCreateOrderReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
openlog.Warn(c, "create_order bind_fail err=%v", err)
|
||||
@@ -103,6 +105,7 @@ func (h *OpenV1Handler) CreateOrder(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *OpenV1Handler) QueryOrder(c *gin.Context) {
|
||||
openlog.SetAction(c, openlog.ActionQuery)
|
||||
orderNo := c.Param("order_no")
|
||||
openlog.Info(c, "query_order start order_no=%s", orderNo)
|
||||
order, err := h.fulfillmentSvc.GetOrder(middleware.GetMerchantID(c), orderNo)
|
||||
@@ -125,6 +128,7 @@ type openCancelOrderReq struct {
|
||||
}
|
||||
|
||||
func (h *OpenV1Handler) CancelOrder(c *gin.Context) {
|
||||
openlog.SetAction(c, openlog.ActionCancel)
|
||||
var req openCancelOrderReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
openlog.Warn(c, "cancel_order bind_fail err=%v", err)
|
||||
@@ -145,6 +149,7 @@ func (h *OpenV1Handler) CancelOrder(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *OpenV1Handler) GetWallet(c *gin.Context) {
|
||||
openlog.SetAction(c, openlog.ActionWallet)
|
||||
openlog.Info(c, "get_wallet start")
|
||||
wallet, err := h.fulfillmentSvc.GetWallet(middleware.GetMerchantID(c))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user