+ TmpGetMyStoreList

This commit is contained in:
gazebo
2019-07-29 13:44:22 +08:00
parent 40d96f3342
commit ee613bfa75
5 changed files with 80 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
)
@@ -116,3 +117,30 @@ func GetUserStoreInfo(db *DaoDB, fieldName, fieldValue string) (storeUserInfo *S
}
return storeUserInfo, err
}
func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*model.Store, err error) {
if mobile != "" {
sql := `
SELECT DISTINCT *
FROM (
SELECT *
FROM store t1
WHERE (t1.market_man_phone = ? OR t1.operator_phone = ?)
UNION DISTINCT
SELECT t1.*
FROM store t1
JOIN weixins t2 ON t2.jxstoreid = t1.id AND t2.parentid = -1
LEFT JOIN weixins t3 ON t3.parentid = t2.id
WHERE (t2.tel = ? OR t3.tel = ?)
) t1
ORDER BY t1.name`
sqlParams := []interface{}{
mobile,
mobile,
mobile,
mobile,
}
err = GetRows(db, &storeList, sql, sqlParams...)
}
return storeList, err
}