[fix]登录用户返回userSig
This commit is contained in:
parent
f058de3736
commit
5c603c6151
@ -33,6 +33,7 @@ public class MemberAccount extends BaseAudit {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户类型 1 用户 2 商家 3 代理 4 平台
|
* 账户类型 1 用户 2 商家 3 代理 4 平台
|
||||||
*/
|
*/
|
||||||
|
@ -72,6 +72,7 @@ public class MemberRegisterService {
|
|||||||
// 生成 UserSig
|
// 生成 UserSig
|
||||||
String userSig = tencentIMServicce.createTencentIMAccount(member);
|
String userSig = tencentIMServicce.createTencentIMAccount(member);
|
||||||
member.setUserSig(userSig);
|
member.setUserSig(userSig);
|
||||||
|
memberService.updateById(member);
|
||||||
|
|
||||||
|
|
||||||
recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.register.success"));
|
recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.register.success"));
|
||||||
|
@ -2,17 +2,13 @@ package com.wzj.soopin.member.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.wzj.soopin.member.domain.po.Member;
|
import com.wzj.soopin.member.domain.po.Member;
|
||||||
import okhttp3.MediaType;
|
|
||||||
import okhttp3.RequestBody;
|
|
||||||
import okhttp3.ResponseBody;
|
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import com.wzj.soopin.member.service.ITencentIMServicce;
|
import com.wzj.soopin.member.service.ITencentIMServicce;
|
||||||
import com.wzj.soopin.member.util.GenerateTestUserSig;
|
import com.wzj.soopin.member.util.GenerateTestUserSig;
|
||||||
import com.wzj.soopin.member.util.TLSSigAPIv2;
|
import com.wzj.soopin.member.util.TLSSigAPIv2;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import okhttp3.*;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -22,7 +18,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Service
|
@Service
|
||||||
public class TencentIMServiceImpl implements ITencentIMServicce {
|
public class TencentIMServiceImpl implements ITencentIMServicce {
|
||||||
|
|
||||||
|
@Value("${tencent.im.administrator}")
|
||||||
|
private String adminAccount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建腾讯云IM账号
|
* 创建腾讯云IM账号
|
||||||
@ -33,7 +30,8 @@ public class TencentIMServiceImpl implements ITencentIMServicce {
|
|||||||
String phone=member.getPhoneHidden();
|
String phone=member.getPhoneHidden();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String userSig=generateUserSig("administrator");
|
//这里生成一个管理员签名,
|
||||||
|
String adminSig=generateUserSig(adminAccount);
|
||||||
String random = String.valueOf(System.currentTimeMillis());
|
String random = String.valueOf(System.currentTimeMillis());
|
||||||
|
|
||||||
|
|
||||||
@ -48,8 +46,8 @@ public class TencentIMServiceImpl implements ITencentIMServicce {
|
|||||||
"https://console.tim.qq.com/v4/im_open_login_svc/account_import" +
|
"https://console.tim.qq.com/v4/im_open_login_svc/account_import" +
|
||||||
"?sdkappid=%s&identifier=%s&usersig=%s&random=%s&contenttype=json",
|
"?sdkappid=%s&identifier=%s&usersig=%s&random=%s&contenttype=json",
|
||||||
GenerateTestUserSig.SDKAPPID,
|
GenerateTestUserSig.SDKAPPID,
|
||||||
"administrator", // 使用管理员账号
|
adminAccount, // 使用管理员账号
|
||||||
userSig, // 使用管理员的UserSig
|
adminSig, // 使用管理员的UserSig
|
||||||
random);
|
random);
|
||||||
// return userSig;
|
// return userSig;
|
||||||
|
|
||||||
@ -78,7 +76,8 @@ public class TencentIMServiceImpl implements ITencentIMServicce {
|
|||||||
|
|
||||||
if (errorCode == 0) {
|
if (errorCode == 0) {
|
||||||
log.info("创建IM账号成功: {}", phone);
|
log.info("创建IM账号成功: {}", phone);
|
||||||
return userSig;
|
// 生成用户的UserSig
|
||||||
|
return generateUserSig(member.getId()+"");
|
||||||
} else {
|
} else {
|
||||||
log.error("创建IM账号失败: {}, 错误码: {}, 错误信息: {}",
|
log.error("创建IM账号失败: {}, 错误码: {}, 错误信息: {}",
|
||||||
phone, errorCode, jsonResponse.get("ErrorInfo"));
|
phone, errorCode, jsonResponse.get("ErrorInfo"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user