feat(distribution): 优化货架批量操作、结算大事务、大盘与前台多端解析缓存及货架分页
This commit is contained in:
@@ -74,6 +74,7 @@ func setupHandlerTestEnv(t *testing.T) *handlerTestEnv {
|
||||
siteProtected.PUT("/received-listings/:id/status", h.UpdateReceivedListingStatus)
|
||||
siteProtected.PUT("/accounts/:id/markup", h.UpdateAccountMarkup)
|
||||
siteProtected.POST("/accounts/batch-markup", h.BatchUpdateAccountMarkup)
|
||||
siteProtected.POST("/accounts/batch-display", h.BatchUpdateAccountDisplay)
|
||||
}
|
||||
|
||||
// 3. 总台管理路由
|
||||
@@ -453,16 +454,39 @@ func TestHandler_SiteOperatorEndpoints(t *testing.T) {
|
||||
t.Fatalf("update markup expected 200, got %d: %s", wMarkup.Code, wMarkup.Body.String())
|
||||
}
|
||||
|
||||
// 8. 批量调价
|
||||
// 8. 批量调价(支持 Items 个性化与统一加价)
|
||||
batchMarkupReq := BatchUpdateAccountMarkupRequest{
|
||||
ListingIDs: []uint64{masterListing.ID},
|
||||
ShelfRatioDelta: 20,
|
||||
Items: []AccountMarkupItem{
|
||||
{ListingID: masterListing.ID, ShelfRatioDelta: 20},
|
||||
},
|
||||
}
|
||||
wBatchMarkup := env.request("POST", "/api/v1/distribution/accounts/batch-markup", batchMarkupReq, adminA.ID, nil)
|
||||
if wBatchMarkup.Code != http.StatusOK {
|
||||
t.Fatalf("batch markup expected 200, got %d: %s", wBatchMarkup.Code, wBatchMarkup.Body.String())
|
||||
}
|
||||
|
||||
// 8.1 批量启停下架(POST /api/v1/distribution/accounts/batch-display)
|
||||
batchDisplayReq := BatchUpdateAccountDisplayRequest{
|
||||
DisplayIDs: []uint64{dsa.ID},
|
||||
TargetStatus: "disabled",
|
||||
}
|
||||
wBatchDisplay := env.request("POST", "/api/v1/distribution/accounts/batch-display", batchDisplayReq, adminA.ID, nil)
|
||||
if wBatchDisplay.Code != http.StatusOK {
|
||||
t.Fatalf("batch display expected 200, got %d: %s", wBatchDisplay.Code, wBatchDisplay.Body.String())
|
||||
}
|
||||
var dsaCheck model.DistributionSiteAccount
|
||||
env.db.First(&dsaCheck, dsa.ID)
|
||||
if dsaCheck.DisplayStatus != "disabled" {
|
||||
t.Fatalf("expected dsa disabled, got %s", dsaCheck.DisplayStatus)
|
||||
}
|
||||
|
||||
// 恢复展示
|
||||
batchDisplayReq.TargetStatus = "enabled"
|
||||
wBatchDisplayEnable := env.request("POST", "/api/v1/distribution/accounts/batch-display", batchDisplayReq, adminA.ID, nil)
|
||||
if wBatchDisplayEnable.Code != http.StatusOK {
|
||||
t.Fatalf("batch display enable expected 200, got %d: %s", wBatchDisplayEnable.Code, wBatchDisplayEnable.Body.String())
|
||||
}
|
||||
|
||||
// 9. 查询收号资产列表
|
||||
wRecList := env.request("GET", "/api/v1/distribution/received-listings?page=1&size=10", nil, adminA.ID, nil)
|
||||
if wRecList.Code != http.StatusOK {
|
||||
|
||||
Reference in New Issue
Block a user