hmp 4 лет назад
Родитель
Сommit
4cf46fc2a5

+ 37 - 7
src/main/java/org/springblade/gateway/login_gateway/controller/LoginController.java

@@ -1,29 +1,59 @@
 package org.springblade.gateway.login_gateway.controller;
 
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.support.Condition;
 import org.springblade.core.tool.api.R;
 import org.springblade.gateway.login_gateway.service.LoginService;
+import org.springblade.sing.user.entity.LoginUser;
+import org.springblade.sing.user.service.ILoginUserService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 
+
+/**
+ * @author cy-computer
+ */
 @RestController
 @RequestMapping("/user/login")
 @Api(value = "用户登录控制器", tags = "登录接口")
+@AllArgsConstructor
 public class LoginController {
-	@Autowired
+
 	private LoginService loginService;
+	private ILoginUserService loginUserService;
 
 	/**
 	 * 登陆校验
 	 * 判断是否为移动用户
 	 */
 	@GetMapping("/isCMCC")
-	public R<Boolean> isCMCC(@ApiParam(value = "用户ID",required = true) @RequestParam Long userId){
-		return R.status(loginService.isCMCC(userId));
+	public R<Boolean> isCMCC(@ApiParam(value = "手机号",required = true) @RequestParam String phone){
+		return R.data(loginService.isCMCC(phone));
 	}
+
+	/**
+	 * 用户登录
+	 */
+	@PostMapping("/login")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "用户登录", notes = "传入loginUser")
+	public R login(@Valid @RequestBody LoginUser loginUser) {
+		LoginUser user = loginUserService.getOne(Condition.getQueryWrapper(new LoginUser()).lambda().eq(LoginUser::getOpenid, loginUser.getOpenid()));
+		if(user==null){
+			user = new LoginUser();
+			user.setAvatar(loginUser.getAvatar());
+			user.setNickName(loginUser.getNickName());
+			user.setOpenid(loginUser.getOpenid());
+			user.setSex(loginUser.getSex());
+			loginUserService.save(user);
+		}
+		return R.data(user);
+	}
+
 }

+ 2 - 2
src/main/java/org/springblade/gateway/login_gateway/service/LoginService.java

@@ -4,8 +4,8 @@ public interface LoginService {
 
 	/**
 	 * 判断登陆的手机号是否是移动号码
-	 * @param userId 用户id
+	 * @param phone 手机号
 	 * @return
 	 */
-	boolean isCMCC(Long userId);
+	boolean isCMCC(String phone);
 }

+ 3 - 4
src/main/java/org/springblade/gateway/login_gateway/service/impl/LoginServiceImpl.java

@@ -15,13 +15,12 @@ public class LoginServiceImpl implements LoginService {
 
 	/**
 	 * 判断是否是移动号码
-	 * @param userId
+	 * @param phone
 	 * @return
 	 */
 	@Override
-	public boolean isCMCC(Long userId) {
-		LoginUser loginUser = loginUserService.getById(userId);
-		if (Pattern.matches("^1(3[4-9]|5[012789]|8[278])\\d{8}$",loginUser.getPhone())){
+	public boolean isCMCC(String phone) {
+		if (Pattern.matches("^1(3[4-9]|5[012789]|8[278])\\d{8}$",phone)){
 			return true;
 		}
 		return false;

+ 1 - 1
src/main/java/org/springblade/modules/system/controller/DeptController.java

@@ -159,7 +159,7 @@ public class DeptController extends BladeController {
 	/**
 	 * 下拉数据源
 	 */
-	@PreAuth(AuthConstant.PERMIT_ALL)
+	@PreAuth(AuthConstant.PERMISSION_ALL)
 	@GetMapping("/select")
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "下拉数据源", notes = "传入id集合")

+ 1 - 1
src/main/java/org/springblade/modules/system/controller/RoleController.java

@@ -153,7 +153,7 @@ public class RoleController extends BladeController {
 	/**
 	 * 下拉数据源
 	 */
-	@PreAuth(AuthConstant.PERMIT_ALL)
+	@PreAuth(AuthConstant.PERMISSION_ALL)
 	@GetMapping("/select")
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "下拉数据源", notes = "传入id集合")

+ 2 - 2
src/main/java/org/springblade/sing/user/controller/LoginUserController.java

@@ -114,7 +114,7 @@ public class LoginUserController extends BladeController {
 		return R.status(loginUserService.saveOrUpdate(loginUser));
 	}
 
-	
+
 	/**
 	 * 删除 用户表
 	 */
@@ -125,5 +125,5 @@ public class LoginUserController extends BladeController {
 		return R.status(loginUserService.deleteLogic(Func.toLongList(ids)));
 	}
 
-	
+
 }

+ 1 - 1
src/main/resources/application-dev.yml

@@ -64,5 +64,5 @@ cmcc:
     # 签名key
     signKey: b47366a9df9d
     # 回调地址
-    callbackUrl: http://ldt.guosen-fumao.cn/
+    callbackUrl: https://ldt.guosen-fumao.cn/wapp/auth.html
 

+ 3 - 19
src/main/resources/wxConfig.properties

@@ -1,22 +1,6 @@
-#爱效科技
-#wx.appId = wx7e7a38f071b360e9
-#wx.appSecret = 4e862f91b48ac85a91380fa0991c9fda
-
-#guoxin
-#wx.appId = wx6dacff40877a1b1a
-#wx.appSecret = eac73798c4c509e43dc7cb475de82f4d
-
-#南粤药业
-#wx.appId = wx322e246549d7620d
-#wx.appSecret = 118059d75bc8c1a08162fc8a8cf5ac04
-
-# 音乐之声
-#wx.appId = wxf3f84c916a741cac
-#wx.appSecret = 8377629994436f17210500a11bbce6cc
-
-#联兑通客户端
-wx.client.appId = wx9ad53e8c83ae1a51
-wx.client.appSecret = 9b9b5eafad345f5664e5e373b8cae10a
+#音乐之声
+wx.client.appId = wx432ac69188f554a9
+wx.client.appSecret = 25fbbd170a3c551f0d3498c16259bc36
 
 
 wx.shop.appId = wx2db9c41e85d5a4fc