Upd:登录识别字段由OpenId变更为unionId,微信不同平台相同识别字段为unionid

master
duLingLing 5 years ago
parent 9424535448
commit 036b33ae03

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.2.79</version>
<version>1.2.80</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.6.1</jib-maven-plugin.version>

@ -2298,8 +2298,8 @@ public class RetailAppServiceImp implements RetailAppService {
result.put("remark_contact_phone",contact_phone);
result.put("nation_code",account.getString("nation_code"));
}
result.put("wechat_bind_status",account.containsKey("wechat_openid"));
if(account.containsKey("wechat_openid")){
result.put("wechat_bind_status",account.containsKey("wx_unionid"));
if(account.containsKey("wx_unionid")){
result.put("wechat_name",account.getString("wechat_name"));
}
return result;

@ -85,10 +85,10 @@ public interface ClientAccountMapper {
/**
*
* @param openid
* @param unionId
* @return
*/
JSONObject findOneByOpenIdAndCreateTimeDesc(@Param("wechat_openid")String openid);
JSONObject findOneByUnionIdAndCreateTimeDesc(@Param("wx_unionid")String unionId);
JSONObject findOneByPhoneAndCreateTimeDesc(@Param("contact_phone")String contactPhone,@Param("nation_code")String nationCode);

@ -1698,6 +1698,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
account.put("wechat_openid", null);
account.put("wechat_name", null);
account.put("wechat_headimg", null);
account.put("wx_unionid", null);
clientAccountMapper.update(account);
signInAccountService.clearAccountCache(accountId);
}

@ -42,10 +42,10 @@ public interface SignInAccountService {
/**
*
* @param openid
* @param unionId
* @return
*/
JSONObject clientWechatOneSignIn(String openid);
JSONObject clientWechatOneSignIn(String unionId);
JSONObject clientWechatAppSignIn(String openId);

@ -363,8 +363,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
}
@Override
public JSONObject clientWechatOneSignIn(String openid){
JSONObject account = clientAccountMapper.findOneByOpenIdAndCreateTimeDesc(openid);
public JSONObject clientWechatOneSignIn(String unionId){
JSONObject account = clientAccountMapper.findOneByUnionIdAndCreateTimeDesc(unionId);
if (account == null) {
return null;
}

@ -385,13 +385,13 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
if(user==null){
throw new BadRequestException("WeChat users do not exist");
}
String unionId = user.getString("unionid");
String openId = user.getString("openid");
JSONObject account = signInAccountService.clientWechatOneSignIn(openId);
JSONObject account = signInAccountService.clientWechatOneSignIn(unionId);
if (account == null) {
JSONObject wechatUserInfo = mpClientAppWechatApiProvider.getApi("merchant-app").appUserInfo(openId,user.getString("access_token"));
JSONObject res = new JSONObject();
String nickName = wechatUserInfo.getString("nickname");
String unionId = wechatUserInfo.getString("unionid");
res.put("bind_status", false);
res.put("app_openid", openId);
res.put("status", "success");
@ -405,7 +405,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
account = getCurrentClient(statusKey);
account.put("sign_key", statusKey);
result.put("account",account);
result.put("app_openid", openId);
result.put("app_openid", unionId);
result.put("bind_status", true);
result.put("status", "success");
return result;

@ -28,9 +28,9 @@
OR
sc.parent_client_id IN (select client_id from sys_clients where client_id =#{client_id} or parent_client_id=#{client_id}));
</select>
<select id="findOneByOpenIdAndCreateTimeDesc" resultType="com.alibaba.fastjson.JSONObject">
<select id="findOneByUnionIdAndCreateTimeDesc" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_accounts a
WHERE a.is_valid =1 and a.wechat_openid=#{wechat_openid}
WHERE a.is_valid =1 and a.wx_unionid=#{wx_unionid}
ORDER BY a.create_time DESC
limit 1
</select>

Loading…
Cancel
Save