|
|
@@ -10,6 +10,8 @@ import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.github.microservice.components.data.mongo.mongo.helper.DBHelper;
|
|
|
import com.github.microservice.core.util.net.IPUtil;
|
|
|
import com.zhongshu.card.client.model.org.LoginParam;
|
|
|
+import com.zhongshu.card.client.model.wechat.PhoneModel;
|
|
|
+import com.zhongshu.card.client.model.wechat.WechatPhoneNumber;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.utils.type.LoginFromType;
|
|
|
import com.zhongshu.card.client.utils.type.OrganizationState;
|
|
|
@@ -20,6 +22,8 @@ import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserLoginFailRecord;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserLoginRecord;
|
|
|
import com.zhongshu.card.server.core.service.base.RedisService;
|
|
|
+import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
+import com.zhongshu.card.server.core.util.wx.WechatCUtil;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
@@ -30,6 +34,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* @author TRX
|
|
|
@@ -73,6 +78,9 @@ public class IndexService {
|
|
|
OrganizationUserDao organizationUserDao;
|
|
|
private OrganizationDao organizationDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ WechatCUtil wechatCUtil;
|
|
|
+
|
|
|
/**
|
|
|
* 登录--web
|
|
|
*
|
|
|
@@ -215,4 +223,28 @@ public class IndexService {
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到电话号码
|
|
|
+ *
|
|
|
+ * @param code
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResultContent<PhoneModel> getPhoneNum(String code, String iv) {
|
|
|
+ try {
|
|
|
+ WechatPhoneNumber phoneNumber = wechatCUtil.getPhoneNumber(code);
|
|
|
+ String phone = "";
|
|
|
+ if (Objects.nonNull(phoneNumber) && Objects.nonNull(phoneNumber.getPurePhoneNumber())) {
|
|
|
+ phone = phoneNumber.getPurePhoneNumber();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(phone)) {
|
|
|
+ //保存到redis
|
|
|
+ redisService.setValueSecond(CommonUtil.getIvKey(phone, iv), iv, 600);
|
|
|
+ return ResultContent.buildSuccess(PhoneModel.builder().phone(phone).build());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return ResultContent.buildFail("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+
|
|
|
}
|