package com.ydtech.modules.admin.controller.wechat; import com.fasterxml.jackson.core.JsonProcessingException; import com.ydtech.modules.admin.service.WechatCustomerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; @Api(tags = "微信业务") @Slf4j @RestController @RequestMapping("/wechat/customer") @RequiredArgsConstructor public class WechatCustomerController { private final WechatCustomerService customerService; @GetMapping(path = "/callback") @ApiOperation(value = "客服回调") public String customerCallback(@RequestParam(value = "msg_signature") String msgSignature, @RequestParam(value = "timestamp") String timestamp, @RequestParam(value = "nonce") String nonce, @RequestParam(value = "echostr") String echoStr) { return customerService.customerCallback(msgSignature, timestamp, nonce, echoStr); } @PostMapping(path = "/callback", consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE) @ApiOperation(value = "客服回调(处理事件发送欢迎语)") public void customerCallback(@RequestBody String wechatEncrypt) throws JsonProcessingException { customerService.callbackSendMsgOnEvent(wechatEncrypt); } }