浏览代码

【Fix】修复积分抽奖以及产品查询问题

liuxiangxin 6 月之前
父节点
当前提交
439c572ee1

+ 4 - 0
app/Http/Controllers/Admin/LotteryScore.php

@@ -25,8 +25,12 @@ class LotteryScore extends Auth{
 	 * 
 	 * */
     public function index(Model $Model){
+		// 接收参数
+		$name					= request('name','');
 		// 查询条件
 		$map 					= [];
+		// 组合条件
+		if( $name )				$map[] = ['name','=',$name];
 		// 查询数据
 		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(config('page_num',10));
 		// 循环处理数据

+ 6 - 0
app/Http/Controllers/Admin/LotteryScoreReward.php

@@ -23,8 +23,14 @@ class LotteryScoreReward extends Auth{
 	 * 
 	 * */
     public function index(Model $Model,LotteryScore $LotteryScore){
+		// 接收参数
+		$lotteryId				= request('lottery_id',0);
+		$name					= request('name','');
 		// 查询条件
 		$map 					= [];
+		// 组合条件
+		if( $lotteryId )		$map[] = ['lottery_id','=',$lotteryId];
+		if( $name )				$map[] = ['reward_name','=',$name];
 		// 查询数据
 		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(config('page_num',10));
 		// 循环处理数据

+ 2 - 2
app/Http/Controllers/Admin/Product.php

@@ -44,7 +44,7 @@ class Product extends Auth{
 		// 查询条件
 		$map 					= [];
 		// 是否有城市
-		$wherIn					= empty($custom['city_id']) ? [] : $cityIds;
+		$whereIn				= $cityIds ? $cityIds : [];
 		// 编码ID
 		if( $id )				$map[] = ['product.id','=',$id];
 		if( $name )				$map[] = ['product.name','like','%'.$name.'%'];
@@ -53,7 +53,7 @@ class Product extends Auth{
 		if( !is_null($status) )	$map[] = ['product.status','=',$status];
 		// 查询数据
 		$list					= $Model->query();
-		if( $wherIn )			$list = $list->join('product_city','product_city.product_id','=','product.id')->whereIn('product_city.city_id',$wherIn);
+		if( $whereIn )			$list = $list->join('product_city','product_city.product_id','=','product.id')->whereIn('product_city.city_id',$whereIn);
 		$list 					= $list->groupBy('product.id')
 								->where($map)
 								->orderBy('product.sort')