|
@@ -1,20 +1,22 @@
|
|
|
package entity
|
|
|
|
|
|
import (
|
|
|
+ qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
+ elastic "app.yhyue.com/moapp/jybase/es"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
|
|
|
+ "context"
|
|
|
"fmt"
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
"jy/src/jfw/modules/publicapply/src/config"
|
|
|
+ "jy/src/jfw/modules/publicapply/src/db"
|
|
|
"log"
|
|
|
"time"
|
|
|
|
|
|
- qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
- "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
- elastic "app.yhyue.com/moapp/jybase/es"
|
|
|
- "app.yhyue.com/moapp/jybase/redis"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
-
|
|
|
// "reflect"
|
|
|
//"strconv"
|
|
|
. "jy/src/jfw/modules/publicapply/src/subscribePush/entity"
|
|
@@ -120,6 +122,45 @@ func (this *ParamInfo) IsSub() bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
+type RuleStruct struct {
|
|
|
+ Browse string `ch:"browse"`
|
|
|
+}
|
|
|
+
|
|
|
+// 浏览记录查询
|
|
|
+func (this *ParamInfo) HistorySearch(userId string) (string, string, string) {
|
|
|
+ ass := []RuleStruct{}
|
|
|
+ rows, err1 := db.ClickhouseConn.Query(context.TODO(), "select browse from sub_recommend_rule where userid=?", userId)
|
|
|
+ if err1 != nil {
|
|
|
+ logx.Error(err1)
|
|
|
+ return "", "", ""
|
|
|
+ }
|
|
|
+ defer rows.Close()
|
|
|
+ for rows.Next() {
|
|
|
+ as := RuleStruct{}
|
|
|
+ if err := rows.ScanStruct(&as); err != nil {
|
|
|
+ logx.Error(err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ ass = append(ass, as)
|
|
|
+ }
|
|
|
+ if len(ass) == 0 {
|
|
|
+ return "", "", ""
|
|
|
+ }
|
|
|
+ browseArr := gconv.Maps(ass[0].Browse)
|
|
|
+ if len(browseArr) == 0 {
|
|
|
+ return "", "", ""
|
|
|
+ }
|
|
|
+ for _, v := range browseArr {
|
|
|
+ area := gconv.String(v["area"])
|
|
|
+ city := gconv.String(v["city"])
|
|
|
+ district := gconv.String(v["district"])
|
|
|
+ if area != "" && area != "全国" {
|
|
|
+ return area, city, district
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "", "", ""
|
|
|
+}
|
|
|
+
|
|
|
type UserSubMsg struct {
|
|
|
Area map[string]interface{} `json:"area"` //地区
|
|
|
Infotype []interface{} `json:"infotype"` //信息类型
|