MiniWechatCodeController.java 1000 Bytes
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());
    }


}