正在显示
1 个修改的文件
包含
10 行增加
和
50 行删除
@@ -320,7 +320,7 @@ class Wechat extends Api | @@ -320,7 +320,7 @@ class Wechat extends Api | ||
320 | return $config; | 320 | return $config; |
321 | 321 | ||
322 | }else{ | 322 | }else{ |
323 | - Common::put_file_log('预下单是啊比',json_encode($result), 'prepare_order', __CLASS__ . __FUNCTION__ . __LINE__); | 323 | + Db::name('wechat_pay_recode')->insert(['json'=>json_encode($result),'time'=>time(),'action'=>'prepare_order']); |
324 | return $result; | 324 | return $result; |
325 | } | 325 | } |
326 | 326 | ||
@@ -339,7 +339,7 @@ class Wechat extends Api | @@ -339,7 +339,7 @@ class Wechat extends Api | ||
339 | file_put_contents('1_notify.log',($xmljson),FILE_APPEND); | 339 | file_put_contents('1_notify.log',($xmljson),FILE_APPEND); |
340 | $message = json_decode($xmljson,true); | 340 | $message = json_decode($xmljson,true); |
341 | // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单 | 341 | // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单 |
342 | - Common::put_file_log('支付成功-微信支付回调信息',json_encode($message), 'pay_notify', __CLASS__ . __FUNCTION__ . __LINE__); | 342 | + Db::name('wechat_pay_recode')->insert(['json'=>json_encode($message),'time'=>time(),'action'=>'pay_notify']); |
343 | $out_trade_no = $message['out_trade_no']; | 343 | $out_trade_no = $message['out_trade_no']; |
344 | if ($message['return_code'] === 'SUCCESS' && $message['result_code'] === 'SUCCESS') { | 344 | if ($message['return_code'] === 'SUCCESS' && $message['result_code'] === 'SUCCESS') { |
345 | $o_w["order_no"] = $out_trade_no; | 345 | $o_w["order_no"] = $out_trade_no; |
@@ -390,7 +390,7 @@ class Wechat extends Api | @@ -390,7 +390,7 @@ class Wechat extends Api | ||
390 | try{ | 390 | try{ |
391 | $this->getParent($myInfo['pid'],$order_info['verification_coupon_ids'],$order_info['id']); | 391 | $this->getParent($myInfo['pid'],$order_info['verification_coupon_ids'],$order_info['id']); |
392 | }catch(\Exception $e){ | 392 | }catch(\Exception $e){ |
393 | - Common::put_file_log('上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__); | 393 | + Db::name('wechat_pay_recode')->insert(['json'=>json_encode($e->getMessage()),'time'=>time(),'action'=>'sales_distribution']); |
394 | } | 394 | } |
395 | //上级的上级 | 395 | //上级的上级 |
396 | try{ | 396 | try{ |
@@ -400,7 +400,7 @@ class Wechat extends Api | @@ -400,7 +400,7 @@ class Wechat extends Api | ||
400 | $this->getParent($myInfoP['pid'],$order_info['verification_coupon_ids'],$order_info['id']); | 400 | $this->getParent($myInfoP['pid'],$order_info['verification_coupon_ids'],$order_info['id']); |
401 | } | 401 | } |
402 | }catch(\Exception $e){ | 402 | }catch(\Exception $e){ |
403 | - Common::put_file_log('上级的上级-分销异常',json_encode($e->getMessage()), 'sales_distribution', __CLASS__ . __FUNCTION__ . __LINE__); | 403 | + Db::name('wechat_pay_recode')->insert(['json'=>json_encode($e->getMessage()),'time'=>time(),'action'=>'sales_distribution']); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | } | 406 | } |
@@ -451,47 +451,7 @@ class Wechat extends Api | @@ -451,47 +451,7 @@ class Wechat extends Api | ||
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | - // 发放佣金 企业付款到零钱 | ||
455 | - public function grant_commission($pid=0,$order_id=0){ | ||
456 | - //测试 https://coupon.xp.yn.cn/api/v1/wechat/grant_commission | ||
457 | - //$order_id = 14; | ||
458 | - try{ | ||
459 | - $send_result = 0; | ||
460 | - $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find(); | ||
461 | - $verification_store = Db::name('verification_store')->where(['id'=>$verification_order['verification_store_id']])->find(); | ||
462 | - //测试发送红包 开始 | ||
463 | - $pid = 2; | ||
464 | - $verification_store['commission'] = mt_rand(100,111)/100; | ||
465 | - //测试结束 | ||
466 | - $user_info = Db::name('user')->where(['id'=>$pid])->find(); | ||
467 | - | ||
468 | - if(!empty($verification_store['commission'])){ | ||
469 | - $app = WehcatModule::getInstance()->initWechatPay(); | ||
470 | - $result = $app->transfer->toBalance([ | ||
471 | - 'partner_trade_no' => $verification_order['order_no'], // 商户订单号,需保持唯一性(只能是字母或者数字,不能包含有符号) | ||
472 | - 'openid' => $user_info['openid'], | ||
473 | - 'check_name' => 'NO_CHECK', // NO_CHECK:不校验真实姓名, FORCE_CHECK:强校验真实姓名 | ||
474 | - 're_user_name' => $user_info['nickname'], // 如果 check_name 设置为FORCE_CHECK,则必填用户真实姓名 | ||
475 | - 'amount' =>$verification_store['commission']*100 , // 企业付款金额,单位为分 | ||
476 | - 'desc' => '分销佣金', // 企业付款操作说明信息。必填 | ||
477 | - ]); | ||
478 | - | ||
479 | - if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){ | ||
480 | - //记录佣金表 后台没有配置 | ||
481 | - $send_result = 1; | ||
482 | - | ||
483 | - }else{ | ||
484 | - Common::put_file_log('失败-佣金发放',json_encode($result), 'grant_commission', __CLASS__ . __FUNCTION__ . __LINE__); | ||
485 | - } | ||
486 | - }else{ | ||
487 | - | ||
488 | - } | ||
489 | - | ||
490 | - $this->brokerage_record($verification_store,$user_info,$send_result,$verification_order); | ||
491 | - }catch(\Exception $e){ | ||
492 | - Common::put_file_log('异常-佣金发放',json_encode($result), 'grant_commission', __CLASS__ . __FUNCTION__ . __LINE__); | ||
493 | - } | ||
494 | - } | 454 | + |
495 | 455 | ||
496 | 456 | ||
497 | // 发放红包 单位 分 最低100分, | 457 | // 发放红包 单位 分 最低100分, |
@@ -518,16 +478,16 @@ class Wechat extends Api | @@ -518,16 +478,16 @@ class Wechat extends Api | ||
518 | 'act_name' => '佣金分享红包到账', | 478 | 'act_name' => '佣金分享红包到账', |
519 | 'remark' => '感谢您的参与', | 479 | 'remark' => '感谢您的参与', |
520 | ]); | 480 | ]); |
521 | - return json($result); | ||
522 | - die; | 481 | + |
523 | if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){ | 482 | if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){ |
524 | //记录佣金表 verification_brokerage_record | 483 | //记录佣金表 verification_brokerage_record |
525 | $send_result = 1; | 484 | $send_result = 1; |
526 | } | 485 | } |
527 | - Common::put_file_log('红包发放',json_encode($result), 'grant_red_packets', __CLASS__ . __FUNCTION__ . __LINE__); | 486 | + Db::name('wechat_pay_recode')->insert(['json'=>json_encode($result),'time'=>time(),'action'=>'grant_red_packets']); |
528 | $this->brokerage_record($verification_store,$user_info,$send_result,$verification_order,$mch_billno); | 487 | $this->brokerage_record($verification_store,$user_info,$send_result,$verification_order,$mch_billno); |
529 | }catch(\Exception $e){ | 488 | }catch(\Exception $e){ |
530 | - Common::put_file_log('异常-红包发放',json_encode($result), 'grant_red_packets', __CLASS__ . __FUNCTION__ . __LINE__); | 489 | + Db::name('wechat_pay_recode')->insert(['json'=>json_encode($result),'time'=>time(),'action'=>'grant_red_packets']); |
490 | + | ||
531 | } | 491 | } |
532 | } | 492 | } |
533 | 493 | ||
@@ -553,7 +513,7 @@ class Wechat extends Api | @@ -553,7 +513,7 @@ class Wechat extends Api | ||
553 | $record['mch_billno'] = $mch_billno; | 513 | $record['mch_billno'] = $mch_billno; |
554 | Db::name('verification_brokerage_record')->insert($record); | 514 | Db::name('verification_brokerage_record')->insert($record); |
555 | }catch(\Exception $e){ | 515 | }catch(\Exception $e){ |
556 | - Common::put_file_log('佣金记录失败',$e->getMessage(), 'brokerage_record', __CLASS__ . __FUNCTION__ . __LINE__); | 516 | + Db::name('wechat_pay_recode')->insert(['json'=>$e->getMessage(),'time'=>time()]); |
557 | } | 517 | } |
558 | 518 | ||
559 | } | 519 | } |
-
请 注册 或 登录 后发表评论