Browse Source

Change 初步将手机端连接本地api服务跑起来

enilu 6 years ago
parent
commit
ac6707b6c4
28 changed files with 606 additions and 133 deletions
  1. 2 1
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/ActivityController.java
  2. 1 1
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/AddressController.java
  3. 2 1
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/CartController.java
  4. 2 1
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/DeliveryController.java
  5. 2 1
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/EntryController.java
  6. 2 2
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/OrderController.java
  7. 2 2
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/PositionController.java
  8. 10 10
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/ShopController.java
  9. 4 2
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/system/CfgController.java
  10. 2 0
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/system/RoleController.java
  11. 1 2
      flash-waimai-api/src/main/resources/application-dev.properties
  12. 1 2
      flash-waimai-api/src/main/resources/application-local.properties
  13. 4 67
      flash-waimai-core/src/main/java/cn/enilu/flash/bean/AppConfiguration.java
  14. 4 2
      flash-waimai-core/src/main/java/cn/enilu/flash/service/BaseService.java
  15. 53 23
      flash-waimai-core/src/main/java/cn/enilu/flash/service/front/PositionService.java
  16. 5 1
      flash-waimai-core/src/main/java/cn/enilu/flash/service/system/CfgService.java
  17. 1 1
      flash-waimai-manage/index.html
  18. 1 1
      flash-waimai-manage/package.json
  19. 1 1
      flash-waimai-manage/src/views/dashboard/index.vue
  20. 1 1
      flash-waimai-mobile/build/dev-server.js
  21. 4 2
      flash-waimai-mobile/config/index.js
  22. 4 1
      flash-waimai-mobile/src/components/common/shoplist.vue
  23. 5 3
      flash-waimai-mobile/src/config/env.js
  24. 5 2
      flash-waimai-mobile/src/config/fetch.js
  25. 12 1
      flash-waimai-mobile/src/page/food/food.vue
  26. 3 1
      flash-waimai-mobile/src/page/msite/msite.vue
  27. 1 1
      flash-waimai-mobile/src/service/getData.js
  28. 471 0
      flash-waimai-mobile/src/service/getData_old.js

+ 2 - 1
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/ActivityController.java

@@ -2,6 +2,7 @@ package cn.enilu.flash.api.controller.business;
 
 import cn.enilu.flash.api.controller.BaseController;
 import cn.enilu.flash.bean.entity.front.Activity;
+import cn.enilu.flash.bean.vo.front.Rets;
 import cn.enilu.flash.dao.MongoRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -20,6 +21,6 @@ public class ActivityController extends BaseController {
     @ResponseBody
     public Object list(@RequestParam(value = "latitude",required = false) String latitude,
                        @RequestParam(value = "longitude",required = false) String longitude){
-        return mongoRepository.findAll(Activity.class);
+        return Rets.success(mongoRepository.findAll(Activity.class));
     }
 }

+ 1 - 1
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/AddressController.java

@@ -26,7 +26,7 @@ public class AddressController extends BaseController {
     private IdsService idsService;
     @RequestMapping(value = "/v1/users/${user_id}/addresses",method = RequestMethod.GET)
     public Object address(@PathVariable("user_id")Long userId){
-        return mongoRepository.findAll(Address.class,"user_id",userId);
+        return Rets.success(mongoRepository.findAll(Address.class,"user_id",userId));
     }
     @RequestMapping(value = "/v1/usres/${user_id}/addresses",method =  RequestMethod.POST)
     public Object save(@PathVariable("user_id")Long userId){

+ 2 - 1
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/CartController.java

@@ -2,6 +2,7 @@ package cn.enilu.flash.api.controller.business;
 
 import cn.enilu.flash.api.controller.BaseController;
 import cn.enilu.flash.bean.entity.front.Ids;
+import cn.enilu.flash.bean.vo.front.Rets;
 import cn.enilu.flash.dao.MongoRepository;
 import cn.enilu.flash.service.front.IdsService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +34,6 @@ public class CartController extends BaseController {
     }
     @RequestMapping(value = "v1/carts/${cart_id}/remarks",method = RequestMethod.GET)
     public Object remarks(@PathVariable("cart_id")Long cartId){
-        return mongoRepository.findOne("remarks");
+        return Rets.success(mongoRepository.findOne("remarks"));
     }
 }

+ 2 - 1
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/DeliveryController.java

@@ -2,6 +2,7 @@ package cn.enilu.flash.api.controller.business;
 
 import cn.enilu.flash.api.controller.BaseController;
 import cn.enilu.flash.bean.entity.front.Delivery;
+import cn.enilu.flash.bean.vo.front.Rets;
 import cn.enilu.flash.dao.MongoRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -22,6 +23,6 @@ public class DeliveryController extends BaseController {
     @RequestMapping(value = "/shopping/v1/restaurants/delivery_modes",method = RequestMethod.GET)
     public Object list(@RequestParam(value = "latitude",required = false) String latitude,
                        @RequestParam(value = "longitude",required = false) String longitude){
-        return mongoRepository.findAll(Delivery.class);
+        return Rets.success(mongoRepository.findAll(Delivery.class));
     }
 }

+ 2 - 1
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/EntryController.java

@@ -2,6 +2,7 @@ package cn.enilu.flash.api.controller.business;
 
 import cn.enilu.flash.api.controller.BaseController;
 import cn.enilu.flash.bean.entity.front.Entry;
+import cn.enilu.flash.bean.vo.front.Rets;
 import cn.enilu.flash.dao.MongoRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,6 +20,6 @@ public class EntryController extends BaseController {
     private MongoRepository mongoRepository;
     @RequestMapping(value = "/v2/index_entry",method = RequestMethod.GET)
     public Object list(){
-        return mongoRepository.findAll(Entry.class);
+        return Rets.success(mongoRepository.findAll(Entry.class));
     }
 }

+ 2 - 2
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/OrderController.java

@@ -39,9 +39,9 @@ public class OrderController extends BaseController {
                        @RequestParam(value = "limit", defaultValue = "20") Integer limit) {
         restaurantId="11";
         if (Strings.isBlank(restaurantId)||Strings.equals("undefined",restaurantId)){
-            return mongoRepository.findAll(Order.class,"restaurant_id",Long.valueOf(restaurantId));
+            return Rets.success(mongoRepository.findAll(Order.class,"restaurant_id",Long.valueOf(restaurantId)));
         } else {
-            return mongoRepository.findAll(Order.class);
+            return Rets.success(mongoRepository.findAll(Order.class));
         }
     }
 

+ 2 - 2
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/PositionController.java

@@ -69,9 +69,9 @@ public class PositionController extends BaseController {
     }
 
     //todo 未完成
-    @RequestMapping(value = "/v2/pois/{geoHash}",method = RequestMethod.GET)
+    @RequestMapping(value = "/position/pois/{geoHash}",method = RequestMethod.GET)
 
     public Object getPoiByGeoHash(@PathVariable("geoHash")String geoHash){
-        return Rets.failure();
+        return Rets.success(positionService.pois(geoHash));
     }
 }

