We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class EntMoney { /** * 企业发送现金 */ const API_SEND = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers';
public function send(array $data) { $defaultParam['nonce_str'] = uniqid('pre_'); $defaultParam['mchid'] = $this->business->mch_id; $defaultParam['mch_appid'] = $this->business->appid; //if ($type == self::TYPE_CASH_LUCK_MONEY) { $defaultParam['spbill_create_ip'] = $_SERVER['REMOTE_ADDR']; //} $defaultParam['check_name']='NO_CHECK'; $param = array_merge($data, $defaultParam); $signGenerator = new SignGenerator($param); $me = $this; $signGenerator->onSortAfter(function (SignGenerator $that) use ($me) { $that->key = $me->business->mch_key; }); $sign = $signGenerator->getResult(); $param['sign'] = $sign; $request = XML::build($param); //设置Http使用的证书 $options['sslcert_path'] = $this->business->getClientCert(); $options['sslkey_path'] = $this->business->getClientKey(); $http = new Http(); $url = self::API_SEND; $response = $http->request($url, Http::POST, $request, $options); if (empty($response)) { throw new Exception('Send LuckMoney failed.'); } $result = XML::parse($response); return $result; }
/使用/ $business = new Business( Config::get('wechat.app_id'), Config::get('wechat.secret'), Config::get('wechat.mch_id'), Config::get('wechat.mch_key') ); $business->setClientCert(Config::get('wechat.clientcert_path')); $business->setClientKey(Config::get('wechat.clientkey_path'));
$entMoney = new EntMoney($business); $entMoneyData['partner_trade_no'] = time(); //订单号 $entMoneyData['openid'] = $custom->openid; //企业付款接收者的openId $entMoneyData['check_name'] = 'NO_CHECK'; //是否核对真实姓名 $entMoneyData['amount'] = floor($money); //支付现金 $entMoneyData['desc'] = '奖金支付给A企业员工'; $result = $entMoney->send($entMoneyData);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
class EntMoney
{
/**
* 企业发送现金
*/
const API_SEND = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers';
/使用/
$business = new Business(
Config::get('wechat.app_id'),
Config::get('wechat.secret'),
Config::get('wechat.mch_id'),
Config::get('wechat.mch_key')
);
$business->setClientCert(Config::get('wechat.clientcert_path'));
$business->setClientKey(Config::get('wechat.clientkey_path'));
The text was updated successfully, but these errors were encountered: