readme修改
parent
a764ff57f0
commit
ccafe9b4f9
|
@ -100,11 +100,10 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里巴巴 json 解析 -->
|
||||
<!-- google json 解析 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.59</version>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("top.weimumu.loginapi.dao")
|
||||
@MapperScan("top.weimumu.loginapi.mapper")
|
||||
public class LoginApiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package top.weimumu.loginapi.VO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/31
|
||||
**/
|
||||
@Data
|
||||
public class ResultVO<T> {
|
||||
|
||||
/** 错误码. */
|
||||
private Integer code;
|
||||
|
||||
/** 提示信息. */
|
||||
private String msg;
|
||||
|
||||
/** 具体内容. */
|
||||
private T data;
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
package top.weimumu.loginapi.common;
|
||||
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2019/12/10
|
||||
**/
|
||||
|
||||
public class GlobalResult {
|
||||
// 响应业务状态
|
||||
private Integer status;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package top.weimumu.loginapi.common;
|
||||
|
||||
import java.util.Random;
|
||||
/**
|
||||
* calvin wong
|
||||
* */
|
||||
|
||||
public class KeyUtil {
|
||||
|
||||
/**
|
||||
* 生成唯一的主键
|
||||
* 格式: 时间+随机数
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String genUniqueKey() {
|
||||
Random random = new Random();
|
||||
Integer number = random.nextInt(900000) + 100000;
|
||||
|
||||
return System.currentTimeMillis() + String.valueOf(number);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package top.weimumu.loginapi.common;
|
||||
|
||||
import top.weimumu.loginapi.VO.ResultVO;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/4/1
|
||||
**/
|
||||
public class ResultVOUtils {
|
||||
|
||||
public static ResultVO success(Object object) {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
resultVO.setData(object);
|
||||
resultVO.setCode(0);
|
||||
resultVO.setMsg("成功");
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
public static ResultVO success() {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
public static ResultVO error(Integer code, String msg) {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
resultVO.setCode(code);
|
||||
resultVO.setMsg(msg);
|
||||
return resultVO;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package top.weimumu.loginapi.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 八字表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/bazi-info")
|
||||
public class BaziInfoController{
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package top.weimumu.loginapi.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 名字推荐表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/name-detail")
|
||||
public class NameDetailController{
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package top.weimumu.loginapi.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/name-info")
|
||||
public class NameInfoController{
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package top.weimumu.loginapi.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.weimumu.loginapi.common.GlobalResult;
|
||||
import top.weimumu.loginapi.dao.OrderMasterMapper;
|
||||
import top.weimumu.loginapi.form.OrderForm;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/25
|
||||
**/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class OrderController {
|
||||
@Autowired
|
||||
private OrderMasterMapper orderMasterMapper;
|
||||
|
||||
@PostMapping("/create")
|
||||
public GlobalResult create(@Valid OrderForm orderForm,
|
||||
BindingResult bindingResult
|
||||
){
|
||||
if (bindingResult.hasErrors())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package top.weimumu.loginapi.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.weimumu.loginapi.VO.ResultVO;
|
||||
import top.weimumu.loginapi.common.ResultVOUtils;
|
||||
import top.weimumu.loginapi.converter.OrderForm2OrderDTOConverter;
|
||||
import top.weimumu.loginapi.dto.OrderDTO;
|
||||
import top.weimumu.loginapi.enums.ResultEnum;
|
||||
import top.weimumu.loginapi.exception.NameException;
|
||||
import top.weimumu.loginapi.form.OrderForm;
|
||||
import top.weimumu.loginapi.service.IOrderMasterService;
|
||||
import top.weimumu.loginapi.service.IUserService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
@Slf4j
|
||||
public class OrderMasterController{
|
||||
|
||||
@Autowired
|
||||
private IOrderMasterService iOrderMasterService;
|
||||
|
||||
@Autowired
|
||||
private IUserService iUserService;
|
||||
|
||||
//创建订单
|
||||
@PostMapping("/create")
|
||||
public ResultVO<Map<String,String>> create(@Valid OrderForm orderForm,
|
||||
BindingResult bindingResult){
|
||||
//校验参数
|
||||
if (bindingResult.hasErrors()) {
|
||||
log.error("【订单生成】参数不正确,orderForm={}",orderForm);
|
||||
throw new NameException(ResultEnum.PARAM_ERROR);
|
||||
}
|
||||
OrderDTO orderDTO = OrderForm2OrderDTOConverter.convert(orderForm);
|
||||
OrderDTO createResult = iOrderMasterService.saveInfo(orderDTO);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("orderId", createResult.getOrder_id());
|
||||
|
||||
return ResultVOUtils.success(map);
|
||||
}
|
||||
}
|
|
@ -1,63 +1,19 @@
|
|||
package top.weimumu.loginapi.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.weimumu.loginapi.common.GlobalResult;
|
||||
import top.weimumu.loginapi.common.WechatUtil;
|
||||
import top.weimumu.loginapi.dao.UserMapper;
|
||||
import top.weimumu.loginapi.entity.User;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2019/12/4
|
||||
**/
|
||||
* <p>
|
||||
* 用户表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@RestController
|
||||
public class UserController {
|
||||
@RequestMapping("/sys/user")
|
||||
public class UserController{
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@PostMapping("/wxlogin")
|
||||
public GlobalResult wxLogin(
|
||||
@RequestParam(value = "code", required = false) String code,
|
||||
@RequestParam(value = "rawData", required = false) String rawData
|
||||
) {
|
||||
JSONObject rawDataJson = JSON.parseObject(rawData);
|
||||
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code);
|
||||
String openid = SessionKeyOpenId.getString("openid");
|
||||
String sessionKey = SessionKeyOpenId.getString("session_key");
|
||||
User user = this.userMapper.selectById(openid);
|
||||
String skey = UUID.randomUUID().toString();
|
||||
if (user == null) {
|
||||
String nickName = rawDataJson.getString("nickName");
|
||||
String avatarUrl = rawDataJson.getString("avatarUrl");
|
||||
user = new User();
|
||||
user.setOpenId(openid);
|
||||
user.setSkey(skey);
|
||||
user.setCreateTime(new Date());
|
||||
user.setLastVisitTime(new Date());
|
||||
user.setSession_key(sessionKey);
|
||||
user.setAvatarUrl(avatarUrl);
|
||||
user.setNickName(nickName);
|
||||
this.userMapper.insert(user);
|
||||
}else {
|
||||
// 已存在,更新用户登录时间
|
||||
|
||||
user.setLastVisitTime(new Date());
|
||||
// // 重新设置会话skey
|
||||
user.setSkey(skey);
|
||||
|
||||
this.userMapper.updateById(user);
|
||||
}
|
||||
GlobalResult result = GlobalResult.build(200, null, skey);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package top.weimumu.loginapi.converter;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import top.weimumu.loginapi.dto.OrderDTO;
|
||||
import top.weimumu.loginapi.entity.NameDetail;
|
||||
import top.weimumu.loginapi.enums.ResultEnum;
|
||||
import top.weimumu.loginapi.exception.NameException;
|
||||
import top.weimumu.loginapi.form.OrderForm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Slf4j
|
||||
public class OrderForm2OrderDTOConverter {
|
||||
|
||||
public static OrderDTO convert(OrderForm orderForm) {
|
||||
Gson gson = new Gson();
|
||||
OrderDTO orderDTO = new OrderDTO();
|
||||
|
||||
orderDTO.setOpen_id(orderForm.getOpen_id());
|
||||
orderDTO.setSurname(orderForm.getSurname());
|
||||
orderDTO.setGender(orderForm.getGender());
|
||||
orderDTO.setBirth_time(orderForm.getBirth_time());
|
||||
|
||||
List<NameDetail> orderDetailList = new ArrayList<>();
|
||||
|
||||
orderDTO.setOrderDetailList(orderDetailList);
|
||||
|
||||
|
||||
return orderDTO;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package top.weimumu.loginapi.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import top.weimumu.loginapi.entity.NameDetail;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/24
|
||||
**/
|
||||
public interface NameDetailMapper extends BaseMapper<NameDetail> {
|
||||
}
|
|
@ -20,7 +20,7 @@ public class OrderDTO {
|
|||
private String surname;
|
||||
|
||||
/** 性别 */
|
||||
private Integer sex;
|
||||
private Integer gender;
|
||||
|
||||
/** 出生日期 */
|
||||
private Date birth_time;
|
||||
|
@ -31,6 +31,9 @@ public class OrderDTO {
|
|||
/** 用户身份识别open_id*/
|
||||
private String open_id;
|
||||
|
||||
/** 八字id*/
|
||||
private Integer bazi_id;
|
||||
|
||||
/** 创建时间. */
|
||||
private Date createTime;
|
||||
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
package top.weimumu.loginapi.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/20
|
||||
**/
|
||||
* <p>
|
||||
* 八字表
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("Bazi_info")
|
||||
@Accessors(chain = true)
|
||||
public class BaziInfo {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "bazi_id", type = IdType.AUTO)
|
||||
private Integer baziId;
|
||||
|
||||
/**
|
||||
|
@ -23,15 +29,13 @@ public class BaziInfo {
|
|||
private String baziType;
|
||||
|
||||
/**
|
||||
* 八字内容
|
||||
* 喜用神信息
|
||||
*/
|
||||
private String baziContent;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,45 +1,59 @@
|
|||
package top.weimumu.loginapi.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/24
|
||||
**/
|
||||
|
||||
* <p>
|
||||
* 名字推荐表
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("name_detail")
|
||||
public class NameDetail {
|
||||
/** id */
|
||||
private String detail_id;
|
||||
@Accessors(chain = true)
|
||||
public class NameDetail{
|
||||
|
||||
/** 名字*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String detailId;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String ming;
|
||||
|
||||
/** 名字id号 */
|
||||
private String name_id;
|
||||
/**
|
||||
* 名字id
|
||||
*/
|
||||
private String nameId;
|
||||
|
||||
/** 八字id*/
|
||||
private Integer bazi_id;
|
||||
/**
|
||||
* 八字id
|
||||
*/
|
||||
private Integer baziId;
|
||||
|
||||
/** 姓氏*/
|
||||
/**
|
||||
* 姓氏
|
||||
*/
|
||||
private String surname;
|
||||
|
||||
/** 评分 */
|
||||
/**
|
||||
* 得分
|
||||
*/
|
||||
private BigDecimal score;
|
||||
|
||||
/** 八字信息 */
|
||||
private String bazi_content;
|
||||
/**
|
||||
* 八字信息
|
||||
*/
|
||||
private String baziContent;
|
||||
|
||||
/** 创建时间*/
|
||||
private Timestamp createTime;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 修改时间*/
|
||||
private Timestamp updateTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,40 +1,54 @@
|
|||
package top.weimumu.loginapi.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/23
|
||||
**/
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("name_info")
|
||||
public class NameInfo {
|
||||
@Accessors(chain = true)
|
||||
public class NameInfo {
|
||||
|
||||
/** 主键id */
|
||||
private String name_id;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 姓氏 */
|
||||
private String nameId;
|
||||
|
||||
/**
|
||||
* 姓氏
|
||||
*/
|
||||
private String surname;
|
||||
|
||||
/** 名字 */
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String ming;
|
||||
|
||||
/** 性别*/
|
||||
/**
|
||||
* 性别 1男 2女
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/** 评分 */
|
||||
/**
|
||||
* 名字评分
|
||||
*/
|
||||
private BigDecimal score;
|
||||
|
||||
/** 八字id*/
|
||||
private Integer bazi_id;
|
||||
/**
|
||||
* 八字id
|
||||
*/
|
||||
private Integer baiziId;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 创建时间*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/** 修改时间*/
|
||||
private Timestamp updateTime;
|
||||
}
|
||||
|
|
|
@ -1,57 +1,38 @@
|
|||
package top.weimumu.loginapi.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/20
|
||||
**/
|
||||
* <p>
|
||||
* 订单表
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("order_master")
|
||||
@Accessors(chain = true)
|
||||
public class OrderMaster {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 姓氏
|
||||
*/
|
||||
private LocalDateTime birthTime;
|
||||
|
||||
private String surname;
|
||||
|
||||
/**
|
||||
*
|
||||
* 出生时间
|
||||
*/
|
||||
private Timestamp birth_time;
|
||||
private String detailId;
|
||||
|
||||
/**
|
||||
* 名字详情id
|
||||
*/
|
||||
private String detail_id;
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 用户open_id
|
||||
*/
|
||||
private String open_id;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,55 +1,38 @@
|
|||
package top.weimumu.loginapi.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2019/12/10
|
||||
**/
|
||||
|
||||
* <p>
|
||||
* 用户表
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("user")
|
||||
public class User {
|
||||
/**
|
||||
* openid
|
||||
*/
|
||||
@TableId(value = "open_id",type = IdType.INPUT)
|
||||
@Accessors(chain = true)
|
||||
public class User{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String openId;
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
|
||||
private String sessionKey;
|
||||
|
||||
private LocalDateTime lastVisitTime;
|
||||
|
||||
private String avatarUrl;
|
||||
/**
|
||||
* 用户网名
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* session_key
|
||||
*/
|
||||
private String session_key;
|
||||
/**
|
||||
* skey
|
||||
*/
|
||||
|
||||
private String skey;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
@TableField("last_visit_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date lastVisitTime;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package top.weimumu.loginapi.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/4/2
|
||||
**/
|
||||
|
||||
@Getter
|
||||
public enum GenderEnum {
|
||||
BOY(1,"男孩"),
|
||||
GIRL(2,"女孩"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
GenderEnum(Integer code, String message){
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package top.weimumu.loginapi.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2019/12/10
|
||||
**/
|
||||
@Getter
|
||||
public enum ResultEnum {
|
||||
|
||||
SUCCESS(0, "成功"),
|
||||
|
||||
PARAM_ERROR(1, "参数不正确"),
|
||||
|
||||
ORDER_NOT_EXIST(12, "订单不存在"),
|
||||
|
||||
ORDERDETAIL_NOT_EXIST(13, "订单详情不存在"),
|
||||
|
||||
ORDER_STATUS_ERROR(14, "订单状态不正确"),
|
||||
|
||||
ORDER_UPDATE_FAIL(15, "订单更新失败"),
|
||||
|
||||
ORDER_DETAIL_EMPTY(16, "订单详情为空"),
|
||||
|
||||
ORDER_PAY_STATUS_ERROR(17, "订单支付状态不正确"),
|
||||
|
||||
ORDER_OWNER_ERROR(19, "该订单不属于当前用户"),
|
||||
|
||||
WECHAT_MP_ERROR(20, "微信公众账号方面错误"),
|
||||
|
||||
WXPAY_NOTIFY_MONEY_VERIFY_ERROR(21, "微信支付异步通知金额校验不通过"),
|
||||
|
||||
ORDER_CANCEL_SUCCESS(22, "订单取消成功"),
|
||||
|
||||
ORDER_FINISH_SUCCESS(23, "订单完结成功"),
|
||||
|
||||
LOGIN_FAIL(25, "登录失败, 登录信息不正确"),
|
||||
|
||||
LOGOUT_SUCCESS(26, "登出成功"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
ResultEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package top.weimumu.loginapi.exception;
|
||||
|
||||
import top.weimumu.loginapi.enums.ResultEnum;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/27
|
||||
**/
|
||||
public class NameException extends RuntimeException {
|
||||
private Integer code;
|
||||
|
||||
public NameException(ResultEnum resultEnum){
|
||||
super(resultEnum.getMessage());
|
||||
this.code = resultEnum.getCode();
|
||||
}
|
||||
|
||||
public NameException(Integer code,String message){
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
}
|
|
@ -12,6 +12,9 @@ import java.util.Date;
|
|||
|
||||
@Data
|
||||
public class OrderForm {
|
||||
/** 用户微信open_id*/
|
||||
@NotEmpty(message = "open_id不能为空")
|
||||
private String open_id;
|
||||
/** 姓氏*/
|
||||
@NotEmpty(message="姓氏不能为空")
|
||||
private String surname;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package top.weimumu.loginapi.dao;
|
||||
package top.weimumu.loginapi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import top.weimumu.loginapi.entity.BaziInfo;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/24
|
||||
**/
|
||||
* <p>
|
||||
* 八字表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface BaziInfoMapper extends BaseMapper<BaziInfo> {
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package top.weimumu.loginapi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import top.weimumu.loginapi.entity.NameDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 名字推荐表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface NameDetailMapper extends BaseMapper<NameDetail> {
|
||||
@Override
|
||||
List<NameDetail> selectList(Wrapper<NameDetail> queryWrapper);
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
package top.weimumu.loginapi.dao;
|
||||
package top.weimumu.loginapi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import top.weimumu.loginapi.entity.NameInfo;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/24
|
||||
**/
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface NameInfoMapper extends BaseMapper<NameInfo> {
|
||||
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
package top.weimumu.loginapi.dao;
|
||||
package top.weimumu.loginapi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import top.weimumu.loginapi.entity.OrderMaster;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/24
|
||||
**/
|
||||
* <p>
|
||||
* 订单表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface OrderMasterMapper extends BaseMapper<OrderMaster> {
|
||||
|
||||
}
|
|
@ -1,12 +1,16 @@
|
|||
package top.weimumu.loginapi.dao;
|
||||
package top.weimumu.loginapi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import top.weimumu.loginapi.entity.User;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2019/12/4
|
||||
**/
|
||||
* <p>
|
||||
* 用户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package top.weimumu.loginapi.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import top.weimumu.loginapi.entity.BaziInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 八字表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface IBaziInfoService extends IService<BaziInfo> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package top.weimumu.loginapi.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import top.weimumu.loginapi.entity.NameDetail;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 名字推荐表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface INameDetailService extends IService<NameDetail> {
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package top.weimumu.loginapi.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import top.weimumu.loginapi.dto.OrderDTO;
|
||||
import top.weimumu.loginapi.entity.NameInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface INameInfoService extends IService<NameInfo> {
|
||||
|
||||
/** 根据姓氏和生辰八字查询名字 */
|
||||
List<NameInfo> findList(OrderDTO orderDTO);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package top.weimumu.loginapi.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import top.weimumu.loginapi.dto.OrderDTO;
|
||||
import top.weimumu.loginapi.entity.OrderMaster;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface IOrderMasterService extends IService<OrderMaster> {
|
||||
/** 创建订单*/
|
||||
OrderDTO saveInfo(OrderDTO orderDTO);
|
||||
/** 删除订单*/
|
||||
OrderDTO removeInfo(OrderDTO orderDTO);
|
||||
/** 查询订单*/
|
||||
List<OrderDTO> getList(String openid);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package top.weimumu.loginapi.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import top.weimumu.loginapi.entity.User;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
public interface IUserService extends IService<User> {
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package top.weimumu.loginapi.service;
|
||||
|
||||
import top.weimumu.loginapi.dto.OrderDTO;
|
||||
|
||||
/**
|
||||
* @author: create by calvin wong
|
||||
* @date:2020/3/24
|
||||
**/
|
||||
public interface OrderService {
|
||||
// 创建订单
|
||||
OrderDTO<>
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package top.weimumu.loginapi.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.weimumu.loginapi.entity.BaziInfo;
|
||||
import top.weimumu.loginapi.mapper.BaziInfoMapper;
|
||||
import top.weimumu.loginapi.service.IBaziInfoService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 八字表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Service
|
||||
public class BaziInfoServiceImpl extends ServiceImpl<BaziInfoMapper, BaziInfo> implements IBaziInfoService {
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package top.weimumu.loginapi.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.weimumu.loginapi.entity.NameDetail;
|
||||
import top.weimumu.loginapi.mapper.NameDetailMapper;
|
||||
import top.weimumu.loginapi.service.INameDetailService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 名字推荐表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Service
|
||||
public class NameDetailServiceImpl extends ServiceImpl<NameDetailMapper, NameDetail> implements INameDetailService {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package top.weimumu.loginapi.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.weimumu.loginapi.dto.OrderDTO;
|
||||
import top.weimumu.loginapi.entity.NameInfo;
|
||||
import top.weimumu.loginapi.mapper.NameInfoMapper;
|
||||
import top.weimumu.loginapi.service.INameInfoService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Service
|
||||
public class NameInfoServiceImpl extends ServiceImpl<NameInfoMapper, NameInfo> implements INameInfoService {
|
||||
|
||||
@Autowired
|
||||
private NameInfoMapper nameInfoMapper;
|
||||
|
||||
@Override
|
||||
public List<NameInfo> findList(OrderDTO orderDTO){
|
||||
Map<String,Object> columnMap = new HashMap<>();
|
||||
columnMap.put("surname",orderDTO.getSurname());
|
||||
columnMap.put("gender", orderDTO.getGender());
|
||||
columnMap.put("bazi_id",orderDTO.getBazi_id());
|
||||
return nameInfoMapper.selectByMap(columnMap);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package top.weimumu.loginapi.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sun.org.apache.xml.internal.security.keys.KeyUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.weimumu.loginapi.common.KeyUtil;
|
||||
import top.weimumu.loginapi.dto.OrderDTO;
|
||||
import top.weimumu.loginapi.entity.NameDetail;
|
||||
import top.weimumu.loginapi.entity.NameInfo;
|
||||
import top.weimumu.loginapi.entity.OrderMaster;
|
||||
import top.weimumu.loginapi.mapper.OrderMasterMapper;
|
||||
import top.weimumu.loginapi.service.INameInfoService;
|
||||
import top.weimumu.loginapi.service.IOrderMasterService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Service
|
||||
public class OrderMasterServiceImpl extends ServiceImpl<OrderMasterMapper, OrderMaster> implements IOrderMasterService {
|
||||
|
||||
@Autowired
|
||||
private OrderMasterMapper orderMasterMapper;
|
||||
|
||||
@Autowired
|
||||
private INameInfoService iNameInfoService;
|
||||
@Override
|
||||
public OrderDTO saveInfo(OrderDTO orderDTO) {
|
||||
String orderId = KeyUtil.genUniqueKey();
|
||||
// 查询姓名库中10个名字
|
||||
List<NameDetail> nameInfoList= iNameInfoService.findList(orderDTO);
|
||||
// 刷选10个数据
|
||||
// 将数据入库namedetail
|
||||
// 写入订单
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderDTO removeInfo(OrderDTO orderDTO){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderDTO> getList(String openId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package top.weimumu.loginapi.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.weimumu.loginapi.entity.User;
|
||||
import top.weimumu.loginapi.mapper.UserMapper;
|
||||
import top.weimumu.loginapi.service.IUserService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author calvin
|
||||
* @since 2020-03-30
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
|
||||
|
||||
}
|
|
@ -39,5 +39,5 @@
|
|||
]
|
||||
},
|
||||
"usingComponents": {},
|
||||
"sitemapLocation": "sitemap94.json"
|
||||
"sitemapLocation": "sitemap25.json"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
}
|
113
README.md
113
README.md
|
@ -1,20 +1,40 @@
|
|||
# uni-app微信小程序----“起名”
|
||||
|
||||
## 第一章 uni-app入门
|
||||
## 第一章 简介
|
||||
|
||||
### 1-1 uni-app简介
|
||||
### 1-1 宝宝起名简介
|
||||
|
||||
> 来自给宝宝起名做的功课,了解一些国人在起名方面的讲究
|
||||
|
||||
#### 中国人起名有哪些讲究?
|
||||
|
||||
**首先得避讳;**
|
||||
|
||||
一避讳国讳;
|
||||
|
||||
二避讳帝王;
|
||||
|
||||
三避讳先贤;
|
||||
|
||||
四避讳先人;
|
||||
|
||||
五避讳虚拟人名;
|
||||
|
||||
六忌讳生僻字;
|
||||
|
||||
七避讳多音字;
|
||||
|
||||
**根据中国人文化传统起名**
|
||||
|
||||
三才五格法(通过笔画判定吉凶)
|
||||
|
||||
八字法(通过生辰判定五行盛衰)
|
||||
|
||||
寓意法(通过耳熟能详的美好诗句、成语组合起名)
|
||||
|
||||
|
||||
|
||||
### 1-2 小程序项目介绍
|
||||
|
||||
宝宝在线起名一直是中国人的刚需,与其路边寻找大师,不如求教线上业务
|
||||
|
||||
目前只在淘宝搜索:发现营业额极高,那就让我们把大师的价格打下去
|
||||
|
||||
![image-20200305151834887](C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20200305151834887.png)
|
||||
|
||||
![image-20200305151850634](C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20200305151850634.png)
|
||||
通过这些方法达到数理得当、八字匹配、寓意美好、高端大气;
|
||||
|
||||
### 数理派
|
||||
|
||||
|
@ -510,7 +530,21 @@
|
|||
|
||||
|
||||
|
||||
### 1-3 uni-app安装及目录介绍
|
||||
### 1-2 小程序简介
|
||||
|
||||
宝宝在线起名一直是中国人的刚需,与其路边寻找大师,不如求教线上业务
|
||||
|
||||
目前只在淘宝搜索:发现营业额极高,那如果用一个小程序将各大派系的起名逻辑整合上线,就能帮助大家在起名的时候省下一笔奶粉钱!
|
||||
|
||||
![image-20200305151834887](C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20200305151834887.png)
|
||||
|
||||
![image-20200305151850634](C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20200305151850634.png)
|
||||
|
||||
|
||||
|
||||
## 第二章 uni-app了解下
|
||||
|
||||
### 2-1 uni-app安装及目录介绍
|
||||
|
||||
#### 下载hbuilderx
|
||||
|
||||
|
@ -552,7 +586,7 @@ hx mac和win之间分为标准和APP版
|
|||
|
||||
|
||||
|
||||
### 1-4 uni-app配置
|
||||
### 2-2 uni-app配置
|
||||
|
||||
|
||||
|
||||
|
@ -578,11 +612,9 @@ pages.json
|
|||
|
||||
|
||||
|
||||
## 第二章 整体设计
|
||||
## 第三章 整体设计
|
||||
|
||||
### 2.1api接口设计
|
||||
|
||||
#### 首先我们了解下
|
||||
### 3-1 api接口设计
|
||||
|
||||
什么是前后端分离?
|
||||
|
||||
|
@ -600,8 +632,6 @@ pwa
|
|||
|
||||
本项目是一款基于 SpringBoot 的 Api 服务器脚手架。服务端基础通用框架提取,配以详细的说明文档,针对 Restful 风格 API 服务器,降低学习成本,提高开发效率
|
||||
|
||||
#### API设计规范
|
||||
|
||||
设计接口是一件容易的事,也是件困难的事。设计接口每个人都会,每个人都能设计,也由此产生了各种各样的理念的接口。工作这么多年,我也很有感悟。很多人会说,设计接口多么简单,只要命名好,然后联调通了,上线可以调用就行了。特别是非互联网行业的人,这里没有歧视的意思。因为互联网行业和传统行业太多不一致性决定了这种思想的产生。
|
||||
|
||||
|
||||
|
@ -610,13 +640,13 @@ pwa
|
|||
|
||||
**格式{ "data": 返回数据, "code": 状态码, "msg": "返回描述"}**
|
||||
|
||||
### 2.2 mysql数据库搭建
|
||||
### 3-2 mysql数据库搭建
|
||||
|
||||
本机vmware搭建centos7环境
|
||||
|
||||
使用docker安装mysql8
|
||||
|
||||
### 2.3 mysql数据库创建和设计规范
|
||||
### 3-3 mysql数据库创建和设计规范
|
||||
|
||||
> #### **《mysql设计规范》**
|
||||
>
|
||||
|
@ -837,7 +867,7 @@ Query OK, 0 rows affected (0.01 sec)
|
|||
|
||||
算法换成mysql_native_password即可
|
||||
|
||||
#### user数据表建立
|
||||
### 3-4 user数据表建立
|
||||
|
||||
配置application.yml
|
||||
|
||||
|
@ -852,30 +882,13 @@ spring:
|
|||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
```
|
||||
|
||||
创建表格
|
||||
|
||||
```
|
||||
CREATE TABLE `user` (
|
||||
`open_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'open_id',
|
||||
`skey` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'skey',
|
||||
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`last_visit_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
|
||||
`session_key` varchar(100) CHARACTER SET COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'session_key',
|
||||
`avatar_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像',
|
||||
`nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网名',
|
||||
PRIMARY KEY (`open_id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '微信用户信息' ;
|
||||
```
|
||||
|
||||
## 第四章 前端页面
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
## 第三章 前端页面
|
||||
|
||||
|
||||
|
||||
### 3.1 前端登录login开发
|
||||
### 4-1 前端登录login开发
|
||||
|
||||
前端使用uni-app
|
||||
|
||||
|
@ -1084,9 +1097,9 @@ export default {
|
|||
|
||||
|
||||
|
||||
## 第四章 uni-app业务逻辑开发
|
||||
## 第五章 uni-app业务逻辑开发
|
||||
|
||||
### 4.1 vuex在uni-app中的使用
|
||||
### 5-1 vuex在uni-app中的使用
|
||||
|
||||
```
|
||||
import Vue from 'vue'
|
||||
|
@ -1129,7 +1142,7 @@ export default store
|
|||
|
||||
|
||||
|
||||
### 4.2 登录功能实现
|
||||
### 5-2 登录功能实现
|
||||
|
||||
小程序已经抛弃getUserInfo,使用open-type绑定即可;
|
||||
|
||||
|
@ -1148,9 +1161,9 @@ export default store
|
|||
|
||||
|
||||
|
||||
## 第五章 springboot开发后端接口
|
||||
## 第六章 springboot开发后端接口
|
||||
|
||||
### 4.1 entity
|
||||
### 6-1 entity
|
||||
|
||||
```
|
||||
package top.weimumu.loginapi.entity;
|
||||
|
@ -1211,7 +1224,7 @@ public class User {
|
|||
|
||||
```
|
||||
|
||||
### 4.2 mapper
|
||||
### 6-2 mapper
|
||||
|
||||
```
|
||||
package top.weimumu.loginapi.dao;
|
||||
|
@ -1229,7 +1242,7 @@ public interface UserMapper extends BaseMapper<User> {
|
|||
|
||||
```
|
||||
|
||||
### 4.3 common封装工具类
|
||||
### 6-3 common封装工具类
|
||||
|
||||
GolbalResult
|
||||
|
||||
|
@ -1561,7 +1574,7 @@ public class WechatUtil {
|
|||
|
||||
```
|
||||
|
||||
### 4.3 controller
|
||||
### 6-4 controller
|
||||
|
||||
```
|
||||
package top.weimumu.loginapi.controller;
|
||||
|
|
Loading…
Reference in New Issue