From f13912640b945a91b028e9f29d0c50e35c768b93 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 11 八月 2023 11:21:41 +0800 Subject: [PATCH] Merge branch 'master' into zq --- api/v1/followRecord.go | 64 ++++++++++++++++--------------- 1 files changed, 33 insertions(+), 31 deletions(-) diff --git a/api/v1/followRecord.go b/api/v1/followRecord.go index 497592f..e015177 100644 --- a/api/v1/followRecord.go +++ b/api/v1/followRecord.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" "time" ) @@ -43,46 +42,22 @@ ctx.Ok() } -// List -// -// @Tags FollowRecord -// @Summary 鑾峰彇璺熻繘璁板綍鍒楄〃 -// @Produce application/json -// @Success 200 {object} contextx.Response{data=response.FollowRecordResponse} -// @Router /api/followRecord/list [get] -func (fr *FollowRecordApi) List(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) - if !ok { - return - } - - errCode, followRecordList := followRecordService.GetFollowRecordList() - if errCode != ecode.OK { - ctx.Fail(errCode) - return - } - - ctx.OkWithDetailed(response.FollowRecordResponse{ - List: followRecordList, - }) -} - // Delete // // @Tags FollowRecord // @Summary 鍒犻櫎璺熻繘璁板綍 // @Produce application/json -// @Param id path string true "璺熻繘璁板綍id" +// @Param object body request.DeleteFollowRecord true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/followRecord/delete/{id} [delete] +// @Router /api/followRecord/delete [delete] func (fr *FollowRecordApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteFollowRecord + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := followRecordService.DeleteFollowRecord(id) + errCode := followRecordService.DeleteFollowRecord(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -199,7 +174,7 @@ // 妫�鏌ユ椂闂存牸寮� func checkTimeFormat(t string) (time.Time, error) { if t == "" { - t = "1970-01-01T00:00:00+08:00" + t = "1900-01-01T00:00:00+08:00" } location, err := time.LoadLocation("Asia/Shanghai") @@ -219,3 +194,30 @@ return time.Time{}, err } + +// List +// +// @Tags FollowRecord +// @Summary 鍥炶璁板綍鍒楄〃 +// @Produce application/json +// @Param object body request.GetFollowRecordList true "鍙傛暟" +// @Success 200 {object} contextx.Response{data=response.FollowRecordResponse} +// @Router /api/followRecord/list [post] +func (fr *FollowRecordApi) List(c *gin.Context) { + var params request.GetFollowRecordList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + followRecords, total, errCode := followRecordService.GetFollowRecordList(params.Page, params.PageSize, params.SearchMap) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.FollowRecordResponse{ + List: followRecords, + Count: int(total), + }) +} -- Gitblit v1.8.0