+ 10 - 10
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/ShopController.java

@@ -14,12 +14,9 @@ import cn.enilu.flash.service.front.PositionService;
 import cn.enilu.flash.utils.BeanUtil;
 import cn.enilu.flash.utils.Maps;
 import cn.enilu.flash.utils.factory.Page;
-import com.google.common.collect.Lists;
 import org.nutz.json.Json;
 import org.nutz.lang.Strings;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.geo.GeoResult;
-import org.springframework.data.geo.GeoResults;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -56,13 +53,16 @@ public class ShopController extends BaseController {
             return Rets.success(mongoRepository.queryPage(page, Shop.class));
         } else {
             //查询指定经纬度范围内的餐厅
-            GeoResults<Map> geoResults = mongoRepository.near(Double.valueOf(longitude), Double.valueOf(latitude), "shops");
-            List<GeoResult<Map>> geoResultList = geoResults.getContent();
-            List list = Lists.newArrayList();
-            for (int i = 0; i < geoResultList.size(); i++) {
-                list.add(geoResultList.get(i).getContent());
-            }
-            return Rets.success(list);
+            //todo mongo4.2之后不支持geoNear command,暂时先用下面方法返回测试数据
+//            GeoResults<Map> geoResults = mongoRepository.near(Double.valueOf(longitude), Double.valueOf(latitude), "shops");
+//            List<GeoResult<Map>> geoResultList = geoResults.getContent();
+//            List list = Lists.newArrayList();
+//            for (int i = 0; i < geoResultList.size(); i++) {
+//                list.add(geoResultList.get(i).getContent());
+//            }
+//            return Rets.success(list);
+            Page<Shop> page = new PageFactory<Shop>().defaultPage();
+            return Rets.success(mongoRepository.queryPage(page, Shop.class));
         }
     }
 

+ 4 - 2
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/system/CfgController.java

