package com.agri.common.utils.wechat;

import cn.hutool.core.map.MapUtil;
import com.agri.common.utils.http.HttpUtils;
import org.springframework.http.MediaType;

import java.util.Map;

/**
 * @Auther: jone
 * @Date: 2026/1/24 - 01 - 24 - 21:12
 * @Description: com.agri.common.utils.wechat
 * @version: 1.0
 */
public class WxUtil {


    private static final String WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3cfeb466-76b9-4cf9-b03b-2324a2c3900f";

    /**
     *
     * @param param
     * @return
     */
    public static Map pushText(String param) {
        // 1. 构建请求参数
        Map<String, Object> requestBody = MapUtil.<String, Object>builder()
                .put("msgtype", "text")
                .put("text", MapUtil.<String, Object>builder()
                        .put("content", param)
                        .build())
                .build();
        return HttpUtils.post(WEBHOOK_URL,
                requestBody, MediaType.APPLICATION_JSON_VALUE, Map.class);
    }
}
