|
|
@@ -16,6 +16,7 @@ import javax.imageio.ImageIO;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import io.renren.common.constant.WeChatConstant;
|
|
|
import io.renren.modules.qmjz.entity.ScoreStu;
|
|
|
import io.renren.modules.qmjz.entity.TaskManage;
|
|
|
@@ -28,7 +29,9 @@ import io.renren.modules.wechat.config.WxMaConfiguration;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -83,6 +86,9 @@ public class ApiAuthServiceImpl implements ApiAuthService {
|
|
|
@Autowired
|
|
|
private TaskManageService taskManageService;
|
|
|
|
|
|
+ @Value("${yic.loginUrl}")
|
|
|
+ private String yicLoginUrl;
|
|
|
+
|
|
|
@Override
|
|
|
public void sendCode(String mobile) {
|
|
|
if (!PhoneFormatCheckUtils.isPhoneLegal(mobile)) {
|
|
|
@@ -186,7 +192,7 @@ public class ApiAuthServiceImpl implements ApiAuthService {
|
|
|
List<SysRoleEntity> sysRoleEntities = memberRoleService.queryRoleList(id);
|
|
|
memberInfoEntity.setRoleList(sysRoleEntities);
|
|
|
memberInfoEntity.setMemberState(memberRoleService.getMemberRoleStatus(id));
|
|
|
- return R.ok("您已经注册过了").put("memberinfo", memberInfoEntity);
|
|
|
+ return R.ok("您已经注册过了").put("memberinfo", memberInfoEntity).put("yicLogin", this.yicLogin(memberInfoEntity.getPhone(), openid));
|
|
|
} else {
|
|
|
return R.ok("您还未注册").put("data", false);
|
|
|
}
|
|
|
@@ -236,9 +242,9 @@ public class ApiAuthServiceImpl implements ApiAuthService {
|
|
|
MemberInfoEntity memberInfoEntity = memberInfoService.selectMemberByOpenid(openid);
|
|
|
if (memberInfoEntity != null) {
|
|
|
if (StrUtil.isNotBlank(inviteCode)) {
|
|
|
- return R.ok("您已经注册过了,邀请码无效").put("memberinfo", memberInfoEntity);
|
|
|
+ return R.ok("您已经注册过了,邀请码无效").put("memberinfo", memberInfoEntity).put("yicLogin", this.yicLogin(memberInfoEntity.getPhone(), openid));
|
|
|
}
|
|
|
- return R.ok().put("memberinfo", memberInfoEntity);
|
|
|
+ return R.ok().put("memberinfo", memberInfoEntity).put("yicLogin", this.yicLogin(memberInfoEntity.getPhone(), openid));
|
|
|
} else {
|
|
|
MemberInfoEntity memberinfo = new MemberInfoEntity();
|
|
|
if (memberInfoInviteCode != null) {
|
|
|
@@ -317,8 +323,34 @@ public class ApiAuthServiceImpl implements ApiAuthService {
|
|
|
scoreStuService.save(scoreStu);
|
|
|
}
|
|
|
}
|
|
|
- return R.ok().put("memberinfo", memberinfo);
|
|
|
+ return R.ok().put("memberinfo", memberinfo).put("yicLogin", this.yicLogin(memberinfo.getPhone(), openid));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 青创赛登录注册
|
|
|
+ *
|
|
|
+ * @param mobile
|
|
|
+ * @param openId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Map yicLogin(String mobile, String openId) {
|
|
|
+ Map<String, Object> paramMap = new HashMap<>(2);
|
|
|
+ paramMap.put("mobile", mobile);
|
|
|
+ paramMap.put("openId", openId);
|
|
|
+ try {
|
|
|
+ String resultStr = cn.hutool.http.HttpUtil.post(yicLoginUrl, paramMap);
|
|
|
+ if (ObjectUtil.isNotNull(resultStr)) {
|
|
|
+ JSONObject result = JSONObject.parseObject(resultStr);
|
|
|
+ if (ObjectUtil.isNotNull(result) && result.getInteger("code") == 200) {
|
|
|
+ return result.getObject("data", Map.class);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println("青创赛登录注册失败:" + e);
|
|
|
+ return null;
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
}
|