- GetMyStoreList 返回城市名
This commit is contained in:
@@ -84,7 +84,7 @@ func getMobileFromCtx(ctx *jxcontext.Context) (mobile string) {
|
|||||||
return mobile
|
return mobile
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMyStoreList(ctx *jxcontext.Context) (storeList []*model.Store, err error) {
|
func GetMyStoreList(ctx *jxcontext.Context) (storeList []*dao.StoreWithCityName, err error) {
|
||||||
mobileNum := getMobileFromCtx(ctx)
|
mobileNum := getMobileFromCtx(ctx)
|
||||||
if mobileNum == "" {
|
if mobileNum == "" {
|
||||||
return nil, fmt.Errorf("不能得到用户手机号")
|
return nil, fmt.Errorf("不能得到用户手机号")
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ type StoreUserInfo struct {
|
|||||||
MembersStr string `json:"-"`
|
MembersStr string `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StoreWithCityName struct {
|
||||||
|
model.Store
|
||||||
|
CityName string `json:"cityName"`
|
||||||
|
}
|
||||||
|
|
||||||
func CreateWeiXins(db *DaoDB, user *legacymodel.WeiXins) (err error) {
|
func CreateWeiXins(db *DaoDB, user *legacymodel.WeiXins) (err error) {
|
||||||
Begin(db)
|
Begin(db)
|
||||||
if err = CreateEntity(db, user); err != nil {
|
if err = CreateEntity(db, user); err != nil {
|
||||||
@@ -118,10 +123,11 @@ func GetUserStoreInfo(db *DaoDB, fieldName, fieldValue string) (storeUserInfo *S
|
|||||||
return storeUserInfo, err
|
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 != "" {
|
if mobile != "" {
|
||||||
sql := `
|
sql := `
|
||||||
SELECT DISTINCT *
|
SELECT
|
||||||
|
DISTINCT t1.*, t2.name city_name
|
||||||
FROM (
|
FROM (
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM store t1
|
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
|
LEFT JOIN weixins t3 ON t3.parentid = t2.id
|
||||||
WHERE (t2.tel = ? OR t3.tel = ?)
|
WHERE (t2.tel = ? OR t3.tel = ?)
|
||||||
) t1
|
) t1
|
||||||
|
LEFT JOIN place t2 ON t2.code = t1.city_code
|
||||||
WHERE t1.deleted_at = ?
|
WHERE t1.deleted_at = ?
|
||||||
ORDER BY t1.name`
|
ORDER BY t1.name`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
|
|||||||
Reference in New Issue
Block a user