|
@@ -13,7 +13,7 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
"jy/src/jfw/config"
|
|
"jy/src/jfw/config"
|
|
"math/rand"
|
|
"math/rand"
|
|
- "sort"
|
|
|
|
|
|
+ "strconv"
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
"time"
|
|
"time"
|
|
@@ -26,11 +26,13 @@ var (
|
|
|
|
|
|
type ClaimProject struct {
|
|
type ClaimProject struct {
|
|
*xweb.Action
|
|
*xweb.Action
|
|
- nzjSearch xweb.Mapper `xweb:"/project/nzj/search"` //拟在建工作桌面外列表页
|
|
|
|
- nzjDetails xweb.Mapper `xweb:"/project/nzj/details"` //拟在建工作桌面外详情页
|
|
|
|
|
|
+ nzjSearch xweb.Mapper `xweb:"/front/project/nzj/search"` //拟在建工作桌面外列表页
|
|
|
|
+ nzjDetails xweb.Mapper `xweb:"/front/project/nzj/details"` //拟在建工作桌面外详情页
|
|
|
|
+ nzjConditions xweb.Mapper `xweb:"/front/project/nzj/conditions"` //工作台引导说明
|
|
|
|
+
|
|
analyzeWord xweb.Mapper `xweb:"/homePage/analyzeWord"` //首页定制化分析报告词收集
|
|
analyzeWord xweb.Mapper `xweb:"/homePage/analyzeWord"` //首页定制化分析报告词收集
|
|
analysisRegional xweb.Mapper `xweb:"/homePage/analysisRegional"` //首页区域分析
|
|
analysisRegional xweb.Mapper `xweb:"/homePage/analysisRegional"` //首页区域分析
|
|
- specification xweb.Mapper `xweb:"/front/bootstrap/specification"` //工作台引导说明
|
|
|
|
|
|
+ specification xweb.Mapper `xweb:"/front/bootstrap/specification"` //拟在建工作桌面外搜索
|
|
}
|
|
}
|
|
|
|
|
|
func init() {
|
|
func init() {
|
|
@@ -66,26 +68,118 @@ func (l *ClaimProject) AnalyzeWord() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (l *ClaimProject) NzjConditions() {
|
|
|
|
+ var (
|
|
|
|
+ data []map[string]interface{}
|
|
|
|
+ projectStageArr, ownerclassArr []string
|
|
|
|
+ areaArr = []string{"全国"}
|
|
|
|
+ )
|
|
|
|
+ redisKey := "nzj_search_criteria"
|
|
|
|
+ redisData := redis.Get(RedisNameNew, redisKey)
|
|
|
|
+ if redisData != nil {
|
|
|
|
+ rData, _ := redisData.([]interface{})
|
|
|
|
+ data = common.ObjArrToMapArr(rData)
|
|
|
|
+ } else {
|
|
|
|
+ area := public.GlobalCommonMysql.SelectBySql(`SELECT
|
|
|
|
+ name
|
|
|
|
+FROM
|
|
|
|
+ Jianyu_subjectdb.d_area_code where level = 1 and name != '其它'`)
|
|
|
|
+ if area != nil && len(*area) > 0 {
|
|
|
|
+ for _, m := range *area {
|
|
|
|
+ areaArr = append(areaArr, common.InterfaceToStr(m["name"]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ data = append(data, map[string]interface{}{"地区": areaArr})
|
|
|
|
+
|
|
|
|
+ categoryCode := public.GlobalCommonMysql.SelectBySql(`SELECT
|
|
|
|
+ name, code
|
|
|
|
+FROM
|
|
|
|
+ Jianyu_subjectdb.d_nzj_category_code WHERE name != '其它工程' and pcode = ""
|
|
|
|
+ ORDER BY id asc`)
|
|
|
|
+ if categoryCode != nil && len(*categoryCode) > 0 {
|
|
|
|
+ for _, m := range *categoryCode {
|
|
|
|
+ category := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT
|
|
|
|
+ name
|
|
|
|
+FROM
|
|
|
|
+ Jianyu_subjectdb.d_nzj_category_code WHERE pcode = '%s'
|
|
|
|
+ ORDER BY id asc`, common.InterfaceToStr(m["code"])))
|
|
|
|
+ if category != nil && len(*category) > 0 {
|
|
|
|
+ var names []string
|
|
|
|
+ for _, m2 := range *category {
|
|
|
|
+ names = append(names, common.InterfaceToStr(m2["name"]))
|
|
|
|
+ }
|
|
|
|
+ data = append(data, map[string]interface{}{common.InterfaceToStr(m["name"]): names})
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ project_stage := public.GlobalCommonMysql.SelectBySql(`SELECT
|
|
|
|
+ name
|
|
|
|
+FROM
|
|
|
|
+ Jianyu_subjectdb.d_nzj_project_stage_code
|
|
|
|
+ ORDER BY id asc
|
|
|
|
+ `)
|
|
|
|
+ if project_stage != nil && len(*project_stage) > 0 {
|
|
|
|
+ for _, m := range *project_stage {
|
|
|
|
+ projectStageArr = append(projectStageArr, common.InterfaceToStr(m["name"]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ data = append(data, map[string]interface{}{"项目阶段": projectStageArr})
|
|
|
|
+
|
|
|
|
+ ownerclass := public.GlobalCommonMysql.SelectBySql(`SELECT
|
|
|
|
+ name
|
|
|
|
+FROM
|
|
|
|
+ Jianyu_subjectdb.d_nzj_ownerclass_code ORDER BY id asc`)
|
|
|
|
+ if area != nil && len(*area) > 0 {
|
|
|
|
+ for _, m := range *ownerclass {
|
|
|
|
+ ownerclassArr = append(ownerclassArr, common.InterfaceToStr(m["name"]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ data = append(data, map[string]interface{}{"业主类型": ownerclassArr})
|
|
|
|
+ redis.Put(RedisNameNew, redisKey, data, 3600*24*30)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ l.ServeJson(map[string]interface{}{
|
|
|
|
+ "error_code": 0,
|
|
|
|
+ "error_msg": nil,
|
|
|
|
+ "data": data,
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
func (l *ClaimProject) NzjSearch() {
|
|
func (l *ClaimProject) NzjSearch() {
|
|
- //userId, _ := l.GetSession("user_id").(string)
|
|
|
|
- infoMap := map[string]interface{}{}
|
|
|
|
- body := xweb.FilterXSS(string(l.Body()))
|
|
|
|
- json.Unmarshal([]byte(body), &infoMap)
|
|
|
|
- count, list := getNzjList(infoMap)
|
|
|
|
|
|
+ pageNum, _ := l.GetInt("pageNum")
|
|
|
|
+ pageSize, _ := l.GetInt("pageSize")
|
|
|
|
+ count, list := getNzjList(map[string]interface{}{
|
|
|
|
+ "keyWord": l.GetString("keyWord"),
|
|
|
|
+ "area": l.GetString("area"),
|
|
|
|
+ "category": l.GetString("category"),
|
|
|
|
+ "project_stage": l.GetString("project_stage"),
|
|
|
|
+ "ownerclass": l.GetString("ownerclass"),
|
|
|
|
+ "searchSort": l.GetString("searchSort"),
|
|
|
|
+ "pageNum": pageNum,
|
|
|
|
+ "pageSize": pageSize,
|
|
|
|
+ })
|
|
l.ServeJson(map[string]interface{}{
|
|
l.ServeJson(map[string]interface{}{
|
|
"error_code": 0,
|
|
"error_code": 0,
|
|
"error_msg": nil,
|
|
"error_msg": nil,
|
|
- "data": map[string]interface{}{
|
|
|
|
- "list": list,
|
|
|
|
- "count": count,
|
|
|
|
- },
|
|
|
|
|
|
+ "list": list,
|
|
|
|
+ "count": count,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
func (l *ClaimProject) NzjDetails() {
|
|
func (l *ClaimProject) NzjDetails() {
|
|
equity := nzjEquity(l.Session())
|
|
equity := nzjEquity(l.Session())
|
|
pid := l.GetString("pid")
|
|
pid := l.GetString("pid")
|
|
- data := getDetail(pid, equity)
|
|
|
|
|
|
+ id := encrypt.SE2.Decode4Hex(pid)
|
|
|
|
+ if id == "" {
|
|
|
|
+ l.ServeJson(map[string]interface{}{
|
|
|
|
+ "error_code": -1,
|
|
|
|
+ "error_msg": "错误id",
|
|
|
|
+ "data": nil,
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ data := getDetail(id, equity)
|
|
l.ServeJson(map[string]interface{}{
|
|
l.ServeJson(map[string]interface{}{
|
|
"error_code": 0,
|
|
"error_code": 0,
|
|
"error_msg": nil,
|
|
"error_msg": nil,
|
|
@@ -99,37 +193,51 @@ type RemovalKey struct {
|
|
}
|
|
}
|
|
|
|
|
|
type ProjectConnection struct {
|
|
type ProjectConnection struct {
|
|
- endName string
|
|
|
|
- address string
|
|
|
|
- data []map[string]interface{}
|
|
|
|
|
|
+ EndName string `json:"endName"`
|
|
|
|
+ Address string `json:"address"`
|
|
|
|
+ IdentityType string `json:"identityType"`
|
|
|
|
+ EndId string `json:"endId"`
|
|
|
|
+ Data interface{} `json:"data"`
|
|
}
|
|
}
|
|
|
|
|
|
func getDetail(pid string, equity int) map[string]interface{} {
|
|
func getDetail(pid string, equity int) map[string]interface{} {
|
|
var codeContent string
|
|
var codeContent string
|
|
detail := make(map[string]interface{})
|
|
detail := make(map[string]interface{})
|
|
|
|
+ if pid == "" {
|
|
|
|
+ return detail
|
|
|
|
+ }
|
|
if equity < 3 {
|
|
if equity < 3 {
|
|
codeContent = common.If(equity == 1, "登陆后解锁会员查看", "(付费展示)").(string)
|
|
codeContent = common.If(equity == 1, "登陆后解锁会员查看", "(付费展示)").(string)
|
|
}
|
|
}
|
|
|
|
+ detail = BasicInfo(pid, codeContent, equity)
|
|
|
|
+ detail["follRecord"] = ProjectProgress(pid, equity)
|
|
|
|
+ detail["contact"] = EntConnection(pid, codeContent, equity)
|
|
|
|
+ return detail
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// BasicInfo 基本信息
|
|
|
|
+func BasicInfo(pid, codeContent string, equity int) map[string]interface{} {
|
|
//基本信息
|
|
//基本信息
|
|
- dataDetail := public.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT
|
|
|
|
|
|
+ detail := make(map[string]interface{})
|
|
|
|
+ dataDetail := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT
|
|
a.projectname,
|
|
a.projectname,
|
|
- a.lasttime,
|
|
|
|
- a.firsttime,
|
|
|
|
|
|
+ DATE_FORMAT(a.lasttime, '%s') AS lasttime,
|
|
|
|
+ DATE_FORMAT(a.firsttime, '%s') AS firsttime,
|
|
a.proposed_number,
|
|
a.proposed_number,
|
|
- CONCAT('进展', a.follow_num) AS follow,
|
|
|
|
|
|
+ (SELECT COUNT(*) FROM Jianyu_subjectdb.dwd_f_nzj_follw_record WHERE proposed_id = '%s') AS follow,
|
|
b.name AS project_stage,
|
|
b.name AS project_stage,
|
|
|
|
+ g.name AS area,
|
|
c.name AS nature,
|
|
c.name AS nature,
|
|
d.name AS category,
|
|
d.name AS category,
|
|
a.owner,
|
|
a.owner,
|
|
e.name AS ownerclass,
|
|
e.name AS ownerclass,
|
|
f.name AS industry,
|
|
f.name AS industry,
|
|
a.total_investment,
|
|
a.total_investment,
|
|
- a.project_startdate,
|
|
|
|
- a.project_completedate,
|
|
|
|
|
|
+ DATE_FORMAT(a.project_startdate, '%s') AS project_startdate,
|
|
|
|
+ DATE_FORMAT(a.project_completedate, '%s') AS project_completedate,
|
|
a.construction_area,
|
|
a.construction_area,
|
|
a.floor_area,
|
|
a.floor_area,
|
|
a.project_scale,
|
|
a.project_scale,
|
|
- a.createtime,
|
|
|
|
a.projectaddr
|
|
a.projectaddr
|
|
FROM
|
|
FROM
|
|
Jianyu_subjectdb.dwd_f_nzj_baseinfo a
|
|
Jianyu_subjectdb.dwd_f_nzj_baseinfo a
|
|
@@ -138,134 +246,136 @@ FROM
|
|
LEFT JOIN Jianyu_subjectdb.d_nzj_category_code d on a.category_code = d.code
|
|
LEFT JOIN Jianyu_subjectdb.d_nzj_category_code d on a.category_code = d.code
|
|
LEFT JOIN Jianyu_subjectdb.d_nzj_ownerclass_code e on a.ownerclass_code = e.code
|
|
LEFT JOIN Jianyu_subjectdb.d_nzj_ownerclass_code e on a.ownerclass_code = e.code
|
|
LEFT JOIN Jianyu_subjectdb.d_topsubtype_code f on a.industry_code = f.code
|
|
LEFT JOIN Jianyu_subjectdb.d_topsubtype_code f on a.industry_code = f.code
|
|
|
|
+ LEFT JOIN Jianyu_subjectdb.d_area_code g ON a.area_code = g.CODE
|
|
WHERE
|
|
WHERE
|
|
- proposed_id = '%s'`, pid))
|
|
|
|
|
|
+ proposed_id = '%s'`, "%Y-%m-%d", "%Y-%m-%d", pid, "%Y-%m-%d", "%Y-%m-%d", pid))
|
|
|
|
+ if dataDetail == nil || len(*dataDetail) == 0 {
|
|
|
|
+ //tidi缺失 查询es
|
|
|
|
+ dataDetail = elastic.GetById(proposed, proposed, pid)
|
|
|
|
+ if dataDetail != nil && len(*dataDetail) > 0 {
|
|
|
|
+ if lasttime := common.Int64All((*dataDetail)[0]["lasttime"]); lasttime > 0 {
|
|
|
|
+ // 格式化日期
|
|
|
|
+ formattedDate := time.UnixMilli(lasttime).Format("2006-01-02")
|
|
|
|
+ (*dataDetail)[0]["lasttime"] = formattedDate
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if dataDetail != nil && len(*dataDetail) > 0 {
|
|
if dataDetail != nil && len(*dataDetail) > 0 {
|
|
detail = (*dataDetail)[0]
|
|
detail = (*dataDetail)[0]
|
|
|
|
+ if follow := common.IntAll(detail["follow"]); follow > 100 {
|
|
|
|
+ detail["follow"] = fmt.Sprintf("进展%d", 100)
|
|
|
|
+ } else {
|
|
|
|
+ detail["follow"] = fmt.Sprintf("进展%d", follow)
|
|
|
|
+ }
|
|
|
|
+ detail["total_investment"] = removeTrailingZeros(common.Float64All(detail["total_investment"]))
|
|
//拼接项目概况
|
|
//拼接项目概况
|
|
- if equity < 3 {
|
|
|
|
|
|
+ if equity < 3 { //非会员打码
|
|
projectname := common.InterfaceToStr(detail["projectname"])
|
|
projectname := common.InterfaceToStr(detail["projectname"])
|
|
- detail["generalSituation"] = fmt.Sprintf("项目概况:%s项目是剑鱼标讯网站%s发布的%s行业项目信息,该项目投资总额%f万元,建设周期为%s至%s,且目前处于%s阶段。我们将持续跟踪并发布%s进展信息,感兴趣的用户开通大会员查看项目详情。",
|
|
|
|
- projectname, timeFmt(common.InterfaceToStr(detail["createtime"])), common.InterfaceToStr(detail["industry"]), common.Float64All(detail["total_investment"]),
|
|
|
|
- timeFmt(common.InterfaceToStr(detail["project_startdate"])), timeFmt(common.InterfaceToStr(detail["project_completedate"])), common.InterfaceToStr(detail["project_stage"]), projectname)
|
|
|
|
-
|
|
|
|
|
|
+ detail["generalSituation"] = fmt.Sprintf("%s项目是剑鱼标讯网站%s发布的%s行业项目信息,该项目投资总额%s万元,建设周期为%s至%s,且目前处于%s阶段。我们将持续跟踪并发布%s进展信息,感兴趣的用户开通大会员查看项目详情。",
|
|
|
|
+ projectname, common.InterfaceToStr(detail["firsttime"]), common.InterfaceToStr(detail["industry"]), common.If(common.Float64All(detail["total_investment"]) > 0, common.InterfaceToStr(detail["total_investment"]), "-"),
|
|
|
|
+ common.InterfaceToStr(detail["project_startdate"]), common.InterfaceToStr(detail["project_completedate"]), common.InterfaceToStr(detail["project_stage"]), projectname)
|
|
if detail["owner"] != nil && detail["owner"] != "" {
|
|
if detail["owner"] != nil && detail["owner"] != "" {
|
|
detail["owner"] = codeContent
|
|
detail["owner"] = codeContent
|
|
}
|
|
}
|
|
- detail["project_scale"] = config.Seoconfig["nzjConstructionContent"]
|
|
|
|
|
|
+ // 拟在建项目是指尚在规划、报批、立项、环评、设计等阶段的项目,一般由发改委和各部委提供,且项目规模和投资额都较大。剑鱼标讯一般会在项目正式招标前3-12个月就通知付费客户,让客户有足够的时间和空间和业主联系,做好前期准备工作。
|
|
|
|
+ detail["project_scale"] = config.Sysconfig["nzjConstructionContent"]
|
|
}
|
|
}
|
|
- //项目进展
|
|
|
|
- follRecord := public.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT a.publishtime,CONCAT('进展', a.follow_num) AS follow,CONCAT(a.title,'-',b.name) as remark,a.jybxhref FROM Jianyu_subjectdb.dwd_f_nzj_follw_record a
|
|
|
|
-LEFT JOIN Jianyu_subjectdb.d_nzj_project_stage_code b on a.project_stage_code = b.code WHERE proposed_id = '%s'
|
|
|
|
-ORDER BY publishtime DESC `, pid))
|
|
|
|
- if follRecord != nil && len(*follRecord) > 0 {
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return detail
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func removeTrailingZeros(f float64) string {
|
|
|
|
+ if f == 0 {
|
|
|
|
+ return ""
|
|
|
|
+ }
|
|
|
|
+ str := strconv.FormatFloat(f, 'f', -1, 64)
|
|
|
|
+ return str
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func ProjectProgress(pid string, equity int) *[]map[string]interface{} {
|
|
|
|
+ //项目进展
|
|
|
|
+ follRecord := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT DATE_FORMAT(a.publishtime, '%s') as publishtime,b.name as project_stage,a.title,a.jybxhref FROM Jianyu_subjectdb.dwd_f_nzj_follw_record a
|
|
|
|
+LEFT JOIN Jianyu_subjectdb.d_nzj_project_stage_code b on a.project_stage_code = b.code WHERE a.proposed_id = '%s'
|
|
|
|
+ORDER BY a.publishtime DESC,b.id DESC LIMIT 100`, "%Y-%m-%d", pid))
|
|
|
|
+ if follRecord != nil && len(*follRecord) > 0 {
|
|
|
|
+ for k, v := range *follRecord {
|
|
|
|
+ //CONCAT('进展', ROW_NUMBER() OVER (ORDER BY a.publishtime DESC)) AS follow,
|
|
|
|
+ v["follow"] = fmt.Sprintf("进展%d", len(*follRecord)-k)
|
|
if equity < 3 {
|
|
if equity < 3 {
|
|
- for _, v := range *follRecord {
|
|
|
|
- v["remark"] = config.Seoconfig["nzjProgressRemark"]
|
|
|
|
- delete(v, "jybxhref")
|
|
|
|
- }
|
|
|
|
|
|
+ // 进展备注是剑鱼标讯通过一定渠道获得的项目进度计划,帮您提前把握商机!开通大会员即可享受此权益。
|
|
|
|
+ v["title"] = config.Sysconfig["nzjProgressRemark"]
|
|
|
|
+ delete(v, "jybxhref")
|
|
}
|
|
}
|
|
- detail["follRecord"] = follRecord
|
|
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ return follRecord
|
|
|
|
+}
|
|
|
|
|
|
- //获取企业主题id
|
|
|
|
- entId := public.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT name_id,name,address FROM Jianyu_subjectdb.dwd_f_nzj_ent WHERE proposed_id = '%s' ORDER BY identity_type DESC , createtime ASC`, pid))
|
|
|
|
- if entId != nil && len(*entId) > 0 {
|
|
|
|
- pool := make(chan bool, 10)
|
|
|
|
- wait := &sync.WaitGroup{}
|
|
|
|
- var lock sync.Mutex
|
|
|
|
- var contact []ProjectConnection
|
|
|
|
- for _, nameMap := range *entId {
|
|
|
|
- pool <- true
|
|
|
|
- wait.Add(1)
|
|
|
|
- go func(nameId map[string]interface{}) {
|
|
|
|
- defer func() {
|
|
|
|
- wait.Done()
|
|
|
|
- <-pool
|
|
|
|
- }()
|
|
|
|
- connection := make(map[RemovalKey]map[string]interface{})
|
|
|
|
- var data []map[string]interface{}
|
|
|
|
- person := ProjectConnection{
|
|
|
|
- endName: common.InterfaceToStr(nameId["name"]),
|
|
|
|
- address: common.InterfaceToStr(nameId["address"]),
|
|
|
|
- }
|
|
|
|
- nzjContact := public.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT * FROM Jianyu_subjectdb.dwd_f_nzj_contact WHERE name_id ='%s' ORDER BY createtime DESC `, nameId))
|
|
|
|
- if nzjContact != nil && len(*nzjContact) > 0 {
|
|
|
|
- for _, v := range *nzjContact {
|
|
|
|
- v["lasttime"] = v["createtime"]
|
|
|
|
- var key RemovalKey
|
|
|
|
- key.person = common.InterfaceToStr(v["contact_name"])
|
|
|
|
- key.phone = common.InterfaceToStr(v["contact_tel"])
|
|
|
|
- connection[key] = v
|
|
|
|
- }
|
|
|
|
|
|
+func EntConnection(pid, codeContent string, equity int) []ProjectConnection {
|
|
|
|
+ //获取企业主题id
|
|
|
|
+ entId := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT ent.name_id, ent.name, ent.address, ent.identity_type
|
|
|
|
+FROM Jianyu_subjectdb.dwd_f_nzj_ent AS ent
|
|
|
|
+JOIN (
|
|
|
|
+ SELECT MAX(id) AS max_id FROM Jianyu_subjectdb.dwd_f_nzj_ent WHERE proposed_id = '%s' and name_id is not null GROUP BY name_id
|
|
|
|
+) AS sub ON ent.id = sub.max_id
|
|
|
|
+ORDER BY ent.identity_type DESC, ent.createtime ASC;`, pid))
|
|
|
|
+ if entId != nil && len(*entId) > 0 {
|
|
|
|
+ pool := make(chan bool, 10)
|
|
|
|
+ wait := &sync.WaitGroup{}
|
|
|
|
+ var (
|
|
|
|
+ lock sync.Mutex
|
|
|
|
+ contact = make([]ProjectConnection, len(*entId))
|
|
|
|
+ )
|
|
|
|
+ for k, nameMap := range *entId {
|
|
|
|
+ pool <- true
|
|
|
|
+ wait.Add(1)
|
|
|
|
+ go func(nameMaps map[string]interface{}, ks int) {
|
|
|
|
+ defer func() {
|
|
|
|
+ wait.Done()
|
|
|
|
+ <-pool
|
|
|
|
+ }()
|
|
|
|
+ nameId := common.InterfaceToStr(nameMaps["name_id"])
|
|
|
|
+ person := ProjectConnection{
|
|
|
|
+ EndName: common.InterfaceToStr(nameMaps["name"]),
|
|
|
|
+ Address: common.InterfaceToStr(nameMaps["address"]),
|
|
|
|
+ IdentityType: common.InterfaceToStr(nameMaps["identity_type"]),
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ data := make(map[string]interface{})
|
|
|
|
+ if equity != 3 {
|
|
|
|
+ person.EndName = codeContent
|
|
|
|
+ dataArr := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT contact_name, contact_tel, 1 AS source_type, createtime AS lasttime FROM Jianyu_subjectdb.dwd_f_nzj_contact WHERE proposed_id = '%s' and name_id = '%s' and contact_tel != "" ORDER BY lasttime DESC LIMIT 1`, pid, nameId))
|
|
|
|
+ if dataArr != nil && len(*dataArr) > 0 {
|
|
|
|
+ data = (*dataArr)[0]
|
|
}
|
|
}
|
|
- if equity > 3 {
|
|
|
|
- //企业联系人
|
|
|
|
- entContact := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT * FROM dws_f_ent_contact WHERE name_id ='%s'`, nameId))
|
|
|
|
- if entContact != nil && len(*entContact) > 0 {
|
|
|
|
- for _, v := range *entContact {
|
|
|
|
- v["lasttime"] = v["createtime"]
|
|
|
|
- if common.InterfaceToStr(v["createtime"]) < common.InterfaceToStr(v["updatetime"]) {
|
|
|
|
- v["lasttime"] = v["updatetime"]
|
|
|
|
- }
|
|
|
|
- var key RemovalKey
|
|
|
|
- key.person = common.InterfaceToStr(v["contact_name"])
|
|
|
|
- key.phone = common.InterfaceToStr(v["contact_tel"])
|
|
|
|
- connection[key] = v
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- for _, m := range connection {
|
|
|
|
- data = append(data, m)
|
|
|
|
- }
|
|
|
|
- //私有联系人用户
|
|
|
|
- userContact := public.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT * FROM Jianyu_subjectdb.dwd_f_user_contact_record WHERE name_id = '%s' `, nameId))
|
|
|
|
- if userContact != nil && len(*userContact) > 0 {
|
|
|
|
- for _, m := range *userContact {
|
|
|
|
- data = append(data, m)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- person.endName = codeContent
|
|
|
|
- for _, m := range connection {
|
|
|
|
- data = append(data, m)
|
|
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
+ dataArr := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT * FROM (( SELECT contact_name, contact_tel, 1 AS source_type, createtime AS lasttime FROM Jianyu_subjectdb.dwd_f_nzj_contact WHERE proposed_id = '%s' and name_id = '%s' and contact_tel != "" ORDER BY lasttime DESC LIMIT 1) UNION ALL
|
|
|
|
+ ( SELECT contact_name, contact_tel, source_type, CASE WHEN updatetime IS NOT NULL THEN updatetime ELSE createtime END AS lasttime FROM dws_f_ent_contact WHERE name_id = '%s' and contact_tel != "" ORDER BY source_type ASC,lasttime DESC LIMIT 1) UNION ALL
|
|
|
|
+( SELECT person AS contact_name, phone AS contact_tel, 0 AS source_type, lasttime FROM Jianyu_subjectdb.dwd_f_user_contact_record WHERE name_id = '%s' and person != "" and phone != "" ORDER BY lasttime DESC LIMIT 1)) a
|
|
|
|
+ORDER BY
|
|
|
|
+ a.source_type ASC,
|
|
|
|
+ a.lasttime DESC
|
|
|
|
+ LIMIT 1`, pid, nameId, nameId, nameId))
|
|
|
|
+ if dataArr != nil && len(*dataArr) > 0 {
|
|
|
|
+ data = (*dataArr)[0]
|
|
}
|
|
}
|
|
- // 自定义排序函数
|
|
|
|
- sort.Slice(data, func(i, j int) bool {
|
|
|
|
- sourceTypeA := data[i]["source_type"].(string)
|
|
|
|
- sourceTypeB := data[j]["source_type"].(string)
|
|
|
|
- if sourceTypeA == sourceTypeB {
|
|
|
|
- lastTimeA := data[i]["lasttime"].(int)
|
|
|
|
- lastTimeB := data[j]["lasttime"].(int)
|
|
|
|
- return lastTimeA > lastTimeB // 降序排序
|
|
|
|
- }
|
|
|
|
- return sourceTypeA < sourceTypeB // 升序排序
|
|
|
|
- })
|
|
|
|
- person.data = data
|
|
|
|
- lock.Lock()
|
|
|
|
- contact = append(contact, person)
|
|
|
|
- lock.Unlock()
|
|
|
|
- }(nameMap)
|
|
|
|
- }
|
|
|
|
- wait.Wait()
|
|
|
|
- detail["contact"] = contact
|
|
|
|
|
|
+ }
|
|
|
|
+ person.Data = data
|
|
|
|
+ lock.Lock()
|
|
|
|
+ contact[ks] = person
|
|
|
|
+ lock.Unlock()
|
|
|
|
+ }(nameMap, k)
|
|
}
|
|
}
|
|
|
|
+ wait.Wait()
|
|
|
|
+ return contact
|
|
}
|
|
}
|
|
- return detail
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-func timeFmt(tm string) string {
|
|
|
|
- tms := strings.Split(tm, " ")
|
|
|
|
- if len(tms) == 2 {
|
|
|
|
- return tms[0]
|
|
|
|
- }
|
|
|
|
- return "-"
|
|
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
|
|
|
|
func getNzjList(infoMap map[string]interface{}) (count int64, list *[]map[string]interface{}) {
|
|
func getNzjList(infoMap map[string]interface{}) (count int64, list *[]map[string]interface{}) {
|
|
pageNum := common.If(common.IntAll(infoMap["pageNum"]) <= 0, 1, common.IntAll(infoMap["pageNum"])).(int)
|
|
pageNum := common.If(common.IntAll(infoMap["pageNum"]) <= 0, 1, common.IntAll(infoMap["pageNum"])).(int)
|
|
- pageSize := common.IntAll(infoMap["pageSize"])
|
|
|
|
|
|
+ pageSize := common.If(common.IntAll(infoMap["pageSize"]) <= 0, 50, common.IntAll(infoMap["pageSize"])).(int)
|
|
if pageNum*pageSize > common.IntAll(config.Sysconfig["nzjLimit"]) { //工作台外 默认只能搜索搜索100
|
|
if pageNum*pageSize > common.IntAll(config.Sysconfig["nzjLimit"]) { //工作台外 默认只能搜索搜索100
|
|
pageNum = 1
|
|
pageNum = 1
|
|
pageSize = 50
|
|
pageSize = 50
|
|
@@ -274,109 +384,185 @@ func getNzjList(infoMap map[string]interface{}) (count int64, list *[]map[string
|
|
return nzjEmptySearch(pageNum, pageSize)
|
|
return nzjEmptySearch(pageNum, pageSize)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ categoryCodeArr := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT category_code FROM Jianyu_subjectdb.dwd_f_nzj_category_rule WHERE stage_info = '%s'`, common.InterfaceToStr(infoMap["keyWord"])))
|
|
|
|
+ if categoryCodeArr != nil && len(*categoryCodeArr) > 0 {
|
|
|
|
+ var codes []string
|
|
|
|
+ for _, code := range *categoryCodeArr {
|
|
|
|
+ codes = append(codes, fmt.Sprintf(`"%s"`, common.InterfaceToStr(code["category_code"])))
|
|
|
|
+ }
|
|
|
|
+ infoMap["keyCode"] = codes
|
|
|
|
+ }
|
|
musts := esQuery(infoMap)
|
|
musts := esQuery(infoMap)
|
|
if pageNum == 1 {
|
|
if pageNum == 1 {
|
|
- count = elastic.Count(proposed, proposed, fmt.Sprintf(`{"query": {"bool": {"must": [%s]}}`, strings.Join(musts, ",")))
|
|
|
|
|
|
+ count = elastic.Count(proposed, proposed, fmt.Sprintf(`{"query": {"bool": {"must": [%s]}}}`, strings.Join(musts, ",")))
|
|
|
|
+ if count == 0 {
|
|
|
|
+ return count, nil
|
|
|
|
+ }
|
|
if count > common.Int64All(config.Sysconfig["nzjLimit"]) {
|
|
if count > common.Int64All(config.Sysconfig["nzjLimit"]) {
|
|
count = common.Int64All(config.Sysconfig["nzjLimit"])
|
|
count = common.Int64All(config.Sysconfig["nzjLimit"])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- list = elastic.Get(proposed, proposed, fmt.Sprintf(`{"query": {"bool": {"must": [%s]}},"_source":["projectname","area_city","lasttime","project_stage","ownerclass","proposed_id","category","project_stage"],"sort":[{"lasttime":{"order":"desc"}}],"from":%d,"size":%d`, strings.Join(musts, ","), (pageNum-1)*pageSize, pageSize))
|
|
|
|
|
|
+
|
|
|
|
+ list = elastic.Get(proposed, proposed, fmt.Sprintf(`{"query": {"bool": {"must": [%s]}},"_source":["projectname","area","area_city","lasttime","project_stage","ownerclass","proposed_id","category","project_stage"],"sort":[{"lasttime":{"order":"desc"}}],"from":%d,"size":%d}`, strings.Join(musts, ","), (pageNum-1)*pageSize, pageSize))
|
|
|
|
+ if list != nil && len(*list) > 0 {
|
|
|
|
+ for _, v := range *list {
|
|
|
|
+ v["proposed_id"] = encrypt.SE2.Encode2Hex(common.InterfaceToStr(v["proposed_id"]))
|
|
|
|
+ //v["lasttime"] = MillisecondsToStr(common.Int64All(v["lasttime"]))
|
|
|
|
+ if v["area_city"] == nil || v["area_city"] == "" {
|
|
|
|
+ v["area_city"] = v["area"]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func MillisecondsToStr(ms int64) int64 {
|
|
|
|
+ timestampStr := strconv.FormatInt(ms, 10)
|
|
|
|
+ if len(timestampStr) == 13 {
|
|
|
|
+ return ms / 1000
|
|
|
|
+ } else if len(timestampStr) == 10 {
|
|
|
|
+ return ms
|
|
|
|
+ }
|
|
|
|
+ return 0
|
|
|
|
+}
|
|
|
|
+
|
|
func esQuery(infoMap map[string]interface{}) []string {
|
|
func esQuery(infoMap map[string]interface{}) []string {
|
|
var (
|
|
var (
|
|
- terms []string
|
|
|
|
|
|
+ musts []string
|
|
)
|
|
)
|
|
-
|
|
|
|
- if infoMap["area"] != nil || infoMap["area"] != "" {
|
|
|
|
|
|
+ name := common.If(common.IntAll(infoMap["searchSort"]) == 0, "projectname", "owner").(string)
|
|
|
|
+ if infoMap["area"] != nil && infoMap["area"] != "" {
|
|
area := common.InterfaceToStr(infoMap["area"])
|
|
area := common.InterfaceToStr(infoMap["area"])
|
|
var areas []string
|
|
var areas []string
|
|
for _, v := range strings.Split(area, ",") {
|
|
for _, v := range strings.Split(area, ",") {
|
|
areas = append(areas, fmt.Sprintf(`"%s"`, v))
|
|
areas = append(areas, fmt.Sprintf(`"%s"`, v))
|
|
}
|
|
}
|
|
- terms = append(terms, fmt.Sprintf(`{
|
|
|
|
|
|
+ musts = append(musts, fmt.Sprintf(`{
|
|
"terms": {
|
|
"terms": {
|
|
"area": [%s]
|
|
"area": [%s]
|
|
}
|
|
}
|
|
}`, strings.Join(areas, ",")))
|
|
}`, strings.Join(areas, ",")))
|
|
|
|
|
|
}
|
|
}
|
|
- if infoMap["category"] != nil || infoMap["category"] != "" {
|
|
|
|
|
|
+ if infoMap["category"] != nil && infoMap["category"] != "" {
|
|
category := common.InterfaceToStr(infoMap["category"])
|
|
category := common.InterfaceToStr(infoMap["category"])
|
|
var categorys []string
|
|
var categorys []string
|
|
for _, v := range strings.Split(category, ",") {
|
|
for _, v := range strings.Split(category, ",") {
|
|
categorys = append(categorys, fmt.Sprintf(`"%s"`, v))
|
|
categorys = append(categorys, fmt.Sprintf(`"%s"`, v))
|
|
}
|
|
}
|
|
- terms = append(terms, fmt.Sprintf(`{
|
|
|
|
|
|
+ musts = append(musts, fmt.Sprintf(`{
|
|
"terms": {
|
|
"terms": {
|
|
"category": [%s]
|
|
"category": [%s]
|
|
}
|
|
}
|
|
}`, strings.Join(categorys, ",")))
|
|
}`, strings.Join(categorys, ",")))
|
|
}
|
|
}
|
|
- if infoMap["project_stage"] != nil || infoMap["project_stage"] != "" {
|
|
|
|
|
|
+ if infoMap["project_stage"] != nil && infoMap["project_stage"] != "" {
|
|
projectStage := common.InterfaceToStr(infoMap["project_stage"])
|
|
projectStage := common.InterfaceToStr(infoMap["project_stage"])
|
|
var projectStages []string
|
|
var projectStages []string
|
|
for _, v := range strings.Split(projectStage, ",") {
|
|
for _, v := range strings.Split(projectStage, ",") {
|
|
projectStages = append(projectStages, fmt.Sprintf(`"%s"`, v))
|
|
projectStages = append(projectStages, fmt.Sprintf(`"%s"`, v))
|
|
}
|
|
}
|
|
- terms = append(terms, fmt.Sprintf(`{
|
|
|
|
|
|
+ musts = append(musts, fmt.Sprintf(`{
|
|
"terms": {
|
|
"terms": {
|
|
"project_stage": [%s]
|
|
"project_stage": [%s]
|
|
}
|
|
}
|
|
}`, strings.Join(projectStages, ",")))
|
|
}`, strings.Join(projectStages, ",")))
|
|
|
|
|
|
}
|
|
}
|
|
- if infoMap["ownerclass"] != nil || infoMap["ownerclass"] != "" {
|
|
|
|
|
|
+ if infoMap["ownerclass"] != nil && infoMap["ownerclass"] != "" {
|
|
ownerclass := common.InterfaceToStr(infoMap["ownerclass"])
|
|
ownerclass := common.InterfaceToStr(infoMap["ownerclass"])
|
|
var ownerclasss []string
|
|
var ownerclasss []string
|
|
for _, v := range strings.Split(ownerclass, ",") {
|
|
for _, v := range strings.Split(ownerclass, ",") {
|
|
ownerclasss = append(ownerclasss, fmt.Sprintf(`"%s"`, v))
|
|
ownerclasss = append(ownerclasss, fmt.Sprintf(`"%s"`, v))
|
|
}
|
|
}
|
|
- terms = append(terms, fmt.Sprintf(`{
|
|
|
|
|
|
+ musts = append(musts, fmt.Sprintf(`{
|
|
"terms": {
|
|
"terms": {
|
|
"ownerclass": [%s]
|
|
"ownerclass": [%s]
|
|
}
|
|
}
|
|
}`, strings.Join(ownerclasss, ",")))
|
|
}`, strings.Join(ownerclasss, ",")))
|
|
}
|
|
}
|
|
-
|
|
|
|
- if infoMap["keyWord"] != nil || infoMap["keyWord"] != "" {
|
|
|
|
|
|
+ var (
|
|
|
|
+ keyWordsMusts []string
|
|
|
|
+ wordsShould []string
|
|
|
|
+ )
|
|
|
|
+ if infoMap["keyWord"] != "" && infoMap["keyWord"] != nil {
|
|
keyWord := common.InterfaceToStr(infoMap["keyWord"])
|
|
keyWord := common.InterfaceToStr(infoMap["keyWord"])
|
|
- keyWords := strings.Split(keyWord, " ")
|
|
|
|
- var words []string
|
|
|
|
- for _, vv := range keyWords {
|
|
|
|
- words = append(words, vv)
|
|
|
|
|
|
+ for _, v := range strings.Split(keyWord, " ") {
|
|
|
|
+ keyWordsMusts = append(keyWordsMusts, fmt.Sprintf(`{"multi_match": {"query": "%s","type": "phrase","fields": ["%s"]}}`, v, name))
|
|
}
|
|
}
|
|
- terms = append(terms, fmt.Sprintf(`{
|
|
|
|
- "multi_match": {
|
|
|
|
- "query": "%s",
|
|
|
|
- "fields": ["projectname"]
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if len(keyWordsMusts) > 0 {
|
|
|
|
+ keyCode, _ := infoMap["keyCode"].([]string)
|
|
|
|
+ if keyCode != nil && len(keyCode) > 0 { //查询关键词匹配到的code
|
|
|
|
+ wordsShould = append(wordsShould, fmt.Sprintf(elastic.NgramMust, strings.Join(keyWordsMusts, ",")))
|
|
|
|
+ wordsShould = append(wordsShould, fmt.Sprintf(`{
|
|
|
|
+ "terms": {
|
|
|
|
+ "category_code": [%s]
|
|
}
|
|
}
|
|
- },`, strings.Join(words, ",")))
|
|
|
|
|
|
+ }`, strings.Join(keyCode, ",")))
|
|
|
|
+ musts = append(musts, fmt.Sprintf(queryBoolShould, strings.Join(wordsShould, ",")))
|
|
|
|
+ } else {
|
|
|
|
+ musts = append(musts, fmt.Sprintf(elastic.NgramMust, strings.Join(keyWordsMusts, ",")))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- return terms
|
|
|
|
|
|
+
|
|
|
|
+ return musts
|
|
}
|
|
}
|
|
|
|
|
|
func nzjEmptySearch(pageNum, pageSize int) (int64, *[]map[string]interface{}) {
|
|
func nzjEmptySearch(pageNum, pageSize int) (int64, *[]map[string]interface{}) {
|
|
- var ds []map[string]interface{}
|
|
|
|
|
|
+ var (
|
|
|
|
+ ds []map[string]interface{}
|
|
|
|
+ count int64
|
|
|
|
+ )
|
|
data, _ := redis.Get("newother", nzjRedisKey).([]interface{})
|
|
data, _ := redis.Get("newother", nzjRedisKey).([]interface{})
|
|
if len(data) > 0 {
|
|
if len(data) > 0 {
|
|
|
|
+ count = int64(len(data))
|
|
ds = common.ObjArrToMapArr(data)[(pageNum-1)*pageSize : pageNum*pageSize]
|
|
ds = common.ObjArrToMapArr(data)[(pageNum-1)*pageSize : pageNum*pageSize]
|
|
} else {
|
|
} else {
|
|
- dataArr := public.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT * FROM Jianyu_subjectdb.dwd_f_nzj_baseinfo ORDER BY lasttime DESC LIMIT %v`, config.Sysconfig["nzjLimit"]))
|
|
|
|
|
|
+ dataArr := public.GlobalCommonMysql.SelectBySql(fmt.Sprintf(`SELECT
|
|
|
|
+ a.proposed_id,
|
|
|
|
+ a.projectname,
|
|
|
|
+ a.lasttime,
|
|
|
|
+ b.NAME AS project_stage,
|
|
|
|
+ COALESCE(c.NAME, f.NAME) AS area_city,
|
|
|
|
+ d.NAME AS category,
|
|
|
|
+ e.NAME AS ownerclass,
|
|
|
|
+ a.total_investment
|
|
|
|
+FROM
|
|
|
|
+ Jianyu_subjectdb.dwd_f_nzj_baseinfo a
|
|
|
|
+ LEFT JOIN Jianyu_subjectdb.d_nzj_project_stage_code b ON a.project_stage_code = b.CODE
|
|
|
|
+ LEFT JOIN Jianyu_subjectdb.d_nzj_category_code d ON a.category_code = d.CODE
|
|
|
|
+ LEFT JOIN Jianyu_subjectdb.d_area_code c ON a.city_code = c.CODE
|
|
|
|
+ LEFT JOIN Jianyu_subjectdb.d_area_code f ON a.area_code = f.CODE
|
|
|
|
+ LEFT JOIN Jianyu_subjectdb.d_nzj_ownerclass_code e ON a.ownerclass_code = e.CODE
|
|
|
|
+ ORDER BY a.lasttime DESC
|
|
|
|
+ LIMIT %d`, common.IntAll(config.Sysconfig["nzjLimit"])))
|
|
if dataArr != nil && len(*dataArr) > 0 {
|
|
if dataArr != nil && len(*dataArr) > 0 {
|
|
- redis.Put("newother", nzjRedisKey, *dataArr, 3600*24)
|
|
|
|
|
|
+ count = int64(len(data))
|
|
|
|
+ for _, m := range *dataArr {
|
|
|
|
+ m["proposed_id"] = encrypt.SE2.Encode2Hex(common.InterfaceToStr(m["proposed_id"]))
|
|
|
|
+ lasttime := common.InterfaceToStr(m["lasttime"])
|
|
|
|
+ if lasttime != "" { //日期转时间戳
|
|
|
|
+ layout := "2006-01-02 15:04:05" // 输入字符串的时间格式
|
|
|
|
+ t, err := time.Parse(layout, lasttime)
|
|
|
|
+ if err != nil {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ m["lasttime"] = t.UnixMilli()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ redis.Put("newother", nzjRedisKey, *dataArr, 3600*12)
|
|
ds = (*dataArr)[(pageNum-1)*pageSize : pageNum*pageSize]
|
|
ds = (*dataArr)[(pageNum-1)*pageSize : pageNum*pageSize]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return common.Int64All(len(ds)), &ds
|
|
|
|
|
|
+ return count, &ds
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func isEmpty(infoMap map[string]interface{}) bool {
|
|
func isEmpty(infoMap map[string]interface{}) bool {
|
|
for k, v := range infoMap {
|
|
for k, v := range infoMap {
|
|
- if k == "pageNum" || k == "pageSize" {
|
|
|
|
|
|
+ if k == "pageNum" || k == "pageSize" || k == "searchSort" {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
if v != nil && v != "" {
|
|
if v != nil && v != "" {
|
|
@@ -634,6 +820,27 @@ func GetEsWinner(number int) (data []map[string]interface{}) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func IndexNzjProject(number int) (data []map[string]interface{}) {
|
|
|
|
+ redisKey := "pcIndexNzjProject"
|
|
|
|
+ if dataBy := redis.Get(RedisNameNew, redisKey); dataBy != nil {
|
|
|
|
+ dataArr, _ := dataBy.([]interface{})
|
|
|
|
+ data = common.ObjArrToMapArr(dataArr)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ sql := fmt.Sprintf(`SELECT a.proposed_id,a.projectname,a.lasttime FROM Jianyu_subjectdb.dwd_f_nzj_baseinfo a ORDER BY a.lasttime DESC LIMIT %d`, number)
|
|
|
|
+ res := public.GlobalCommonMysql.SelectBySql(sql)
|
|
|
|
+ if res != nil && len(*res) > 0 {
|
|
|
|
+ for _, v := range *res {
|
|
|
|
+ data = append(data, map[string]interface{}{
|
|
|
|
+ "title": common.ObjToString(v["projectname"]),
|
|
|
|
+ "publish_time": strings.Split(common.ObjToString(v["lasttime"]), " ")[0],
|
|
|
|
+ "proposed_id": encrypt.SE2.Encode2Hex(common.InterfaceToStr(v["proposed_id"])),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return data
|
|
|
|
+}
|
|
|
|
+
|
|
func getEsEntBid(names, sta, end string) map[string]interface{} {
|
|
func getEsEntBid(names, sta, end string) map[string]interface{} {
|
|
sTime, err := time.Parse("2006-01-02 15:04:05", sta)
|
|
sTime, err := time.Parse("2006-01-02 15:04:05", sta)
|
|
if err != nil {
|
|
if err != nil {
|