fix(handler): 药品目录按分页契约修正 YPML00001(T-211)

- DrugQuery.PageNo 去 omitempty(pageNo=0 也上送)+ 加 PageSize
- handler Drugs 改 pageNo 必填(parseRequiredInt,缺则返回 400)+ 读 pageSize
- 补缺 pageNo 返回 400 的测试
- 依 docx;YPML00001 未真实联调,pageNo 是否真必填待厂家样本核对

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ila
2026-07-09 22:22:54 +08:00
co-authored by Claude Opus 4.8
parent 4fa1317ac8
commit dc065a9c29
3 changed files with 31 additions and 7 deletions
+10
View File
@@ -88,6 +88,16 @@ func TestPublicOrgsReturnsRawResponse(t *testing.T) {
}
}
func TestPublicDrugsRequiresPageNo(t *testing.T) {
h := NewPublicHandler(nil) // 缺 pageNo 在触达 client 前返回 400(药品目录分页必填)
req := httptest.NewRequest(http.MethodGet, "/api/dictionaries/drugs?ypmc=测试", nil)
rec := httptest.NewRecorder()
h.Drugs(rec, req)
if rec.Code != http.StatusBadRequest {
t.Fatalf("status = %d, want 400 (pageNo required)", rec.Code)
}
}
func TestPublicDictionaryRejectsInvalidPageNo(t *testing.T) {
h := NewPublicHandler(nil)