function httpurl($api, $postdata, $post = false, $pic = false, $needSlove = true)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $api);
        curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回

        if ($pic) {
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
        } elseif (0 === strpos(strtolower($api), 'https')) {
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); // 从证书中检查SSL加密算法是否存在
        }

        if ($post) {
            curl_setopt($curl, CURLOPT_POST, 1);
        }

        if (isset($postdata) && $postdata != '') {
            curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
        }

        $response = curl_exec($curl);

        if (curl_errno($curl)) {
            $this->loginfo(json_encode($postdata), __METHOD__, 'wechat_fail', json_encode($response));
            return false;
        }

        curl_close($curl);
        if($needSlove){
            $response = json_decode($response);
        }
        return $response;
    }
public function post_curls($url, $post, $type = '', $headersParams = [], $timeout = 30)
    {
        // header("Content-Type:application/json;charset=utf-8");
        $headers = array(
            "Content-type: application/json;charset='utf-8'",
            "Accept: application/json",
            "Cache-Control: no-cache",
            "Pragma: no-cache",
        );
        if (!empty($headersParams)) {
            $headers = array_merge($headers, $headersParams);
        }
        if ($type == 'file') {
            $headers = ['Content-Type:multipart/form-data;charset=utf-8'];
        } else if ($type == 'task') {
            $headers = ['X-USERID:heamePWZka1m8TVyARMhyA=='];
        }
        $curl = curl_init(); // 启动一个CURL会话
        curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
        if (0 === strpos(strtolower($url), 'https')) {
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); // 从证书中检查SSL加密算法是否存在
        }
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
        curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
        curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
        curl_setopt($curl, CURLOPT_POSTFIELDS, $type == 'file' || $type == 'encrypt' ? $post : json_encode($post)); // Post提交的数据包
        curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // 设置超时限制防止死循环
        curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        $res = curl_exec($curl); // 执行操作
        if (curl_errno($curl)) {
            $this->loginfo('-', __METHOD__, "Errno", curl_error($curl)); //捕抓异常
        }
        curl_close($curl); // 关闭CURL会话
        return $res; // 返回数据,json格式
    }