Fixing .gitignore
This commit is contained in:
@@ -1,64 +1,64 @@
|
||||
/**
|
||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||
*
|
||||
* https://www.renren.io
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.validator.ValidatorUtils;
|
||||
import com.peanut.modules.app.form.LoginForm;
|
||||
import com.peanut.modules.app.service.UserService;
|
||||
import com.peanut.modules.app.utils.JwtUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* APP登录授权
|
||||
*
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@Api("APP登录接口")
|
||||
public class AppLoginController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private JwtUtils jwtUtils;
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@PostMapping("login")
|
||||
@ApiOperation("登录")
|
||||
public R login(@RequestBody LoginForm form){
|
||||
//表单校验
|
||||
ValidatorUtils.validateEntity(form);
|
||||
|
||||
//用户登录
|
||||
long userId = userService.login(form);
|
||||
|
||||
//生成token
|
||||
String token = jwtUtils.generateToken(userId);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("token", token);
|
||||
map.put("expire", jwtUtils.getExpire());
|
||||
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||
*
|
||||
* https://www.renren.io
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.validator.ValidatorUtils;
|
||||
import com.peanut.modules.app.form.LoginForm;
|
||||
import com.peanut.modules.app.service.UserService;
|
||||
import com.peanut.modules.app.utils.JwtUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* APP登录授权
|
||||
*
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@Api("APP登录接口")
|
||||
public class AppLoginController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private JwtUtils jwtUtils;
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@PostMapping("login")
|
||||
@ApiOperation("登录")
|
||||
public R login(@RequestBody LoginForm form){
|
||||
//表单校验
|
||||
ValidatorUtils.validateEntity(form);
|
||||
|
||||
//用户登录
|
||||
long userId = userService.login(form);
|
||||
|
||||
//生成token
|
||||
String token = jwtUtils.generateToken(userId);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("token", token);
|
||||
map.put("expire", jwtUtils.getExpire());
|
||||
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
/**
|
||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||
*
|
||||
* https://www.renren.io
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.validator.ValidatorUtils;
|
||||
import com.peanut.modules.app.entity.UserEntity;
|
||||
import com.peanut.modules.app.form.RegisterForm;
|
||||
import com.peanut.modules.app.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@Api("APP注册接口")
|
||||
public class AppRegisterController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@PostMapping("register")
|
||||
@ApiOperation("注册")
|
||||
public R register(@RequestBody RegisterForm form){
|
||||
//表单校验
|
||||
ValidatorUtils.validateEntity(form);
|
||||
|
||||
UserEntity user = new UserEntity();
|
||||
user.setMobile(form.getMobile());
|
||||
user.setUsername(form.getMobile());
|
||||
user.setPassword(DigestUtils.sha256Hex(form.getPassword()));
|
||||
user.setCreateTime(new Date());
|
||||
userService.save(user);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||
*
|
||||
* https://www.renren.io
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.validator.ValidatorUtils;
|
||||
import com.peanut.modules.app.entity.UserEntity;
|
||||
import com.peanut.modules.app.form.RegisterForm;
|
||||
import com.peanut.modules.app.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@Api("APP注册接口")
|
||||
public class AppRegisterController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@PostMapping("register")
|
||||
@ApiOperation("注册")
|
||||
public R register(@RequestBody RegisterForm form){
|
||||
//表单校验
|
||||
ValidatorUtils.validateEntity(form);
|
||||
|
||||
UserEntity user = new UserEntity();
|
||||
user.setMobile(form.getMobile());
|
||||
user.setUsername(form.getMobile());
|
||||
user.setPassword(DigestUtils.sha256Hex(form.getPassword()));
|
||||
user.setCreateTime(new Date());
|
||||
userService.save(user);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||
*
|
||||
* https://www.renren.io
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.app.annotation.Login;
|
||||
import com.peanut.modules.app.annotation.LoginUser;
|
||||
import com.peanut.modules.app.entity.UserEntity;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* APP测试接口
|
||||
*
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@Api("APP测试接口")
|
||||
public class AppTestController {
|
||||
|
||||
@Login
|
||||
@GetMapping("userInfo")
|
||||
@ApiOperation("获取用户信息")
|
||||
public R userInfo(@LoginUser UserEntity user){
|
||||
return R.ok().put("user", user);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("userId")
|
||||
@ApiOperation("获取用户ID")
|
||||
public R userInfo(@RequestAttribute("userId") Integer userId){
|
||||
return R.ok().put("userId", userId);
|
||||
}
|
||||
|
||||
@GetMapping("notToken")
|
||||
@ApiOperation("忽略Token验证测试")
|
||||
public R notToken(){
|
||||
return R.ok().put("msg", "无需token也能访问。。。");
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||
*
|
||||
* https://www.renren.io
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.app.annotation.Login;
|
||||
import com.peanut.modules.app.annotation.LoginUser;
|
||||
import com.peanut.modules.app.entity.UserEntity;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* APP测试接口
|
||||
*
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@Api("APP测试接口")
|
||||
public class AppTestController {
|
||||
|
||||
@Login
|
||||
@GetMapping("userInfo")
|
||||
@ApiOperation("获取用户信息")
|
||||
public R userInfo(@LoginUser UserEntity user){
|
||||
return R.ok().put("user", user);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("userId")
|
||||
@ApiOperation("获取用户ID")
|
||||
public R userInfo(@RequestAttribute("userId") Integer userId){
|
||||
return R.ok().put("userId", userId);
|
||||
}
|
||||
|
||||
@GetMapping("notToken")
|
||||
@ApiOperation("忽略Token验证测试")
|
||||
public R notToken(){
|
||||
return R.ok().put("msg", "无需token也能访问。。。");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baidu.ueditor.ActionEnter;
|
||||
import com.peanut.common.utils.UEditorUpload;
|
||||
import com.peanut.modules.app.entity.UEditorFile;
|
||||
import com.peanut.modules.oss.service.OssService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/ueditor")
|
||||
public class UeditorController {
|
||||
|
||||
@Autowired
|
||||
ResourceLoader resourceLoader;
|
||||
@Autowired
|
||||
UEditorUpload ueditorUpload;
|
||||
|
||||
@RequestMapping("/config")
|
||||
@ResponseBody
|
||||
public String exec(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
@RequestParam(value = "action") String action,
|
||||
@RequestParam(value = "upfile", required = false) MultipartFile upfile) throws Exception {
|
||||
if (action.equals("config")) {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
response.setContentType("text/html");
|
||||
String rootPath = request.getSession().getServletContext().getRealPath("/");
|
||||
return new ActionEnter(request, rootPath).exec();
|
||||
} else if (action.equals("uploadimage")) {
|
||||
UEditorFile uEditorFile = ueditorUpload.uploadImage(upfile);
|
||||
String jsonString = JSONObject.toJSONString(uEditorFile);
|
||||
|
||||
return jsonString;
|
||||
} else if (action.equals("uploadfile")) {
|
||||
UEditorFile uEditorFile = ueditorUpload.uploadImage(upfile);
|
||||
String jsonString = JSONObject.toJSONString(uEditorFile);
|
||||
|
||||
return jsonString;
|
||||
}
|
||||
return "无效Action";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package com.peanut.modules.app.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baidu.ueditor.ActionEnter;
|
||||
import com.peanut.common.utils.UEditorUpload;
|
||||
import com.peanut.modules.app.entity.UEditorFile;
|
||||
import com.peanut.modules.oss.service.OssService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/ueditor")
|
||||
public class UeditorController {
|
||||
|
||||
@Autowired
|
||||
ResourceLoader resourceLoader;
|
||||
@Autowired
|
||||
UEditorUpload ueditorUpload;
|
||||
|
||||
@RequestMapping("/config")
|
||||
@ResponseBody
|
||||
public String exec(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
@RequestParam(value = "action") String action,
|
||||
@RequestParam(value = "upfile", required = false) MultipartFile upfile) throws Exception {
|
||||
if (action.equals("config")) {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
response.setContentType("text/html");
|
||||
String rootPath = request.getSession().getServletContext().getRealPath("/");
|
||||
return new ActionEnter(request, rootPath).exec();
|
||||
} else if (action.equals("uploadimage")) {
|
||||
UEditorFile uEditorFile = ueditorUpload.uploadImage(upfile);
|
||||
String jsonString = JSONObject.toJSONString(uEditorFile);
|
||||
|
||||
return jsonString;
|
||||
} else if (action.equals("uploadfile")) {
|
||||
UEditorFile uEditorFile = ueditorUpload.uploadImage(upfile);
|
||||
String jsonString = JSONObject.toJSONString(uEditorFile);
|
||||
|
||||
return jsonString;
|
||||
}
|
||||
return "无效Action";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user