验证openId
This commit is contained in:
parent
4c4631fa12
commit
bb13e3bd35
@ -453,7 +453,7 @@ public class FyPayServiceImpl implements FyPayService {
|
|||||||
String rspXml = Message.responseMsg(reqBody,Const.fuiou_32_url);
|
String rspXml = Message.responseMsg(reqBody,Const.fuiou_32_url);
|
||||||
//响应报文验签
|
//响应报文验签
|
||||||
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
|
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
|
||||||
|
log.info("--FyPayServiceImpl--:{}",resMap);
|
||||||
String str = resMap.get("sign");
|
String str = resMap.get("sign");
|
||||||
if (Utils.verifySign(resMap, str)){
|
if (Utils.verifySign(resMap, str)){
|
||||||
System.out.println(resMap);
|
System.out.println(resMap);
|
||||||
|
@ -80,6 +80,8 @@ public class ChainStoreInfoServiceImpl extends ServiceImpl<ChainStoreInfoMapper,
|
|||||||
public boolean theJudgmentIsTheSame(Integer chainStoreId) {
|
public boolean theJudgmentIsTheSame(Integer chainStoreId) {
|
||||||
if (ObjectUtil.isEmpty(chainStoreId)) return false;
|
if (ObjectUtil.isEmpty(chainStoreId)) return false;
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
if (ObjectUtil.isEmpty(nowAccountInfo)) return true;
|
||||||
|
if (ObjectUtil.isEmpty(nowAccountInfo.getChainStoreId())) return true;
|
||||||
|
|
||||||
System.out.println("nowAccount"+nowAccountInfo.toString());
|
System.out.println("nowAccount"+nowAccountInfo.toString());
|
||||||
if (nowAccountInfo.getChainStoreId().equals(chainStoreId)) {
|
if (nowAccountInfo.getChainStoreId().equals(chainStoreId)) {
|
||||||
|
@ -451,6 +451,12 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
|
|||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public int updateUserById(LJUser user) {
|
||||||
|
// return baseMapper.updateById(user);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LJUser selectUserByMobileAndUserId(String mobile, Integer userId) {
|
public LJUser selectUserByMobileAndUserId(String mobile, Integer userId) {
|
||||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||||
|
@ -9,6 +9,7 @@ import com.fuint.business.store.entity.MtStore;
|
|||||||
import com.fuint.business.store.service.StoreService;
|
import com.fuint.business.store.service.StoreService;
|
||||||
import com.fuint.business.storeInformation.entity.LJStore;
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
import com.fuint.business.storeInformation.service.ILJStoreService;
|
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||||
|
import com.fuint.business.userManager.entity.LJUser;
|
||||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||||
import com.fuint.business.userManager.entity.MtInvitation;
|
import com.fuint.business.userManager.entity.MtInvitation;
|
||||||
import com.fuint.business.userManager.entity.UserBalance;
|
import com.fuint.business.userManager.entity.UserBalance;
|
||||||
@ -40,6 +41,7 @@ import com.fuint.repository.model.*;
|
|||||||
import com.fuint.utils.StringUtil;
|
import com.fuint.utils.StringUtil;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -61,6 +63,7 @@ import java.util.*;
|
|||||||
* CopyRight https://www.fuint.cn
|
* CopyRight https://www.fuint.cn
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> implements MemberService {
|
public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> implements MemberService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -754,9 +757,10 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
|
|||||||
String mobile = StringUtil.isNotEmpty(userInfo.getString("phone")) ? userInfo.getString("phone") : "";
|
String mobile = StringUtil.isNotEmpty(userInfo.getString("phone")) ? userInfo.getString("phone") : "";
|
||||||
String source = StringUtil.isNotEmpty(userInfo.getString("source")) ? userInfo.getString("source") : MemberSourceEnum.WECHAT_LOGIN.getKey();
|
String source = StringUtil.isNotEmpty(userInfo.getString("source")) ? userInfo.getString("source") : MemberSourceEnum.WECHAT_LOGIN.getKey();
|
||||||
|
|
||||||
|
log.info("--MemberServiceImpl:登陆时open_id--{}",openId);
|
||||||
// 根绝手机号查询是否有该用户 没有则新建 有就更新
|
|
||||||
if (ObjectUtil.isNotEmpty(mobile) || "".equals(mobile)) {
|
if (ObjectUtil.isNotEmpty(mobile) || "".equals(mobile)) {
|
||||||
|
// 根绝手机号查询是否有该用户 没有则新建 有就更新
|
||||||
|
|
||||||
MtUser mtUserMobile = queryMemberByMobile2(mobile);
|
MtUser mtUserMobile = queryMemberByMobile2(mobile);
|
||||||
MtUser mtUser = new MtUser();
|
MtUser mtUser = new MtUser();
|
||||||
|
|
||||||
@ -798,7 +802,16 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
|
|||||||
// 修改
|
// 修改
|
||||||
mtUserMobile.setOpenId(openId);
|
mtUserMobile.setOpenId(openId);
|
||||||
|
|
||||||
updateById(mtUserMobile);
|
// ljUserService.updateById()
|
||||||
|
LJUser ljUser = new LJUser();
|
||||||
|
BeanUtils.copyProperties(mtUserMobile,ljUser);
|
||||||
|
|
||||||
|
// boolean b = ljUserService.updateById(ljUser);
|
||||||
|
|
||||||
|
|
||||||
|
int i = baseMapper.updateById(mtUserMobile);
|
||||||
|
|
||||||
|
|
||||||
// 新增余额信息
|
// 新增余额信息
|
||||||
if (ObjectUtil.isNotEmpty(storeId) && storeId !="") {
|
if (ObjectUtil.isNotEmpty(storeId) && storeId !="") {
|
||||||
createVaseInfo(mtUserMobile,storeId,staffId,inviterId);
|
createVaseInfo(mtUserMobile,storeId,staffId,inviterId);
|
||||||
|
@ -6,7 +6,9 @@ import com.fuint.business.store.service.StoreService;
|
|||||||
import com.fuint.business.storeInformation.entity.LJStore;
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
import com.fuint.business.storeInformation.service.ILJStoreService;
|
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||||
import com.fuint.business.userManager.entity.ChainStoreConfig;
|
import com.fuint.business.userManager.entity.ChainStoreConfig;
|
||||||
|
import com.fuint.business.userManager.entity.LJUser;
|
||||||
import com.fuint.business.userManager.service.ChainStoreConfigService;
|
import com.fuint.business.userManager.service.ChainStoreConfigService;
|
||||||
|
import com.fuint.business.userManager.service.LJUserService;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.dto.TokenDto;
|
import com.fuint.common.dto.TokenDto;
|
||||||
import com.fuint.common.dto.UserInfo;
|
import com.fuint.common.dto.UserInfo;
|
||||||
@ -98,6 +100,9 @@ public class ClientSignController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
ILJStoreService iljStoreService;
|
ILJStoreService iljStoreService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LJUserService ljUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连锁店配置信息
|
* 连锁店配置信息
|
||||||
*/
|
*/
|
||||||
@ -168,6 +173,37 @@ public class ClientSignController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "微信授权登录(小程序)")
|
||||||
|
@RequestMapping(value = "/mpWxLogin2", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
@CrossOrigin
|
||||||
|
public ResponseObject mpWxLogin2(HttpServletRequest request, @RequestBody Map<String, Object> param) throws BusinessCheckException {
|
||||||
|
|
||||||
|
// 获取code信息
|
||||||
|
JSONObject loginInfo = weixinService.getWxProfile2(param.get("code").toString());
|
||||||
|
logger.info("--loginInfo{}--",loginInfo.toString());
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(loginInfo) && ObjectUtil.isEmpty(loginInfo.get("openid")) ) {
|
||||||
|
return getSuccessResult(true);
|
||||||
|
}
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
if (ObjectUtil.isEmpty(nowAccountInfo)) return getSuccessResult(true);
|
||||||
|
|
||||||
|
LJUser ljUser = ljUserService.queryUserByUserId(nowAccountInfo.getId());
|
||||||
|
if (ObjectUtil.isEmpty(ljUser.getOpenId())) return getSuccessResult(false);
|
||||||
|
|
||||||
|
if (!loginInfo.get("openid").equals(ljUser.getOpenId())) {
|
||||||
|
return getSuccessResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getSuccessResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信授权登录(公众号)
|
* 微信授权登录(公众号)
|
||||||
* */
|
* */
|
||||||
|
@ -380,12 +380,12 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 判断token是否与当前连锁店id相同
|
// 判断token是否与当前连锁店id相同
|
||||||
getTheJudgmentIsTheSame() {
|
async getTheJudgmentIsTheSame() {
|
||||||
// 判断是否登录
|
// 判断是否登录
|
||||||
if (!this.AppToken) {
|
if (!this.AppToken) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
request({
|
await request({
|
||||||
url: 'chainStoreInfo/theJudgmentIsTheSame',
|
url: 'chainStoreInfo/theJudgmentIsTheSame',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data: {
|
data: {
|
||||||
@ -396,6 +396,31 @@
|
|||||||
uni.removeStorageSync("App-Token");
|
uni.removeStorageSync("App-Token");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 判断当前登录的code是否相同
|
||||||
|
wx.login({
|
||||||
|
success(res) {
|
||||||
|
if (res.code) {
|
||||||
|
//发起网络请求
|
||||||
|
request({
|
||||||
|
url: 'clientApi/sign/mpWxLogin2',
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
code: res.code
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (!res.data) {
|
||||||
|
uni.removeStorageSync("App-Token");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('登录失败!' + res.errMsg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取门店信息
|
// 获取门店信息
|
||||||
|
@ -490,12 +490,12 @@
|
|||||||
// console.log(this.value);
|
// console.log(this.value);
|
||||||
},
|
},
|
||||||
// 判断token是否与当前连锁店id相同
|
// 判断token是否与当前连锁店id相同
|
||||||
getTheJudgmentIsTheSame() {
|
async getTheJudgmentIsTheSame() {
|
||||||
// 判断是否登录
|
// 判断是否登录
|
||||||
if (!this.AppToken) {
|
if (!this.AppToken) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
request({
|
await request({
|
||||||
url: 'chainStoreInfo/theJudgmentIsTheSame',
|
url: 'chainStoreInfo/theJudgmentIsTheSame',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data: {
|
data: {
|
||||||
@ -506,6 +506,28 @@
|
|||||||
uni.removeStorageSync("App-Token");
|
uni.removeStorageSync("App-Token");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 判断当前登录的code是否相同
|
||||||
|
wx.login({
|
||||||
|
success(res) {
|
||||||
|
if (res.code) {
|
||||||
|
//发起网络请求
|
||||||
|
request({
|
||||||
|
url: 'clientApi/sign/mpWxLogin2',
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
code: res.code
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (!res.data) {
|
||||||
|
uni.removeStorageSync("App-Token");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('登录失败!' + res.errMsg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 退格键被点击
|
// 退格键被点击
|
||||||
backspace() {
|
backspace() {
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
console.log(this.$baseUrl);
|
console.log(this.$baseUrl);
|
||||||
|
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
methods: {
|
methods: {
|
||||||
|
Loading…
Reference in New Issue
Block a user