- GetMyStoreList 返回城市名

This commit is contained in:
gazebo
2019-07-31 15:17:13 +08:00
parent e853b45176
commit 75e5e99273
2 changed files with 10 additions and 3 deletions

View File

@@ -15,6 +15,11 @@ type StoreUserInfo struct {
MembersStr string `json:"-"`
}
type StoreWithCityName struct {
model.Store
CityName string `json:"cityName"`
}
func CreateWeiXins(db *DaoDB, user *legacymodel.WeiXins) (err error) {
Begin(db)
if err = CreateEntity(db, user); err != nil {
@@ -118,10 +123,11 @@ func GetUserStoreInfo(db *DaoDB, fieldName, fieldValue string) (storeUserInfo *S
return storeUserInfo, err
}
func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*model.Store, err error) {
func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*StoreWithCityName, err error) {
if mobile != "" {
sql := `
SELECT DISTINCT *
SELECT
DISTINCT t1.*, t2.name city_name
FROM (
SELECT *
FROM store t1
@@ -133,6 +139,7 @@ func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*model.Store, e
LEFT JOIN weixins t3 ON t3.parentid = t2.id
WHERE (t2.tel = ? OR t3.tel = ?)
) t1
LEFT JOIN place t2 ON t2.code = t1.city_code
WHERE t1.deleted_at = ?
ORDER BY t1.name`
sqlParams := []interface{}{