| | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.dao.business.dto.WebQwSingatureDto; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.vo.WebQwSingatureVO; |
| | | import com.doumee.dao.web.dto.LoginH5DTO; |
| | | import com.doumee.dao.web.dto.UpdEmailDTO; |
| | | import com.doumee.service.business.MemberService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.server.reactive.ServerHttpRequest; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @Api(tags ="webç«¯ç¨æ·ç¸å
³æ¥å£") |
| | | @RequestMapping("/web/member") |
| | | @Slf4j |
| | | public class WebMemberController { |
| | | @Resource |
| | | private JwtTokenUtil jwtTokenUtil; |
| | |
| | | @ApiOperation("è·åä¼ä¸å¾®ä¿¡JSç¾å") |
| | | @PostMapping("/getQwSignature") |
| | | @ResponseBody |
| | | public ApiResponse<Object> getQwSignature(@RequestBody Map<String,String> url) { |
| | | public ApiResponse<WebQwSingatureVO> getQwSignature(@RequestBody WebQwSingatureDto param) { |
| | | try { |
| | | String jsapiTicket = systemDictDataBiz.queryByCode(Constants.QYWX,Constants.QYWX_JS_API_TICKET).getCode(); |
| | | String noncestr = UUID.randomUUID().toString(); |
| | | Long timestamp = System.currentTimeMillis() / 1000; |
| | | |
| | | String jsapiTicketStr = jsapiTicket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
| | | try { |
| | | String jsapiTicketStr = jsapiTicket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + param.getUrl(); |
| | | MessageDigest instance = MessageDigest.getInstance("SHA-1"); |
| | | instance.update(jsapiTicketStr.getBytes()); |
| | | byte[] digest = instance.digest(); |
| | | BigInteger bigInteger = new BigInteger(1, digest); |
| | | String string = bigInteger.toString(); |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("noncestr", noncestr); |
| | | result.put("signature", string); |
| | | result.put("timestamp", timestamp); |
| | | result.put("url", url); |
| | | WebQwSingatureVO result = new WebQwSingatureVO(); |
| | | result.setNoncestr( noncestr); |
| | | result.setSignature( string); |
| | | result.setTimestamp( timestamp); |
| | | result.setUrl( param.getUrl()); |
| | | // result.put("ticket", jsapiTicket); |
| | | return ApiResponse.success( result); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | throw new RuntimeException(e); |
| | | } catch ( Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("è·åç¾å失败"+e.getMessage()); |
| | | } |
| | | |
| | | return ApiResponse.failed( "è·åç¾å失败"); |
| | | } |
| | | } |