From cf10eb777eb0d1d7317fbf24e454165b53ceaf64 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 2 Nov 2018 22:59:42 +0800 Subject: [PATCH] - fix GetStores search by mobile --- business/jxstore/cms/store.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index c0e12c133..ea2f35cfb 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -131,11 +131,12 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil { if jxutils.IsLegalMobileNumber(keywordInt64) { sql += ` - LEFT JOIN weixins wx1 ON t1.id = wx1.jxstoreid AND wx1.tel = ? - LEFT JOIN weixins wx2 ON wx2.parentid = wx1.id AND wx2.tel = ? + LEFT JOIN weixins wx1 ON t1.id = wx1.jxstoreid AND wx1.parentid = -1 AND wx1.tel = ? + LEFT JOIN weixins wx2 ON t1.id = wx2.jxstoreid AND wx2.parentid = -1 + LEFT JOIN weixins wx3 ON wx3.parentid = wx2.id AND wx3.tel = ? ` sqlParams = append(sqlParams, keywordInt64, keywordInt64) - sqlWhere += " OR wx1.id IS NOT NULL OR wx2.id IS NOT NULL" + sqlWhere += " OR wx1.id IS NOT NULL OR wx3.id IS NOT NULL" } sqlWhere += " OR t1.id = ? OR t1.city_code = ? OR t1.district_code = ?" sqlWhereParams = append(sqlWhereParams, keywordInt64, keywordInt64, keywordInt64)