|
|
@@ -292,7 +292,7 @@ class BalanceLogsService extends BaseService
|
|
|
/**
|
|
|
* 审核结算申请(管理员审核)
|
|
|
*/
|
|
|
- public function audit($id = null, $status = null, $actualMoney = null, $remark = '', $payImg = '')
|
|
|
+ public function audit($id = null, $status = null, $payStatus=0, $actualMoney = null, $remark = '', $payImg = '',)
|
|
|
{
|
|
|
// 如果没有传入参数,从请求中获取
|
|
|
if ($id === null) {
|
|
|
@@ -310,7 +310,7 @@ class BalanceLogsService extends BaseService
|
|
|
|
|
|
DB::beginTransaction();
|
|
|
try {
|
|
|
- $record = BalanceLogModel::where('id', $id)
|
|
|
+ $record = BalanceLogModel::with(['member'])->where('id', $id)
|
|
|
->where('mark', 1)
|
|
|
->lockForUpdate()
|
|
|
->first();
|
|
|
@@ -335,12 +335,51 @@ class BalanceLogsService extends BaseService
|
|
|
|
|
|
// 如果是通过,更新支付状态和打款凭证
|
|
|
if ($status == 2) {
|
|
|
- $record->pay_status = 20; // 20-已支付
|
|
|
- $record->pay_at = date('Y-m-d H:i:s');
|
|
|
- if (!empty($payImg)) {
|
|
|
- $record->pay_img = $payImg;
|
|
|
+ // 微信
|
|
|
+ if($record->pay_type==10){
|
|
|
+
|
|
|
+ // 若立即打款
|
|
|
+ if($payStatus==20){
|
|
|
+ $member = isset($record->member)?$record->member : [];
|
|
|
+ $openid = isset($member['openid'])?$member['openid']: '';
|
|
|
+ $wechatOpenid = isset($member['wechat_openid'])?$member['wechat_openid']: '';
|
|
|
+ $openid = $openid?$openid:$wechatOpenid;
|
|
|
+ if(empty($openid)){
|
|
|
+ $this->error = '微信OPENID不为空,请确认该用户已授权登录过才可打款';
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 打款请求
|
|
|
+ $order = [
|
|
|
+ 'order_no'=> $record->order_no,
|
|
|
+ 'pay_money'=> $record->actual_money,
|
|
|
+ 'account'=> $openid,
|
|
|
+ 'real_name'=> $record->realname,
|
|
|
+ 'body'=>'收入提现',
|
|
|
+ ];
|
|
|
+
|
|
|
+ if(!$result = PaymentService::make()->transfer($order)){
|
|
|
+ $this->error = PaymentService::make()->getError();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ var_dump($result);
|
|
|
+ $record->batch_id = isset($result['batch_id'])?$result['batch_id']:''; //
|
|
|
+ $record->pay_status = 20; // 20-已支付
|
|
|
+ $record->pay_at = date('Y-m-d H:i:s');
|
|
|
+ if (!empty($payImg)) {
|
|
|
+ $record->pay_img = $payImg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $record->pay_status = 20; // 20-已支付
|
|
|
+ $record->pay_at = date('Y-m-d H:i:s');
|
|
|
+ if (!empty($payImg)) {
|
|
|
+ $record->pay_img = $payImg;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 如果是代理提现审核通过,更新代理表的累计提现金额
|
|
|
if ($record->account_type == 2 && $record->type == 2) {
|
|
|
$this->updateAgentWithdrawTotal($record);
|
|
|
@@ -427,7 +466,7 @@ class BalanceLogsService extends BaseService
|
|
|
$this->error = PaymentService::make()->getError();
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
DB::beginTransaction();
|
|
|
$batchId = isset($result['batch_id'])?$result['batch_id']:'';
|
|
|
$updateData = ['pay_status'=> 20,'pay_at'=>date('Y-m-d H:i:s'),'batch_id'=>$batchId,'receive_status'=> 2,'update_time'=>time()];
|