Commit 5bc2ee20 authored by liuyang's avatar liuyang

添加获取JS签名方法

parent 891b645d
...@@ -18,6 +18,7 @@ import com.qkdata.common.util.UserContext; ...@@ -18,6 +18,7 @@ import com.qkdata.common.util.UserContext;
import com.qkdata.wx.mp.config.WxMpProperties; import com.qkdata.wx.mp.config.WxMpProperties;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
...@@ -26,6 +27,9 @@ import org.apache.shiro.authz.annotation.RequiresRoles; ...@@ -26,6 +27,9 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.security.Signature;
import java.util.Map;
@Api(tags = "用户下单处理-手机端") @Api(tags = "用户下单处理-手机端")
@RestController @RestController
@RequestMapping("/api/productOrder") @RequestMapping("/api/productOrder")
...@@ -111,4 +115,13 @@ public class FrontendProductOrderController { ...@@ -111,4 +115,13 @@ public class FrontendProductOrderController {
public Result<String> getAppId(){ public Result<String> getAppId(){
return Result.succeed(wxMpProperties.getAppId()); return Result.succeed(wxMpProperties.getAppId());
} }
@ApiOperation("获取JS-SDK签名")
@GetMapping("/js-sdk/sign")
@RequiresRoles(value = {BizConstants.ROLE_USER,BizConstants.ROLE_ENTERPRISE_ADMIN},logical = Logical.OR)
@SysLog("获取JS-SDK签名")
public Result<WxJsapiSignature> getJsSDKSign(@RequestParam String url) throws WxErrorException {
WxJsapiSignature sign = wxMpService.createJsapiSignature(url);
return Result.succeed(sign);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment