From d0b406e6b521bb39a56150aa577b061fc2c089f7 Mon Sep 17 00:00:00 2001 From: FantasyRL <1845983502@qq.com> Date: Sat, 16 Nov 2024 15:52:50 +0800 Subject: [PATCH] fix: biz in launchScreen.MobileGetImage --- internal/launch_screen/service/mobile_get.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/launch_screen/service/mobile_get.go b/internal/launch_screen/service/mobile_get.go index 71bb70d..0314afa 100644 --- a/internal/launch_screen/service/mobile_get.go +++ b/internal/launch_screen/service/mobile_get.go @@ -58,8 +58,12 @@ func (s *LaunchScreenService) MobileGetImage(req *launch_screen.MobileGetImageRe } // addShowtime for cache - if err = s.db.LaunchScreen.AddImageListShowTime(s.ctx, respList); err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.AddImageListShowTime error:%w", err) + if cntResp != 0 { + if err = s.db.LaunchScreen.AddImageListShowTime(s.ctx, respList); err != nil { + return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.AddImageListShowTime error:%w", err) + } + } else { + return nil, 0, errno.NoRunningPictureError } return respList, cntResp, nil @@ -151,7 +155,7 @@ func (s *LaunchScreenService) getImagesFromMySQL(studentId string, sType int64, var eg errgroup.Group eg.Go(func() error { // addShowTime - return s.db.LaunchScreen.AddImageListShowTime(s.ctx, imgList) + return s.db.LaunchScreen.AddImageListShowTime(s.ctx, ¤tImgList) }) eg.Go(func() error { // setIdCache