|
@@ -1,19 +1,40 @@
|
|
package com.fdkankan.ucenter.controller.app;
|
|
package com.fdkankan.ucenter.controller.app;
|
|
|
|
|
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
|
|
+import com.fdkankan.common.util.JwtUtil;
|
|
|
|
+import com.fdkankan.common.util.SecurityUtil;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
|
+import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
|
+import com.fdkankan.ucenter.entity.User;
|
|
import com.fdkankan.ucenter.service.ISceneProService;
|
|
import com.fdkankan.ucenter.service.ISceneProService;
|
|
|
|
+import com.fdkankan.ucenter.service.IUserService;
|
|
|
|
+import com.fdkankan.ucenter.service.impl.LoginService;
|
|
|
|
+import com.fdkankan.ucenter.vo.request.LoginParam;
|
|
|
|
+import com.fdkankan.ucenter.vo.response.LoginVo;
|
|
|
|
+import com.fdkankan.ucenter.vo.response.UserVo;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/scene")
|
|
@RequestMapping("/scene")
|
|
public class SceneApiController {
|
|
public class SceneApiController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
ISceneProService sceneProService;
|
|
ISceneProService sceneProService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IUserService userService;
|
|
|
|
+ @Value("${main.url}")
|
|
|
|
+ private String mainUrl;
|
|
|
|
+ @Autowired
|
|
|
|
+ LoginService loginService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取指定场景信息
|
|
* 获取指定场景信息
|
|
@@ -23,4 +44,22 @@ public class SceneApiController {
|
|
public Result getInfo(@RequestParam(required = false) String num){
|
|
public Result getInfo(@RequestParam(required = false) String num){
|
|
return Result.success( sceneProService.getInfo(num) );
|
|
return Result.success( sceneProService.getInfo(num) );
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //app调用 跳转到官网消费页面
|
|
|
|
+ @RequestMapping("goConsumptionPage")
|
|
|
|
+ public void goConsumptionPage(HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
|
|
+ String phoneNum = request.getParameter("phoneNum");
|
|
|
|
+ String password = request.getParameter("password");
|
|
|
|
+ String lang = request.getParameter("lang");
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isEmpty(phoneNum) || StringUtils.isEmpty(password)){
|
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
|
+ }
|
|
|
|
+ LoginParam param = new LoginParam();
|
|
|
|
+ param.setPhoneNum(phoneNum);
|
|
|
|
+ param.setPassword(password);
|
|
|
|
+ LoginVo loginVo = loginService.login(param);
|
|
|
|
+ //登录成功
|
|
|
|
+ response.sendRedirect(mainUrl + "mobile.html?token="+ loginVo.getToken() + "&app" + (lang == null ? "" : "&lang=" + lang)+"#/consumption/0" );
|
|
|
|
+ }
|
|
}
|
|
}
|