|
@@ -5,6 +5,7 @@ import (
|
|
ME "app.yhyue.com/moapp/jybase/encrypt"
|
|
ME "app.yhyue.com/moapp/jybase/encrypt"
|
|
elastic "app.yhyue.com/moapp/jybase/esv1"
|
|
elastic "app.yhyue.com/moapp/jybase/esv1"
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
|
|
+ "app.yhyue.com/moapp/jybase/mysql"
|
|
"fmt"
|
|
"fmt"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
@@ -29,6 +30,7 @@ const (
|
|
type NewestInfo struct {
|
|
type NewestInfo struct {
|
|
TableName string
|
|
TableName string
|
|
UserId string
|
|
UserId string
|
|
|
|
+ MysqlDb *mysql.Mysql
|
|
}
|
|
}
|
|
|
|
|
|
var mysqlTables = map[string]string{
|
|
var mysqlTables = map[string]string{
|
|
@@ -39,21 +41,22 @@ var mysqlTables = map[string]string{
|
|
}
|
|
}
|
|
|
|
|
|
func GetNewestInfo(userId, userType string) *NewestInfo {
|
|
func GetNewestInfo(userId, userType string) *NewestInfo {
|
|
- return &NewestInfo{
|
|
|
|
|
|
+ nt := &NewestInfo{
|
|
UserId: userId,
|
|
UserId: userId,
|
|
TableName: mysqlTables[userType],
|
|
TableName: mysqlTables[userType],
|
|
|
|
+ MysqlDb: IC.PushMysql,
|
|
}
|
|
}
|
|
|
|
+ switch userType {
|
|
|
|
+ case "m":
|
|
|
|
+ nt.MysqlDb = IC.BigmemberPushMysql
|
|
|
|
+ case "e":
|
|
|
|
+ nt.MysqlDb = IC.EntnichePushMysql
|
|
|
|
+ }
|
|
|
|
+ return nt
|
|
}
|
|
}
|
|
func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
|
|
func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
|
|
findSQL := "select infoid,matchkeys,attachment_count,budget,bidamount from " + n.TableName + " where userid = '" + n.UserId + "' and date >= %d order by id desc limit 50"
|
|
findSQL := "select infoid,matchkeys,attachment_count,budget,bidamount from " + n.TableName + " where userid = '" + n.UserId + "' and date >= %d order by id desc limit 50"
|
|
- list := &[]map[string]interface{}{}
|
|
|
|
- if n.TableName == "pushmember" { //大会员
|
|
|
|
- list = IC.BigmemberPushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
|
|
|
|
- } else if n.TableName == "pushentniche" { //商机管理
|
|
|
|
- list = IC.EntnichePushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
|
|
|
|
- } else {
|
|
|
|
- list = IC.PushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
|
|
|
|
- }
|
|
|
|
|
|
+ list := n.MysqlDb.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
|
|
if len(*list) > 0 {
|
|
if len(*list) > 0 {
|
|
m := map[string]bool{}
|
|
m := map[string]bool{}
|
|
es_ids := []string{}
|
|
es_ids := []string{}
|
|
@@ -95,9 +98,8 @@ func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
|
|
//mongodb bidding
|
|
//mongodb bidding
|
|
mgo_ids := []primitive.ObjectID{}
|
|
mgo_ids := []primitive.ObjectID{}
|
|
for _, v := range es_ids {
|
|
for _, v := range es_ids {
|
|
- if infos[v] == nil {
|
|
|
|
- _id, _ := primitive.ObjectIDFromHex(v)
|
|
|
|
- mgo_ids = append(mgo_ids, _id)
|
|
|
|
|
|
+ if infos[v].Title == "" {
|
|
|
|
+ mgo_ids = append(mgo_ids, mongodb.StringTOBsonId(v))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if len(mgo_ids) > 0 {
|
|
if len(mgo_ids) > 0 {
|
|
@@ -121,7 +123,7 @@ func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
|
|
//mongodb bidding_back
|
|
//mongodb bidding_back
|
|
mgo_back_ids := []primitive.ObjectID{}
|
|
mgo_back_ids := []primitive.ObjectID{}
|
|
for _, v := range mgo_ids {
|
|
for _, v := range mgo_ids {
|
|
- if infos[mongodb.BsonIdToSId(v)] == nil {
|
|
|
|
|
|
+ if infos[mongodb.BsonIdToSId(v)].Title == "" {
|
|
mgo_back_ids = append(mgo_back_ids, v)
|
|
mgo_back_ids = append(mgo_back_ids, v)
|
|
}
|
|
}
|
|
}
|
|
}
|