工行支付

This commit is contained in:
xucong 2024-11-25 16:31:37 +08:00
parent 795af6b254
commit 89ad4b8d6a

@ -167,7 +167,7 @@ class Gh extends Api
return substr(md5("donglonghui".time().mt_rand(1,1000000)),8,13); return substr(md5("donglonghui".time().mt_rand(1,1000000)),8,13);
} }
// 查询回调记录 // 查询回调记录
public function checkReturn($alog_id,$type=""){ public function checkReturn($alog_id,$type="",$id){
$abutment = Db::name("abutment_log") $abutment = Db::name("abutment_log")
->where("alog_id",$alog_id) ->where("alog_id",$alog_id)
->where("state",0) ->where("state",0)
@ -183,23 +183,39 @@ class Gh extends Api
} }
$checkPay = $this->payReturnCheck($abutment['out_trade_no']); $checkPay = $this->payReturnCheck($abutment['out_trade_no']);
if($checkPay['return_msg'] === "SUCCESS"){ if($checkPay['return_msg'] === "SUCCESS"){
// 解冻查询
$r = json_decode($checkPay['order_submit_act_output'],true);
$jd = $this->jiedong($r);
// var_dump($jd);
if(!$jd){
return JsonServer::error('解冻失败');
}
Db::name("abutment_log") Db::name("abutment_log")
->where("seq_no",$abutment['seq_no']) ->where("seq_no",$abutment['seq_no'])
->update(['state'=>1]); ->update(['state'=>1]);
Db::name("distribution_pay") Db::name("distribution_pay")
->where("alog_id",$alog_id) ->where("alog_id",$alog_id)
->update(['pay_status'=>1]); ->update(['pay_status'=>1]);
if($type == ""){
Db::name("distribution_member_apply")->where("id",$id)->update(['alog_id'=>$alog_id]);
}
}else{ }else{
return JsonServer::error('支付失败'); return JsonServer::error('支付失败');
} }
return JsonServer::success('回调成功');
}
//分销审核通过之后才会解冻分账或者确认收货
public function CompleteAudit($id,$type=""){
$dmemberApply = Db::name("distribution_member_apply")
->where("id",$id)
->find();
$alog_id = $dmemberApply['alog_id'];
$abutment = Db::name("abutment_log")
->where("alog_id",$alog_id)
->where("state",0)
->find();
$checkPay = $this->payReturnCheck($abutment['out_trade_no']);
if($checkPay['return_msg'] === "SUCCESS") {
$r = json_decode($checkPay['order_submit_act_output'], true);
$jd = $this->jiedong($r);
// var_dump($jd);
if (!$jd) {
return JsonServer::error('解冻失败');
}
$user = Db::name("user") $user = Db::name("user")
->where('id',$abutment['user_id']) ->where('id',$abutment['user_id'])
->where('disable',0) ->where('disable',0)
@ -223,7 +239,7 @@ class Gh extends Api
} }
$earns = new Earnings(); $earns = new Earnings();
// 推广会员用户佣金 // 推广会员用户佣金
$earnings = round($earnings_pecent*$distributionPay['order_amount']/100,2); $earnings = round($earnings_pecent*$abutment['classify_amt']/100,2);
$distribution_user_earnings = AccountLog::distribution_user_earnings; $distribution_user_earnings = AccountLog::distribution_user_earnings;
$earnings_result = $earns->userEarnings($earnings,$user['first_leader'],$distribution_user_earnings); $earnings_result = $earns->userEarnings($earnings,$user['first_leader'],$distribution_user_earnings);
if(!$earnings_result){ if(!$earnings_result){
@ -232,7 +248,7 @@ class Gh extends Api
// 推广会员无极佣金 // 推广会员无极佣金
if($user['divide_state']==1){ if($user['divide_state']==1){
if($user['divide_role_user_id'] > 0){ if($user['divide_role_user_id'] > 0){
$electrodeless = round($earnings_electrodeless_pecent*$distributionPay['order_amount']/100,2); $electrodeless = round($earnings_electrodeless_pecent*$abutment['order_amount']/100,2);
$distribution_user_electrodeless_earnings = AccountLog::distribution_user_electrodeless_earnings; $distribution_user_electrodeless_earnings = AccountLog::distribution_user_electrodeless_earnings;
$earnings_result = $earns->userElectrodelessEarnings($electrodeless,$user['divide_role_user_id'],$distribution_user_electrodeless_earnings); $earnings_result = $earns->userElectrodelessEarnings($electrodeless,$user['divide_role_user_id'],$distribution_user_electrodeless_earnings);
if(!$earnings_result){ if(!$earnings_result){
@ -241,9 +257,10 @@ class Gh extends Api
} }
} }
} }
}
// 参与消费返补 // 参与消费返补
$billions = new Billions(); $billions = new Billions();
$order['order_amount'] = round($distributionPay['order_amount'],2); $order['order_amount'] = round($abutment['order_amount'],2);
$order['id'] = $alog_id; $order['id'] = $alog_id;
$order['type'] = 5; $order['type'] = 5;
$type = "distribution"; $type = "distribution";
@ -251,8 +268,9 @@ class Gh extends Api
if(!$billions_result){ if(!$billions_result){
return JsonServer::error('支付失败'); return JsonServer::error('支付失败');
} }
return JsonServer::success('回调成功'); return JsonServer::success('操作成功');
} }
// 用户账户 // 用户账户
public function userAccount($user_id,$out,$money,$merchant,$user_msg){ public function userAccount($user_id,$out,$money,$merchant,$user_msg){
$out4 = "dlh".time().$user_id."4"; $out4 = "dlh".time().$user_id."4";
@ -446,4 +464,6 @@ class Gh extends Api
} }
return true; return true;
} }
// 退款
} }