From 5dd3c7344ae87f8a34feec5d23de62bd4bec9fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 28 Jan 2026 16:56:36 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/sku.go | 4 ++++ business/jxutils/jxutils.go | 4 +--- business/jxutils/jxutils_test.go | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index eb37f4f53..8b1023b6c 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -3060,6 +3060,10 @@ func UpdateVendorImg(ctx *jxcontext.Context, storeId int, imgWaterMark string, v if toTimeP.Before(fromTimeP) { return "", fmt.Errorf("结束时间不可以小于开始时间!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP) } + img := `https://image.jxc4.com/176958594000e2b7c111897ee53e13312c2bbdc29b132168.jpg` + if ImgMix := jxutils.MixWatermarkImg(imgWaterMark, img, &fromTimeP, &toTimeP); ImgMix != "" { + return img, err + } task := tasksch.NewParallelTask("刷新商品前缀水印图", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 0b1cf6402..d125deed3 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -1105,9 +1105,7 @@ func PKCS5UnPadding(origData []byte) []byte { //合成水印图1111 func MixWatermarkImg(imgWatermark, img string, exPrefixBegin, exPrefixEnd *time.Time) (imgMix string) { if exPrefixBegin != nil && exPrefixEnd != nil { - globals.SugarLogger.Debugf("---111111") if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) <= 0 { - globals.SugarLogger.Debugf("---111111222222") baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) var imgUrl string if strings.Contains(img, "?") { @@ -1115,8 +1113,8 @@ func MixWatermarkImg(imgWatermark, img string, exPrefixBegin, exPrefixEnd *time. } else { imgUrl = img + "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" } + globals.SugarLogger.Debugf("---imgUrl := %s", imgUrl) if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { - globals.SugarLogger.Debugf("--resBinary-err := %v", err) downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+img[strings.LastIndex(img, "/")+1:len(img)]) globals.SugarLogger.Debugf("---downloadURL := %s", downloadURL) globals.SugarLogger.Debugf("---err := %v", err) diff --git a/business/jxutils/jxutils_test.go b/business/jxutils/jxutils_test.go index 2b3a7a54c..0d5cdcc4e 100644 --- a/business/jxutils/jxutils_test.go +++ b/business/jxutils/jxutils_test.go @@ -6,12 +6,12 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/model" - "git.rosy.net.cn/jx-callback/globals/testinit" + //"git.rosy.net.cn/jx-callback/globals/testinit" ) -func init() { - testinit.Init() -} +//func init() { +// testinit.Init() +//} func TestEarthDistance(t *testing.T) { lng1, lat1 := 118.796877, 32.060255