作者 chencheng

0601-5

@@ -507,8 +507,9 @@ class Wechat extends Api @@ -507,8 +507,9 @@ class Wechat extends Api
507 $user_info = Db::name('user')->where(['id'=>$pid])->find(); 507 $user_info = Db::name('user')->where(['id'=>$pid])->find();
508 $total_amount = $verification_store['commission'] * 100; 508 $total_amount = $verification_store['commission'] * 100;
509 $app = WehcatModule::getInstance()->initWechatPay(); 509 $app = WehcatModule::getInstance()->initWechatPay();
  510 + $mch_billno=time().rand(10000,99999);
510 $result = $app->redpack->sendNormal([ 511 $result = $app->redpack->sendNormal([
511 - 'mch_billno' => $verification_order['order_no'], 512 + 'mch_billno' => $mch_billno,
512 'send_name' => '佣金红包', 513 'send_name' => '佣金红包',
513 're_openid' => $user_info['openid'], 514 're_openid' => $user_info['openid'],
514 'total_num' => 1, //固定为1,可不传 515 'total_num' => 1, //固定为1,可不传
@@ -524,14 +525,14 @@ class Wechat extends Api @@ -524,14 +525,14 @@ class Wechat extends Api
524 $send_result = 1; 525 $send_result = 1;
525 } 526 }
526 Common::put_file_log('红包发放',json_encode($result), 'grant_red_packets', __CLASS__ . __FUNCTION__ . __LINE__); 527 Common::put_file_log('红包发放',json_encode($result), 'grant_red_packets', __CLASS__ . __FUNCTION__ . __LINE__);
527 - $this->brokerage_record($verification_store,$user_info,$send_result,$verification_order); 528 + $this->brokerage_record($verification_store,$user_info,$send_result,$verification_order,$mch_billno);
528 }catch(\Exception $e){ 529 }catch(\Exception $e){
529 Common::put_file_log('异常-红包发放',json_encode($result), 'grant_red_packets', __CLASS__ . __FUNCTION__ . __LINE__); 530 Common::put_file_log('异常-红包发放',json_encode($result), 'grant_red_packets', __CLASS__ . __FUNCTION__ . __LINE__);
530 } 531 }
531 } 532 }
532 533
533 //佣金发放记录 534 //佣金发放记录
534 - private function brokerage_record($verification_store,$user_info,$send_result,$verification_order){ 535 + private function brokerage_record($verification_store,$user_info,$send_result,$verification_order,$mch_billno){
535 //关于该笔订单是否有发送给这个人 536 //关于该笔订单是否有发送给这个人
536 // $w_re = []; 537 // $w_re = [];
537 // $w_re['order_id'] = $verification_order['id']; 538 // $w_re['order_id'] = $verification_order['id'];
@@ -549,6 +550,7 @@ class Wechat extends Api @@ -549,6 +550,7 @@ class Wechat extends Api
549 $record['send_result'] = $send_result; 550 $record['send_result'] = $send_result;
550 $record['send_reason'] = 'ID:'.$user_info['id'].'分享给ID:'.$verification_order['user_id'].',并且成功支付ID:'.$verification_order['id']; 551 $record['send_reason'] = 'ID:'.$user_info['id'].'分享给ID:'.$verification_order['user_id'].',并且成功支付ID:'.$verification_order['id'];
551 $record['order_id'] = $verification_order['id']; 552 $record['order_id'] = $verification_order['id'];
  553 + $record['mch_billno'] = $mch_billno;
552 Db::name('verification_brokerage_record')->insert($record); 554 Db::name('verification_brokerage_record')->insert($record);
553 }catch(\Exception $e){ 555 }catch(\Exception $e){
554 Common::put_file_log('佣金记录失败',$e->getMessage(), 'brokerage_record', __CLASS__ . __FUNCTION__ . __LINE__); 556 Common::put_file_log('佣金记录失败',$e->getMessage(), 'brokerage_record', __CLASS__ . __FUNCTION__ . __LINE__);