微擎企业付款到用户 PHP

public function sendMoney($openid, $money, $re_user_name = '', $desc = '', $trade_no = '')
    {
        global $_W;
        $paysetting = uni_setting($_W['uniacid'], array('payment'));
        $wechatpay = $paysetting['payment']['wechat'];
        $account_info = $_W['account'];
        $mchid = $wechatpay['mchid'];
        $key = $wechatpay['apikey'];
        $appid = $account_info['key'];

        $desc = isset($desc) ? $desc : '余额提现';
        $money = $money * 100;

        $pars = array();
        $pars['mch_appid'] = $appid;
        $pars['mchid'] = $mchid;
        $pars['nonce_str'] = random(32);
        $pars['partner_trade_no'] = empty($trade_no) ? $mchid . date('Ymd') . rand(1000000000, 9999999999) : $trade_no;
        $pars['openid'] = $openid;
        if (empty($re_user_name)) {
            $pars['check_name'] = 'NO_CHECK';
        } else {
            $pars['check_name'] = 'FORCE_CHECK';
            $pars['re_user_name'] = $re_user_name;
        }
        // NO_CHECK:不校验真实姓名
        // FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账)
        // OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)

        $pars['amount'] = $money;
        $pars['desc'] = $desc;
//        $pars['spbill_create_ip'] = isset($wechat['ip']) ? $wechat['ip'] : $_SERVER['SERVER_ADDR'];

        $pars['spbill_create_ip'] = gethostbyname($_SERVER["SERVER_NAME"]);
//        $pars['spbill_create_ip'] = $_SERVER['SERVER_ADDR'];

        ksort($pars, SORT_STRING);
        $string1 = '';
        foreach ($pars as $k => $v) {
            $string1 .= "{$k}={$v}&";
        }
        $string1 .= "key={$key}";
        $pars['sign'] = strtoupper(md5($string1));
        $xml = array2xml($pars);
        $extras = array();

        $path_cert = IA_ROOT . '/addons/weisrc_dish/cert/apiclient_cert_' . $_W['uniacid'] . '.pem';
        $path_key = IA_ROOT . '/addons/weisrc_dish/cert/apiclient_key_' . $_W['uniacid'] . '.pem';
        $path_rootca = IA_ROOT . '/addons/weisrc_dish/cert/rootca_' . $_W['uniacid'] . '.pem';
        $extras['CURLOPT_CAINFO'] = $path_rootca;
        $extras['CURLOPT_SSLCERT'] = $path_cert;
        $extras['CURLOPT_SSLKEY'] = $path_key;

        load()->func('communication');
        $procResult = null;
        $url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";
        $response = ihttp_request($url, $xml, $extras);

        if ($response['code'] == 200) {
            $responseObj = simplexml_load_string($response['content'], 'SimpleXMLElement', LIBXML_NOCDATA);
            $responseObj = (array)$responseObj;
            $return['code'] = $responseObj['return_code'];
            $return['result_code'] = $responseObj['result_code'];
            $return['err_code'] = $responseObj['err_code'];
            $return['msg'] = $responseObj['return_msg'];
            $return['trade_no'] = $pars['partner_trade_no'];
            $return['payment_no'] = $responseObj['payment_no'];

            if ($responseObj['result_code'] != 'SUCCESS') {
                print_r($responseObj);
                exit;
            }
            return $return;
        } else {
            echo '证书错误:';
            print_r($response);
            exit;
        }
    }

    //发放红包
    public function sendRedPack($openid, $money, $send_name = '余额提现', $act_name = '余额提现', $wishing = '祝您生活愉快', $trade_no
    = '')
    {
        global $_W;
        $paysetting = uni_setting($_W['uniacid'], array('payment'));
        $wechatpay = $paysetting['payment']['wechat'];
        $account_info = $_W['account'];
        $mchid = $wechatpay['mchid'];
        $key = $wechatpay['apikey'];
        $appid = $account_info['key'];

        $money = $money * 100;
        $num = 1;
        $url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack";
        $pars = array();
        $pars['wxappid'] = $appid;
        $pars['mch_id'] = $mchid;
        $pars['nonce_str'] = random(32);
        $pars['mch_billno'] = empty($trade_no) ? $mchid . date('Ymd') . rand(1000000000, 9999999999) : $trade_no;
        $pars['send_name'] = $send_name;
        $pars['re_openid'] = $openid;
        $pars['total_amount'] = $money;
        $pars['total_num'] = $num;
        $pars['wishing'] = $wishing;
//        $pars['client_ip'] = isset($wechat['ip']) ? $wechat['ip'] : $_SERVER['SERVER_ADDR'];
        $pars['client_ip'] = $_SERVER['SERVER_ADDR'];
        $pars['act_name'] = $act_name;
        $pars['remark'] = $act_name;
        ksort($pars, SORT_STRING);
        $string1 = '';
        foreach ($pars as $k => $v) {
            $string1 .= "{$k}={$v}&";
        }
        $string1 .= "key={$key}";
        $pars['sign'] = strtoupper(md5($string1));
        $xml = array2xml($pars);
        $extras = array();

        $path_cert = IA_ROOT . '/addons/weisrc_dish/cert/apiclient_cert_' . $_W['uniacid'] . '.pem';
        $path_key = IA_ROOT . '/addons/weisrc_dish/cert/apiclient_key_' . $_W['uniacid'] . '.pem';
        $path_rootca = IA_ROOT . '/addons/weisrc_dish/cert/rootca_' . $_W['uniacid'] . '.pem';
        $extras['CURLOPT_CAINFO'] = $path_rootca;
        $extras['CURLOPT_SSLCERT'] = $path_cert;
        $extras['CURLOPT_SSLKEY'] = $path_key;

        load()->func('communication');
        $procResult = null;
        $response = ihttp_request($url, $xml, $extras);
        if ($response['code'] == 200) {
            $responseObj = simplexml_load_string($response['content'], 'SimpleXMLElement', LIBXML_NOCDATA);
            $responseObj = (array)$responseObj;
            $return['code'] = $responseObj['return_code'];
            $return['result_code'] = $responseObj['result_code'];
            $return['err_code'] = $responseObj['err_code'];
            $return['msg'] = $responseObj['return_msg'];
            $return['trade_no'] = $pars['mch_billno']; //返回订单号 用于重试
            return $return;
        }
    }

