Przeglądaj źródła

增加日志打印

weifanli 3 lat temu
rodzic
commit
4752dba599

+ 7 - 1
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/PaymentController.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.student.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.huifu.adapay.core.AdapayCore;
 import com.huifu.adapay.core.util.AdapaySign;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
@@ -11,6 +12,8 @@ import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
@@ -26,6 +29,8 @@ import java.util.Map;
 @RequestMapping("/payment")
 @Api(value = "付款接口", tags = "付款接口")
 public class PaymentController extends BaseController {
+    private final static Logger log = LoggerFactory.getLogger(PaymentController.class);
+
     @Autowired
     private PaymentSdk paymentSdk;
     @Autowired
@@ -49,10 +54,11 @@ public class PaymentController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         HttpResponseResult<Map<String, String>> responseResult = paymentSdk.getOpenId(js_code);
-        if(responseResult.getStatus()){
+        if (responseResult.getStatus()) {
             Map<String, String> data = responseResult.getData();
             //绑定到用户表
             user.setWechatId(data.get("openid"));
+            log.info("绑定用户openid,param is {}", JSONObject.toJSONString(user));
             sysUserFeignService.bindOpenId(user);
         }
         return responseResult;