Administrator
2024-06-20 fe0d4b28f459cda206a290f68272e27b98819155
2024-06-20 朱宝民 迁移2个微信小程序接口
2个文件已修改
16 ■■■■ 已修改文件
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/client/ClientCtrl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/result/WechatResultCode.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/client/ClientCtrl.java
@@ -62,7 +62,7 @@
     * @throws IOException
     */
    @PostMapping(path = "code_login", consumes = MediaType.APPLICATION_JSON_VALUE)
    public BaseResponse<VoClientWechat> codeLogin(@RequestBody @Valid CodeLoginDTO po, BindingResult bindingResult) throws IOException {
    public BaseResponse<JSONObject> codeLogin(@RequestBody @Valid CodeLoginDTO po, BindingResult bindingResult) throws IOException {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
@@ -77,14 +77,25 @@
        Map<String, String> headerParams = new HashMap<>();
        JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams);
        if(job.containsKey("errmsg ")) {
            return BaseResponseUtils.buildErrorMsg(WechatResultCode.INVALID_CODE.getMessage());
        }
        String openId = job.getString("openid");
        if(openId == null) {
            return BaseResponseUtils.buildErrorMsg(WechatResultCode.LOGIN_FAIL.getMessage());
        }
        try {
            JSONObject job_client = new JSONObject();
            VoClientWechat res = clientSv.getSimpleClientInfo(null, openId);
            return BaseResponseUtils.buildSuccess(res);
            if(res != null) {
                job_client.put("client", res);
            } else {
                VoClientWechat voClientWechat = new VoClientWechat();
                job_client.put("client", voClientWechat);
            }
            return BaseResponseUtils.buildSuccess(job_client);
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/result/WechatResultCode.java
@@ -40,6 +40,7 @@
    SECURITY_CODE_ERROR(20003, "验证码错误"),
    VALIDATION_TIMEOUT(20004, "验证超时"),
    PHONE_NUMBER_IS_ERROR(20004, "手机号错误,非注册农户"),
    INVALID_CODE(20004, "无效的临时登录凭证"),
    LOGIN_FAIL(20004, "登录失败");
    private final Integer code;