杨佳乐 发布于  2024-4-30 11:22 

HTML的电子邮件链接标签mailto用法详解 前端

大家知道,mailto 是网页设计制作中的一个非常实用的 html 标签,许多拥有个人网页的朋友都喜欢在网站的醒目位置处写上自己的电子邮件地址,这样网页浏览者一旦用鼠标单击一下由 mailto 组成的超级连接后,就能自动打开当前计算机系统中默认的电子邮件客户端软件,例如 OutLook Express 以及 Foxmail 等。当然有关 mailto 标签的使用,并不仅仅就象上面所说的那样简单,它还有其他方面的应用。现在我再进一步讲解一下 mailto 的用法。

mailto 四个常用的参数

subject — 代表邮件的标题

body — 代表邮件的内容

cc — 代表一个抄送对象

bcc — 代表一个暗送对象

mailto 示例:

杨佳乐
定义了邮件的标题为 杨佳乐

杨佳乐
定义了邮件的标题为 杨佳乐 和内容为 杨佳乐博客。

杨佳乐
定义了邮件的抄送对象为 1401586744@ss.com 和邮件的暗送对象为 1401586744@tt.com


杨佳乐 发布于  2024-4-30 11:21 

Layui 使用form表单 单独使用一个原始的元素 前端

例如

加上如下代码即可:
lay-ignore


杨佳乐 发布于  2024-4-30 11:20 

Bootstrap日期时间选择器(Bootstrap DateTime Picker) 分钟间隔30 前端

$('.js-date').datetimepicker({
    lang:'ch',
    format:'Y-m-d H:i',
    step:1,
    onChangeDateTime:logic,
    onShow:logic,

    allowTimes:[
        '00:00', '00:30', '01:00', '01:30', '02:00', '02:30', '03:00', '03:30',
        '04:00', '04:30', '05:00', '05:30', '06:00', '06:30', '07:00', '07:30',
        '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30',
        '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30',
        '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30',
        '20:00', '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30'
    ]
});

杨佳乐 发布于  2024-4-30 11:20 

uniapp 配置花生壳内网穿透提示Invalid Host header解决方法 前端

uniapp 配置花生壳内网穿透提示Invalid Host header

打开manifest.json配置,重点是disableHostCheck

"h5" : {
        "devServer" : {
            "https" : false,
        "disableHostCheck":true,
        "port": 8080
        }
    }

杨佳乐 发布于  2024-4-30 11:19