|
@@ -35,17 +35,18 @@ func (l *InfoRelatedLogic) InfoRelated(in *consumerinfo.UserIdReq) (*consumerinf
|
|
|
resp consumerinfo.InfoRelatedResp
|
|
|
)
|
|
|
log.Println("关联公告接口调用", in)
|
|
|
- queryName = ` and type=` + mc.InterfaceToStr(in.MsgType)
|
|
|
+
|
|
|
if in.AppId != "" {
|
|
|
- queryName = queryName + ` and app_id = ` + util.StrFormat(in.AppId)
|
|
|
+ queryName += ` and app_id = ` + util.StrFormat(in.AppId)
|
|
|
}
|
|
|
if in.EntId != 0 {
|
|
|
- queryName = queryName + ` and ent_id = ` + mc.InterfaceToStr(in.EntId)
|
|
|
+ queryName += ` and ent_id = ` + mc.InterfaceToStr(in.EntId)
|
|
|
}
|
|
|
switch in.MsgId {
|
|
|
case 0:
|
|
|
+ queryName += ` and type=` + mc.InterfaceToStr(in.MsgType)
|
|
|
if in.Match != "" {
|
|
|
- queryName = queryName + ` and title LIKE '%` + in.Match + `%' `
|
|
|
+ queryName += ` and title LIKE '%` + in.Match + `%' `
|
|
|
}
|
|
|
allData := model.Mysql.SelectBySql(`SELECT * from information WHERE user_id="` + in.UserId + `" and published=2 and is_del=1` + queryName + ` order by create_time desc limit 50`)
|
|
|
if allData == nil || len(*allData) == 0 {
|
|
@@ -62,13 +63,11 @@ func (l *InfoRelatedLogic) InfoRelated(in *consumerinfo.UserIdReq) (*consumerinf
|
|
|
resp.Data = append(resp.Data, &data)
|
|
|
}
|
|
|
case 1:
|
|
|
- var allData *[]map[string]interface{}
|
|
|
- switch in.MsgType {
|
|
|
- case 3:
|
|
|
- allData = model.Mysql.SelectBySql(`SELECT * from supply_info WHERE user_id="` + in.UserId + `"` + queryName + ` order by create_time desc limit 1`)
|
|
|
- default:
|
|
|
- allData = model.Mysql.SelectBySql(`SELECT * from information WHERE user_id="` + in.UserId + `"` + queryName + ` order by create_time desc limit 1`)
|
|
|
- }
|
|
|
+ allData := model.Mysql.SelectBySql(`SELECT a.id,a.title,a.create_time,a.contact_person,a.contact_phone,a.contact_overt from (SELECT id,title,create_time,contact_person,contact_phone,contact_overt from information WHERE user_id= "` + in.UserId + `"
|
|
|
+ union all
|
|
|
+ SELECT id,title,create_time,contact_person,contact_phone,contact_overt from supply_info WHERE is_del = 1 and user_id= "` + in.UserId + `" ) a order by a.create_time desc limit 1`)
|
|
|
+ oneData := model.Mysql.SelectBySql(`SELECT * from information WHERE user_id="` + in.UserId + `" order by create_time desc limit 1`)
|
|
|
+
|
|
|
if allData == nil || len(*allData) == 0 {
|
|
|
return &resp, nil
|
|
|
}
|
|
@@ -79,7 +78,9 @@ func (l *InfoRelatedLogic) InfoRelated(in *consumerinfo.UserIdReq) (*consumerinf
|
|
|
data.Person = mc.InterfaceToStr(v["contact_person"])
|
|
|
data.Phone = mc.InterfaceToStr(v["contact_phone"])
|
|
|
data.Overt = mc.Int64All(v["contact_overt"])
|
|
|
- data.RecommendedService = mc.Int64All(v["recommended_service"])
|
|
|
+ if oneData != nil && len(*oneData) > 0 {
|
|
|
+ data.RecommendedService = mc.Int64All((*oneData)[0]["recommended_service"])
|
|
|
+ }
|
|
|
resp.Data = append(resp.Data, &data)
|
|
|
}
|
|
|
}
|