Browse Source

卡批次详情

PV-12\Admin 4 months ago
parent
commit
c0dd384125

+ 18 - 0
app/admin/controller/card/CardBatchController.php

@@ -97,4 +97,22 @@ class CardBatchController
     }
 
 
+    /**
+     * Notes: 卡批次详情
+     * User: ZhouBenXu
+     * DateTime: 2024/6/28 上午10:51
+     * @param Request $request
+     * @return Response
+     */
+    public function info(Request $request)
+    {
+        $params = $request->get();
+        // 验证器
+        $validate = new CardBatchValidate();
+        if (!$validate->scene('info')->check($params)) {
+            return json_fail($validate->getError());
+        }
+        return CardBatchService::getInfo($params['card_batch_id']);
+    }
+
 }

+ 39 - 0
app/admin/controller/card/CardController.php

@@ -12,7 +12,46 @@ namespace app\admin\controller\card;
 class CardController
 {
 
+    /**
+     * Notes: 卡列表
+     * User: ZhouBenXu
+     * DateTime: 2024/6/28 上午10:42
+     */
+    public function list(){
 
+    }
+
+    /**
+     * Notes: 卡详情
+     * User: ZhouBenXu
+     * DateTime: 2024/6/28 上午10:43
+     */
+    public function info(){
+
+    }
+
+
+    /**
+     * Notes: 修改卡信息
+     * User: ZhouBenXu
+     * DateTime: 2024/6/28 上午10:43
+     */
+    public function save()
+    {
+
+
+    }
+
+
+    /**
+     * Notes: 删除卡信息
+     * User: ZhouBenXu
+     * DateTime: 2024/6/28 上午10:43
+     */
+    public function delete()
+    {
+
+    }
 
 
 }

+ 19 - 2
app/admin/service/card/CardBatchService.php

@@ -87,8 +87,6 @@ class CardBatchService
             $model = $cardBatchModel::find($params['card_batch_id']);
             $model->card_batch_name = $params['card_batch_name'];
             $params['card_batch_status'] = $model->card_batch_status = $cardBatchModel::CARD_BATCH_STATUS[$params['card_batch_status']]; // 批次状态
-
-
             if ($params['validtimes_status'] == 0) {
                 $model->card_batch_validtimes = 0; // 卡批次有效期 0=永久 天
             } elseif ($params['validtimes_status'] == 1) {
@@ -254,4 +252,23 @@ class CardBatchService
         return json_success('', compact('rows', 'page', 'page_size', 'total'));
     }
 
+
+    /**
+     * Notes: 卡批次详情
+     * User: ZhouBenXu
+     * DateTime: 2024/6/28 上午10:50
+     * @param $card_batch_id
+     * @return Response
+     */
+    public static function getInfo($card_batch_id)
+    {
+        $cardBatch = CardBatch::where('card_batch_id', $card_batch_id)->first()->toArray();
+        if (!empty($cardBatch)) {
+            $cardBatch['card_batch_status'] = array_flip(CardBatch::CARD_BATCH_STATUS)[$cardBatch['card_batch_status']];
+            !empty($cardBatch['card_batch_json']) && $cardBatch['card_batch_json'] = json_decode($cardBatch['card_batch_json'], true);
+            !empty($cardBatch['card_batch_extend_json']) && $cardBatch['card_batch_extend_json'] = json_decode($cardBatch['card_batch_extend_json'], true);
+        }
+        return json_success('',$cardBatch);
+    }
+
 }

+ 1 - 1
app/admin/validate/card/CardBatchValidate.php

@@ -39,7 +39,7 @@ class CardBatchValidate extends Validate
         'save' => ['join_card_batch_user_id','card_batch_id','validtimes_status','card_batch_name'],
         'delete' => ['card_batch_ids'],
         'list' => ['page','pageSize'],
-        'changeStatus' => []
+        'info' => ['card_batch_id']
     ];
 
 

+ 2 - 3
route/admin.php

@@ -897,9 +897,7 @@ Route::group('/admin', function () {
     Route::group('/card', function () {
         /* 卡管理 */
         Route::group('/card', function () {
-            Route::get('/list', [\app\admin\controller\member\FamilyController::class, 'list']);
-            Route::get('/list/{id:\w+}', [\app\admin\controller\member\FamilyController::class, 'selectList']);
-            Route::get('/info/{id:\w+}', [\app\admin\controller\member\FamilyController::class, 'selectInfo']);
+            Route::get('/list', [\app\admin\controller\card\CardController::class, 'list']);
         })->middleware([
             \app\middleware\AdminAuthCheck::class
         ]);
@@ -910,6 +908,7 @@ Route::group('/admin', function () {
             Route::post('/save', [\app\admin\controller\card\CardBatchController::class, 'save']);
             Route::delete('/delete', [\app\admin\controller\card\CardBatchController::class, 'delete']);
             Route::get('/list', [\app\admin\controller\card\CardBatchController::class, 'list']);
+            Route::get('/info', [\app\admin\controller\card\CardBatchController::class, 'info']);
         })->middleware([
             \app\middleware\AdminAuthCheck::class
         ]);