From f2178a75482bd62b4274530711229815ad2990c7 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Thu, 24 Jun 2021 15:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=80=E4=BA=9B=E4=B8=8D?= =?UTF-8?q?=E8=A6=81=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/authz.go | 130 -------------------------------- business/jxstore/cms/cms.go | 125 ------------------------------ business/jxutils/jxutils.go | 86 --------------------- business/jxutils/jxutils_cms.go | 15 ---- business/model/const.go | 10 --- business/model/dao/act.go | 110 --------------------------- 6 files changed, 476 deletions(-) delete mode 100644 business/jxstore/cms/authz.go diff --git a/business/jxstore/cms/authz.go b/business/jxstore/cms/authz.go deleted file mode 100644 index 695572cfd..000000000 --- a/business/jxstore/cms/authz.go +++ /dev/null @@ -1,130 +0,0 @@ -package cms - -import ( - "git.rosy.net.cn/jx-callback/business/auth2" - "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" - "git.rosy.net.cn/jx-callback/business/authz/autils" - "git.rosy.net.cn/jx-callback/business/model" - "git.rosy.net.cn/jx-callback/business/model/dao" - "git.rosy.net.cn/jx-callback/business/model/legacymodel" - "git.rosy.net.cn/jx-callback/globals" - "git.rosy.net.cn/jx-callback/globals/api2" -) - -// todo 是否需要将Store.MarketManPhone与OperatorPhone成角色? - -func TransferLegacyWeixins(mobile string) (err error) { - globals.SugarLogger.Debugf("TransferLegacyWeixins mobile:%s", mobile) - if !globals.EnableWXAuth2 || globals.DisableWXAuth1 { - return nil - } - remark4Transfer := "transfer" - // DELETE t1 - // FROM auth_bind t1 - // WHERE t1.remark = 'transfer'; - - // DELETE t1 - // FROM user t1 - // WHERE t1.remark = 'transfer'; - - // TRUNCATE TABLE casbin_rule; - - sql := ` - SELECT t1.* - FROM weixins t1 - LEFT JOIN user t2 ON t2.mobile = t1.tel - LEFT JOIN auth_bind t3 ON t3.auth_id = t1.openid AND t3.type = 'weixinsns' - LEFT JOIN auth_bind t4 ON t4.auth_id = t1.openid_mini AND t4.type = 'weixinmini' - WHERE` - sqlParams := []interface{}{} - if mobile != "" { - remark4Transfer = "transfer2" - sql += " t1.tel = ?" - sqlParams = append(sqlParams, mobile) - } else { - sql += " t2.id IS NULL OR (t1.openid <> '' AND t3.id IS NULL) OR (t1.openid_mini <> '' AND t4.id IS NULL)" - } - sql += " ORDER BY t1.parentid;" - var weixinList []*legacymodel.WeiXins - db := dao.GetDB() - err = dao.GetRows(db, &weixinList, sql, sqlParams...) - if err != nil { - return err - } - parentMap := make(map[int]*legacymodel.WeiXins) - for _, v := range weixinList { - if v.ParentID == -1 { - parentMap[v.ID] = v - } else { - if parentMap[v.ParentID] != nil { - v.JxStoreID = parentMap[v.ParentID].JxStoreID - } - } - if v.Tel != "" { - user := &model.User{ - UserID2: v.Tel, - Name: v.NickName, - Mobile: &v.Tel, - Type: model.UserTypeStoreBoss, - Remark: remark4Transfer, - } - if user.Name == "" { - user.Name = user.GetMobile() - } - userList, _, err2 := dao.GetUsers(db, 0, "", "", nil, nil, []string{v.Tel}, 0, -1) - if err = err2; err != nil { - return err - } - // globals.SugarLogger.Debug(utils.Format4Output(user, false)) - if len(userList) == 0 { - err = CreateUser(user, v.LastOperator) - } else { - user = userList[0] - } - if err != nil { - return err - } - if v.OpenID != "" { - auth2.AddAuthBind(user, &auth2.AuthInfo{ - AuthBindInfo: &auth2.AuthBindEx{ - AuthBind: model.AuthBind{ - Type: weixin.AuthTypeMP, - AuthID: v.OpenID, - AuthID2: v.OpenIDUnion, - Remark: remark4Transfer, - }, - }, - }) - } - if v.OpenIDMini != "" { - auth2.AddAuthBind(user, &auth2.AuthInfo{ - AuthBindInfo: &auth2.AuthBindEx{ - AuthBind: model.AuthBind{ - Type: weixin.AuthTypeMini, - AuthID: v.OpenIDMini, - AuthID2: v.OpenIDUnion, - Remark: remark4Transfer, - }, - }, - }) - } - if v.JxStoreID > 0 { // 运营就不加到门店老板组里了 - if user.Type&model.UserTypeOperator == 0 { - api2.RoleMan.AddRole4User(user.GetID(), autils.NewStoreBossRole(v.JxStoreID)) - } - } else { - if mobile != "" { - rList, err2 := api2.RoleMan.GetUserRoleList(user.GetID()) - if err = err2; err == nil { - for _, role := range rList { - if role.StoreID > 0 { - api2.RoleMan.DeleteRole4User(user.GetID(), autils.NewStoreBossRole(role.StoreID)) - } - } - } - } - } - } - } - return err -} diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index 59c37f1ea..c932c785e 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -12,18 +12,11 @@ import ( "git.rosy.net.cn/baseapi/platformapi/ejyapi" - "git.rosy.net.cn/baseapi/utils/errlist" - - "git.rosy.net.cn/jx-callback/globals/api2" - - "git.rosy.net.cn/jx-callback/business/authz/autils" - "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" - "git.rosy.net.cn/jx-callback/globals/api" ) const ( @@ -154,15 +147,6 @@ func GetPlaces(ctx *jxcontext.Context, keyword string, includeDisabled bool, par return places, dao.GetRows(nil, &places, sql, sqlParams) } -func GetCoordinateDistrictCode(ctx *jxcontext.Context, lng, lat float64) (code int, err error) { - return api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat), nil -} - -func GetCoordinateCityInfo(ctx *jxcontext.Context, lng, lat float64) (name string, err error) { - name, _ = api.AutonaviAPI.GetCoordinateCityInfo(lng, lat) - return name, err -} - func SendMsg2Somebody(ctx *jxcontext.Context, mobileNum, verifyCode, msgType, msgContent string) (err error) { return err @@ -187,47 +171,6 @@ func AddConfig(ctx *jxcontext.Context, key, configType, value string) (err error return err } -func DeleteConfig(ctx *jxcontext.Context, key, configType string) (err error) { - // if err = checkConfig(model.SyncFlagDeletedMask, configType, key, ""); err != nil { - // return err - // } - db := dao.GetDB() - switch configType { - case model.ConfigTypePricePack: - - case model.ConfigTypeFreightPack: - - case model.ConfigTypeBank: - //todo - return fmt.Errorf("暂不支持删除银行") - case model.ConfigTypeRole: - errList := errlist.New() - userIDs, err2 := api2.RoleMan.GetRoleUserList(autils.NewRole(key, 0)) - if err = err2; err == nil && len(userIDs) > 0 { - userList, totalCount, err2 := dao.GetUsers(dao.GetDB(), 0, "", "", userIDs, nil, nil, 0, -1) - if err = err2; err == nil && totalCount > 0 { - // todo - // err = fmt.Errorf("还有人员在使用角色:%s,人员信息:%s", key, utils.MustMarshal(utils.Struct2Map(userList, "compact"))) - err = fmt.Errorf("还有人员在使用角色:%s,人员信息:%s", key, utils.Format4Output(userList, false)) - } - } - errList.AddErr(err) - - errList.AddErr(err) - err = errList.GetErrListAsOne() - } - if err == nil { - _, err = dao.DeleteEntityLogically(db, &model.NewConfig{}, nil, ctx.GetUserName(), map[string]interface{}{ - "Key": key, - "Type": configType, - }) - } - if configType == model.ConfigTypeSys && err == nil { - // err = onSysConfigChanged(key, "") - } - return err -} - func UpdateConfig(ctx *jxcontext.Context, key, configType, value string) (hint string, err error) { if key == "" { return "", fmt.Errorf("修改配置必须给定key") @@ -269,74 +212,6 @@ func QueryConfigs(key, configType, keyword string) (configList []*model.NewConfi return dao.QueryConfigs(dao.GetDB(), key, configType, keyword) } -func InitStation(ctx *jxcontext.Context) (err error) { - var ( - db = dao.GetDB() - stationMap = make(map[string]*model.StationInfo) - stationEjyMap = make(map[string]*ejyapi.GetStationListResult) - addList []*model.StationInfo - updateList []*model.StationInfo - deleteList []*model.StationInfo - ) - api.EjyAPI.SetTimestamp(time.Now().Unix()) - if stations, err := dao.GetStationList(db); len(stations) > 0 && err == nil { - for _, v := range stations { - stationMap[v.StationID] = v - } - } - if getStationListResult, err := api.EjyAPI.GetStationList(); len(getStationListResult) > 0 && err == nil { - for _, v := range getStationListResult { - stationEjyMap[v.StationID] = v - if stationMap[v.StationID] == nil { - addList = append(addList, EjyStationToStationInfo(v)) - } else { - updateList = append(updateList, stationMap[v.StationID]) - } - } - } - for _, v := range stationMap { - if stationEjyMap[v.StationID] == nil { - deleteList = append(deleteList, v) - } - } - task := tasksch.NewParallelTask("InitStation", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - step := batchItemList[0].(int) - switch step { - case 0: - if len(addList) > 0 { - err = dao.CreateMultiEntities(db, addList) - } - case 1: - if len(updateList) > 0 { - task := tasksch.NewParallelTask("updateList", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - station := batchItemList[0].(*model.StationInfo) - dao.UpdateEntity(db, station) - return retVal, err - }, updateList) - tasksch.HandleTask(task, nil, true).Run() - _, err = task.GetResult(0) - } - case 2: - if len(deleteList) > 0 { - task := tasksch.NewParallelTask("deleteList", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - station := batchItemList[0].(*model.StationInfo) - dao.DeleteEntity(db, station) - return retVal, err - }, deleteList) - tasksch.HandleTask(task, nil, true).Run() - _, err = task.GetResult(0) - } - } - return retVal, err - }, []int{0, 1, 2}) - tasksch.HandleTask(task, nil, true).Run() - _, err = task.GetResult(0) - return err -} - func EjyStationToStationInfo(station *ejyapi.GetStationListResult) (stationInfo *model.StationInfo) { stationInfo = &model.StationInfo{ StationID: station.StationID, diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 387d0c5e4..efae95ffc 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -1,8 +1,6 @@ package jxutils import ( - "bytes" - "context" "crypto/aes" "crypto/md5" "encoding/base64" @@ -14,15 +12,9 @@ import ( "strings" "time" - "git.rosy.net.cn/baseapi" - "git.rosy.net.cn/baseapi/platformapi/autonavi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils/routinepool" - "git.rosy.net.cn/jx-callback/business/jxutils/excel" "git.rosy.net.cn/jx-callback/business/model" - "git.rosy.net.cn/jx-callback/globals" - "git.rosy.net.cn/jx-callback/globals/api" - "github.com/qiniu/api.v7/storage" ) var ( @@ -244,16 +236,6 @@ func EarthDistance(lng1, lat1, lng2, lat2 float64) float64 { return dist * radius } -// 返回结果单元为公里 -func WalkingDistance(lng1, lat1, lng2, lat2 float64) (distance float64) { - if distance = api.AutonaviAPI.WalkingDistance(lng1, lat1, lng2, lat2); distance == 0 { - distance = EarthDistance(lng1, lat1, lng2, lat2) * 1.4 - } else { - distance /= 1000 - } - return distance -} - func StandardCoordinate2Int(value float64) int { return int(math.Round(value * 1000000)) } @@ -262,25 +244,6 @@ func IntCoordinate2Standard(value int) float64 { return float64(value) / 1000000 } -func IntCoordinate2MarsStandard(gpsLng, gpsLat int, coordinateType int) (marsLng, marsLat float64, err error) { - marsLng = IntCoordinate2Standard(gpsLng) - marsLat = IntCoordinate2Standard(gpsLat) - coordSys := "" - switch coordinateType { - case model.CoordinateTypeGPS: - coordSys = autonavi.CoordSysGPS - case model.CoordinateTypeMars: - return marsLng, marsLat, nil - case model.CoordinateTypeBaiDu: - coordSys = autonavi.CoordSysBaidu - case model.CoordinateTypeMapbar: - coordSys = autonavi.CoordSysMapbar - default: - panic(fmt.Sprintf("known coordinate type:%d", coordinateType)) - } - return api.AutonaviAPI.CoordinateConvert(marsLng, marsLat, coordSys) -} - func IntPrice2Standard(value int64) float64 { return float64(value) / 100 } @@ -595,36 +558,6 @@ func RefreshAfsOrderSkuRelated(afsOrder *model.AfsOrder) *model.AfsOrder { return afsOrder } -func UploadExportContent(content []byte, key string) (downloadURL string, err error) { - putPolicy := storage.PutPolicy{ - Scope: globals.QiniuBucket, - Expires: 10 * 60, - DeleteAfterDays: 1, - } - upToken := putPolicy.UploadToken(api.QiniuAPI) - cfg := &storage.Config{} - formUploader := storage.NewFormUploader(cfg) - ret := storage.PutRet{} - for i := 0; i < 3; i++ { - if err = formUploader.Put(context.Background(), &ret, upToken, key, bytes.NewReader(content), int64(len(content)), &storage.PutExtra{}); err == nil { - break - } - } - if err == nil { - downloadURL = ComposeQiniuResURL(key) - } - return downloadURL, err -} - -func UploadExeclAndPushMsg(sheetList []*excel.Obj2ExcelSheetConfig, name string) (downloadURL, fileName string, err error) { - excelBin := excel.Obj2Excel(sheetList) - timeStr := utils.Int64ToStr(time.Now().Unix()) - fileName = name + timeStr + fileExt - baseapi.SugarLogger.Debugf("WriteToExcel:save %s success", fileName) - downloadURL, err = UploadExportContent(excelBin, fileName) - return downloadURL, fileName, err -} - func TaskResult2Hint(resultList []interface{}) (hint string) { strList := make([]string, len(resultList)) for k, v := range resultList { @@ -820,25 +753,6 @@ func PKCS5UnPadding(origData []byte) []byte { return origData[:(length - unpadding)] } -//合成水印图 -func MixWatermarkImg(imgWatermark, img, positon string) (imgMix string) { - baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) - var imgUrl string - if strings.Contains(img, "?") { - imgUrl = img + "/imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/" + positon + "/dx/10/dy/10" - } else { - imgUrl = img + "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/" + positon + "/dx/10/dy/10" - } - if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { - if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+img[strings.LastIndex(img, "/")+1:len(img)]); err == nil { - if err == nil { - return downloadURL - } - } - } - return imgMix -} - func GetIssue() (issue int) { year, month, _ := time.Now().Date() return year*100 + int(month) diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index 86233cf57..956ca3ec6 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -20,7 +20,6 @@ import ( "git.rosy.net.cn/baseapi/platformapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/model" - "git.rosy.net.cn/jx-callback/globals" "github.com/boombuler/barcode" "github.com/boombuler/barcode/code128" "github.com/boombuler/barcode/qr" @@ -97,20 +96,6 @@ func SplitStoreName(fullName, separator, defaultPrefix string) (prefix, bareName return TrimDecorationChar(prefix), TrimDecorationChar(bareName) } -func ComposeStoreName(bareName string, vendorID int) (fullName string) { - bareName = TrimDecorationChar(strings.Trim(bareName, "-")) - storeName := globals.StoreName - if vendorID == model.VendorIDJD { - fullName = storeName + "-" + bareName - } else { - if globals.IsMainProductEnv() && model.ShopChineseNames[vendorID] != "" { - storeName = model.ShopChineseNames[vendorID] - } - fullName = storeName + "(" + bareName + ")" - } - return fullName -} - func StrTime2JxOperationTime(strTime string, defValue int16) int16 { if timeValue, err := time.Parse("15:04:05", strTime); err == nil { return int16(timeValue.Hour()*100 + timeValue.Minute()) diff --git a/business/model/const.go b/business/model/const.go index 6da92a2a4..a4b7ad638 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -1,12 +1,9 @@ package model import ( - "fmt" - "git.rosy.net.cn/baseapi/platformapi/ebaiapi" "git.rosy.net.cn/baseapi/platformapi/jdapi" "git.rosy.net.cn/baseapi/platformapi/mtwmapi" - "git.rosy.net.cn/jx-callback/globals" ) var ( @@ -25,13 +22,6 @@ var ( }, } - ShopChineseNames = map[int]string{ - VendorIDJD: globals.StoreName, - VendorIDMTWM: globals.StoreNameMtwm, - VendorIDEBAI: globals.StoreNameEbai, - VendorIDJX: fmt.Sprintf("%s商城", globals.StoreName), - } - OrderStatusName = map[int]string{ OrderStatusMsg: "通知消息", OrderStatusWaybillTipChanged: "小费变动", diff --git a/business/model/dao/act.go b/business/model/dao/act.go index 6e470673c..ff12d6cb4 100644 --- a/business/model/dao/act.go +++ b/business/model/dao/act.go @@ -4,8 +4,6 @@ import ( "fmt" "time" - "git.rosy.net.cn/jx-callback/globals" - "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/model" @@ -364,114 +362,6 @@ func GetExistVendorActIDs(db *DaoDB, vendorID int) (vendorActIDs []string, err e return vendorActIDs, err } -func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs []int, actType int, storeIDs, skuIDs []int, beginAt, endAt time.Time) (actStoreSkuList []*model.ActStoreSku2, err error) { - if utils.IsTimeZero(beginAt) { - return nil, fmt.Errorf("GeActStoreSkuInfo必须指定活动开始时间") - } - if utils.IsTimeZero(endAt) { - endAt = beginAt - } - sql := ` - SELECT - t1.type, t1.discount_type, t1.discount_value1, t1.discount_value2, - t2.*, - t3.actual_act_price, t3.sync_status, t3.vendor_price, t3.vendor_id, t3.trend_type, t3.trend_price - FROM act t1 - JOIN act_store_sku t2 ON t2.act_id = t1.id AND t2.deleted_at = ? - JOIN act_store_sku_map t3 ON t3.bind_id = t2.id AND t3.act_id = t1.id AND (t3.sync_status & ? = 0 OR t1.type = ?) - JOIN act_map t4 ON t4.act_id = t1.id AND t4.vendor_id = t3.vendor_id AND t4.deleted_at = ? AND (t4.sync_status & ? = 0 OR t1.type = ?) - WHERE t1.deleted_at = ? AND t1.status = ? AND NOT (t1.begin_at > ? OR t1.end_at < ?) AND t1.create_type = ?` - sqlParams := []interface{}{ - utils.DefaultTimeValue, - - model.SyncFlagNewMask, - model.ActSkuFake, - - utils.DefaultTimeValue, model.SyncFlagNewMask, model.ActSkuFake, - utils.DefaultTimeValue, model.ActStatusCreated, endAt, beginAt, model.ActCreateTypeAPI, - } - if len(vendorIDs) > 0 { - sql += " AND (t1.vendor_mask & ?) <> 0 AND t3.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")" - sqlParams = append(sqlParams, model.GetVendorMask(vendorIDs...), vendorIDs) - } - if actID > 0 { - sql += " AND t1.id = ?" - sqlParams = append(sqlParams, actID) - } - if actType != model.ActTypeAll { - sql += " AND t1.type = ?" - sqlParams = append(sqlParams, actType) - } - if len(storeIDs) > 0 { - sql += " AND t2.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")" - sqlParams = append(sqlParams, storeIDs) - } - if len(skuIDs) > 0 { - sql += " AND t2.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")" - sqlParams = append(sqlParams, skuIDs) - } - if globals.IsStoreSkuAct { - sql += " AND t1.is_special = 0" - } - err = GetRows(db, &actStoreSkuList, sql, sqlParams...) - return actStoreSkuList, err -} - -func GetEffectiveActStoreSkuInfo2(db *DaoDB, actID int, vendorIDs []int, actTypes []int, storeIDs, skuIDs []int, beginAt, endAt time.Time) (actStoreSkuList []*model.ActStoreSku2, err error) { - if utils.IsTimeZero(beginAt) { - return nil, fmt.Errorf("GeActStoreSkuInfo必须指定活动开始时间") - } - if utils.IsTimeZero(endAt) { - endAt = beginAt - } - sql := ` - SELECT - t1.type, - t2.*, - t3.actual_act_price, t3.sync_status, t3.vendor_price, t3.vendor_id - FROM act t1 - JOIN act_store_sku t2 ON t2.act_id = t1.id AND t2.deleted_at = ? - JOIN act_store_sku_map t3 ON t3.bind_id = t2.id AND t3.act_id = t1.id AND (t3.sync_status & ? = 0 OR t1.type = ?) - JOIN act_map t4 ON t4.act_id = t1.id AND t4.vendor_id = t3.vendor_id AND t4.deleted_at = ? AND (t4.sync_status & ? = 0 OR t1.type = ?) - WHERE t1.deleted_at = ? AND t1.status = ? AND NOT (t1.begin_at > ? OR t1.end_at < ?) AND t1.create_type = ?` - sqlParams := []interface{}{ - utils.DefaultTimeValue, - - model.SyncFlagNewMask, - model.ActSkuFake, - - utils.DefaultTimeValue, model.SyncFlagNewMask, model.ActSkuFake, - utils.DefaultTimeValue, model.ActStatusCreated, endAt, beginAt, model.ActCreateTypeAPI, - } - if len(vendorIDs) > 0 { - sql += " AND (t1.vendor_mask & ?) <> 0 AND t3.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")" - sqlParams = append(sqlParams, model.GetVendorMask(vendorIDs...), vendorIDs) - } - if actID > 0 { - sql += " AND t1.id = ?" - sqlParams = append(sqlParams, actID) - } - if len(actTypes) > 0 { - sql += " AND t1.type IN (" + GenQuestionMarks(len(actTypes)) + ")" - sqlParams = append(sqlParams, actTypes) - } - if len(storeIDs) > 0 { - sql += " AND t2.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")" - sqlParams = append(sqlParams, storeIDs) - } - if len(skuIDs) > 0 { - sql += " AND t2.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")" - sqlParams = append(sqlParams, skuIDs) - } - if globals.IsStoreSkuAct { - sql += " AND t1.is_special = 0" - } - // globals.SugarLogger.Debug(sql) - // globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false)) - err = GetRows(db, &actStoreSkuList, sql, sqlParams...) - return actStoreSkuList, err -} - func UpdateActStatusByTime(db *DaoDB, refTime time.Time) (num int64, err error) { sql := ` UPDATE act t1