@@ -19,6 +19,7 @@ import cn.enilu.flash.utils.StringUtils;
 import cn.enilu.flash.utils.ToolUtil;
 import cn.enilu.flash.utils.factory.Page;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.nutz.json.Json;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,6 +48,7 @@ public class CfgController extends BaseController {
     @RequestMapping(value = "/list",method = RequestMethod.GET)
     @RequiresPermissions(value = {Permission.CFG})
     public Object list(@RequestParam(required = false) String cfgName, @RequestParam(required = false) String cfgValue) {
+        logger.info(Json.toJson(cfgService.get(6L)));
         Page<Cfg> page = new PageFactory<Cfg>().defaultPage();
         if(StringUtils.isNotEmpty(cfgName)){
             page.addFilter(SearchFilter.build("cfgName", SearchFilter.Operator.LIKE, cfgName));
@@ -88,9 +90,9 @@ public class CfgController extends BaseController {
             old.setCfgName(cfg.getCfgName());
             old.setCfgValue(cfg.getCfgValue());
             old.setCfgDesc(cfg.getCfgDesc());
-            cfgService.saveOrUpdate(old);
+            cfgService.update(old);
         }else {
-            cfgService.saveOrUpdate(cfg);
+            cfgService.insert(cfg);
         }
         return Rets.success();
     }

+ 2 - 0
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/system/RoleController.java

@@ -24,6 +24,7 @@ import cn.enilu.flash.warpper.RoleWarpper;
 import com.google.common.base.Strings;
 import com.google.common.collect.Lists;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.nutz.json.Json;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,6 +48,7 @@ public class RoleController extends BaseController {
     @RequestMapping(value = "/list",method = RequestMethod.GET)
     @RequiresPermissions(value = {Permission.ROLE})
     public Object list(String name){
+        logger.info("========="+ Json.toJson(roleService.get(3L)));
         List roles = null;
         if(Strings.isNullOrEmpty(name)) {
             roles =  roleService.queryAll();

+ 1 - 2
flash-waimai-api/src/main/resources/application-dev.properties

@@ -22,8 +22,7 @@ cfg.baidukey=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
 cfg.baidukey2=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
 
 ## api
-api.qq.get.location=http://apis.map.qq.com/ws/location/v1/ip
-api.qq.search.place=http://apis.map.qq.com/ws/place/v1/search
+api.qq.map.url=https://apis.map.qq.com/ws
 
 ## 图片地址
 img.dir=/data/springboot-elm/img/

+ 1 - 2
flash-waimai-api/src/main/resources/application-local.properties

@@ -22,8 +22,7 @@ cfg.baidukey=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
 cfg.baidukey2=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
 
 ## api
-api.qq.get.location=http://apis.map.qq.com/ws/location/v1/ip
-api.qq.search.place=http://apis.map.qq.com/ws/place/v1/search
+api.qq.map.url=https://apis.map.qq.com/ws/
 
 ## 图片地址
 img.dir=/data/springboot-elm/img/

+ 4 - 67
flash-waimai-core/src/main/java/cn/enilu/flash/bean/AppConfiguration.java

@@ -1,5 +1,6 @@
 package cn.enilu.flash.bean;
 
+import lombok.Data;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
@@ -9,11 +10,10 @@ import org.springframework.stereotype.Component;
  * @author zt
  */
 @Component
+@Data
 public class AppConfiguration {
-    @Value("${api.qq.get.location}")
-    private String apiQqGetLocation;
-    @Value("${api.qq.search.place}")
-    private String apiQqSearchPlace;
+    @Value("${api.qq.map.url}")
+    private String apiUrl;
     @Value("${cfg.tencentkey}")
     private String tencentKey;
     @Value("${cfg.tencentkey2}")
@@ -27,67 +27,4 @@ public class AppConfiguration {
     @Value("${img.dir}")
     private String imgDir;
 
-    public String getApiQqGetLocation() {
-        return apiQqGetLocation;
-    }
-
-    public void setApiQqGetLocation(String apiQqGetLocation) {
-        this.apiQqGetLocation = apiQqGetLocation;
-    }
-
-    public String getApiQqSearchPlace() {
-        return apiQqSearchPlace;
-    }
-
-    public void setApiQqSearchPlace(String apiQqSearchPlace) {
-        this.apiQqSearchPlace = apiQqSearchPlace;
-    }
-
-    public String getTencentKey() {
-        return tencentKey;
-    }
-
-    public void setTencentKey(String tencentKey) {
-        this.tencentKey = tencentKey;
-    }
-
-    public String getTencentKey2() {
-        return tencentKey2;
-    }
-
-    public void setTencentKey2(String tencentKey2) {
-        this.tencentKey2 = tencentKey2;
-    }
-
-    public String getTencentKey3() {
-        return tencentKey3;
-    }
-
-    public void setTencentKey3(String tencentKey3) {
-        this.tencentKey3 = tencentKey3;
-    }
-
-    public String getBaiduKey() {
-        return baiduKey;
-    }
-
-    public void setBaiduKey(String baiduKey) {
-        this.baiduKey = baiduKey;
-    }
-
-    public String getBaiduKey2() {
-        return baiduKey2;
-    }
-
-    public void setBaiduKey2(String baiduKey2) {
-        this.baiduKey2 = baiduKey2;
-    }
-
-    public String getImgDir() {
-        return imgDir;
-    }
-
-    public void setImgDir(String imgDir) {
-        this.imgDir = imgDir;
-    }
 }

+ 4 - 2
flash-waimai-core/src/main/java/cn/enilu/flash/service/BaseService.java

@@ -7,6 +7,7 @@ import cn.enilu.flash.dao.BaseRepository;
 import cn.enilu.flash.utils.Lists;
 import cn.enilu.flash.utils.factory.Page;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
@@ -29,6 +30,7 @@ public abstract  class BaseService<T, ID extends Serializable, R extends BaseRep
 
 
     @Override
+    @CacheEvict(value = Cache.APPLICATION ,key = "#root.targetClass.simpleName+':'+#id")
     public void delete(ID id) {
         dao.deleteById(id);
     }
@@ -118,13 +120,13 @@ public abstract  class BaseService<T, ID extends Serializable, R extends BaseRep
         }
 
     }
-
+    @CacheEvict(value = Cache.APPLICATION ,key = "#root.targetClass.simpleName+':'+#record.id")
     @Override
     public T update(T record) {
         return dao.save(record);
     }
-
     @Override
+    @CacheEvict(value = Cache.APPLICATION ,key = "#root.targetClass.simpleName+':'+#record.id")
     public T saveOrUpdate(T record) {
         return dao.save(record);
     }

+ 53 - 23
flash-waimai-core/src/main/java/cn/enilu/flash/service/front/PositionService.java

@@ -36,37 +36,37 @@ public class PositionService {
         map.put("key", appConfiguration.getTencentKey());
         Map result = null;
         try {
-            String str = HttpClients.get(appConfiguration.getApiQqGetLocation(), map);
-            result = (Map) Json.fromJson(str);// new JsonParser().parse(str).getAsJsonObject();
+            String str = HttpClients.get(appConfiguration.getApiUrl() + "location/v1/ip", map);
+            result = (Map) Json.fromJson(str);
         } catch (Exception e) {
-            logger.error("获取地理位置异常",e);
+            logger.error("获取地理位置异常", e);
         }
         if (result == null || Integer.valueOf(result.get("status").toString()) != 0) {
             try {
                 map.put("key", appConfiguration.getTencentKey2());
-                String str = HttpClients.get(appConfiguration.getApiQqGetLocation(), map);
+                String str = HttpClients.get(appConfiguration.getApiUrl() + "location/v1/ip", map);
                 result = (Map) Json.fromJson(str);
             } catch (Exception e) {
-                logger.error("获取地理位置异常",e);
+                logger.error("获取地理位置异常", e);
             }
         }
         if (result == null || Integer.valueOf(result.get("status").toString()) != 0) {
             try {
                 map.put("key", appConfiguration.getTencentKey3());
-                String str = HttpClients.get(appConfiguration.getApiQqGetLocation(), map);
+                String str = HttpClients.get(appConfiguration.getApiUrl() + "location/v1/ip", map);
                 result = (Map) Json.fromJson(str);
             } catch (Exception e) {
-                logger.error("获取地理位置异常",e);
+                logger.error("获取地理位置异常", e);
             }
 
         }
-        if ( Integer.valueOf(result.get("status").toString()) == 0) {
+        if (Integer.valueOf(result.get("status").toString()) == 0) {
             Map resultData = (Map) result.get("result");
 
-            String lat = String.valueOf(Mapl.cell(resultData,"location.lat"));
-            String lng = String.valueOf( Mapl.cell(resultData,"location.lng"));
-            String city = (String) Mapl.cell(resultData,"ad_info.city");
-            city = city.replace("市","");
+            String lat = String.valueOf(Mapl.cell(resultData, "location.lat"));
+            String lng = String.valueOf(Mapl.cell(resultData, "location.lng"));
+            String city = (String) Mapl.cell(resultData, "ad_info.city");
+            city = city.replace("市", "");
             CityInfo cityInfo = new CityInfo();
             cityInfo.setCity(city);
             cityInfo.setLat(lat);
@@ -77,25 +77,26 @@ public class PositionService {
         return null;
     }
 
-    public List searchPlace(String cityName,String keyword){
-        Map<String,String> params = Maps.newHashMap();
-        params.put("key",appConfiguration.getTencentKey());
+    public List searchPlace(String cityName, String keyword) {
+        Map<String, String> params = Maps.newHashMap();
+        params.put("key", appConfiguration.getTencentKey());
         params.put("keyword", URLEncoder.encode(keyword));
-        params.put("boundary","region("+URLEncoder.encode(cityName)+",0)");
-        params.put("page_size","10");
+        params.put("boundary", "region(" + URLEncoder.encode(cityName) + ",0)");
+        params.put("page_size", "10");
         try {
-            String str = HttpClients.get(appConfiguration.getApiQqSearchPlace(), params);
+            String str = HttpClients.get(appConfiguration.getApiUrl() + "place/v1/search", params);
             Map result = (Map) Json.fromJson(str);
             if (Integer.valueOf(result.get("status").toString()).intValue() == 0) {
-               return (List) result.get("data");
+                return (List) result.get("data");
             }
-        }catch (Exception e){
-            throw  new RuntimeException(e.getMessage());
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
         }
         return null;
 
     }
-    public Map findById(Integer id){
+
+    public Map findById(Integer id) {
         Map cities = mongoRepository.findOne("cities");
         Map<String, List> data = (Map) cities.get("data");
         Map result = null;
@@ -111,7 +112,8 @@ public class PositionService {
         }
         return result;
     }
-    public Map findByName(String cityName){
+
+    public Map findByName(String cityName) {
         Map cities = mongoRepository.findOne("cities");
         Map<String, List> data = (Map) cities.get("data");
         Map result = null;
@@ -128,4 +130,32 @@ public class PositionService {
         return result;
     }
 
+    /**
+     * 根据经纬度坐标获取位置信息
+     *
+     * @param geohash
+     * @return
+     */
+    public Map pois(String geohash) {
+        Map<String, String> map = Maps.newHashMap();
+        map.put("location", geohash);
+        map.put("key", appConfiguration.getTencentKey());
+        Map result = Maps.newHashMap();
+        try {
+            String str = HttpClients.get(appConfiguration.getApiUrl() + "geocoder/v1", map);
+            Map response = (Map) Json.fromJson(str);
+            if ("0".equals(response.get("status").toString())) {
+                result.put("address", Mapl.cell(response,"result.address"));
+                result.put("city", Mapl.cell(response, "result.address_component.city"));
+                result.put("name", Mapl.cell(response, "result.formatted_addresses.recommend"));
+                result.put("latitude", Mapl.cell(response, "result.location.lat"));
+                result.put("longitude", Mapl.cell(response, "result.location.lng"));
+            }
+
+        } catch (Exception e) {
+            logger.error("获取地理位置异常", e);
+        }
+        return result;
+    }
+
 }

+ 5 - 1
flash-waimai-core/src/main/java/cn/enilu/flash/service/system/CfgService.java

@@ -23,7 +23,11 @@ public class CfgService  extends BaseService<Cfg,Long,CfgRepository> {
 
     @Override
     public Cfg saveOrUpdate(Cfg cfg) {
-        super.saveOrUpdate(cfg);
+        if(cfg.getId()==null){
+            insert(cfg);
+        }else{
+            update(cfg);
+        }
         configCache.cache();
         return cfg;
     }

+ 1 - 1
flash-waimai-manage/index.html

@@ -3,7 +3,7 @@
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <title>web-flash</title>
+    <title>flash-waimai</title>
   </head>
   <body>
 

+ 1 - 1
flash-waimai-manage/package.json

@@ -11,7 +11,7 @@
     "start": "npm run dev",
     "build": "node build/build.js",
     "build:report": "npm_config_report=true node build/build.js",
-    "lint": "eslint --ext .js,.vue src",
+    "lint": "eslint --ext .js,w.vue src",
     "test": "npm run lint"
   },
   "dependencies": {

+ 1 - 1
flash-waimai-manage/src/views/dashboard/index.vue

@@ -19,7 +19,7 @@
       <el-col :span="6">
         <el-card class="box-card">
           <el-col :span="12">
-            <svg-icon  icon-class="user" ></svg-icon>
+            <svg-icon  icon-class="user"></svg-icon>
           </el-col>
           <el-col :span="12" >
             <div class="card-panel-text">{{ $t('dashboard.newUser') }}</div>

+ 1 - 1
flash-waimai-mobile/build/dev-server.js

@@ -37,7 +37,7 @@ compiler.plugin('compilation', function(compilation) {
 var context = config.dev.context
 
 switch(process.env.NODE_ENV){
-    case 'local': var proxypath = 'http://localhost:8001'; break;
+    case 'local': var proxypath = 'http://localhost:8082'; break;
     case 'online': var proxypath = 'http://elm.cangdu.org'; break;
     default:  var proxypath = config.dev.proxypath;
 }

+ 4 - 2
flash-waimai-mobile/config/index.js

@@ -37,8 +37,10 @@ module.exports = {
             '/eus',
             '/payapi',
             '/img',
+            '/file',
+            '/position'
         ],
-        proxypath: 'http://cangdu.org:8001',
+        proxypath: 'http://localhost:8082',//http://cangdu.org:8001
         // CSS Sourcemaps off by default because relative paths are "buggy"
         // with this option, according to the CSS-Loader README
         // (https://github.com/webpack/css-loader#sourcemaps)
@@ -46,4 +48,4 @@ module.exports = {
         // just be aware of this issue when enabling this option.
         cssSourceMap: false
     }
-}
+}

+ 4 - 1
flash-waimai-mobile/src/components/common/shoplist.vue

@@ -105,7 +105,10 @@ export default {
 	methods: {
 		async initData(){
 			//获取数据
-			let res = await shopList(this.latitude, this.longitude, this.offset, this.restaurantCategoryId);
+			let resResponse = await shopList(this.latitude, this.longitude, this.offset, this.restaurantCategoryId);
+			console.log('resresponse',resResponse)
+			let res = resResponse.records
+      console.log('res',res)
 			this.shopListArr = [...res];
 			if (res.length < 20) {
 				this.touchend = true;

+ 5 - 3
flash-waimai-mobile/src/config/env.js

@@ -13,10 +13,12 @@ let imgBaseUrl = '';
 
 
 if (process.env.NODE_ENV == 'development') {
-    imgBaseUrl = '/img/';
-
+    // imgBaseUrl = '/img/';
+        imgBaseUrl = '/file/getImgStream?fileName='
+  console.log('development',baseUrl)
 }else if(process.env.NODE_ENV == 'production'){
 	baseUrl = '//elm.cangdu.org';
+	console.log('product',baseUrl)
     imgBaseUrl = '//elm.cangdu.org/img/';
 }
 
@@ -24,4 +26,4 @@ export {
 	baseUrl,
 	routerMode,
 	imgBaseUrl,
-}
+}

+ 5 - 2
flash-waimai-mobile/src/config/fetch.js

@@ -35,10 +35,13 @@ export default async(url = '', data = {}, type = 'GET', method = 'fetch') => {
 				value: JSON.stringify(data)
 			})
 		}
-		
+
 		try {
 			const response = await fetch(url, requestConfig);
 			const responseJson = await response.json();
+			if(responseJson.code === 20000){
+			  return responseJson.data
+      }
 			return responseJson
 		} catch (error) {
 			throw new Error(error)
@@ -76,4 +79,4 @@ export default async(url = '', data = {}, type = 'GET', method = 'fetch') => {
 			}
 		})
 	}
-}
+}

+ 12 - 1
flash-waimai-mobile/src/page/food/food.vue

@@ -170,6 +170,7 @@
     	</transition>
     	<section class="shop_list_container">
 	    	<shop-list :geohash="geohash" :restaurantCategoryId="restaurant_category_id" :restaurantCategoryIds="restaurant_category_ids" :sortByType='sortByType' :deliveryMode="delivery_mode" :confirmSelect="confirmStatus" :supportIds="support_ids" v-if="latitude"></shop-list>
+        <shop-list :geohash="geohash" :restaurantCategoryId="restaurant_category_id" :restaurantCategoryIds="restaurant_category_ids" :sortByType='sortByType' :deliveryMode="delivery_mode" :confirmSelect="confirmStatus" :supportIds="support_ids" v-if="latitude"></shop-list>
     	</section>
     </div>
 </template>
@@ -226,29 +227,39 @@ export default {
       this.headTitle = this.$route.query.title;
       this.foodTitle = this.headTitle;
       this.restaurant_category_id = this.$route.query.restaurant_category_id;
+      console.log('geohash',this.geohash)
+      console.log('restaurant_category_id',this.restaurant_category_id)
       //防止刷新页面时,vuex状态丢失,经度纬度需要重新获取,并存入vuex
       if (!this.latitude) {
+        console.log('经度' ,this.latitude)
         //获取位置信息
         let res = await msiteAddress(this.geohash);
+        console.log('位置信息',res)
         // 记录当前经度纬度进入vuex
         this.RECORD_ADDRESS(res);
       }
       //获取category分类左侧数据
       this.category = await foodCategory(this.latitude, this.longitude);
+      console.log(this.category)
       //初始化时定位当前category分类左侧默认选择项,在右侧展示出其sub_categories列表
       this.category.forEach(item => {
         if (this.restaurant_category_id == item.id) {
           this.categoryDetail = item.sub_categories;
         }
-      });
+      })
+
+      console.log(1)
       //获取筛选列表的配送方式
       this.Delivery = await foodDelivery(this.latitude, this.longitude);
       //获取筛选列表的商铺活动
+      console.log('delivery',this.Delivery)
       this.Activity = await foodActivity(this.latitude, this.longitude);
+      console.log('ac1',this.Activity)
       //记录support_ids的状态,默认不选中,点击状态取反,status为true时为选中状态
       this.Activity.forEach((item, index) => {
         this.support_ids[index] = { status: false, id: item.id };
       });
+      console.log('activity',this.Activity)
     },
     // 点击顶部三个选项,展示不同的列表,选中当前选项进行展示,同时收回其他选项
     async chooseType(type) {

+ 3 - 1
flash-waimai-mobile/src/page/msite/msite.vue

@@ -37,7 +37,7 @@
 	    	<shop-list v-if="hasGetData" :geohash="geohash"></shop-list>
     	</div>
     	<foot-guide></foot-guide>
-    </div>    
+    </div>
 </template>
 
 <script>
@@ -80,7 +80,9 @@ export default {
     mounted(){
         //获取导航食品类型列表
        	msiteFoodTypes(this.geohash).then(res => {
+       	  console.log('res',res)
        		let resLength = res.length;
+       	  console.log(resLength)
        		let resArr = [...res]; // 返回一个新的数组
        		let foodArr = [];
     		for (let i = 0, j = 0; i < resLength; i += 8, j++) {

+ 1 - 1
flash-waimai-mobile/src/service/getData.js

@@ -50,7 +50,7 @@ export const searchplace = (cityid, value) => fetch('/v1/pois', {
  * 获取msite页面地址信息
  */
 
-export const msiteAddress = geohash => fetch('/v2/pois/' + geohash);
+export const msiteAddress = geohash => fetch('/position/pois/' + geohash);
 
 
 /**

+ 471 - 0
flash-waimai-mobile/src/service/getData_old.js

@@ -0,0 +1,471 @@
+import fetch from '../config/fetch'
+import {getStore} from '../config/mUtils'
+
+/**
+ * 获取首页默认地址
+ */
+
+export const cityGuess = () => fetch('/v1/cities', {
+	type: 'guess'
+});
+
+
+/**
+ * 获取首页热门城市
+ */
+
+export const hotcity = () => fetch('/v1/cities', {
+	type: 'hot'
+});
+
+
+/**
+ * 获取首页所有城市
+ */
+
+export const groupcity = () => fetch('/v1/cities', {
+	type: 'group'
+});
+
+
+/**
+ * 获取当前所在城市
+ */
+
+export const currentcity = number => fetch('/v1/cities/' + number);
+
+
+/**
+ * 获取搜索地址
+ */
+
+export const searchplace = (cityid, value) => fetch('/v1/pois', {
+	type: 'search',
+	city_id: cityid,
+	keyword: value
+});
+
+
+/**
+ * 获取msite页面地址信息
+ */
+
+export const msiteAddress = geohash => fetch('/v2/pois/' + geohash);
+
+
+/**
+ * 获取msite页面食品分类列表
+ */
+
+export const msiteFoodTypes = geohash => fetch('/v2/index_entry', {
+	geohash,
+	group_type: '1',
+	'flags[]': 'F'
+});
+
+
+/**
+ * 获取msite商铺列表
+ */
+
+export const shopList = (latitude, longitude, offset, restaurant_category_id = '', restaurant_category_ids = '', order_by = '', delivery_mode = '', support_ids = []) => {
+	let supportStr = '';
+	support_ids.forEach(item => {
+		if (item.status) {
+			supportStr += '&support_ids[]=' + item.id;
+		}
+	});
+	let data = {
+		latitude,
+		longitude,
+		offset,
+		limit: '20',
+		'extras[]': 'activities',
+		keyword: '',
+		restaurant_category_id,
+		'restaurant_category_ids[]': restaurant_category_ids,
+		order_by,
+		'delivery_mode[]': delivery_mode + supportStr
+	};
+	return fetch('/shopping/restaurants', data);
+};
+
+
+/**
+ * 获取search页面搜索结果
+ */
+
+export const searchRestaurant = (geohash, keyword) => fetch('/v4/restaurants', {
+	'extras[]': 'restaurant_activity',
+	geohash,
+	keyword,
+	type: 'search'
+});
+
+
+/**
+ * 获取food页面的 category 种类列表
+ */
+
+export const foodCategory = (latitude, longitude) => fetch('/shopping/v2/restaurant/category', {
+	latitude,
+	longitude
+});
+
+
+/**
+ * 获取food页面的配送方式
+ */
+
+export const foodDelivery = (latitude, longitude) => fetch('/shopping/v1/restaurants/delivery_modes', {
+	latitude,
+	longitude,
+	kw: ''
+});
+
+
+/**
+ * 获取food页面的商家属性活动列表
+ */
+
+export const foodActivity = (latitude, longitude) => fetch('/shopping/v1/restaurants/activity_attributes', {
+	latitude,
+	longitude,
+	kw: ''
+});
+
+
+/**
+ * 获取shop页面商铺详情
+ */
+
+export const shopDetails = (shopid, latitude, longitude) => fetch('/shopping/restaurant/' + shopid, {
+	latitude,
+	longitude: longitude + '&extras[]=activities&extras[]=album&extras[]=license&extras[]=identification&extras[]=statistics'
+});
+
+
+
+/**
+ * 获取shop页面菜单列表
+ */
+
+export const foodMenu = restaurant_id => fetch('/shopping/v2/menu', {
+	restaurant_id
+});
+
+
+/**
+ * 获取商铺评价列表
+ */
+
+export const getRatingList = (shopid, offset, tag_name = '') => fetch('/ugc/v2/restaurants/' + shopid + '/ratings', {
+	has_content: true,
+	offset,
+	limit: 10,
+	tag_name
+});
+
+
+/**
+ * 获取商铺评价分数
+ */
+
+export const ratingScores = shopid => fetch('/ugc/v2/restaurants/' + shopid + '/ratings/scores');
+
+
+/**
+ * 获取商铺评价分类
+ */
+
+export const ratingTags = shopid => fetch('/ugc/v2/restaurants/' + shopid + '/ratings/tags');
+
+
+/**
+ * 获取短信验证码
+ */
+
+export const mobileCode = phone => fetch('/v4/mobile/verify_code/send', {
+	mobile: phone,
+	scene: 'login',
+	type: 'sms'
+}, 'POST');
+
+
+/**
+ * 获取图片验证码
+ */
+
+export const getcaptchas = () => fetch('/v1/captchas', {},'POST');
+
+
+/**
+ * 检测帐号是否存在
+ */
+
+export const checkExsis = (checkNumber, type) => fetch('/v1/users/exists', {
+	[type]: checkNumber,
+	type
+});
+
+
+/**
+ * 发送帐号
+ */
+
+export const sendMobile = (sendData, captcha_code, type, password) => fetch('/v1/mobile/verify_code/send', {
+	action: "send",
+	captcha_code,
+	[type]: sendData,
+	type: "sms",
+	way: type,
+	password,
+}, 'POST');
+
+
+/**
+ * 确认订单
+ */
+
+export const checkout = (geohash, entities, shopid) => fetch('/v1/carts/checkout', {
+	come_from: "web",
+	geohash,
+	entities,
+	restaurant_id: shopid,
+}, 'POST');
+
+
+/**
+ * 获取快速备注列表
+ */
+
+export const getRemark = (id, sig) => fetch('/v1/carts/' + id + '/remarks', {
+	sig
+});
+
+
+/**
+ * 获取地址列表
+ */
+
+export const getAddress = (id, sig) => fetch('/v1/carts/' + id + '/addresses', {
+	sig
+});
+
+
+/**
+ * 搜索地址
+ */
+
+export const searchNearby = keyword => fetch('/v1/pois', {
+	type: 'nearby',
+	keyword
+});
+
+
+/**
+ * 添加地址
+ */
+
+export const postAddAddress = (userId, address, address_detail, geohash, name, phone, phone_bk, poi_type, sex, tag, tag_type) => fetch('/v1/users/' + userId + '/addresses', {
+	address,
+	address_detail,
+	geohash,
+	name,
+	phone,
+	phone_bk,
+	poi_type,
+	sex,
+	tag,
+	tag_type,
+}, 'POST');
+
+
+/**
+ * 下订单
+ */
+
+export const placeOrders = (user_id, cart_id, address_id, description, entities, geohash, sig) => fetch('/v1/users/' + user_id + '/carts/' + cart_id + '/orders', {
+	address_id,
+	come_from: "mobile_web",
+	deliver_time: "",
+	description,
+	entities,
+	geohash,
+	paymethod_id: 1,
+	sig,
+}, 'POST');
+
+
+/**
+ * 重新发送订单验证码
+ */
+
+export const rePostVerify = (cart_id, sig, type) => fetch('/v1/carts/' + cart_id + '/verify_code', {
+	sig,
+	type,
+}, 'POST');
+
+
+
+/**
+ * 下订单
+ */
+
+export const validateOrders = ({
+	user_id,
+	cart_id,
+	address_id,
+	description,
+	entities,
+	geohash,
+	sig,
+	validation_code,
+	validation_token
+}) => fetch('/v1/users/' + user_id + '/carts/' + cart_id + '/orders', {
+	address_id,
+	come_from: "mobile_web",
+	deliver_time: "",
+	description,
+	entities,
+	geohash,
+	paymethod_id: 1,
+	sig,
+	validation_code,
+	validation_token,
+}, 'POST');
+
+
+/**
+ * 重新发送订单验证码
+ */
+
+export const payRequest = (merchantOrderNo, userId) => fetch('/payapi/payment/queryOrder', {
+	merchantId: 5,
+	merchantOrderNo,
+	source: 'MOBILE_WAP',
+	userId,
+	version: '1.0.0',
+});
+
+
+
+/**
+ * 获取服务中心信息
+ */
+
+export const getService = () => fetch('/v3/profile/explain');
+
+
+
+/**
+*兑换会员卡
+*/
+
+export const vipCart = (id, number, password) => fetch('/member/v1/users/' + id + '/delivery_card/physical_card/bind',{
+	number,
+	password
+}, 'POST')
+
+
+
+/**
+ * 获取红包
+*/
+
+export const getHongbaoNum = id => fetch('/promotion/v2/users/' + id + '/hongbaos?limit=20&offset=0');
+
+
+
+/**
+ * 获取过期红包
+*/
+
+
+export const getExpired = id => fetch('/promotion/v2/users/' + id + '/expired_hongbaos?limit=20&offset=0');
+
+
+/**
+ * 兑换红包
+*/
+
+export const exChangeHongbao = (id, exchange_code, captcha_code) => fetch('/v1/users/' + id + '/hongbao/exchange',{
+	exchange_code,
+	captcha_code,
+}, 'POST');
+
+
+/**
+ * 获取用户信息
+ */
+
+export const getUser = () => fetch('/v1/user', {user_id: getStore('user_id')});
+
+
+/**
+ * 手机号登录
+ */
+
+var sendLogin = (code, mobile, validate_token) => fetch('/v1/login/app_mobile', {
+	code,
+	mobile,
+	validate_token
+}, 'POST');
+
+
+/**
+ * 获取订单列表
+ */
+
+export const getOrderList = (user_id, offset) => fetch('/bos/v2/users/' + user_id + '/orders', {
+	limit: 10,
+	offset,
+});
+
+
+/**
+ * 获取订单详情
+ */
+
+export const getOrderDetail = (user_id, orderid) => fetch('/bos/v1/users/' + user_id + '/orders/' + orderid + '/snapshot');
+
+
+/**
+*个人中心里编辑地址
+*/
+
+export const getAddressList = (user_id) => fetch('/v1/users/'+user_id+'/addresses')
+
+/**
+*个人中心里搜索地址
+*/
+
+export const getSearchAddress = (keyword) => fetch('v1/pois',{
+	keyword:keyword,
+	type:'nearby'
+})
+
+/**
+* 删除地址
+*/
+
+export const deleteAddress = (userid, addressid) => fetch( '/v1/users/' + userid + '/addresses/' + addressid, {}, 'DELETE')
+
+
+
+/**
+ * 账号密码登录
+ */
+export const accountLogin = (username, password, captcha_code) => fetch('/v2/login', {username, password, captcha_code}, 'POST');
+
+
+/**
+ * 退出登录
+ */
+export const signout = () => fetch('/v2/signout');
+
+
+/**
+ * 改密码
+ */
+export const changePassword = (username, oldpassWord, newpassword, confirmpassword, captcha_code) => fetch('/v2/changepassword', {username, oldpassWord, newpassword, confirmpassword, captcha_code}, 'POST');