1.新增php推送订阅者openid接口

2.库存预警更改为公众号推送
3.sku商品上下架最低价不正确问题
This commit is contained in:
2024-07-25 10:10:54 +08:00
parent 954bfb00ac
commit e87537850a
12 changed files with 263 additions and 30 deletions

View File

@@ -2,11 +2,13 @@ package com.chaozhanggui.system.cashierservice.controller;
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import com.chaozhanggui.system.cashierservice.entity.dto.WxMsgSubDTO;
import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.service.FileService;
import com.chaozhanggui.system.cashierservice.service.LoginService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
@@ -44,6 +46,10 @@ public class CommonController {
private TbPlatformDictMapper platformDictMapper;
@Resource
private FileService fileService;
private final LoginService loginService;;
/**
* 一分钟
*/
@@ -198,4 +204,19 @@ public class CommonController {
// 将手机号码的请求次数加1
redisUtil.getIncrNum(key, "2");
}
}
/**
* 订阅消息
* @param wxMsgSubDTO
* @return
*/
@PostMapping("/subMsg")
public Result subscribeWxAccount(@RequestBody WxMsgSubDTO wxMsgSubDTO) {
if (wxMsgSubDTO.getOpenId() == null || wxMsgSubDTO.getShopId() == null) {
return Result.fail("shopId或openId缺失");
}
loginService.addShopId(wxMsgSubDTO.getOpenId(), wxMsgSubDTO.getShopId());
return Result.success(CodeEnum.SUCCESS);
}
}

View File

@@ -1,48 +1,28 @@
package com.chaozhanggui.system.cashierservice.controller;
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
import com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper;
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
import com.chaozhanggui.system.cashierservice.entity.vo.OrderVo;
import com.chaozhanggui.system.cashierservice.service.LoginService;
import com.chaozhanggui.system.cashierservice.service.OnlineUserService;
import com.chaozhanggui.system.cashierservice.service.UserService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.IpUtil;
import com.chaozhanggui.system.cashierservice.util.MD5Utils;
import com.chaozhanggui.system.cashierservice.util.StringUtil;
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
@CrossOrigin(origins = "*")
@RestController
@@ -142,7 +122,7 @@ public class UserContoller {
return userService.modityIntegral(integralVo, userSign);
}
@PostMapping("/userIntegral")
@PostMapping("/userIntegral")
public JSONObject userIntegral(@RequestHeader String token, @RequestBody IntegralFlowVo integralFlowVo) throws Exception {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userSign = jsonObject.getString("userSign");
@@ -164,4 +144,17 @@ public class UserContoller {
}
/**
* 获取订阅当前用户店库存预警消息的二维码
*
* @param shopId
* @return
*/
@GetMapping("/subQrCode")
public Result getSubQrCode(String shopId) throws Exception {
String url = userService.getSubQrCode(shopId);
return Result.successWithData(url);
}
}