enilu 6 年 前
コミット
301a2e2f6f
24 ファイル変更151 行追加221 行削除
  1. 1 0
      .gitignore
  2. 6 0
      README.md
  3. 2 1
      flash-waimai-api/pom.xml
  4. 19 8
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/CaptchaController.java
  5. 0 62
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/File2Controller.java
  6. 55 53
      flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/User2Controller.java
  7. 7 13
      flash-waimai-api/src/main/resources/application-dev.properties
  8. 0 28
      flash-waimai-api/src/main/resources/application-local.properties
  9. 20 7
      flash-waimai-api/src/main/resources/application-prod.properties
  10. 1 1
      flash-waimai-api/src/main/resources/logback.xml
  11. 1 5
      flash-waimai-core/src/main/java/cn/enilu/flash/bean/AppConfiguration.java
  12. 1 0
      flash-waimai-core/src/main/java/cn/enilu/flash/bean/vo/business/LoginVo.java
  13. 7 2
      flash-waimai-core/src/main/java/cn/enilu/flash/cache/TokenCache.java
  14. 0 3
      flash-waimai-core/src/main/java/cn/enilu/flash/service/system/FileService.java
  15. 6 6
      flash-waimai-core/src/main/java/cn/enilu/flash/service/task/TaskService.java
  16. 1 1
      flash-waimai-manage/config/prod.env.js
  17. 0 2
      flash-waimai-manage/src/permission.js
  18. 0 3
      flash-waimai-manage/src/views/business/shop/add.js
  19. 2 1
      flash-waimai-manage/src/views/business/shop/index.vue
  20. 11 15
      flash-waimai-manage/src/views/business/shop/shop.js
  21. 1 1
      flash-waimai-mobile/config/index.js
  22. 3 5
      flash-waimai-mobile/src/config/env.js
  23. 6 3
      flash-waimai-mobile/src/page/login/login.vue
  24. 1 1
      flash-waimai-mobile/src/service/getData.js

+ 1 - 0
.gitignore

@@ -12,3 +12,4 @@ target
 .project
 launch.json
 .vscode
+dist

+ 6 - 0
README.md

@@ -50,6 +50,12 @@ mongorestore.exe -d flash-waimai d:\\elm
 ![admin](doc/admin.gif)
 - 手机端    
 ![mobile](doc/mobile.gif)
