package com.qmth.ops.api.controller.open; import com.qmth.boot.api.annotation.Aac; import com.qmth.boot.core.solar.model.WxappAccessToken; import com.qmth.boot.core.solar.model.WxappPhoneNumber; import com.qmth.boot.core.solar.model.WxappSession; import com.qmth.boot.tools.signature.SignatureType; import com.qmth.ops.api.constants.OpsApiConstants; import com.qmth.ops.biz.service.WxappService; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController @RequestMapping(OpsApiConstants.OPEN_URI_PREFIX + "/wxapp") @Aac(auth = true, signType = SignatureType.SECRET) public class OpenWxappController { @Resource private WxappService wxappService; @PostMapping("/access_token") public WxappAccessToken getAccessToken(@RequestParam String appId) { return wxappService.getAccessToken(appId); } @PostMapping("/session_by_code") public WxappSession getSessionByCode(@RequestParam String appId, @RequestParam String code) { return wxappService.getSessionByCode(appId, code).output(); } @PostMapping("/get_phone_number") public WxappPhoneNumber getPhoneNumber(@RequestParam String appId, @RequestParam String code) { return wxappService.getPhoneNumber(appId, code).getPhoneNumberInfo().output(); } }