...
|
...
|
@@ -301,7 +301,10 @@ class Wechat extends Api |
|
|
$out_trade_no = $order_no;
|
|
|
$o_w["order_no"] = $out_trade_no;
|
|
|
$order_info = Db::name('verification_order')->where($o_w)->find();
|
|
|
$total_fee = $order_info['price'] = mt_rand(100,120);//测试支付1分钱
|
|
|
$total_fee = $order_info['price'] * 100;
|
|
|
//测试支付
|
|
|
$total_fee = mt_rand(100,120);//测试支付1分钱
|
|
|
//测试结束
|
|
|
$app = WehcatModule::getInstance()->initWechatPay();
|
|
|
$result = $app->order->unify([
|
|
|
'body' => '优惠券购买',
|
...
|
...
|
@@ -451,21 +454,25 @@ class Wechat extends Api |
|
|
// 发放佣金 企业付款到零钱
|
|
|
public function grant_commission($pid=0,$order_id=0){
|
|
|
//测试 https://coupon.xp.yn.cn/api/v1/wechat/grant_commission
|
|
|
$order_id = 14;
|
|
|
//$order_id = 14;
|
|
|
try{
|
|
|
$send_result = 0;
|
|
|
$verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find();
|
|
|
$verification_store = Db::name('verification_store')->where(['id'=>$verification_order['verification_store_id']])->find();
|
|
|
//测试发送红包 开始
|
|
|
$pid = 2;
|
|
|
$verification_store['commission'] = mt_rand(100,111)/100;
|
|
|
//测试结束
|
|
|
$user_info = Db::name('user')->where(['id'=>$pid])->find();
|
|
|
|
|
|
if(!empty($verification_store['commission'])){
|
|
|
$app = WehcatModule::getInstance()->initWechatPay();
|
|
|
$result = $app->transfer->toBalance([
|
|
|
'partner_trade_no' => '168532907259455', // 商户订单号,需保持唯一性(只能是字母或者数字,不能包含有符号)
|
|
|
'openid' => 'o5OQw6PPEGaHqIjAir7gqeDV5MzQ',
|
|
|
'partner_trade_no' => $verification_order['order_no'], // 商户订单号,需保持唯一性(只能是字母或者数字,不能包含有符号)
|
|
|
'openid' => $user_info['openid'],
|
|
|
'check_name' => 'NO_CHECK', // NO_CHECK:不校验真实姓名, FORCE_CHECK:强校验真实姓名
|
|
|
're_user_name' => '陈程', // 如果 check_name 设置为FORCE_CHECK,则必填用户真实姓名
|
|
|
'amount' => 1, // 企业付款金额,单位为分
|
|
|
're_user_name' => $user_info['nickname'], // 如果 check_name 设置为FORCE_CHECK,则必填用户真实姓名
|
|
|
'amount' =>$verification_store['commission']*100 , // 企业付款金额,单位为分
|
|
|
'desc' => '分销佣金', // 企业付款操作说明信息。必填
|
|
|
]);
|
|
|
|
...
|
...
|
|