From 17caebabf7a6a529b7039c71e21e5a324e31ea20 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 27 九月 2024 16:23:42 +0800 Subject: [PATCH] 代理新功能完善 --- src/main/java/com/taoke/autopay/service/impl/WxUserServiceImpl.java | 44 +++++++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/taoke/autopay/service/impl/WxUserServiceImpl.java b/src/main/java/com/taoke/autopay/service/impl/WxUserServiceImpl.java index 12236db..e0e1737 100644 --- a/src/main/java/com/taoke/autopay/service/impl/WxUserServiceImpl.java +++ b/src/main/java/com/taoke/autopay/service/impl/WxUserServiceImpl.java @@ -8,6 +8,7 @@ import com.taoke.autopay.service.WxUserService; import com.taoke.autopay.service.WxUserSettingService; import com.taoke.autopay.utils.StringUtil; +import com.taoke.autopay.utils.WxApiUtil; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,44 +37,49 @@ @Transactional(rollbackFor = Exception.class) @Override - public WxUserInfo login(String openid) { + public WxUserInfo login(WxApiUtil.WXUserInfo wxUserInfo) { // 鏌ヨ鐢ㄦ埛鏄惁瀛樺湪 WxUserInfoMapper.DaoQuery query = new WxUserInfoMapper.DaoQuery(); - query.openId = openid; + query.openId = wxUserInfo.getOpenid(); query.count = 1; query.start = 0; List<WxUserInfo> list = wxUserInfoMapper.list(query); if (list.size() == 0) { // 娌℃湁鏁版嵁锛岄渶瑕佹敞鍐� WxUserInfo user = new WxUserInfo(); - user.setOpenId(openid); + user.setOpenId(wxUserInfo.getOpenid()); + user.setNickName(wxUserInfo.getNickname()); + user.setPortrait(wxUserInfo.getHeadimgurl()); user.setLoginTime(new Date()); user.setCreateTime(new Date()); wxUserInfoMapper.insertSelective(user); - - WxUserSettings settings = new WxUserSettings(); - settings.setId(user.getId()); - String value = systemConfigService.getValueCache(SystemConfigKeyEnum.DY_ORDER_MAX_PAY_COUNT_DEFAULT); - if (!StringUtil.isNullOrEmpty(value)) { - settings.setDyOrderCountPerDay(Integer.parseInt(value)); - } - value = systemConfigService.getValueCache(SystemConfigKeyEnum.KS_ORDER_MAX_PAY_COUNT_DEFAULT); - if (!StringUtil.isNullOrEmpty(value)) { - settings.setKsOrderCountPerDay(Integer.parseInt(value)); - } - value = systemConfigService.getValueCache(SystemConfigKeyEnum.ORDER_MAX_SUBMIT_COUNT_DEFAULT); - if (!StringUtil.isNullOrEmpty(value)) { - settings.setTotalOrderCountPerDay(Integer.parseInt(value)); - } - wxUserSettingService.add(settings); return user; } else { WxUserInfo update = new WxUserInfo(); update.setId(list.get(0).getId()); + update.setNickName(wxUserInfo.getNickname()); + update.setPortrait(wxUserInfo.getHeadimgurl()); update.setLoginTime(new Date()); update.setUpdateTime(new Date()); wxUserInfoMapper.updateByPrimaryKeySelective(update); return list.get(0); } } + + @Override + public WxUserInfo selectById(Long id) { + return wxUserInfoMapper.selectByPrimaryKey(id); + } + + @Override + public List<WxUserInfo> list(WxUserInfoMapper.DaoQuery query, int page, int pageSize) { + query.start = (page - 1) * pageSize; + query.count = pageSize; + return wxUserInfoMapper.list(query); + } + + @Override + public long count(WxUserInfoMapper.DaoQuery query) { + return wxUserInfoMapper.count(query); + } } -- Gitblit v1.8.0