| 
					
				 | 
			
			
				@@ -121,4 +121,95 @@ class CardService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return json_success('success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * Notes: 储值卡列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * User: ZhouBenXu 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * DateTime: 2024/6/28 上午11:36 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param $params 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return \support\Response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static function getList($params) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $cardModel = new Card(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $page = $params['page']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $page_size = $params['pageSize']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $join_card_batch_id = $params['join_card_batch_id'] ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $join_card_category_id = $params['join_card_category_id'] ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $join_card_member_id = $params['join_card_member_id'] ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $card_status = !empty($params['card_status']) ? Card::CARD_STATUS[$params['card_status']] : ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $card_category = $params['card_category'] ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $card_name = $params['card_name'] ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $rows = $cardModel::select('*') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->when(!empty($card_name) && $card_name != '', function ($query) use ($card_name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('card_name', 'like', '%' . $card_name . '%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($card_status), function ($query) use ($card_status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('card_status', $card_status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($join_card_batch_id), function ($query) use ($join_card_batch_id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('join_card_batch_id', $join_card_batch_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($join_card_category_id), function ($query) use ($join_card_category_id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('join_card_category_id', $join_card_category_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($join_card_member_id), function ($query) use ($join_card_member_id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('join_card_member_id', $join_card_member_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($card_category), function ($query) use ($card_category) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('card_category', $card_category); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->orderBy('card_id', 'DESC') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->forPage($page, $page_size) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->get() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $total = $cardModel::select('card_id') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->when(!empty($card_name) && $card_name != '', function ($query) use ($card_name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('card_name', 'like', '%' . $card_name . '%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($card_status), function ($query) use ($card_status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('card_status', $card_status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($join_card_batch_id), function ($query) use ($join_card_batch_id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('join_card_batch_id', $join_card_batch_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($join_card_category_id), function ($query) use ($join_card_category_id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('join_card_category_id', $join_card_category_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($join_card_member_id), function ($query) use ($join_card_member_id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('join_card_member_id', $join_card_member_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })->when(!empty($card_category), function ($query) use ($card_category) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $query->where('card_category', $card_category); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!empty($rows)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            foreach ($rows as $key => &$value) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $value['card_status_value'] = $value['card_status']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $value['card_status'] = array_flip(Card::CARD_STATUS)[$value['card_status']]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                !empty($value['card_json']) && $value['card_json'] = json_decode($value['card_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                !empty($value['card_assign_json']) && $value['card_assign_json'] = json_decode($value['card_assign_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                !empty($value['card_process_json']) && $value['card_process_json'] = json_decode($value['card_process_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                !empty($value['card_extend_json']) && $value['card_extend_json'] = json_decode($value['card_extend_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return json_success('', compact('rows', 'page', 'page_size', 'total')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * Notes: 储值卡详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * User: ZhouBenXu 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * DateTime: 2024/6/28 上午11:41 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param $card_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return \support\Response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static function getInfo($card_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $cardInfo = Card::where('card_id', $card_id)->first() ?? []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!empty($cardInfo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $cardInfo['card_status_value'] = $cardInfo['card_status']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $cardInfo['card_status'] = array_flip(Card::CARD_STATUS)[$cardInfo['card_status']]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            !empty($cardInfo['card_json']) && $cardInfo['card_json'] = json_decode($cardInfo['card_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            !empty($cardInfo['card_assign_json']) && $cardInfo['card_assign_json'] = json_decode($cardInfo['card_assign_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            !empty($cardInfo['card_process_json']) && $cardInfo['card_process_json'] = json_decode($cardInfo['card_process_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            !empty($cardInfo['card_extend_json']) && $cardInfo['card_extend_json'] = json_decode($cardInfo['card_extend_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return json_success('', $cardInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |