Merge branch 'dev' into test

This commit is contained in:
2024-08-19 17:26:01 +08:00
21 changed files with 546 additions and 63 deletions

View File

@@ -220,9 +220,7 @@ public class CommonController {
if (wxMsgSubDTO.getOpenId() == null || wxMsgSubDTO.getShopId() == null) {
return Result.fail("shopId或openId缺失");
}
String msg = wxMsgSubDTO.getShopId().replace("msg", "");
String[] split = msg.split(",");
loginService.addShopId(wxMsgSubDTO.getOpenId(), split[0], split.length > 1 ? Integer.valueOf(split[1]) : null, wxMsgSubDTO.getNickname(), wxMsgSubDTO.getAvatar());
loginService.addShopId(wxMsgSubDTO.getOpenId(), wxMsgSubDTO.getShopId(), null, wxMsgSubDTO.getNickname(), wxMsgSubDTO.getAvatar());
return Result.success(CodeEnum.SUCCESS);
}
}

View File

@@ -201,11 +201,11 @@ public class LoginContoller {
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
try {
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
// if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
}
log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
// }
// log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
// return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
}
} catch (Exception e){
// e.printStackTrace();
@@ -277,6 +277,7 @@ public class LoginContoller {
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
userInfo.setId(Integer.valueOf(userId));
userInfo.setUpdatedAt(System.currentTimeMillis());
// log.info("更新用户信息 param,{}",JSONObject.toJSONString(userInfo));
return loginService.upUserInfo(userInfo);
}

View File

@@ -12,6 +12,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
import com.chaozhanggui.system.cashierservice.service.UserService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
@@ -61,8 +62,17 @@ public class UserContoller {
// jsonObject.put("data",object);
// return jsonObject;
// }
@PostMapping("/openMember")
public Result openMember(@RequestBody OpenMemberVo memberVo){
return userService.openMember(memberVo);
}
@GetMapping("/shopUserInfo")
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
if(shopId.equals("undefined")){
return Result.fail("店铺信息错误,请联系管理员!");
}
TbShopUser shopUser = new TbShopUser();
TbShopInfo tbShopInfo = new TbShopInfo();
if (StringUtils.isNotBlank(shopId) && !shopId.equals("null")) {
@@ -108,8 +118,9 @@ public class UserContoller {
}
if (tbShopInfo != null) {
shopUser.setShopName(tbShopInfo.getShopName());
}else {
shopUser.setShopName("");
shopUser.setLng(tbShopInfo.getLng());
shopUser.setLat(tbShopInfo.getLat());
shopUser.setAddress(tbShopInfo.getAddress());
}
return Result.success(CodeEnum.SUCCESS, shopUser);
}
@@ -156,7 +167,9 @@ public class UserContoller {
* @return
*/
@GetMapping("/subQrCode")
public Result getSubQrCode(String shopId) throws Exception {
public Result getSubQrCode(
@RequestParam String shopId
) throws Exception {
String url = userService.getSubQrCode(shopId);
return Result.successWithData(url);
}