wesmiler 6 godzin temu
rodzic
commit
fa9fa17703

+ 19 - 0
app/Http/Controllers/Api/v1/AccountController.php

@@ -113,4 +113,23 @@ class AccountController extends webApp
             return showJson(1046, false, $error);
         }
     }
+
+    /**
+     * 提现收款确认
+     * @return array
+     */
+    public function confirm()
+    {
+        $params = request()->all();
+        try {
+            if (!$result = AccountService::make()->confirm($this->userId, $params)) {
+                return showJson(AccountService::make()->getError(), false);
+            } else {
+                return showJson(AccountService::make()->getError(), true, $result);
+            }
+        } catch (\Exception $exception) {
+            $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()];
+            return showJson(1046, false, $error);
+        }
+    }
 }

+ 19 - 0
app/Services/Api/BalanceLogService.php

@@ -281,4 +281,23 @@ class BalanceLogService extends BaseService
         $this->error = '提现申请成功,请耐心等候审核~';
         return ['id'=>$orderId,'money'=>$money];
     }
+
+    public function confirm($userId, $params)
+    {
+        $id = isset($params['id'])?$params['id']: 0;
+        $userInfo = MemberService::make()->getInfo($userId,[], true);
+        $status = isset($userInfo['status'])? $userInfo['status'] : 0;
+        if(empty($userInfo) || $status != 1){
+            $this->error = 1045;
+            return false;
+        }
+
+        $withdrawLog = BalanceLogModel::where(['id'=> $id,'mark'=>1])
+            ->first();
+
+        if(empty($withdrawLog)){
+            $this->error = '提现数据不存在';
+            return false;
+        }
+    }
 }

+ 8 - 8
app/Services/Api/MemberService.php

@@ -678,24 +678,24 @@ class MemberService extends BaseService
         $cacheKey = "caches:members:account:{$userId}_{$type}";
         $datas = RedisService::get($cacheKey);
         if ($datas) {
-            return $type?(isset($datas[$type-1])?$datas[$type-1]:[]):$datas;
+            return $type?(isset($datas[$type])?$datas[$type]:[]):$datas;
         }
-
-        $datas[0] = MemberBankModel::where(['type'=>1,'user_id'=>$userId,'status'=>1,'mark'=>1])
+        $datas[10] = ['id'=>0,'type'=>10];
+        $datas[20] = MemberBankModel::where(['type'=>20,'user_id'=>$userId,'status'=>1,'mark'=>1])
             ->select(['id','user_id','type','realname','account','account_remark','status'])
             ->first();
-        $datas[0] = $datas[0]? $datas[0] : ['id'=>0,'type'=>1];
-        $datas[1] = MemberBankModel::where(['type'=>2,'user_id'=>$userId,'status'=>1,'mark'=>1])
+        $datas[20] = $datas[20]? $datas[20] : ['id'=>0,'type'=>20];
+        $datas[50] = MemberBankModel::where(['type'=>50,'user_id'=>$userId,'status'=>1,'mark'=>1])
             ->select(['id','user_id','type','realname','account','account_remark','status'])
             ->first();
-        $datas[1] = $datas[1]? $datas[1] : ['id'=>0,'type'=>2];
+        $datas[50] = $datas[50]? $datas[50] : ['id'=>0,'type'=>50];
         if($datas){
             RedisService::set($cacheKey, $datas, rand(5,10));
         }else{
-            $datas = [['id'=>0,'type'=>1],['id'=>0,'type'=>2]];
+            $datas = [['id'=>0,'type'=>20],['id'=>0,'type'=>50]];
         }
 
-        return $type?(isset($datas[$type-1])?$datas[$type-1]:[]):$datas;
+        return $type?(isset($datas[$type])?$datas[$type]:[]):$datas;
     }
 
     /**

+ 1 - 0
routes/api.php

@@ -73,6 +73,7 @@ Route::prefix('v1')->middleware('web.login')->group(function() {
     Route::post('/account/index', [\App\Http\Controllers\Api\v1\AccountController::class, 'index']);
     Route::post('/account/withdraw', [\App\Http\Controllers\Api\v1\AccountController::class, 'withdraw']);
     Route::post('/account/balance', [\App\Http\Controllers\Api\v1\AccountController::class, 'balance']);
+    Route::post('/account/confirm', [\App\Http\Controllers\Api\v1\AccountController::class, 'confirm']);
 
     // 生活充值
     Route::post('/account/payMeal', [\App\Http\Controllers\Api\v1\AccountController::class, 'payMeal']);