feat: 删除已停用的同步店铺 (#197)
This commit is contained in:
@@ -60,6 +60,19 @@ func (h *Handler) SybAllowedShopStatus(c *gin.Context) {
|
||||
redirectSybShops(c, message, "")
|
||||
}
|
||||
|
||||
func (h *Handler) SybAllowedShopDelete(c *gin.Context) {
|
||||
err := service.DeleteDisabledSybAllowedShop(h.db, currentUser(c), c.PostForm("shop_id"))
|
||||
if err != nil {
|
||||
if service.IsValidationError(err) {
|
||||
redirectSybShops(c, "", err.Error())
|
||||
return
|
||||
}
|
||||
fail(c, http.StatusInternalServerError, "删除同步店铺失败,已有配置和历史货运单没有被改动。")
|
||||
return
|
||||
}
|
||||
redirectSybShops(c, "已删除停用店铺;历史货运单和同步记录保持不变", "")
|
||||
}
|
||||
|
||||
func redirectSybShops(c *gin.Context, message, errorMessage string) {
|
||||
values := url.Values{}
|
||||
if message != "" {
|
||||
|
||||
@@ -88,6 +88,7 @@ func Register(r *gin.Engine, db *sql.DB, onlineThreshold time.Duration) {
|
||||
sybShops.GET("", h.SybAllowedShopList)
|
||||
sybShops.POST("/create", h.SybAllowedShopCreate)
|
||||
sybShops.POST("/status", h.SybAllowedShopStatus)
|
||||
sybShops.POST("/delete", h.SybAllowedShopDelete)
|
||||
|
||||
// 4. 采集采购
|
||||
pages.GET("/tasks", h.TaskList)
|
||||
|
||||
Reference in New Issue
Block a user