|
@@ -15,6 +15,7 @@ var (
|
|
|
INDEX_1 = "transaction_info"
|
|
|
sql_2_0 = `SELECT buyer, buyer_id, agency, agency_id, property_form FROM information.transaction_info WHERE project_id = ?`
|
|
|
sql_2_1 = `SELECT project_id, project_name, zbtime FROM information.transaction_info WHERE buyer_id = ? AND winner winner IN ? ORDER BY zbtime DESC`
|
|
|
+ sql_2_2 = `SELECT b.company_id, b.company_name, b.contact_name, a.relate_id, a.relate_name FROM connection_introduce a INNER JOIN connection b ON b.position_id =%d AND a.connection_id = b.id AND b.state = 1 AND a.itype = 1 AND b.itype = 4 AND a.relate_Id = %s`
|
|
|
es_query = `{
|
|
|
"query": {
|
|
|
"bool": {
|
|
@@ -99,7 +100,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData) {
|
|
|
// 1、同甲异业数据/招标代理机构渠道
|
|
|
if propertyForm != "" {
|
|
|
r1, r2 := getData(propertyForm, common.ObjToString(pMap["buyer_id"]))
|
|
|
- if len(r1) > 0 {
|
|
|
+ if r1 != nil && len(r1) > 0 {
|
|
|
tmp := &ResultData{
|
|
|
channelType: 1,
|
|
|
channel: "同甲异业渠道",
|
|
@@ -108,16 +109,28 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData) {
|
|
|
}
|
|
|
result = append(result, tmp)
|
|
|
}
|
|
|
- if len(r2) > 0 {
|
|
|
+ if r2 != nil && len(r2) > 0 {
|
|
|
tmp := &ResultData{
|
|
|
channelType: 1,
|
|
|
channel: "招标代理机构",
|
|
|
- size: len(r1),
|
|
|
+ size: len(r2),
|
|
|
data: r2,
|
|
|
}
|
|
|
result = append(result, tmp)
|
|
|
}
|
|
|
}
|
|
|
+ // 中间人可介绍业主
|
|
|
+ r3 := getData1(req)
|
|
|
+ if r3 != nil && len(r3) > 0 {
|
|
|
+ tmp := &ResultData{
|
|
|
+ channelType: 1,
|
|
|
+ channel: "中间人",
|
|
|
+ size: len(r3),
|
|
|
+ data: r3,
|
|
|
+ }
|
|
|
+ result = append(result, tmp)
|
|
|
+ }
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -217,3 +230,13 @@ func getData(propertyForm, bid string) (result1, result2 []map[string]interface{
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func getData1(req *types.CoopHistoryReq) (result []map[string]interface{}) {
|
|
|
+ info := T.CrmMysql.SelectBySql(sql_2_2, req.PositionId, req.Pid)
|
|
|
+ if info != nil && len(*info) > 0 {
|
|
|
+ for _, m := range *info {
|
|
|
+ result = append(result, map[string]interface{}{"name": m["company_name"], "pserson": m["contact_name"]})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|