feat: 按允许店铺筛选顺运宝同步 (#196)
This commit is contained in:
@@ -97,6 +97,11 @@ func (h *Handler) renderSybListWithLoginReason(c *gin.Context, keyword, pageRaw,
|
||||
fail(c, http.StatusInternalServerError, "读取可分配客户端失败,数据没有被改动。")
|
||||
return
|
||||
}
|
||||
enabledShopCount, err := service.CountEnabledSybAllowedShops(h.db)
|
||||
if err != nil {
|
||||
fail(c, http.StatusInternalServerError, "读取顺运宝同步店铺数量失败,数据没有被改动。刷新后重试。")
|
||||
return
|
||||
}
|
||||
|
||||
syncStatus := service.GetSybSyncStatus()
|
||||
status := msg
|
||||
@@ -217,10 +222,11 @@ func (h *Handler) renderSybListWithLoginReason(c *gin.Context, keyword, pageRaw,
|
||||
keyword, shop, stage, dateFrom, dateTo),
|
||||
"HistoryFetchPagination": sybHistoryPartialPagination(history.Page, history.TotalPages,
|
||||
keyword, shop, stage, dateFrom, dateTo),
|
||||
"Pagination": service.NewPaginationView(result.Page, result.TotalPages, values.Encode()),
|
||||
"DetailURL": "/syb/detail?" + detailValues.Encode(),
|
||||
"AssignableClients": purchaseClients.Rows,
|
||||
"PurchaseClientCount": purchaseClients.SelectableCount,
|
||||
"Pagination": service.NewPaginationView(result.Page, result.TotalPages, values.Encode()),
|
||||
"DetailURL": "/syb/detail?" + detailValues.Encode(),
|
||||
"AssignableClients": purchaseClients.Rows,
|
||||
"PurchaseClientCount": purchaseClients.SelectableCount,
|
||||
"EnabledSyncShopCount": enabledShopCount,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -363,6 +369,10 @@ func (h *Handler) SybSync(c *gin.Context) {
|
||||
h.sybRedirectRange(c, err.Error())
|
||||
return
|
||||
}
|
||||
if err := service.EnsureEnabledSybAllowedShops(h.db); err != nil {
|
||||
h.sybRedirect(c, "同步没有启动:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
@@ -481,6 +491,10 @@ func (h *Handler) SybLoginAndSync(c *gin.Context) {
|
||||
h.sybRedirectRange(c, optionErr.Error())
|
||||
return
|
||||
}
|
||||
if err := service.EnsureEnabledSybAllowedShops(h.db); err != nil {
|
||||
h.sybRedirect(c, "同步没有启动:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user