sql/xc_mall.sql
@@ -353,4 +353,21 @@ )comment '版本表'; alter table mall_order_info add pay_trade_no text null comment '支付交易单号'; alter table mall_member add bind_phone varchar(20) null comment '绑定手机号(仅全民商城用得到)'; DROP TABLE IF EXISTS mall_news_info; CREATE TABLE mall_news_info( REVISION INT COMMENT '乐观锁' , CREATED_BY VARCHAR(32) COMMENT '创建人' , CREATED_TIME DATETIME COMMENT '创建时间' , UPDATED_BY VARCHAR(32) COMMENT '更新人' , UPDATED_TIME DATETIME COMMENT '更新时间' , ID BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键' , title VARCHAR(255) COMMENT '标题' , content TEXT COMMENT '内容' , target_id BIGINT COMMENT '跳转到目标ID' , type INT COMMENT '类型;1-文章2-跳转到产品' , PRIMARY KEY (ID) ) COMMENT = '新闻中心'; src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
@@ -22,5 +22,6 @@ registration.excludePathPatterns("/api/category/**"); registration.excludePathPatterns("/api/goods/**"); registration.excludePathPatterns("/api/pay/**"); registration.excludePathPatterns("/api/news/**"); } } src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
@@ -4,6 +4,7 @@ import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.entity.MallMemberPayment; import cc.mrbird.febs.mall.service.IApiMallMemberService; import cc.mrbird.febs.mall.service.ICommonService; import cc.mrbird.febs.mall.vo.MallMemberVo; import cc.mrbird.febs.mall.vo.MoneyFlowVo; import cc.mrbird.febs.mall.vo.TeamListVo; @@ -108,4 +109,11 @@ public FebsResponse findPayment() { return new FebsResponse().success().data(memberService.findMemberPayment()); } @ApiOperation(value = "绑定手机号") @PostMapping(value = "/bindPhone") public FebsResponse bindPhone(@RequestBody AccountAndCodeDto accountAndCodeDto) { return null; } } src/main/java/cc/mrbird/febs/mall/controller/ApiMallNewsController.java
New file @@ -0,0 +1,45 @@ package cc.mrbird.febs.mall.controller; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.mall.entity.MallNewsInfo; import cc.mrbird.febs.mall.service.IApiMallNewsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @author wzy * @date 2021-09-28 **/ @Slf4j @RestController @RequestMapping(value = "/api/news") @RequiredArgsConstructor @Api(value = "ApiMallNewsController", tags = "新闻接口类") public class ApiMallNewsController { private final IApiMallNewsService newsService; @ApiOperation(value = "新闻列表", notes = "新闻列表") @GetMapping(value = "/findNews") public FebsResponse findNews() { return new FebsResponse().success().data(newsService.list()); } @ApiOperation(value = "新闻详情", notes = "新闻详情") @GetMapping(value = "/newsDetails/{id}") public FebsResponse newsDetails(@PathVariable("id") Long id) { MallNewsInfo news = newsService.getById(id); if (news == null) { return new FebsResponse().fail().message("新闻不存在"); } return new FebsResponse().success().data(news); } } src/main/java/cc/mrbird/febs/mall/controller/CommonController.java
@@ -4,6 +4,7 @@ import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.*; import cc.mrbird.febs.mall.dto.AccountAndCodeDto; import cc.mrbird.febs.mall.dto.Base64UploadDto; import cc.mrbird.febs.mall.entity.DataDictionaryCustom; import cc.mrbird.febs.mall.service.ICommonService; @@ -142,4 +143,15 @@ public FebsResponse appVersion() { return new FebsResponse().message("获取成功").success().data(commonService.findAppVersion()); } @ApiOperation(value = "验证验证码接口") @PostMapping(value = "/checkCode") public FebsResponse checkCode(@RequestBody AccountAndCodeDto accountAndCodeDto) { boolean flag = commonService.verifyCode(accountAndCodeDto.getAccount(), accountAndCodeDto.getCode()); if (flag) { return new FebsResponse().success(); } return new FebsResponse().fail().message("验证码错误"); } } src/main/java/cc/mrbird/febs/mall/dto/AccountAndCodeDto.java
New file @@ -0,0 +1,20 @@ package cc.mrbird.febs.mall.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @author wzy * @date 2021-09-28 **/ @Data @ApiModel(value = "AccountAndCodeDto", description = "绑定手机号接收参数类") public class AccountAndCodeDto { @ApiModelProperty(value = "手机号") private String account; @ApiModelProperty(value = "验证码") private String code; } src/main/java/cc/mrbird/febs/mall/entity/MallMember.java
@@ -99,4 +99,6 @@ @TableField(exist = false) private String account; private String bindPhone; } src/main/java/cc/mrbird/febs/mall/entity/MallNewsInfo.java
New file @@ -0,0 +1,25 @@ package cc.mrbird.febs.mall.entity; import cc.mrbird.febs.common.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * @author wzy * @date 2021-09-28 **/ @Data @TableName("mall_news_info") public class MallNewsInfo extends BaseEntity { private String title; private String content; private Long targetId; /** * 1-文章2-跳转到产品 */ private Integer type; } src/main/java/cc/mrbird/febs/mall/mapper/MallNewsInfoMapper.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.mapper; import cc.mrbird.febs.mall.entity.MallNewsInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface MallNewsInfoMapper extends BaseMapper<MallNewsInfo> { } src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
@@ -38,4 +38,6 @@ void setPayment(MallMemberPayment mallMemberPayment); MallMemberPayment findMemberPayment(); void bindPhone(AccountAndCodeDto accountAndCodeDto); } src/main/java/cc/mrbird/febs/mall/service/IApiMallNewsService.java
New file @@ -0,0 +1,7 @@ package cc.mrbird.febs.mall.service; import cc.mrbird.febs.mall.entity.MallNewsInfo; import com.baomidou.mybatisplus.extension.service.IService; public interface IApiMallNewsService extends IService<MallNewsInfo> { } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -405,4 +405,18 @@ MallMember member = LoginUserUtil.getLoginUser(); return mallMemberPaymentMapper.selectByMemberId(member.getId()); } @Override public void bindPhone(AccountAndCodeDto accountAndCodeDto) { boolean b = commonService.verifyCode(accountAndCodeDto.getAccount(), accountAndCodeDto.getCode()); if (!b) { throw new FebsException("验证码错误"); } Long id = LoginUserUtil.getLoginUser().getId(); MallMember member = this.baseMapper.selectById(id); member.setBindPhone(accountAndCodeDto.getAccount()); this.baseMapper.updateById(member); } } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallNewsServiceImpl.java
New file @@ -0,0 +1,20 @@ package cc.mrbird.febs.mall.service.impl; import cc.mrbird.febs.mall.entity.MallNewsInfo; import cc.mrbird.febs.mall.mapper.MallNewsInfoMapper; import cc.mrbird.febs.mall.service.IApiMallNewsService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; /** * @author wzy * @date 2021-09-28 **/ @Slf4j @Service @RequiredArgsConstructor public class ApiMallNewsServiceImpl extends ServiceImpl<MallNewsInfoMapper, MallNewsInfo> implements IApiMallNewsService { } src/main/java/cc/mrbird/febs/mall/vo/MallMemberVo.java
@@ -60,4 +60,6 @@ @ApiModelProperty(value = "是否设置交易密码", example = "1是2否") private Integer hasTradePwd = 2; @ApiModelProperty(value = "绑定手机号") private String bindPhone; } src/main/resources/mapper/modules/MallNewsInfoMapper.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cc.mrbird.febs.mall.mapper.MallNewsInfoMapper"> </mapper>