diff --git a/app/db/db_new_acquisition.go b/app/db/db_new_acquisition.go new file mode 100644 index 0000000..1e7758f --- /dev/null +++ b/app/db/db_new_acquisition.go @@ -0,0 +1,35 @@ +package db + +import ( + "applet/app/db/model" + "applet/app/utils/logx" + "xorm.io/xorm" +) + +// 获取拉新奖励记录 +func GetNewAcquisitionRewardLog(Db *xorm.Engine, condition *model.NewAcquisitionRewardLog) (*model.NewAcquisitionRewardLog, bool, error) { + r := new(model.NewAcquisitionRewardLog) + has, err := Db.Get(condition) + if err != nil { + return r, false, err + } + return condition, has, nil +} + +// 获取拉新记录 +func GetNewAcquisitionLog(Db *xorm.Engine, condition *model.NewAcquisitionLog) (*model.NewAcquisitionLog, bool, error) { + r := new(model.NewAcquisitionLog) + has, err := Db.Get(condition) + if err != nil { + return r, false, err + } + return condition, has, nil +} + +// 插入奖励记录 +func InsertNewRewardLog(Db *xorm.Engine, rewardLog *model.NewAcquisitionRewardLog) { + row, err := Db.InsertOne(rewardLog) + if err != nil || row == 0 { + _ = logx.Warn(err) + } +} diff --git a/app/db/db_new_acquisition_cfg.go b/app/db/db_new_acquisition_cfg.go new file mode 100644 index 0000000..65e94ef --- /dev/null +++ b/app/db/db_new_acquisition_cfg.go @@ -0,0 +1,27 @@ +package db + +import ( + "applet/app/db/model" + "applet/app/utils" + "applet/consume/md" + "time" + "xorm.io/xorm" +) + +func GetAcquisitionCfg(eg *xorm.Engine, id string, createAt time.Time) *md.AcquisitionCfg { + var data model.NewAcquisitionCfg + var get bool + var err error + if utils.StrToInt(id) == 0 { + get, err = eg.Where("start_time<=? and end_time>=? and is_show=?", createAt, createAt, 1).Get(&data) + } else { + get, err = eg.Where("id=?", id).Get(&data) + } + if get == false || err != nil { + return nil + } + + var cfg md.AcquisitionCfg + utils.Unserialize([]byte(data.Data), &cfg) + return &cfg +} diff --git a/app/db/model/new_acquisition_cfg.go b/app/db/model/new_acquisition_cfg.go new file mode 100644 index 0000000..58991df --- /dev/null +++ b/app/db/model/new_acquisition_cfg.go @@ -0,0 +1,15 @@ +package model + +import ( + "time" +) + +type NewAcquisitionCfg struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Title string `json:"title" xorm:"VARCHAR(255)"` + Data string `json:"data" xorm:"VARCHAR(5000)"` + IsShow int `json:"is_show" xorm:"default 0 INT(1)"` + StartTime time.Time `json:"start_time" xorm:"DATETIME"` + EndTime time.Time `json:"end_time" xorm:"DATETIME"` + RunTime int `json:"run_time" xorm:"default 0 INT(1)"` +} diff --git a/app/db/model/new_acquisition_log.go b/app/db/model/new_acquisition_log.go new file mode 100644 index 0000000..0717211 --- /dev/null +++ b/app/db/model/new_acquisition_log.go @@ -0,0 +1,15 @@ +package model + +import ( + "time" +) + +type NewAcquisitionLog struct { + Id int64 `json:"id" xorm:"pk autoincr comment('主键') BIGINT(10)"` + ParentUid int `json:"parent_uid" xorm:"not null default 0 comment('上级会员ID') unique(idx_union_u_p_id) INT(20)"` + Uid int `json:"uid" xorm:"not null default 0 comment('关联UserID') unique(idx_union_u_p_id) INT(20)"` + Level int `json:"level" xorm:"not null default 1 comment('推广等级(1直属,大于1非直属)') INT(10)"` + InviteTime time.Time `json:"invite_time" xorm:"not null default CURRENT_TIMESTAMP comment('邀请时间') TIMESTAMP"` + State int `json:"state" xorm:"not null default 0 comment('0为未完成,1为已完成') TINYINT(1)"` + CompleteCon string `json:"complete_con" xorm:"not null default '0' comment('完成的条件') VARCHAR(255)"` +} diff --git a/app/db/model/new_acquisition_reward_log.go b/app/db/model/new_acquisition_reward_log.go new file mode 100644 index 0000000..6dfcb85 --- /dev/null +++ b/app/db/model/new_acquisition_reward_log.go @@ -0,0 +1,28 @@ +package model + +type NewAcquisitionRewardLog struct { + Id int `json:"id" xorm:"not null pk autoincr INT(10)"` + Uid int `json:"uid" xorm:"not null default 0 INT(11)"` + ToUid int `json:"to_uid" xorm:"not null default 0 comment('被邀请人uid') INT(11)"` + Title string `json:"title" xorm:"not null comment('标题') VARCHAR(255)"` + Source int `json:"source" xorm:"not null default 0 comment('1为直推奖励 +2为间推奖励 +3为额外奖励 +4为榜单奖励 +来源标识') TINYINT(4)"` + SourceText string `json:"source_text" xorm:"not null default '' comment('来源text') VARCHAR(255)"` + JobsTag int `json:"jobs_tag" xorm:"comment('任务标识,只有额外奖励有') TINYINT(1)"` + Money string `json:"money" xorm:"not null default 0.00 comment('奖励金额') DECIMAL(10,2)"` + CreatedAt int `json:"created_at" xorm:"not null comment('创建时间') INT(10)"` + GivenAt int `json:"given_at" xorm:"comment('奖励发放时间') INT(10)"` + State int `json:"state" xorm:"not null default 1 comment('发放状态 0未发放 1已发放') TINYINT(1)"` + IsFrozen int `json:"is_frozen" xorm:"not null default 0 comment('冻结状态 0未冻结 1已冻结') TINYINT(1)"` + UpdatedAt int `json:"updated_at" xorm:"comment('更新时间') INT(10)"` + CoinId int `json:"coin_id" xorm:"default 0 INT(11)"` + RewardType int `json:"reward_type" xorm:"default 0 INT(11)"` + InviteTime int `json:"invite_time" xorm:"default 0 INT(11)"` + IsFull int `json:"is_full" xorm:"default 0 INT(11)"` + FullTime int `json:"full_time" xorm:"default 0 INT(11)"` + ToRewardTime int `json:"to_reward_time" xorm:"default 0 INT(11)"` + CompleteCon string `json:"complete_con" xorm:"not null default '0' comment('完成的条件') VARCHAR(255)"` +} diff --git a/app/utils/random.go b/app/utils/random.go index 91e4130..69c44ae 100644 --- a/app/utils/random.go +++ b/app/utils/random.go @@ -14,3 +14,12 @@ func RandInt(max int) int { rand.Seed(time.Now().UnixNano()) // seed后随机数可变 return rand.Intn(max) // 0-100的随机数 } +func RandIntRand(min, max int) int { + if min >= max || min == 0 || max == 0 { + if max == 0 { + max = min + } + return max + } + return rand.Intn(max-min) + min +} diff --git a/consume/init.go b/consume/init.go index 9d55a56..f78c0e1 100644 --- a/consume/init.go +++ b/consume/init.go @@ -17,6 +17,8 @@ func Init() { // 增加消费任务队列 func initConsumes() { + jobs[consumeMd.ZhiosAcquisitionConditionFunName] = ZhiosAcquisitionCondition + jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume diff --git a/consume/md/consume_key.go b/consume/md/consume_key.go index b3d6020..3f19aba 100644 --- a/consume/md/consume_key.go +++ b/consume/md/consume_key.go @@ -174,6 +174,15 @@ var RabbitMqQueueKeyList = []*MqQueue{ BindKey: "", ConsumeFunName: "ZhiosCapitalPoolOrderTotal", }, + { + ExchangeName: "zhios.acquisition.exchange", + Name: "zhios_acquisition_condition", + Type: DirectQueueType, + IsPersistent: false, + RoutKey: "condition", + BindKey: "", + ConsumeFunName: "ZhiosAcquisitionCondition", + }, } const ( @@ -195,4 +204,5 @@ const ( ZhiosTikTokUpdateFunName = "ZhiosTikTokUpdate" ZhiosTikTokAllUpdateFunName = "ZhiosTikTokAllUpdate" CloudIssuanceAsyncMLoginFunName = "CloudIssuanceAsyncMLoginConsume" + ZhiosAcquisitionConditionFunName = "ZhiosAcquisitionCondition" ) diff --git a/consume/md/md.go b/consume/md/md.go new file mode 100644 index 0000000..958c30a --- /dev/null +++ b/consume/md/md.go @@ -0,0 +1,87 @@ +package md + +import "applet/app/db/model" + +type ZhiosAcquisition struct { + Uid string `json:"uid"` + Mid string `json:"mid"` + Id string `json:"id"` +} + +type AcquisitionCfg struct { + Id string `json:"id"` + Status string `json:"status"` + Time int `json:"time"` + StartTime string `json:"start_time"` + EndTime string `json:"end_time"` + SuccessConditions struct { + Register struct { + Open string `json:"open"` + } `json:"register"` + TaobaoAuthorization struct { + Open string `json:"open"` + } `json:"taobao_authorization"` + BindPhone struct { + Open string `json:"open"` + } `json:"bind_phone"` + FirstOrder struct { + Open string `json:"open"` + Day string `json:"day"` + Status string `json:"status"` + } `json:"first_order"` + SelfOrder struct { + Open string `json:"open"` + Money string `json:"money"` + } `json:"self_order"` + OrderPay struct { + Open string `json:"open"` + Money string `json:"money"` + } `json:"order_pay"` + OrderStatus struct { + Open string `json:"open"` + Status string `json:"status"` + } `json:"order_status"` + } `json:"success_conditions"` + RewardAccountDay string `json:"reward_account_day"` + AdSetting struct { + Status string `json:"status"` + AdData string `json:"ad_data"` + } `json:"ad_setting"` + RewardRule struct { + DirectTime string `json:"direct_time"` + IndirectTime string `json:"indirect_time"` + DirectSuccess string `json:"direct_success"` + IndirectSuccess string `json:"indirect_success"` + InvitedReward string `json:"invited_reward"` + DirectSuccessMax string `json:"direct_success_max"` + IndirectSuccessMax string `json:"indirect_success_max"` + InvitedRewardMax string `json:"invited_reward_max"` + RewardType string `json:"reward_type"` + RewardCoinId string `json:"reward_coin_id"` + } `json:"reward_rule"` + ExtraRewardSetting struct { + Status string `json:"status"` + RewardStep []struct { + Number string `json:"number"` + Money string `json:"money"` + } `json:"reward_step"` + } `json:"extra_reward_setting"` + RankRule struct { + Status string `json:"status"` + ActivityCycle string `json:"activity_cycle"` + EndTime string `json:"end_time"` + RankData string `json:"rank_data"` + FirstAwardMoney string `json:"first_award_money"` + SecondAwardMoney string `json:"second_award_money"` + ThirdAwardMoney string `json:"third_award_money"` + FirstAwardExtendCount string `json:"first_award_extend_count"` + SecondAwardExtendCount string `json:"second_award_extend_count"` + ThirdAwardExtendCount string `json:"third_award_extend_count"` + } `json:"rank_rule"` + RankData string `json:"rank_data"` +} + +type User struct { + Info *model.User + Profile *model.UserProfile +} diff --git a/consume/zhios_acquisition_condition.go b/consume/zhios_acquisition_condition.go new file mode 100644 index 0000000..d8719b5 --- /dev/null +++ b/consume/zhios_acquisition_condition.go @@ -0,0 +1,374 @@ +package consume + +import ( + "applet/app/db" + "applet/app/db/model" + "applet/app/utils" + "applet/app/utils/logx" + "applet/consume/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" + "encoding/json" + "errors" + "fmt" + "github.com/streadway/amqp" + "time" + "xorm.io/xorm" +) + +func ZhiosAcquisitionCondition(queue md.MqQueue) { + fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>") + ch, err := rabbit.Cfg.Pool.GetChannel() + if err != nil { + logx.Error(err) + return + } + defer ch.Release() + //1、将自己绑定到交换机上 + ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) + //2、取出数据进行消费 + ch.Qos(100) + delivery := ch.Consume(queue.Name, false) + + var res amqp.Delivery + var ok bool + for { + res, ok = <-delivery + if ok == true { + //fmt.Println(string(res.Body)) + fmt.Println(">>>>>>>>>>>>>>>>CanalOrderConsume<<<<<<<<<<<<<<<<<<<<<<<<<") + err = handleZhiosAcquisition(res.Body) + //_ = res.Reject(false) + fmt.Println(err) + if err == nil { + _ = res.Ack(true) + } else { + var canalMsg *md.ZhiosAcquisition + var tmpString string + err := json.Unmarshal(res.Body, &tmpString) + if err == nil { + fmt.Println(tmpString) + err = json.Unmarshal([]byte(tmpString), &canalMsg) + if err == nil { + ch.Publish(queue.ExchangeName, utils.SerializeStr(canalMsg), queue.RoutKey) + } + } + + } + } else { + panic(errors.New("error getting message")) + } + } + fmt.Println("get msg done") +} +func handleZhiosAcquisition(msg []byte) error { + //1、解析canal采集至mq中queue的数据结构体 + var canalMsg *md.ZhiosAcquisition + fmt.Println(string(msg)) + var tmpString string + err := json.Unmarshal(msg, &tmpString) + if err != nil { + fmt.Println(err.Error()) + return err + } + fmt.Println(tmpString) + err = json.Unmarshal([]byte(tmpString), &canalMsg) + if err != nil { + return err + } + mid := canalMsg.Mid + eg := db.DBs[mid] + userInfo, _ := db.UserFindByID(eg, canalMsg.Uid) + if userInfo == nil { + return nil + } + userProfile, _ := db.UserProfileFindByID(eg, canalMsg.Uid) + cfg := db.GetAcquisitionCfg(eg, canalMsg.Id, userInfo.CreateAt) + if cfg == nil { + return nil + } + nextUserProfile, _ := db.UserProfileFindByID(eg, userProfile.ParentUid) + var user = &md.User{Info: userInfo, Profile: userProfile} + + bools, str := checkAllCompleteTmp(eg, user, cfg) + isFull := 0 + fullTime := 0 + toRewardTime := 0 + if bools { + isFull = 1 + fullTime = int(time.Now().Unix()) + toRewardTime = int(time.Now().Unix()) + utils.StrToInt(cfg.RewardAccountDay)*86400 + } + //写入奖励记录 + InvitedReward := cfg.RewardRule.InvitedReward + if cfg.RewardRule.RewardType == "1" { + InvitedReward = Rands(cfg.RewardRule.InvitedReward, cfg.RewardRule.InvitedRewardMax) + } + if utils.StrToFloat64(InvitedReward) > 0 { + ownRewardLog, ownhas, _ := db.GetNewAcquisitionRewardLog(eg, &model.NewAcquisitionRewardLog{ + Uid: userProfile.Uid, + ToUid: 0, + }) + if !ownhas { + ownRewardLog = &model.NewAcquisitionRewardLog{ + Uid: user.Profile.Uid, + ToUid: user.Profile.Uid, + Title: user.Info.Nickname, + Source: 0, + SourceText: "注册奖励", + Money: InvitedReward, + CreatedAt: int(time.Now().Unix()), + State: 0, + CoinId: utils.StrToInt(cfg.RewardRule.RewardCoinId), + RewardType: utils.StrToInt(cfg.RewardRule.RewardType), + InviteTime: int(userInfo.CreateAt.Unix()), + } + + db.InsertNewRewardLog(eg, ownRewardLog) + } + ownRewardLog.CompleteCon = str + ownRewardLog.IsFull = isFull + if ownRewardLog.FullTime == 0 { + ownRewardLog.FullTime = fullTime + } + if ownRewardLog.ToRewardTime == 0 { + ownRewardLog.ToRewardTime = toRewardTime + } + eg.Where("id=?", ownRewardLog.Id).Update(ownRewardLog) + } + + //直推 + DirectSuccess := cfg.RewardRule.DirectSuccess + if cfg.RewardRule.RewardType == "1" { + DirectSuccess = Rands(cfg.RewardRule.DirectSuccess, cfg.RewardRule.DirectSuccessMax) + } + if utils.StrToFloat64(DirectSuccess) > 0 { + if userProfile.ParentUid > 0 { + //写入奖励记录 + extendRewardLog, extendHas, _ := db.GetNewAcquisitionRewardLog(eg, &model.NewAcquisitionRewardLog{ + Uid: userProfile.ParentUid, + ToUid: userProfile.Uid, + }) + if !extendHas { + extendRewardLog = &model.NewAcquisitionRewardLog{ + Uid: user.Profile.ParentUid, + ToUid: user.Profile.Uid, + Title: user.Info.Nickname, + Source: 1, + SourceText: "直推好友", + Money: DirectSuccess, + CreatedAt: int(time.Now().Unix()), + State: 0, + CoinId: utils.StrToInt(cfg.RewardRule.RewardCoinId), + RewardType: utils.StrToInt(cfg.RewardRule.RewardType), + InviteTime: int(userInfo.CreateAt.Unix()), + } + db.InsertNewRewardLog(eg, extendRewardLog) + } + extendRewardLog.CompleteCon = str + extendRewardLog.IsFull = isFull + if extendRewardLog.FullTime == 0 { + extendRewardLog.FullTime = fullTime + } + if extendRewardLog.ToRewardTime == 0 { + extendRewardLog.ToRewardTime = toRewardTime + } + eg.Where("id=?", extendRewardLog.Id).Update(extendRewardLog) + } + } + + //间推 + IndirectSuccess := cfg.RewardRule.IndirectSuccess + if cfg.RewardRule.RewardType == "1" { + IndirectSuccess = Rands(cfg.RewardRule.IndirectSuccess, cfg.RewardRule.IndirectSuccessMax) + } + if utils.StrToFloat64(IndirectSuccess) > 0 { + if nextUserProfile != nil && nextUserProfile.ParentUid > 0 { + IndirectRewardLog, IndirectHas, _ := db.GetNewAcquisitionRewardLog(eg, &model.NewAcquisitionRewardLog{ + Uid: nextUserProfile.ParentUid, + ToUid: userProfile.Uid, + }) + if !IndirectHas { + IndirectRewardLog = &model.NewAcquisitionRewardLog{ + Uid: nextUserProfile.ParentUid, + ToUid: user.Profile.Uid, + Title: user.Info.Nickname, + Source: 2, + SourceText: "间推好友", + Money: IndirectSuccess, + CreatedAt: int(time.Now().Unix()), + State: 0, + CoinId: utils.StrToInt(cfg.RewardRule.RewardCoinId), + RewardType: utils.StrToInt(cfg.RewardRule.RewardType), + InviteTime: int(userInfo.CreateAt.Unix()), + } + db.InsertNewRewardLog(eg, IndirectRewardLog) + } + IndirectRewardLog.CompleteCon = str + IndirectRewardLog.IsFull = isFull + if IndirectRewardLog.FullTime == 0 { + IndirectRewardLog.FullTime = fullTime + } + if IndirectRewardLog.ToRewardTime == 0 { + IndirectRewardLog.ToRewardTime = toRewardTime + } + eg.Where("id=?", IndirectRewardLog.Id).Update(IndirectRewardLog) + } + } + + return nil +} +func Rands(minVal, maxVal string) string { + min := int(utils.StrToFloat64(minVal) * 100) + max := int(utils.StrToFloat64(maxVal) * 100) + return utils.Float64ToStrByPrec(float64(utils.RandIntRand(min, max))/100, 3) +} + +//判断是否符合条件 +func checkAllCompleteTmp(eg *xorm.Engine, user *md.User, acqCfg *md.AcquisitionCfg) (bool, string) { + res := true + str := "" + if acqCfg.SuccessConditions.Register.Open == "1" { + res = res && AcqRegisterTmp(user, acqCfg) + if res { + str += ",Register" + } + } + if acqCfg.SuccessConditions.TaobaoAuthorization.Open == "1" { + res = res && AcqTaoBaoAuthTmp(user, acqCfg) + if res { + str += ",TaobaoAuthorization" + } + } + if acqCfg.SuccessConditions.FirstOrder.Open == "1" { + res = res && AcqFirstOrder(eg, user, acqCfg) + if res { + str += ",FirstOrder" + } + } + if acqCfg.SuccessConditions.SelfOrder.Open == "1" { + res = res && AcqSelfOrder(eg, user, acqCfg) + if res { + str += ",SelfOrder" + } + } + if acqCfg.SuccessConditions.OrderPay.Open == "1" { + res = res && AcqOrderPay(eg, user, acqCfg) + if res { + str += ",OrderPay" + } + } + if len(str) > 0 { + str = str[1:] + } + return res, str +} +func AcqRegisterTmp(user *md.User, acqCfg *md.AcquisitionCfg) bool { + var startTime = utils.TimeStdParseUnix(acqCfg.StartTime) + var endTime = utils.TimeStdParseUnix(acqCfg.EndTime) + if startTime == 0 || endTime == 0 { + return false + } + //时间不在活动范围之内返回false + if user.Info.CreateAt.Unix() < startTime { + return false + } + if user.Info.CreateAt.Unix() > endTime { + return false + } + return true +} + +func AcqTaoBaoAuthTmp(user *md.User, acqCfg *md.AcquisitionCfg) bool { + if user.Profile.AccTaobaoAuthTime > 0 { + return true + } + return false +} + +func AcqFirstOrder(eg *xorm.Engine, user *md.User, acqCfg *md.AcquisitionCfg) bool { + endTime := int(user.Info.CreateAt.Unix()) + utils.StrToInt(acqCfg.SuccessConditions.FirstOrder.Day)*86400 + return commAmount(eg, utils.IntToStr(user.Info.Uid), endTime, 0, acqCfg) +} +func AcqSelfOrder(eg *xorm.Engine, user *md.User, acqCfg *md.AcquisitionCfg) bool { + return commAmount(eg, utils.IntToStr(user.Info.Uid), 0, 2, acqCfg) +} +func AcqOrderPay(eg *xorm.Engine, user *md.User, acqCfg *md.AcquisitionCfg) bool { + return commAmount(eg, utils.IntToStr(user.Info.Uid), 0, 1, acqCfg) +} +func sqlSelect(eg *xorm.Engine, uid string, endTime, types int, acqCfg *md.AcquisitionCfg, arr []string) int { + sql := `SELECT COUNT(*) as count FROM %s ol + LEFT JOIN %s olr on olr.oid=%s and olr.uid=%s + WHERE ol.uid=? %s %s +` + str := "" + if endTime > 0 { + str += " AND olr.create_at<=" + utils.IntToStr(endTime) + } + if types == 2 { + str += " AND olr.amount>=" + acqCfg.SuccessConditions.SelfOrder.Money + } + if types == 1 { + str += " AND %s>=" + acqCfg.SuccessConditions.OrderPay.Money + str = fmt.Sprintf(str, arr[0]) + } + sqlOrd := fmt.Sprintf(sql, arr[1], arr[2], arr[3], arr[4], str, arr[5]) + ordResult, err := db.QueryNativeString(eg, sqlOrd, uid) + fmt.Println(sqlOrd) + fmt.Println(err) + count := 0 + for _, v := range ordResult { + count = utils.StrToInt(v["count"]) + } + return count +} +func commAmount(eg *xorm.Engine, uid string, endTime, types int, acqCfg *md.AcquisitionCfg) bool { + state := "0,1,2,3,5" + psoState := "'订单付款','订单结算'" + mallState := "1,2,3" + o2oState := "1,2,3,4" + b2cState := "1,2,3,4" + if acqCfg.SuccessConditions.FirstOrder.Status == "1" { + state = "1,2,3,5" + mallState = "2,3" + o2oState = "2,3,4" + b2cState = "2,3,4" + } + if acqCfg.SuccessConditions.FirstOrder.Status == "2" { + state = "2,3,5" + mallState = "2,3" + o2oState = "2,3,4" + b2cState = "2,3,4" + } + if acqCfg.SuccessConditions.FirstOrder.Status == "3" { + state = "3,5" + mallState = "3" + o2oState = "3,4" + b2cState = "3,4" + psoState = "'订单结算'" + } + + arr := []string{"ol.paid_price", "ord_list", "ord_list_relate", "ol.ord_id", "ol.uid", " and ol.state in(" + state + ")"} + count := sqlSelect(eg, uid, endTime, types, acqCfg, arr) + arr = []string{"ol.paid_price", "privilege_card_ord", "ord_list_relate", "ol.ord_id", "ol.uid", " and ol.state=1"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + arr = []string{"ol.commission", "duoyou_ord_list", "ord_list_relate", "ol.oid", "ol.uid", " and ol.id>0"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + arr = []string{"ol.amount", "recharge_order", "ord_list_relate", "ol.oid", "ol.uid", " and ol.status<>'已退款'"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + arr = []string{"ol.amount", "playlet_sale_order", "ord_list_relate", "ol.custom_oid", "ol.uid", " and ol.status in(" + psoState + ")"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + + arr = []string{"ol.cost_price", "mall_ord", "mall_ord_list_relate", "ol.ord_id", "ol.uid", " and ol.state in(" + mallState + ")"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + + arr = []string{"ol.cost_price", "o2o_ord", "o2o_ord_list_relate", "ol.ord_id", "ol.uid", " and ol.state in(" + o2oState + ")"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + arr = []string{"ol.actual_pay_amount", "o2o_pay_to_merchant", "o2o_ord_list_relate", "ol.pay_id", "ol.uid", " and ol.state >=1"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + arr = []string{"ol.cost_price", "b2c_ord", "b2c_ord_list_relate", "ol.ord_id", "ol.uid", " and ol.state in(" + b2cState + ")"} + count += sqlSelect(eg, uid, endTime, types, acqCfg, arr) + if count > 0 { + return true + } + return false +} diff --git a/go.mod b/go.mod index 1cbf4bb..eeeeb10 100644 --- a/go.mod +++ b/go.mod @@ -65,8 +65,6 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nilorg/sdk v0.0.0-20221104025912-4b6ccb7004d8 // indirect github.com/olivere/elastic/v7 v7.0.32 // indirect - github.com/onsi/ginkgo v1.16.5 // indirect - github.com/onsi/gomega v1.19.0 // indirect github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/rakyll/statik v0.1.7 // indirect