MiniWechatCodeController.java
1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.viontech.controller;
import com.viontech.model.MiniWeChatCode;
import com.viontech.service.MiniWechatCodeService;
import com.viontech.vo.ResultVo;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* Created with IntelliJ IDEA.
*
* @author: zhuhai
* Date: 2023-04-04
* Time: 16:07
*/
@RestController
public class MiniWechatCodeController {
@Resource
private MiniWechatCodeService miniWechatCodeService;
@GetMapping("/getUrl")
public ResultVo getUrlByCode(@RequestParam("code") String code) {
MiniWeChatCode miniWeChatCode = miniWechatCodeService.getByCode(code);
if (miniWeChatCode == null) {
return ResultVo.error("code is not exist");
}
return ResultVo.success(miniWeChatCode.getUrl());
}
}