|
@@ -62,8 +62,8 @@ type ProjectEntity struct {
|
|
|
Connections []map[string]interface{}
|
|
|
}
|
|
|
type Recommend struct {
|
|
|
- buyerId string `ch:"buyer_id"`
|
|
|
- buyer string `ch:"buyer"`
|
|
|
+ BuyerId string `ch:"buyer_id"`
|
|
|
+ Buyer string `ch:"buyer"`
|
|
|
}
|
|
|
type Project struct {
|
|
|
BuyerId string `ch:"buyer_id"`
|
|
@@ -674,12 +674,14 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
|
for _, v := range strings.Split(heterotophy, ",") {
|
|
|
findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
|
|
|
}
|
|
|
- sqlStr := fmt.Sprintf(`SELECT buyer, buyer_id FROM transaction_info where hasAny(winner_id,[%s]) `, strings.Join(findInSetArr, ","))
|
|
|
+ sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where hasAny(winner_id,[%s]) `, strings.Join(findInSetArr, ","))
|
|
|
FindHandle(sqlStr, dataMap)
|
|
|
}
|
|
|
//中间人
|
|
|
if intermediary != "" {
|
|
|
- intermediaryArr := CrmMysql.SelectBySql(`select b.relate_id as relate_id,b.relate_name as relate_name from crm.connection a inner join crm.connection_introduce b on (a.position_id=? and find_in_set(a.company_id,?) and a.id=b.connection_id and b.itype=1)`, positionId, intermediary)
|
|
|
+ wh, args := common.WhArgs(strings.Split(intermediary, ","))
|
|
|
+ args = append(args, positionId)
|
|
|
+ intermediaryArr := CrmMysql.SelectBySql(`select b.relate_id as relate_id,b.relate_name as relate_name from crm.connection a inner join crm.connection_introduce b on ( a.id in (`+wh+`) and a.position_id=? and a.id=b.connection_id and b.itype=1)`, args...)
|
|
|
if intermediaryArr != nil && len(*intermediaryArr) > 0 {
|
|
|
for _, m := range *intermediaryArr {
|
|
|
buyerId := gconv.String(m["relate_id"])
|
|
@@ -696,7 +698,7 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
|
for _, s := range strings.Split(agency, ",") {
|
|
|
agencyArr = append(agencyArr, fmt.Sprintf("'%s'", s))
|
|
|
}
|
|
|
- sqlStr := fmt.Sprintf(`SELECT buyer, buyer_id FROM transaction_info where agency_id in (%s) `, strings.Join(agencyArr, ","))
|
|
|
+ sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where agency_id in (%s) `, strings.Join(agencyArr, ","))
|
|
|
FindHandle(sqlStr, dataMap)
|
|
|
}
|
|
|
return dataMap
|
|
@@ -791,10 +793,11 @@ func FindHandle(sqlStr string, dataMap *map[string]map[string]interface{}) {
|
|
|
}
|
|
|
for rows.Next() {
|
|
|
data := Recommend{}
|
|
|
- rows.ScanStruct(&data)
|
|
|
- if data.buyerId != "" {
|
|
|
- (*dataMap)[data.buyerId] = map[string]interface{}{
|
|
|
- "buyerName": data.buyer,
|
|
|
+ aa := rows.ScanStruct(&data)
|
|
|
+ logx.Info(aa)
|
|
|
+ if data.BuyerId != "" {
|
|
|
+ (*dataMap)[data.BuyerId] = map[string]interface{}{
|
|
|
+ "buyerName": data.Buyer,
|
|
|
}
|
|
|
}
|
|
|
}
|