@@ -23,8 +23,7 @@ func (h *Handler) ShopList(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *Handler) ShopCreate(c *gin.Context) {
|
||||
err := service.CreateShop(h.db, currentUser(c), c.PostForm("display_name"),
|
||||
c.PostForm("syb_alias"), c.PostForm("shopee_alias"), time.Now())
|
||||
err := service.CreateShop(h.db, currentUser(c), c.PostForm("shop_name"), time.Now())
|
||||
if err != nil {
|
||||
if service.IsValidationError(err) {
|
||||
redirectShops(c, "", err.Error())
|
||||
@@ -33,12 +32,11 @@ func (h *Handler) ShopCreate(c *gin.Context) {
|
||||
fail(c, http.StatusInternalServerError, "新增店铺失败,已有数据没有被改动。")
|
||||
return
|
||||
}
|
||||
redirectShops(c, "店铺已新增;历史数据已按渠道原始名称精确关联", "")
|
||||
redirectShops(c, "店铺已新增;历史数据已按店铺名称精确关联", "")
|
||||
}
|
||||
|
||||
func (h *Handler) ShopUpdate(c *gin.Context) {
|
||||
err := service.UpdateShop(h.db, currentUser(c), c.PostForm("shop_id"), c.PostForm("display_name"),
|
||||
c.PostForm("syb_alias"), c.PostForm("shopee_alias"), time.Now())
|
||||
err := service.UpdateShop(h.db, currentUser(c), c.PostForm("shop_id"), c.PostForm("shop_name"), time.Now())
|
||||
if err != nil {
|
||||
if service.IsValidationError(err) {
|
||||
redirectShops(c, "", err.Error())
|
||||
@@ -47,7 +45,7 @@ func (h *Handler) ShopUpdate(c *gin.Context) {
|
||||
fail(c, http.StatusInternalServerError, "保存店铺失败,原配置保持不变。")
|
||||
return
|
||||
}
|
||||
redirectShops(c, "店铺名称和渠道关联已保存", "")
|
||||
redirectShops(c, "店铺名称已保存,历史数据关联已重建", "")
|
||||
}
|
||||
|
||||
func (h *Handler) ShopStatus(c *gin.Context) {
|
||||
@@ -60,26 +58,9 @@ func (h *Handler) ShopStatus(c *gin.Context) {
|
||||
fail(c, http.StatusInternalServerError, "更新店铺状态失败,原状态保持不变。")
|
||||
return
|
||||
}
|
||||
message := "业务店铺已停用;SYB 不再同步该店铺"
|
||||
message := "店铺已停用;SYB 不再同步该店铺"
|
||||
if enabled {
|
||||
message = "业务店铺已启用"
|
||||
}
|
||||
redirectShops(c, message, "")
|
||||
}
|
||||
|
||||
func (h *Handler) ShopSybStatus(c *gin.Context) {
|
||||
enabled := c.PostForm("enabled") == "1"
|
||||
if err := service.SetShopSybEnabled(h.db, currentUser(c), c.PostForm("shop_id"), enabled, time.Now()); err != nil {
|
||||
if service.IsValidationError(err) {
|
||||
redirectShops(c, "", err.Error())
|
||||
return
|
||||
}
|
||||
fail(c, http.StatusInternalServerError, "更新 SYB 同步状态失败,原状态保持不变。")
|
||||
return
|
||||
}
|
||||
message := "SYB 同步已停用"
|
||||
if enabled {
|
||||
message = "SYB 同步已启用"
|
||||
message = "店铺已启用"
|
||||
}
|
||||
redirectShops(c, message, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user