liusheng
2023-10-13 b1bd4cbd01cb8d7616de0b3c321439985a149e5e
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/WeChatController.java
@@ -4,6 +4,8 @@
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.smartor.domain.WeChatSendVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
@@ -13,10 +15,13 @@
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
/**
@@ -25,21 +30,25 @@
 * @author liusheng
 * @date 2023-05-15
 */
@Api(description = "微信接口")
@RestController
@RequestMapping("/smartor/wechat")
@PropertySource(value = {"classpath:application-druid.yml"})
public class WeChatController extends BaseController {
    @Value("appid")
    private String appid = "wx1c5243d2337753f4";
    @Value("${appid}")
    private String appid;
    @Value("appSecret")
    private String appSecret = "84a2186a0d175e88345267c716516cd3";
    @Value("${appSecret}")
    private String appSecret;
    /**
     * 获取模板信息
     *
     * @return
     */
    @ApiOperation("获取模板信息")
    @GetMapping("/getTemplateList")
    public JSONArray getTemplateList() {
        String url = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=" + getAccessToken();
@@ -62,6 +71,7 @@
     * @param weChatSendVo
     * @return
     */
    @ApiOperation("微信公众号信息发送")
    @PostMapping("/sendMessageToFollowers")
    public Boolean sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo) {
        WxMpService wxMpService;
@@ -86,7 +96,6 @@
    }
    /**
     * 获取 access_token
     */
@@ -103,7 +112,6 @@
            return null;
        }
    }
    //  }
}