wuchao hai 5 meses
pai
achega
55f1be24ec

+ 36 - 4
renren-admin/src/main/java/io/renren/modules/qyh/service/impl/ApiAuthServiceImpl.java

@@ -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;
     }
 
 }

+ 5 - 2
renren-admin/src/main/resources/application-dev.yml

@@ -4,7 +4,7 @@ spring:
     druid:
       driver-class-name: com.mysql.jdbc.Driver
       url: jdbc:mysql://192.168.0.119:3306/qingyunhui?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
-#      url: jdbc:mysql://192.168.0.119:3306/wujiexiaoyuan-prod?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
+      #      url: jdbc:mysql://192.168.0.119:3306/wujiexiaoyuan-prod?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
       username: root
       password: songlanyun
       initial-size: 10
@@ -43,7 +43,7 @@ spring:
     port: 5672
     publisher-returns: true
     virtual-host: my_vhost
-#    virtual-host: vhost2
+    #    virtual-host: vhost2
     listener:
       simple:
         acknowledge-mode: manual
@@ -66,3 +66,6 @@ spring:
         max-wait: -1ms    # 连接池最大阻塞等待时间(使用负值表示没有限制)
         max-idle: 10      # 连接池中的最大空闲连接
         min-idle: 5       # 连接池中的最小空闲连接
+
+yic:
+  loginUrl: http://192.168.0.101:8203/third/user/authorization/register

+ 2 - 1
renren-admin/src/main/resources/application-prod.yml

@@ -65,4 +65,5 @@ spring:
         max-idle: 10      # 连接池中的最大空闲连接
         min-idle: 5       # 连接池中的最小空闲连接
 
-
+yic:
+  loginUrl: http://192.168.0.101:8203/third/user/authorization/register