优化商品列表表格列宽与上架配置面板
This commit is contained in:
@@ -214,20 +214,57 @@ func (h *MerchantHandler) ListWalletLedger(c *gin.Context) {
|
||||
response.Page(c, list, total, page, size)
|
||||
}
|
||||
|
||||
// AdminGetWallet 供平台管理员查看指定商户的钱包。
|
||||
func (h *MerchantHandler) AdminGetWallet(c *gin.Context) {
|
||||
id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
if id == 0 {
|
||||
response.BadRequest(c, "商户 ID 无效")
|
||||
return
|
||||
}
|
||||
wallet, err := h.fulfillmentSvc.GetWallet(uint(id))
|
||||
if err != nil {
|
||||
response.ServerError(c, err.Error())
|
||||
return
|
||||
}
|
||||
response.OK(c, wallet)
|
||||
}
|
||||
|
||||
// AdminListWalletLedger 供平台管理员查看指定商户的积分流水。
|
||||
func (h *MerchantHandler) AdminListWalletLedger(c *gin.Context) {
|
||||
id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
if id == 0 {
|
||||
response.BadRequest(c, "商户 ID 无效")
|
||||
return
|
||||
}
|
||||
page, size := pageParams(c)
|
||||
list, total, err := h.fulfillmentSvc.ListWalletLedger(uint(id), page, size, c.Query("reference_no"), c.Query("type"))
|
||||
if err != nil {
|
||||
response.ServerError(c, err.Error())
|
||||
return
|
||||
}
|
||||
response.Page(c, list, total, page, size)
|
||||
}
|
||||
|
||||
type walletAdjustReq struct {
|
||||
Amount int64 `json:"amount" binding:"required"`
|
||||
IdempotencyKey string `json:"idempotency_key" binding:"required"`
|
||||
Note string `json:"note"`
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) AdjustWallet(c *gin.Context) {
|
||||
// AdminAdjustWallet 供平台管理员手动调整指定商户的积分,商户侧无任何调账入口。
|
||||
func (h *MerchantHandler) AdminAdjustWallet(c *gin.Context) {
|
||||
id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
if id == 0 {
|
||||
response.BadRequest(c, "商户 ID 无效")
|
||||
return
|
||||
}
|
||||
var req walletAdjustReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.BadRequest(c, "参数错误:amount 与 idempotency_key 必填")
|
||||
return
|
||||
}
|
||||
wallet, err := h.fulfillmentSvc.AdjustWallet(service.WalletAdjustInput{
|
||||
MerchantID: middleware.GetMerchantID(c),
|
||||
MerchantID: uint(id),
|
||||
ActorUserID: middleware.GetUserID(c),
|
||||
Amount: req.Amount,
|
||||
IdempotencyKey: req.IdempotencyKey,
|
||||
|
||||
Reference in New Issue
Block a user