+
+## 在线演示
+- 查看演示系统请不要随意删除数据
+- 后台管理:[http://waimai-admin.microapp.store](http://waimai-admin.microapp.store)
+- 手机端:[http://waimai-mobile.microapp.store](http://waimai-mobile.microapp.store/#/login)
+- 
 ## 开发进度
 - flash-waimai-manage [初步完成]
 - flash-waimai-mobile[完善中]

+ 2 - 1
flash-waimai-api/pom.xml

@@ -7,6 +7,7 @@
         <groupId>cn.enilu</groupId>
         <version>1.0</version>
     </parent>
+    <packaging>war</packaging>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>flash-waimai-api</artifactId>
@@ -32,7 +33,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-war-plugin</artifactId>
                 <configuration>
-                    <warName>api</warName>
+                    <warName>waimai-api</warName>
                     <failOnMissingWebXml>false</failOnMissingWebXml>
                 </configuration>
             </plugin>

+ 19 - 8
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/CaptchaController.java

@@ -2,7 +2,12 @@ package cn.enilu.flash.api.controller.business;
 
 import cn.enilu.flash.api.controller.BaseController;
 import cn.enilu.flash.bean.vo.front.Rets;
+import cn.enilu.flash.cache.TokenCache;
 import cn.enilu.flash.utils.CaptchaCode;
+import cn.enilu.flash.utils.Maps;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -13,6 +18,7 @@ import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.Map;
+import java.util.UUID;
 
 /**
  * Created  on 2018/1/5 0005.
@@ -21,21 +27,26 @@ import java.util.Map;
  */
 @RestController
 public class CaptchaController extends BaseController {
-    @RequestMapping(value = "/v1/captchas",method = RequestMethod.POST)
-    public Object get() throws IOException {
-        ByteArrayOutputStream outputStream =  new ByteArrayOutputStream();
-        Map<String,Object> map = CaptchaCode.getImageCode(60, 20, outputStream);
 
-        setSession(CaptchaCode.CAPTCH_KEY, map.get("strEnsure").toString().toLowerCase());
-        setSession("codeTime",System.currentTimeMillis());
+    private static Logger logger = LoggerFactory.getLogger(CaptchaController.class);
+    @Autowired
+    private TokenCache tokenCache;
+
+    @RequestMapping(value = "/v1/captchas", method = RequestMethod.POST)
+    public Object get() throws IOException {
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        Map<String, Object> map = CaptchaCode.getImageCode(60, 20, outputStream);
+        String captchCodeId = UUID.randomUUID().toString();
+        tokenCache.put(captchCodeId, map.get("strEnsure").toString().toLowerCase());
+        logger.info("captchCode:{}", map.get("strEnsure").toString().toLowerCase());
         try {
             ImageIO.write((BufferedImage) map.get("image"), "png", outputStream);
             BASE64Encoder encoder = new BASE64Encoder();
             String base64 = encoder.encode(outputStream.toByteArray());
             String captchaBase64 = "data:image/png;base64," + base64.replaceAll("\r\n", "");
-           return Rets.success("code",captchaBase64);
+            return Rets.success(Maps.newHashMap("captchCodeId",captchCodeId,"code",captchaBase64));
         } catch (IOException e) {
-           return Rets.failure(e.getMessage());
+            return Rets.failure(e.getMessage());
         }
 
     }

+ 0 - 62
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/File2Controller.java

@@ -1,62 +0,0 @@
-package cn.enilu.flash.api.controller.business;
-
-import cn.enilu.flash.api.controller.BaseController;
-import cn.enilu.flash.bean.AppConfiguration;
-import cn.enilu.flash.bean.vo.front.Rets;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ResourceLoader;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-/**
- * Created  on 2018/1/2 0002.
- *
- * @author zt
- */
-@Controller
-public class File2Controller extends BaseController {
-    private static final Logger log = LoggerFactory.getLogger(File2Controller.class);
-
-    @Autowired
-    private AppConfiguration appConfiguration;
-    @Autowired
-    private  ResourceLoader resourceLoader;
-    @RequestMapping(method = RequestMethod.POST, value = "/v1/addimg/{type}")
-    @ResponseBody
-    public Object add(@PathVariable("type") String type, @RequestParam("file") MultipartFile file) {
-        if (!file.isEmpty()) {
-            try {
-                String fileName= type+"_"+System.currentTimeMillis()+"."+file.getOriginalFilename().split("\\.")[1];
-                Files.copy(file.getInputStream(), Paths.get(appConfiguration.getImgDir(), fileName));
-                return Rets.success("image_path",fileName);
-            } catch (IOException | RuntimeException e) {
-                e.printStackTrace();
-
-            }
-        }
-        return Rets.failure();
-
-
-    }
-
-    @RequestMapping(method = RequestMethod.GET, value = "/img/{filename:.+}")
-    @ResponseBody
-    public ResponseEntity<?> get(@PathVariable String filename) {
-
-        try {
-            return ResponseEntity.ok(resourceLoader.getResource("file:" + Paths.get(appConfiguration.getImgDir(), filename).toString()));
-        } catch (Exception e) {
-            return ResponseEntity.notFound().build();
-        }
-    }
-
-
-}

+ 55 - 53
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/User2Controller.java

@@ -7,6 +7,7 @@ import cn.enilu.flash.bean.entity.front.Ids;
 import cn.enilu.flash.bean.vo.business.CityInfo;
 import cn.enilu.flash.bean.vo.business.LoginVo;
 import cn.enilu.flash.bean.vo.front.Rets;
+import cn.enilu.flash.cache.TokenCache;
 import cn.enilu.flash.dao.MongoRepository;
 import cn.enilu.flash.service.front.IdsService;
 import cn.enilu.flash.service.front.PositionService;
@@ -19,11 +20,7 @@ import org.nutz.mapl.Mapl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
 import java.util.List;
@@ -42,99 +39,104 @@ public class User2Controller extends BaseController {
     private IdsService idsService;
     @Autowired
     private PositionService positionService;
+    @Autowired
+    private TokenCache tokenCache;
 
-    @RequestMapping(value = "/v1/user",method = RequestMethod.GET)
-    public Object getUser(){
+    @RequestMapping(value = "/v1/user", method = RequestMethod.GET)
+    public Object getUser() {
         return getSession("currentUser");
     }
+
     @RequestMapping(method = RequestMethod.GET)
-    public Object getUser(@RequestParam("user_id") Long userId){
+    public Object getUser(@RequestParam("user_id") Long userId) {
         return getSession("currentUser");
     }
-    @RequestMapping(value = "/list",method = RequestMethod.GET)
-    public Object list(@RequestParam("offset") Integer offset,@RequestParam("limit") Integer limit){
+
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public Object list(@RequestParam("offset") Integer offset, @RequestParam("limit") Integer limit) {
         List list = mongoRepository.findAll("userinfos");
         return list;
     }
-    @RequestMapping(value = "/count",method = RequestMethod.GET)
-    public Object count(){
-        return Rets.success("count",2);
+
+    @RequestMapping(value = "/count", method = RequestMethod.GET)
+    public Object count() {
+        return Rets.success("count", 2);
     }
 
-    @RequestMapping(value = "/v2/login",method = RequestMethod.POST)
-    public Object login(@RequestBody LoginVo loginVo){
-        String captch = (String) getSession(CaptchaCode.CAPTCH_KEY);
-        if(!Strings.equals(loginVo.getCaptchaCode(),captch)){
-            return Rets.failure(Maps.newHashMap("type","ERROR_CAPTCHA","message","验证码不正确"));
+    @RequestMapping(value = "/v2/login", method = RequestMethod.POST)
+    public Object login(@RequestBody LoginVo loginVo) {
+        String captchCode =   tokenCache.get(loginVo.getCaptchCodeId(),String.class);
+        if (!Strings.equals(loginVo.getCaptchaCode(), captchCode)) {
+            return Rets.failure(Maps.newHashMap("type", "ERROR_CAPTCHA", "message", "验证码不正确"));
         }
-        Map user = mongoRepository.findOne("users","username",loginVo.getUsername());
-        String newPassword = MD5.getMD5String(MD5.getMD5String(loginVo.getPassword()).substring(2,7)+MD5.getMD5String(loginVo.getPassword()));
-        if(user==null){
+        Map user = mongoRepository.findOne("users", "username", loginVo.getUsername());
+        String newPassword = MD5.getMD5String(MD5.getMD5String(loginVo.getPassword()).substring(2, 7) + MD5.getMD5String(loginVo.getPassword()));
+        if (user == null) {
             FrontUser frontUser = new FrontUser();
             frontUser.setUser_id(idsService.getId(Ids.USER_ID));
-            frontUser.setUsername(loginVo.getUsername());                         
+            frontUser.setUsername(loginVo.getUsername());
             frontUser.setPassword(newPassword);
-            mongoRepository.save(frontUser); 
+            mongoRepository.save(frontUser);
             FrontUserInfo userInfo = new FrontUserInfo();
             userInfo.setId(frontUser.getUser_id());
             userInfo.setUser_id(frontUser.getUser_id());
-            userInfo.setRegiste_time(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm"));
+            userInfo.setRegiste_time(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
             String ip = getIp();
             CityInfo cityInfo = positionService.getPostion(ip);
             userInfo.setCity(cityInfo.getCity());
             userInfo.setUsername(frontUser.getUsername());
             mongoRepository.save(userInfo);
             Object result = Mapl.merge(frontUser, userInfo);
-            setSession("currentUser",result);
+            setSession("currentUser", result);
             return frontUser;
-        }else{            
-            if(newPassword.equals(user.get("password"))){
+        } else {
+            if (newPassword.equals(user.get("password"))) {
                 Map userInfo = mongoRepository.findOne("userinfos", "user_id", Long.valueOf(user.get("user_id").toString()));
                 Object result = Mapl.merge(user, userInfo);
-                setSession("currentUser",result);
+                setSession("currentUser", result);
                 return result;
-            }else{
-                return Rets.failure(Maps.newHashMap("type","ERROR_PASSWORD","message","密码错误"));
+            } else {
+                return Rets.failure(Maps.newHashMap("type", "ERROR_PASSWORD", "message", "密码错误"));
             }
-            
+
         }
-        
+
 
     }
-    @RequestMapping(value = "/v2/signout",method = RequestMethod.GET)
-    public Object signOut(){
+
+    @RequestMapping(value = "/v2/signout", method = RequestMethod.GET)
+    public Object signOut() {
         getRequest().getSession().removeAttribute("currentUser");
         return Rets.success();
     }
-    @RequestMapping(value = "/v2/changepassword",method = RequestMethod.POST)
-    public Object changePassword(@RequestParam("username")String userName,
-                                 @RequestParam("oldpassWord")String oldPassword,
-                                 @RequestParam("newpassword")String newPassword,
-                                 @RequestParam("confirmpassword")String confirmPassword,
-                                 @RequestParam("captcha_code")String captchaCode){
+
+    @RequestMapping(value = "/v2/changepassword", method = RequestMethod.POST)
+    public Object changePassword(@RequestParam("username") String userName,
+                                 @RequestParam("oldpassWord") String oldPassword,
+                                 @RequestParam("newpassword") String newPassword,
+                                 @RequestParam("confirmpassword") String confirmPassword,
+                                 @RequestParam("captcha_code") String captchaCode) {
 
         String captch = (String) getSession(CaptchaCode.CAPTCH_KEY);
-        if(!Strings.equals(captchaCode,captch)){
-            return Rets.failure(Maps.newHashMap("type","ERROR_CAPTCHA","message","验证码不正确"));
+        if (!Strings.equals(captchaCode, captch)) {
+            return Rets.failure(Maps.newHashMap("type", "ERROR_CAPTCHA", "message", "验证码不正确"));
         }
-        Map user = mongoRepository.findOne("users","username",userName);
-        if(user==null){
-            return Rets.failure(Maps.newHashMap("type","ERROR_QUERY","message","用户不存在"));
+        Map user = mongoRepository.findOne("users", "username", userName);
+        if (user == null) {
+            return Rets.failure(Maps.newHashMap("type", "ERROR_QUERY", "message", "用户不存在"));
         }
-        if(!Strings.equals(oldPassword,Strings.sNull(user.get("password")))){
-            return Rets.failure(Maps.newHashMap("type","ERROR_QUERY","message","原密码错误"));
+        if (!Strings.equals(oldPassword, Strings.sNull(user.get("password")))) {
+            return Rets.failure(Maps.newHashMap("type", "ERROR_QUERY", "message", "原密码错误"));
         }
-        if(Strings.equals(newPassword,confirmPassword)){
-            return Rets.failure(Maps.newHashMap("type","ERROR_QUERY","message","新密码不一致"));
+        if (Strings.equals(newPassword, confirmPassword)) {
+            return Rets.failure(Maps.newHashMap("type", "ERROR_QUERY", "message", "新密码不一致"));
         }
 
-        user.put("password",newPassword);
-        mongoRepository.update(Long.valueOf(user.get("id").toString()),"users",user);
+        user.put("password", newPassword);
+        mongoRepository.update(Long.valueOf(user.get("id").toString()), "users", user);
 
         return Rets.success();
     }
 
 
-
-
 }

+ 7 - 13
flash-waimai-api/src/main/resources/application-dev.properties

@@ -1,29 +1,23 @@
 ## 开发环境配置
 debug=true
-spring.datasource.url=jdbc:mysql://my-db:3306/waimai?useUnicode=true&characterEncoding=UTF8
-spring.datasource.username=waimai
-spring.datasource.password=waimai123
-
-#spring.jpa.hibernate.ddl-auto=create
+spring.datasource.url=jdbc:mysql://localhost:3306/flash-waimai?useUnicode=true&characterEncoding=UTF8
+spring.datasource.username=root
+spring.datasource.password=root
+# 开启该配置自动创建数据库
+spring.jpa.hibernate.ddl-auto=create
 #默认使用InnoDB引擎
 spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
 spring.datasource.sql-script-encoding=utf-8
 spring.jpa.show-sql=true
 #server.servlet.context-path=/api
 
-spring.data.mongodb.uri=mongodb://my-db:27017/flash-waimai
-spring.data.mongodb.username=enilu
-spring.data.mongodb.password=enilu123456
+spring.data.mongodb.uri=mongodb://localhost:27017/flash-waimai
+
 
 ##全局参数
 cfg.tencentkey=RLHBZ-WMPRP-Q3JDS-V2IQA-JNRFH-EJBHL
 cfg.tencentkey2=RRXBZ-WC6KF-ZQSJT-N2QU7-T5QIT-6KF5X
 cfg.tencentkey3=OHTBZ-7IFRG-JG2QF-IHFUK-XTTK6-VXFBN
-cfg.baidukey=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
-cfg.baidukey2=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
 
 ## api
 api.qq.map.url=https://apis.map.qq.com/ws/
-
-## 图片地址
-img.dir=/data/springboot-elm/img/

+ 0 - 28
flash-waimai-api/src/main/resources/application-local.properties

@@ -1,28 +0,0 @@
-## 开发环境配置
-debug=true
-spring.datasource.url=jdbc:mysql://localhost:3306/flash-waimai?useUnicode=true&characterEncoding=UTF8
-spring.datasource.username=root
-spring.datasource.password=root
-
-#spring.jpa.hibernate.ddl-auto=create
-#默认使用InnoDB引擎
-spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
-spring.datasource.sql-script-encoding=utf-8
-spring.jpa.show-sql=true
-#server.servlet.context-path=/api
-
-spring.data.mongodb.uri=mongodb://localhost:27017/flash-waimai
-
-
-##全局参数
-cfg.tencentkey=RLHBZ-WMPRP-Q3JDS-V2IQA-JNRFH-EJBHL
-cfg.tencentkey2=RRXBZ-WC6KF-ZQSJT-N2QU7-T5QIT-6KF5X
-cfg.tencentkey3=OHTBZ-7IFRG-JG2QF-IHFUK-XTTK6-VXFBN
-cfg.baidukey=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
-cfg.baidukey2=fjke3YUipM9N64GdOIh1DNeK2APO2WcT
-
-## api
-api.qq.map.url=https://apis.map.qq.com/ws/
-
-## 图片地址
-img.dir=/data/springboot-elm/img/

+ 20 - 7
flash-waimai-api/src/main/resources/application-prod.properties

@@ -1,11 +1,24 @@
-## 生产环境配置
-debug=false
-spring.datasource.url=jdbc:mysql://localhost:3306/webflash?useUnicode=true&characterEncoding=UTF8
-spring.datasource.username=webflash
-spring.datasource.password=webflash190602
+## 开发环境配置
+debug=true
+spring.datasource.url=jdbc:mysql://my-db:3306/waimai?useUnicode=true&characterEncoding=UTF8
+spring.datasource.username=waimai
+spring.datasource.password=waimai123
 
-spring.jpa.hibernate.ddl-auto=create
+#spring.jpa.hibernate.ddl-auto=create
 #默认使用InnoDB引擎
 spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
 spring.datasource.sql-script-encoding=utf-8
-spring.jpa.show-sql=true
+spring.jpa.show-sql=false
+#server.servlet.context-path=/api
+
+spring.data.mongodb.uri=mongodb://my-db:27017/flash-waimai
+spring.data.mongodb.username=enilu
+spring.data.mongodb.password=enilu123456
+
+##全局参数
+cfg.tencentkey=RLHBZ-WMPRP-Q3JDS-V2IQA-JNRFH-EJBHL
+cfg.tencentkey2=RRXBZ-WC6KF-ZQSJT-N2QU7-T5QIT-6KF5X
+cfg.tencentkey3=OHTBZ-7IFRG-JG2QF-IHFUK-XTTK6-VXFBN
+
+## api
+api.qq.map.url=https://apis.map.qq.com/ws/

+ 1 - 1
flash-waimai-api/src/main/resources/logback.xml

@@ -15,7 +15,7 @@
 	<!-- 向文件输出日志 -->
 	<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
 		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-			<fileNamePattern>/Users/maggie/app/waimai/runtime/log/api_%d{yyyy-MM-dd}.log</fileNamePattern>
+			<fileNamePattern>/data/flash-waimai/runtime/log/api_%d{yyyy-MM-dd}.log</fileNamePattern>
 			<maxHistory>1000</maxHistory>
 		</rollingPolicy>
 		<encoder>

+ 1 - 5
flash-waimai-core/src/main/java/cn/enilu/flash/bean/AppConfiguration.java

@@ -19,11 +19,7 @@ public class AppConfiguration {
     @Value("${cfg.tencentkey2}")
     private String tencentKey2;
     @Value("${cfg.tencentkey3}")
-    private String tencentKey3;
-    @Value("${cfg.baidukey}")
-    private String baiduKey;
-    @Value("${cfg.baidukey2}")
-    private String baiduKey2;
+    private String tencentKey3;    
     @Value("${img.dir}")
     private String imgDir;
 

+ 1 - 0
flash-waimai-core/src/main/java/cn/enilu/flash/bean/vo/business/LoginVo.java

@@ -6,4 +6,5 @@ public class LoginVo{
     private String username;
     private String password;
     private String captchaCode;
+    private String captchCodeId;
 }

+ 7 - 2
flash-waimai-core/src/main/java/cn/enilu/flash/cache/TokenCache.java

@@ -14,12 +14,17 @@ public   class TokenCache {
 
     @Autowired
     private EhcacheDao ehcacheDao;
-
+    public void put(String key,Object value){
+        ehcacheDao.hset(EhcacheDao.SESSION,key,value);
+    }
+     public <T> T get(String key,Class<T> klass){
+         return ehcacheDao.hget(EhcacheDao.SESSION, key,klass);
+     }
     public   void put(String token, Long idUser) {
         ehcacheDao.hset(EhcacheDao.SESSION,token, idUser);
     }
 
-    public   Long get(String token) {
+    public   Long getToken(String token) {
         return ehcacheDao.hget(EhcacheDao.SESSION,token,Long.class);
     }
     public Long getIdUser(){

+ 0 - 3
flash-waimai-core/src/main/java/cn/enilu/flash/service/system/FileService.java

@@ -5,7 +5,6 @@ import cn.enilu.flash.bean.constant.cache.CacheKey;
 import cn.enilu.flash.bean.entity.system.FileInfo;
 import cn.enilu.flash.bean.enumeration.ConfigKeyEnum;
 import cn.enilu.flash.cache.ConfigCache;
-import cn.enilu.flash.cache.TokenCache;
 import cn.enilu.flash.dao.system.FileInfoRepository;
 import cn.enilu.flash.security.JwtUtil;
 import cn.enilu.flash.service.BaseService;
@@ -31,8 +30,6 @@ public class FileService extends BaseService<FileInfo,Long,FileInfoRepository> {
     private ConfigCache configCache;
     @Autowired
     private FileInfoRepository fileInfoRepository;
-    @Autowired
-    private TokenCache tokenCache;
 
     /**
      * 文件上传

+ 6 - 6
flash-waimai-core/src/main/java/cn/enilu/flash/service/task/TaskService.java

@@ -41,19 +41,19 @@ public class TaskService extends BaseService<Task,Long,TaskRepository> {
 	}
 
 @Override
-	public Task update(Task task) {
-		logger.info("更新定时任务{}", task.getName());
-		taskRepository.save(task);
+	public Task update(Task record) {
+		logger.info("更新定时任务{}", record.getName());
+		taskRepository.save(record);
 		try {
-			QuartzJob job = jobService.getJob(task.getId().toString(), task.getJobGroup());
+			QuartzJob job = jobService.getJob(record.getId().toString(), record.getJobGroup());
 			if (job != null) {
 				jobService.deleteJob(job);
 			}
-			jobService.addJob(jobService.getJob(task));
+			jobService.addJob(jobService.getJob(record));
 		} catch (SchedulerException e) {
 			logger.error(e.getMessage(), e);
 		}
-		return task;
+		return record;
 	}
 
 

+ 1 - 1
flash-waimai-manage/config/prod.env.js

@@ -1,5 +1,5 @@
 'use strict'
 module.exports = {
   NODE_ENV: '"production"',
-  BASE_API: '"http://flash-api.enilu.cn/"',
+  BASE_API: '"http://waimai-api.microapp.store"',
 }

+ 0 - 2
flash-waimai-manage/src/permission.js

@@ -39,7 +39,6 @@ router.beforeEach((to, from, next) => {
           // next()
         }).catch((err) => {
           store.dispatch('FedLogOut').then(() => {
-            console.log('1111111'.err)
             // Message.error(err || 'Verification failed, please login again')
             next({ path: '/' })
           })
@@ -47,7 +46,6 @@ router.beforeEach((to, from, next) => {
       } else {
         // 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
         if (hasPermission(store.getters.roles, to.meta.roles)) {
-          console.log('next')
           next()
         } else {
           console.log(401)

+ 0 - 3
flash-waimai-manage/src/views/business/shop/add.js

@@ -123,10 +123,8 @@ export default {
     addressSelect(address) {
       this.formData.latitude = address.latitude
       this.formData.longitude = address.longitude
-      console.log(this.formData.latitude, this.formData.longitude)
     },
     handleShopAvatarScucess(res, file) {
-      console.log('res', res)
       this.formData.imagePath = getApiUrl() + '/file/getImgStream?fileName=' + res.data.realFileName
       this.formData.image_path = res.data.realFileName
     },
@@ -222,7 +220,6 @@ export default {
           const activitiesJson = JSON.stringify(activities)
           delete this.formData.activities
           this.formData.activitiesJson = activitiesJson
-          console.log(this.formData)
           addShop(this.formData).then(response => {
             this.$message({
               type: 'success',

+ 2 - 1
flash-waimai-manage/src/views/business/shop/index.vue

@@ -113,7 +113,8 @@
             <el-form-item label="商铺图片" label-width="100px">
               <el-upload
                 class="avatar-uploader"
-                :action="fileMgrUrl + '/v1/addimg/shop'"
+                :action="fileMgrUrl"
+                :headers="uploadHeaders"
                 :show-file-list="false"
                 :on-success="handleServiceAvatarScucess"
                 :before-upload="beforeAvatarUpload">

+ 11 - 15
flash-waimai-manage/src/views/business/shop/shop.js

@@ -1,4 +1,5 @@
 import { getApiUrl } from '@/utils/utils'
+import { getToken } from '@/utils/auth'
 import { cityGuess } from '@/api/getData'
 import {
   getResturants,
@@ -13,11 +14,11 @@ export default {
   data() {
     return {
       city: {},
-
-      // offset: 0,
-      // limit: 20,
       count: 0,
-      fileMgrUrl: getApiUrl(),
+      fileMgrUrl: getApiUrl() + '/file',
+      uploadHeaders: {
+        'Authorization': ''
+      },
       tableData: [],
       currentPage: 1,
       selectTable: {},
@@ -34,6 +35,7 @@ export default {
   },
   created() {
     this.initData()
+    this.uploadHeaders['Authorization'] = getToken()
   },
 
   methods: {
@@ -78,11 +80,9 @@ export default {
       }
     },
     async fetchData() {
-      // const {latitude, longitude} = this.city;
       const latitude = ''
       const longitude = ''
       getResturants({ page: this.listQuery.page, limit: this.listQuery.limit }).then(response => {
-        console.log(response)
         const restaurants = response.data.records
         this.total = response.data.total
         this.tableData = []
@@ -127,8 +127,7 @@ export default {
     },
     handleEdit(index, row) {
       this.selectTable = row
-      this.selectTable.image = getApiUrl() + '/file/getImgStream?fileName=' + row.image_path
-      console.log(this.selectTable)
+      this.selectTable.image = getApiUrl() + '/file/getImgStream?fileName=' + row.image_path    
       this.address.address = row.address
       this.dialogFormVisible = true
       this.selectedCategory = row.category.split('/')
@@ -180,11 +179,9 @@ export default {
       this.address = { address, latitude, longitude }
     },
     handleServiceAvatarScucess(res, file) {
-      if (res.status == 1) {
-        this.selectTable.image_path = res.image_path
-      } else {
-        this.$message.error('上传图片失败!')
-      }
+      this.selectTable.image_path = res.data.realFileName
+      this.selectTable.image =  getApiUrl() + '/file/getImgStream?fileName=' + res.data.realFileName
+      
     },
     beforeAvatarUpload(file) {
       const isRightType = (file.type === 'image/jpeg') || (file.type === 'image/png')
@@ -202,8 +199,7 @@ export default {
       this.dialogFormVisible = false
       try {
         Object.assign(this.selectTable, this.address)
-        this.selectTable.category = this.selectedCategory.join('/')
-        console.log(this.selectTable)
+        this.selectTable.category = this.selectedCategory.join('/')         
         updateResturant(this.selectTable).then(response => {
           this.$message({
             type: 'success',

+ 1 - 1
flash-waimai-mobile/config/index.js

@@ -9,7 +9,7 @@ module.exports = {
         index: path.resolve(__dirname, '../elm/index.html'),
         assetsRoot: path.resolve(__dirname, '../elm'),
         assetsSubDirectory: 'static',
-        assetsPublicPath: '/elm/',
+        assetsPublicPath: '/',
         productionSourceMap: true,
         // Surge or Netlify already gzip all static assets for you.
         // Before setting to `true`, make sure to:

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

@@ -14,12 +14,10 @@ let imgBaseUrl = '';
 
 if (process.env.NODE_ENV == 'development') {
     // imgBaseUrl = '/img/';
-        imgBaseUrl = '/file/getImgStream?fileName='
-  console.log('development',baseUrl)
+        imgBaseUrl = '/file/getImgStream?fileName='  
 }else if(process.env.NODE_ENV == 'production'){
-	baseUrl = '//elm.cangdu.org';
-	console.log('product',baseUrl)
-    imgBaseUrl = '//elm.cangdu.org/img/';
+	baseUrl = '//waimai-api.microapp.store';
+    imgBaseUrl = '//waimai-api.microapp.store/file/getImgStream?fileName=';
 }
 
 export {

+ 6 - 3
flash-waimai-mobile/src/page/login/login.vue

@@ -69,6 +69,7 @@
                 userAccount: null, //用户名
                 passWord: null, //密码
                 captchaCodeImg: null, //验证码地址
+                captchCodeId:null,//验证码id
                 codeNumber: null, //验证码
                 showAlert: false, //显示提示组件
                 alertText: null, //提示的内容
@@ -101,8 +102,10 @@
             },
             //获取验证吗,线上环境使用固定的图片,生产环境使用真实的验证码
             async getCaptchaCode(){
-                let res = await getcaptchas();
-                this.captchaCodeImg = res.code;
+                let res = await getcaptchas()
+                console.log('res',res)
+                this.captchaCodeImg = res.code
+                this.captchCodeId = res.captchCodeId
             },
             //获取短信验证码
             async getVerifyCode(){
@@ -164,7 +167,7 @@
                         return
                     }
                     //用户名登录
-                    this.userInfo = await accountLogin(this.userAccount, this.passWord, this.codeNumber);
+                    this.userInfo = await accountLogin(this.userAccount, this.passWord, this.codeNumber,this.captchCodeId);
                 }
                 //如果返回的值不正确,则弹出提示框,返回的值正确则返回上一页
                 if (!this.userInfo.user_id) {

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

@@ -458,7 +458,7 @@ export const deleteAddress = (userid, addressid) => fetch( '/v1/users/' + userid
 /**
  * 账号密码登录
  */
-export const accountLogin = (username, password, captchaCode) => fetch('/v1/users/v2/login', {username, password, captchaCode}, 'POST');
+export const accountLogin = (username, password, captchaCode,captchCodeId ) => fetch('/v1/users/v2/login', {username, password, captchaCode,captchCodeId}, 'POST');
 
 
 /**