Procházet zdrojové kódy

【Add】中奖记录下载

liuxiangxin před 3 měsíci
rodič
revize
2dfd958b4a

+ 96 - 7
app/Http/Controllers/Admin/LotteryOrderRecord.php

@@ -4,6 +4,8 @@ use App\Http\Requests\Admin\Lottery\OrderReward as Request;
 use App\Models\Custom;
 use App\Models\Lottery\OrderRecord as Model;
 use App\Models\Lottery\Order as LotteryOrder;
+use Illuminate\Support\Facades\DB;
+
 /**
  * 抽奖记录
  *
@@ -23,10 +25,10 @@ class LotteryOrderRecord extends Auth{
 	 * 
 	 * */
     public function index(Model $Model,LotteryOrder $LotteryOrder,Custom $Custom){
-		// 接受参数
 		// 接受参数
 		$lotteryId				= request('lottery_id',0);
 		$customCode				= request('custom_code','');
+		$rewardName				= request('reward_name','');
 		$startTime				= request('start_time','');
 		$endTime				= request('end_time','');
 		$status					= request('status');
@@ -34,13 +36,20 @@ class LotteryOrderRecord extends Auth{
 		$map 					= [];
 		// 编码转ID
 		$customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
-		if( $customUid )		$map[] = ['custom_uid','=',$customUid];
-		if( $lotteryId )		$map[] = ['lottery_id','=',$lotteryId];
-		if( $startTime )		$map[] = ['insert_time','>=',strtotime($startTime)];
-		if( $endTime )			$map[] = ['insert_time','<=',strtotime($endTime)];
-		if( !is_null($status) )	$map[] = ['status','=',$status];
+		if( $customUid )		$map[] = ['lottery_order_record.custom_uid','=',$customUid];
+		if( $lotteryId )		$map[] = ['lottery_order_record.lottery_id','=',$lotteryId];
+		if( $rewardName )		$map[] = ['lottery_order_record.reward_name','=',$rewardName];
+		if( $startTime )		$map[] = ['lottery_order_record.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['lottery_order_record.insert_time','<=',strtotime($endTime)];
+		if( !is_null($status) )	$map[] = ['lottery_order_record.status','=',$status];
 		// 查询数据
-		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(config('page_num',10));
+		$list					= $Model->query()
+								->join('lottery_order','lottery_order.id','=','lottery_order_record.lottery_id')
+								->join('custom','custom.uid','=','lottery_order_record.custom_uid')
+								->where($map)
+								->select(['lottery_order_record.*','custom.weiban_extid','custom.username','lottery_order.name as active_name'])
+								->orderByDesc('id')
+								->paginate(config('page_num',10));
 		// 循环处理数据
 		foreach ($list as $key => $value) {
 			// 组合数据
@@ -88,4 +97,84 @@ class LotteryOrderRecord extends Auth{
 		return 			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
 	}
 
+	/**
+	 * 导出表格
+	 * 
+	 * */
+	public function down_excel(Model $Model,Custom $Custom){
+		// 接受参数
+        $lotteryId				= request('lottery_id',0);
+        $customCode				= request('custom_code','');
+        $startTime				= request('start_time','');
+        $endTime				= request('end_time','');
+        $status					= request('status');
+        // 查询条件
+        $map 					= [];
+        // 编码转ID
+        $customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
+        if( $customUid )		$map[] = ['lottery_order_record.custom_uid','=',$customUid];
+        if( $lotteryId )		$map[] = ['lottery_order_record.lottery_id','=',$lotteryId];
+        if( $startTime )		$map[] = ['lottery_order_record.insert_time','>=',strtotime($startTime)];
+        if( $endTime )			$map[] = ['lottery_order_record.insert_time','<=',strtotime($endTime)];
+        if( !is_null($status) )	$map[] = ['lottery_order_record.status','=',$status];
+        // 查询数据
+        $list					= $Model->query()
+                                    ->join('lottery_order','lottery_order.id','=','lottery_order_record.lottery_id')
+                                    ->join('custom','custom.uid','=','lottery_order_record.custom_uid')
+                                    ->where($map)
+                                    ->select([
+                                        'lottery_order_record.id',
+                                        'lottery_order.id as active_id',
+                                        'lottery_order.name as active_name',
+                                        'custom.uid as custom_uid',
+                                        'custom.username',
+                                        'lottery_order_record.reward_name',
+                                        'lottery_order_record.status',
+										'lottery_order_record.contact_name',
+										'lottery_order_record.contact_phone',
+										'lottery_order_record.contact_province',
+										'lottery_order_record.contact_city',
+										'lottery_order_record.contact_area',
+										'lottery_order_record.contact_addr',
+                                        'lottery_order_record.insert_time',
+                                        'custom.weiban_extid',
+                                    ])
+                                    ->orderByDesc('id')->get()->toArray();
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// 组合数据
+			$value['status']	    = $Model->getRecordState($value['status'],'name');
+			$value['custom_uid']    = $Custom->idToCode($value['custom_uid']);
+			$value['contact_addr']	= $value['contact_phone'] ? $value['contact_province'].'/'.$value['contact_city'].'/'.$value['contact_area'].'/'.$value['contact_addr'].' '.$value['contact_name'].' '.$value['contact_phone'] : '';
+			$value['username'] 	    = hide_phone($value['username']);
+			$value['insert_time']   = date('Y-m-d H:i:s',$value['insert_time']);
+			// 删除数据
+			unset($value['contact_province'],$value['contact_city'],$value['contact_area'],$value['contact_name'],$value['contact_phone']);
+			// 重组
+			$list[$key]			    = $value;
+		}
+		// 去下载
+		$this->toDown($list);
+	}
+
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+		// xlsx文件保存路径
+		$excel      		= new \Vtiful\Kernel\Excel(['path' =>public_path().'/uploads/']);
+		$filePath 			= $excel->fileName('tutorial01.xlsx', 'sheet1')->header(['记录ID','活动ID','活动名称','客户编码','客户昵称','奖品名称','收货信息','中奖时间','微伴ID'])->data($data)->output();
+		header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		header('Content-Disposition: attachment;filename="下单抽奖中奖记录'.date('Y-m-d His').'.xlsx"');
+		header('Content-Length: ' . filesize($filePath));
+		header('Content-Transfer-Encoding: binary');
+		header('Cache-Control: must-revalidate');
+		header('Cache-Control: max-age=0');
+		header('Pragma: public');
+		ob_clean();
+		flush();
+		// 输出文件,成功删除文件路径
+		if ( copy($filePath, 'php://output') )  @unlink($filePath);
+	}
+
 }

+ 1 - 1
app/Http/Controllers/Admin/LotteryRiddle.php

@@ -60,7 +60,7 @@ class LotteryRiddle extends Auth{
         // 不存在数据
         if ( is_null($link) ) {
             // 从数据库获取数据
-            $link              = Mini::getUrlLink('pages/riddle/lottery','id='.$id);
+            $link              = Mini::getUrlLink('pages/activity/lottery','id='.$id);
             // 存起来
             cache(['admin:lottery:riddle:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
         }

+ 78 - 2
app/Http/Controllers/Admin/LotteryRiddleRecord.php

@@ -23,7 +23,6 @@ class LotteryRiddleRecord extends Auth{
      *
      * */
     public function index(Model $Model,LotteryRiddle $LotteryRiddle,Custom $Custom){
-        // 接受参数
         // 接受参数
         $lotteryId				= request('lottery_id',0);
         $customCode				= request('custom_code','');
@@ -40,7 +39,13 @@ class LotteryRiddleRecord extends Auth{
         if( $endTime )			$map[] = ['insert_time','<=',strtotime($endTime)];
         if( !is_null($status) )	$map[] = ['status','=',$status];
         // 查询数据
-        $list					= $Model->query()->where($map)->orderByDesc('id')->paginate(config('page_num',10));
+        $list					= $Model->query()
+                                    ->join('lottery_riddle','lottery_riddle.id','=','lottery_riddle_record.lottery_id')
+                                    ->join('custom','custom.uid','=','lottery_riddle_record.custom_uid')
+                                    ->where($map)
+                                    ->select(['lottery_riddle_record.*','custom.weiban_extid','custom.username','lottery_riddle.name as active_name'])
+                                    ->orderByDesc('id')
+                                    ->paginate(config('page_num',10));
         // 循环处理数据
         foreach ($list as $key => $value) {
             // 组合数据
@@ -88,4 +93,75 @@ class LotteryRiddleRecord extends Auth{
         return 			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
     }
 
+    /**
+	 * 导出表格
+	 * 
+	 * */
+	public function down_excel(Model $Model,Custom $Custom){
+		// 接受参数
+        $lotteryId				= request('lottery_id',0);
+        $customCode				= request('custom_code','');
+        $startTime				= request('start_time','');
+        $endTime				= request('end_time','');
+        $status					= request('status');
+        // 查询条件
+        $map 					= [];
+        // 编码转ID
+        $customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
+        if( $customUid )		$map[] = ['lottery_riddle_record.custom_uid','=',$customUid];
+        if( $lotteryId )		$map[] = ['lottery_riddle_record.lottery_id','=',$lotteryId];
+        if( $startTime )		$map[] = ['lottery_riddle_record.insert_time','>=',strtotime($startTime)];
+        if( $endTime )			$map[] = ['lottery_riddle_record.insert_time','<=',strtotime($endTime)];
+        if( !is_null($status) )	$map[] = ['lottery_riddle_record.status','=',$status];
+        // 查询数据
+        $list					= $Model->query()
+                                    ->join('lottery_riddle','lottery_riddle.id','=','lottery_riddle_record.lottery_id')
+                                    ->join('custom','custom.uid','=','lottery_riddle_record.custom_uid')
+                                    ->where($map)
+                                    ->select([
+                                        'lottery_riddle_record.id',
+                                        'lottery_riddle.id as active_id',
+                                        'lottery_riddle.name as active_name',
+                                        'custom.uid as custom_uid',
+                                        'custom.username',
+                                        'lottery_riddle_record.reward_name',
+                                        'lottery_riddle_record.status',
+                                        'lottery_riddle_record.insert_time',
+                                        'custom.weiban_extid',
+                                    ])
+                                    ->orderByDesc('id')->get()->toArray();
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+            // 组合数据
+            $value['status']	    = $Model->getRecordState($value['status'],'name');
+			$value['custom_uid']    = $Custom->idToCode($value['custom_uid']);
+			$value['username'] 	    = hide_phone($value['username']);
+			$value['insert_time']   = date('Y-m-d H:i:s',$value['insert_time']);
+			// 重组
+			$list[$key]			    = $value;
+		}
+		// 去下载
+		$this->toDown($list);
+	}
+
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+		// xlsx文件保存路径
+		$excel      		= new \Vtiful\Kernel\Excel(['path' =>public_path().'/uploads/']);
+		$filePath 			= $excel->fileName('tutorial01.xlsx', 'sheet1')->header(['记录ID','活动ID','活动名称','客户编码','客户昵称','奖品名称','中奖状态','中奖时间','微伴ID'])->data($data)->output();
+		header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		header('Content-Disposition: attachment;filename="灯谜抽奖中奖记录'.date('Y-m-d His').'.xlsx"');
+		header('Content-Length: ' . filesize($filePath));
+		header('Content-Transfer-Encoding: binary');
+		header('Cache-Control: must-revalidate');
+		header('Cache-Control: max-age=0');
+		header('Pragma: public');
+		ob_clean();
+		flush();
+		// 输出文件,成功删除文件路径
+		if ( copy($filePath, 'php://output') )  @unlink($filePath);
+	}
+
 }

+ 96 - 5
app/Http/Controllers/Admin/LotteryScoreRecord.php

@@ -4,6 +4,8 @@ use App\Http\Requests\Admin\LotteryScoreReward as Request;
 use App\Models\Custom;
 use App\Models\Lottery\ScoreRecord as Model;
 use App\Models\Lottery\Score as LotteryScore;
+use Illuminate\Support\Facades\DB;
+
 /**
  * 抽奖记录
  *
@@ -24,7 +26,9 @@ class LotteryScoreRecord extends Auth{
 	 * */
     public function index(Model $Model,LotteryScore $LotteryScore,Custom $Custom){
 		// 接受参数
+		$lotteryId				= request('lottery_id',0);
 		$customCode				= request('custom_code','');
+		$rewardName				= request('reward_name','');
 		$startTime				= request('start_time','');
 		$endTime				= request('end_time','');
 		$status					= request('status');
@@ -32,12 +36,20 @@ class LotteryScoreRecord extends Auth{
 		$map 					= [];
 		// 编码转ID
 		$customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
-		if( $customUid )		$map[] = ['custom_uid','=',$customUid];
-		if( $startTime )		$map[] = ['insert_time','>=',strtotime($startTime)];
-		if( $endTime )			$map[] = ['insert_time','<=',strtotime($endTime)];
-		if( !is_null($status) )	$map[] = ['status','=',$status];
+		if( $customUid )		$map[] = ['lottery_score_record.custom_uid','=',$customUid];
+		if( $lotteryId )		$map[] = ['lottery_score_record.lottery_id','=',$lotteryId];
+		if( $rewardName )		$map[] = ['lottery_score_record.reward_name','=',$rewardName];
+		if( $startTime )		$map[] = ['lottery_score_record.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['lottery_score_record.insert_time','<=',strtotime($endTime)];
+		if( !is_null($status) )	$map[] = ['lottery_score_record.status','=',$status];
 		// 查询数据
-		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(config('page_num',10));
+		$list					= $Model->query()
+								->join('lottery_score','lottery_score.id','=','lottery_score_record.lottery_id')
+								->join('custom','custom.uid','=','lottery_score_record.custom_uid')
+								->where($map)
+								->select(['lottery_score_record.*','custom.weiban_extid','custom.username','lottery_score.name as active_name'])
+								->orderByDesc('id')
+								->paginate(config('page_num',10));
 		// 循环处理数据
 		foreach ($list as $key => $value) {
 			// 组合数据
@@ -85,4 +97,83 @@ class LotteryScoreRecord extends Auth{
 		return 			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
 	}
 
+	/**
+	 * 导出表格
+	 * 
+	 * */
+	public function down_excel(Model $Model,Custom $Custom){
+		// 接受参数
+        $lotteryId				= request('lottery_id',0);
+        $customCode				= request('custom_code','');
+        $startTime				= request('start_time','');
+        $endTime				= request('end_time','');
+        $status					= request('status');
+        // 查询条件
+        $map 					= [];
+        // 编码转ID
+        $customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
+        if( $customUid )		$map[] = ['lottery_score_record.custom_uid','=',$customUid];
+        if( $lotteryId )		$map[] = ['lottery_score_record.lottery_id','=',$lotteryId];
+        if( $startTime )		$map[] = ['lottery_score_record.insert_time','>=',strtotime($startTime)];
+        if( $endTime )			$map[] = ['lottery_score_record.insert_time','<=',strtotime($endTime)];
+        if( !is_null($status) )	$map[] = ['lottery_score_record.status','=',$status];
+        // 查询数据
+        $list					= $Model->query()
+                                    ->join('lottery_score','lottery_score.id','=','lottery_score_record.lottery_id')
+                                    ->join('custom','custom.uid','=','lottery_score_record.custom_uid')
+                                    ->where($map)
+                                    ->select([
+                                        'lottery_score_record.id',
+                                        'lottery_score.id as active_id',
+                                        'lottery_score.name as active_name',
+                                        'custom.uid as custom_uid',
+                                        'custom.username',
+                                        'lottery_score_record.reward_name',
+                                        'lottery_score_record.status',
+										'lottery_score_record.contact_name',
+										'lottery_score_record.contact_phone',
+										'lottery_score_record.contact_province',
+										'lottery_score_record.contact_city',
+										'lottery_score_record.contact_area',
+										'lottery_score_record.contact_addr',
+                                        'lottery_score_record.insert_time',
+                                        'custom.weiban_extid',
+                                    ])
+                                    ->orderByDesc('id')->get()->toArray();
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+            // 组合数据
+            $value['status']	    = $Model->getRecordState($value['status'],'name');
+			$value['custom_uid']    = $Custom->idToCode($value['custom_uid']);
+			$value['contact_addr']	= $value['contact_phone'] ? $value['contact_province'].'/'.$value['contact_city'].'/'.$value['contact_area'].'/'.$value['contact_addr'].' '.$value['contact_name'].' '.$value['contact_phone'] : '';
+			$value['username'] 	    = hide_phone($value['username']);
+			$value['insert_time']   = date('Y-m-d H:i:s',$value['insert_time']);
+			// 删除数据
+			unset($value['contact_province'],$value['contact_city'],$value['contact_area'],$value['contact_name'],$value['contact_phone']);
+			// 重组
+			$list[$key]			    = $value;
+		}
+		// 去下载
+		$this->toDown($list);
+	}
+
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+		// xlsx文件保存路径
+		$excel      		= new \Vtiful\Kernel\Excel(['path' =>public_path().'/uploads/']);
+		$filePath 			= $excel->fileName('tutorial01.xlsx', 'sheet1')->header(['记录ID','活动ID','活动名称','客户编码','客户昵称','奖品名称','中奖状态','收货信息','中奖时间','微伴ID'])->data($data)->output();
+		header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		header('Content-Disposition: attachment;filename="积分抽奖中奖记录'.date('Y-m-d His').'.xlsx"');
+		header('Content-Length: ' . filesize($filePath));
+		header('Content-Transfer-Encoding: binary');
+		header('Cache-Control: must-revalidate');
+		header('Cache-Control: max-age=0');
+		header('Pragma: public');
+		ob_clean();
+		flush();
+		// 输出文件,成功删除文件路径
+		if ( copy($filePath, 'php://output') )  @unlink($filePath);
+	}
 }

+ 132 - 0
app/Http/Controllers/Admin/RiddleActiveRecord.php

@@ -0,0 +1,132 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Http\Requests\Admin\Riddle\ActiveRecord as Request;
+use App\Models\Custom;
+use App\Models\Riddle\ActiveRecord as Model;
+use App\Models\Riddle\Active as RiddleActive;
+/**
+ * 抽奖记录
+ *
+ * @author    刘相欣
+ *
+ */
+class RiddleActiveRecord extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','灯谜活动');
+		$this->assign('breadcrumb2','答题记录');
+	}
+
+	/**
+	 * 列表页
+	 * 
+	 * */
+    public function index(Model $Model,RiddleActive $RiddleActive,Custom $Custom){
+		// 接受参数
+		$activeId				= request('active_id',0);
+		$customCode				= request('custom_code','');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 查询条件
+		$map 					= [];
+		// 编码转ID
+		$customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
+		if( $customUid )		$map[] = ['riddle_active_record.custom_uid','=',$customUid];
+		if( $activeId )			$map[] = ['riddle_active_record.active_id','=',$activeId];
+		if( $startTime )		$map[] = ['riddle_active_record.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['riddle_active_record.insert_time','<=',strtotime($endTime)];
+		// 查询数据
+		$list					= $Model->query()
+								->join('riddle_active','riddle_active.id','=','riddle_active_record.active_id')
+								->join('custom','custom.uid','=','riddle_active_record.custom_uid')
+								->where($map)
+								->select(['riddle_active_record.*','custom.weiban_extid','custom.username','riddle_active.name as active_name'])
+								->orderByDesc('riddle_active_record.id')
+								->paginate(config('page_num',10));
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// id转编号
+			$value['custom_code'] = $Custom->idToCode($value['custom_uid']);
+			// 重组
+			$list[$key]			= $value;
+		}
+		// 获取列表
+		$activeList 			= $RiddleActive->query()->get(['id','name'])->toArray();
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list',$list);
+		$this->assign('activeList',$activeList);
+		// 加载模板
+		return 					$this->fetch();
+    }
+
+
+	/**
+	 * 导出表格
+	 * 
+	 * */
+	public function down_excel(Model $Model,Custom $Custom){
+		// 接受参数
+		$activeId				= request('active_id',0);
+		$customCode				= request('custom_code','');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 查询条件
+		$map 					= [];
+		// 编码转ID
+		$customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
+		if( $customUid )		$map[] = ['riddle_active_record.custom_uid','=',$customUid];
+		if( $activeId )			$map[] = ['riddle_active_record.active_id','=',$activeId];
+		if( $startTime )		$map[] = ['riddle_active_record.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['riddle_active_record.insert_time','<=',strtotime($endTime)];
+		// 查询数据
+		$list					= $Model->query()
+								->join('riddle_active','riddle_active.id','=','riddle_active_record.active_id')
+								->join('custom','custom.uid','=','riddle_active_record.custom_uid')
+								->where($map)
+								->select([
+									'riddle_active_record.id',
+									'riddle_active.id as active_id',
+									'riddle_active.name as active_name',
+									'custom.uid as custom_uid',
+									'custom.username',
+									'riddle_active_record.is_answer',
+									'custom.weiban_extid',
+									'riddle_active_record.insert_time as answer_time',
+								])->orderByDesc('riddle_active_record.id')->get()->toArray();
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// 数据处理
+			$value['custom_uid'] = $Custom->idToCode($value['custom_uid']);
+			$value['username'] 	 = hide_phone($value['username']);
+			$value['is_answer']  = $value['is_answer'] ? '是' : '否';
+			$value['answer_time']= date('Y-m-d H:i:s',$value['answer_time']);
+			// 重组
+			$list[$key]			= $value;
+		}
+		// 去下载
+		$this->toDown($list);
+	}
+
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+		// xlsx文件保存路径
+		$excel      		= new \Vtiful\Kernel\Excel(['path' =>public_path().'/uploads/']);
+		$filePath 			= $excel->fileName('tutorial01.xlsx', 'sheet1')->header(['记录ID','活动ID','活动名称','客户编码','客户昵称','是否答对','微伴ID','答题时间'])->data($data)->output();
+		header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		header('Content-Disposition: attachment;filename="灯谜活动答题记录'.date('Y-m-d His').'.xlsx"');
+		header('Content-Length: ' . filesize($filePath));
+		header('Content-Transfer-Encoding: binary');
+		header('Cache-Control: must-revalidate');
+		header('Cache-Control: max-age=0');
+		header('Pragma: public');
+		ob_clean();
+		flush();
+		// 输出文件,成功删除文件路径
+		if ( copy($filePath, 'php://output') )  @unlink($filePath);
+	}
+
+}

+ 14 - 14
resources/views/admin/lottery_order_record/index.blade.php

@@ -4,7 +4,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endsection
 @section('content')
 
-<form action="" method="get" class="form-horizontal form-line">
+<form action="" method="get" class="form-horizontal form-line" name="thisform">
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
@@ -15,20 +15,20 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" required="required" class="form-control" >
-			<option value="0" > 状态 </option>
+			<option value="" > 状态 </option>
 			@foreach ($statusList as $value)
 				<option value="{{$value['id']}}" @if( !is_null(request('status'))  && request('status') == $value['id'] ) selected @endif>{{$value['name']}}</option>
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
-		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入奖品名称查询" />
-	</div>
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
 	</div>
-	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
+	<button type="submit" onclick="alter_from_attr({'method':'get','action':`{{url('admin/lottery_order_record/index')}}`})" class="btn btn-sm btn-primary"> 查询</button>
 	<a href="{{url('admin/lottery_order_record/index')}}" class="btn btn-sm btn-default" >重置</a>
+	@if( check_auth('admin/lottery_order_record/down_excel') )
+		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/lottery_order_record/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载</button>
+	@endif
 </form>
 <div class="row">
 	<div class="col-xs-12">	
@@ -37,9 +37,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<thead>
 					<tr>
 						<th>记录ID</th>
+						<th>活动ID</th>
+						<th>活动名称</th>
 						<th>客户编码</th>
+						<th>客户昵称</th>
 						<th>奖品名称</th>
-						<th>所属活动</th>
 						<th>状态</th>
 						<th>收货信息</th>
 						<th>中奖时间</th>
@@ -51,14 +53,12 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<tbody>
 						@foreach ($list as $a)
 						<tr>
-							<th>{{$a['id']}}</th>
+							<td>{{$a['id']}}</td>
+							<td>{{$a['lottery_id']}}</td>
+							<td>{{$a['active_name']}}</td>
 							<td>{{$a['custom_code']}}</td>
+							<td>{{$a['username']}}</td>
 							<td>{{$a['reward_name']}}</td>
-							<td>
-								@foreach ($lotteryList as $value)
-									@if( $a['lottery_id'] == $value['id'] ) {{$value['name']}} @endif
-								@endforeach
-							</td>
 							<td>{{$a['state']}}</td>
 							<td>{{$a['contact_name']}} {{$a['contact_phone']}} {{$a['contact_province']}} {{$a['contact_city']}} {{$a['contact_area']}} {{$a['contact_addr']}} {{$a['contact_shop']}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>
@@ -78,7 +78,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td colspan="20" class="page">{{$list->render()}}</td>
 						</tr>
 						<tr>
-							<td colspan="20">总计 {{$list->total()}} 个商店</td>
+							<td colspan="20">总计 {{$list->total()}} 条记录</td>
 						</tr>
 				</tbody>
 				

+ 2 - 2
resources/views/admin/lottery_riddle/index.blade.php

@@ -58,7 +58,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									@endif
 								@endif
 							</td>
-							<td>/pages/riddle/lottery?id={{$a['id']}}</td>
+							<td>/pages/activity/lottery?id={{$a['id']}}</td>
 							<td>{{$a['mp_urllink']}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 							<td>
@@ -88,7 +88,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td colspan="20" class="page">{{$list->render()}}</td>
 						</tr>
 						<tr>
-							<td colspan="20">总计 {{$list->total()}} 个商店</td>
+							<td colspan="20">总计 {{$list->total()}} 个活动</td>
 						</tr>
 				</tbody>
 				

+ 13 - 13
resources/views/admin/lottery_riddle_record/index.blade.php

@@ -4,7 +4,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endsection
 @section('content')
 
-<form action="" method="get" class="form-horizontal form-line">
+<form action="" method="get" class="form-horizontal form-line" name="thisform">
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
@@ -15,20 +15,20 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" required="required" class="form-control" >
-			<option value="0" > 状态 </option>
+			<option value="" > 状态 </option>
 			@foreach ($statusList as $value)
 				<option value="{{$value['id']}}" @if( !is_null(request('status'))  && request('status') == $value['id'] ) selected @endif>{{$value['name']}}</option>
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
-		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入奖品名称查询" />
-	</div>
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
 	</div>
-	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
-	<a href="{{url('admin/lottery_order_record/index')}}" class="btn btn-sm btn-default" >重置</a>
+	<button type="submit" onclick="alter_from_attr({'method':'get','action':`{{url('admin/lottery_riddle_record/index')}}`})" class="btn btn-sm btn-primary"> 查询</button>
+	<a href="{{url('admin/lottery_riddle_record/index')}}" class="btn btn-sm btn-default" >重置</a>
+	@if( check_auth('admin/lottery_riddle_record/down_excel') )
+		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/lottery_riddle_record/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载</button>
+	@endif
 </form>
 <div class="row">
 	<div class="col-xs-12">	
@@ -37,9 +37,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<thead>
 					<tr>
 						<th>记录ID</th>
+						<th>活动ID</th>
+						<th>活动名称</th>
 						<th>客户编码</th>
+						<th>客户昵称</th>
 						<th>奖品名称</th>
-						<th>所属活动</th>
 						<th>状态</th>
 						<th>收货信息</th>
 						<th>中奖时间</th>
@@ -52,13 +54,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						@foreach ($list as $a)
 						<tr>
 							<th>{{$a['id']}}</th>
+							<td>{{$a['lottery_id']}}</td>
+							<td>{{$a['active_name']}}</td>
 							<td>{{$a['custom_code']}}</td>
+							<td>{{$a['username']}}</td>
 							<td>{{$a['reward_name']}}</td>
-							<td>
-								@foreach ($lotteryList as $value)
-									@if( $a['lottery_id'] == $value['id'] ) {{$value['name']}} @endif
-								@endforeach
-							</td>
 							<td>{{$a['state']}}</td>
 							<td>{{$a['contact_name']}} {{$a['contact_phone']}} {{$a['contact_province']}} {{$a['contact_city']}} {{$a['contact_area']}} {{$a['contact_addr']}} {{$a['contact_shop']}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>

+ 14 - 14
resources/views/admin/lottery_score_record/index.blade.php

@@ -4,7 +4,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endsection
 @section('content')
 
-<form action="" method="get" class="form-horizontal form-line">
+<form action="" method="get" class="form-horizontal form-line" name="thisform">
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
@@ -15,20 +15,20 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" required="required" class="form-control" >
-			<option value="0" > 状态 </option>
+			<option value="" > 状态 </option>
 			@foreach ($statusList as $value)
 				<option value="{{$value['id']}}" @if( !is_null(request('status'))  && request('status') == $value['id'] ) selected @endif>{{$value['name']}}</option>
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
-		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入奖品名称查询" />
-	</div>
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
 	</div>
-	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
+	<button type="submit" onclick="alter_from_attr({'method':'get','action':`{{url('admin/lottery_score_record/index')}}`})" class="btn btn-sm btn-primary"> 查询</button>
 	<a href="{{url('admin/lottery_score_record/index')}}" class="btn btn-sm btn-default" >重置</a>
+	@if( check_auth('admin/lottery_score_record/down_excel') )
+		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/lottery_score_record/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载</button>
+	@endif
 </form>
 <div class="row">
 	<div class="col-xs-12">	
@@ -37,9 +37,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<thead>
 					<tr>
 						<th>记录ID</th>
+						<th>活动ID</th>
+						<th>活动名称</th>
 						<th>客户编码</th>
+						<th>客户昵称</th>
 						<th>奖品名称</th>
-						<th>所属活动</th>
 						<th>状态</th>
 						<th>收货信息</th>
 						<th>中奖时间</th>
@@ -51,14 +53,12 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<tbody>
 						@foreach ($list as $a)
 						<tr>
-							<th>{{$a['id']}}</th>
+							<td>{{$a['id']}}</td>
+							<td>{{$a['lottery_id']}}</td>
+							<td>{{$a['active_name']}}</td>
 							<td>{{$a['custom_code']}}</td>
+							<td>{{$a['username']}}</td>
 							<td>{{$a['reward_name']}}</td>
-							<td>
-								@foreach ($lotteryList as $value)
-									@if( $a['lottery_id'] == $value['id'] ) {{$value['name']}} @endif
-								@endforeach
-							</td>
 							<td>{{$a['state']}}</td>
 							<td>{{$a['contact_name']}} {{$a['contact_phone']}} {{$a['contact_province']}} {{$a['contact_city']}} {{$a['contact_area']}} {{$a['contact_addr']}} {{$a['contact_shop']}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>
@@ -78,7 +78,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td colspan="20" class="page">{{$list->render()}}</td>
 						</tr>
 						<tr>
-							<td colspan="20">总计 {{$list->total()}} 个商店</td>
+							<td colspan="20">总计 {{$list->total()}} 条记录</td>
 						</tr>
 				</tbody>
 				

+ 7 - 4
resources/views/admin/riddle_active/index.blade.php

@@ -29,8 +29,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>开始时间</th>
 						<th>结束时间</th>
 						<th>活动状态</th>
-						<!-- <th>内部跳转</th> -->
-						<!-- <th>宣发链接</th> -->
+						<th>内部跳转</th>
+						<th>宣发链接</th>
 						<th>修改时间</th>
 						<th>操作</th>									
 					</tr>
@@ -58,10 +58,13 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									@endif
 								@endif
 							</td>
-							<!-- <td>/pages/riddle/active?id={{$a['id']}}</td> -->
-							<!-- <td>{{$a['mp_urllink']}}</td> -->
+							<td>/pages/riddle/active?id={{$a['id']}}</td>
+							<td>{{$a['mp_urllink']}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 							<td>
+								@if(check_auth('admin/riddle_active_record/index'))
+								<a href="{{url('admin/riddle_active_record/index?'.http_build_query(['active_id'=>$a['id']]))}}" class="btn btn-sm btn-primary" >参与记录</a>
+								@endif
 								@if(check_auth('admin/riddle_active/edit'))
 								<a href="{{url('admin/riddle_active/edit?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-warning" >编辑</a>
 								@endif

+ 71 - 0
resources/views/admin/riddle_active_record/index.blade.php

@@ -0,0 +1,71 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+
+<form action="" method="get" class="form-horizontal form-line" name="thisform">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
+		<select name="active_id" required="required" class="form-control" >
+			<option value="0" > 选择活动 </option>
+			@foreach ($activeList as $value)
+				<option value="{{$value['id']}}" @if( request('active_id',0) == $value['id'] ) selected @endif>{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
+	</div>
+	<button type="submit" onclick="alter_from_attr({'method':'get','action':`{{url('admin/riddle_active_record/index')}}`})" class="btn btn-sm btn-primary"> 查询</button>
+	<a href="{{url('admin/riddle_active_record/index')}}" class="btn btn-sm btn-default" >重置</a>
+	@if( check_auth('admin/riddle_active_record/down_excel') )
+		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/riddle_active_record/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载</button>
+	@endif
+</form>
+<div class="row">
+	<div class="col-xs-12">	
+		<div class="table-responsive">
+			<table class="table table-striped table-bordered table-hover">
+				<thead>
+					<tr>
+						<th>记录ID</th>
+						<th>活动ID</th>
+						<th>活动名称</th>
+						<th>客户编码</th>
+						<th>客户昵称</th>
+						<th>是否答对</th>
+						<th>微伴ID</th>
+						<th>答题时间</th>
+						<th>操作</th>									
+					</tr>
+				</thead>
+				
+				<tbody>
+						@foreach ($list as $a)
+						<tr>
+							<th>{{$a['id']}}</th>
+							<td>{{$a['active_id']}}</td>
+							<td>{{$a['active_name']}}</td>
+							<td>{{$a['custom_code']}}</td>
+							<td>{{$a['username']}}</td>
+							<td>{{$a['is_answer']?'是':'否'}}</td>
+							<td>{{$a['weiban_extid']??''}}</td>
+							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>
+							<td>
+								
+							</td>							
+						</tr>  
+						@endforeach
+						<tr>
+							<td colspan="20" class="page">{{$list->render()}}</td>
+						</tr>
+						<tr>
+							<td colspan="20">总计 {{$list->total()}} 条记录</td>
+						</tr>
+				</tbody>
+				
+			</table>
+		</div>
+	</div>
+</div>
+@endsection

+ 13 - 1
routes/web.php

@@ -402,7 +402,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('lottery_score_record/index',[App\Http\Controllers\Admin\LotteryScoreRecord::class,'index']);
     // 状态
     Route::any('lottery_score_record/set_status',[App\Http\Controllers\Admin\LotteryScoreRecord::class,'set_status']);
-
+    // 下载
+    Route::any('lottery_score_record/down_excel',[App\Http\Controllers\Admin\LotteryScoreRecord::class,'down_excel']);
 
      /* 下单抽奖活动 */
     // 列表
@@ -431,6 +432,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('lottery_order_record/index',[App\Http\Controllers\Admin\LotteryOrderRecord::class,'index']);
     // 状态
     Route::any('lottery_order_record/set_status',[App\Http\Controllers\Admin\LotteryOrderRecord::class,'set_status']);
+    // 下载
+    Route::any('lottery_order_record/down_excel',[App\Http\Controllers\Admin\LotteryOrderRecord::class,'down_excel']);
 
     /* 下单抽奖-商品范围 */
     // 列表
@@ -600,6 +603,9 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('lottery_riddle_record/index',[App\Http\Controllers\Admin\LotteryRiddleRecord::class,'index']);
     // 状态
     Route::any('lottery_riddle_record/set_status',[App\Http\Controllers\Admin\LotteryRiddleRecord::class,'set_status']);
+    // 状态
+    Route::any('lottery_riddle_record/down_excel',[App\Http\Controllers\Admin\LotteryRiddleRecord::class,'down_excel']);
+
 
     /* 灯谜活动 */
     // 列表
@@ -623,6 +629,12 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     // 状态
     Route::any('riddle_question/set_status',[App\Http\Controllers\Admin\RiddleQuestion::class,'set_status']);
 
+    /* 灯谜记录 */
+    // 列表
+    Route::any('riddle_active_record/index',[App\Http\Controllers\Admin\RiddleActiveRecord::class,'index']);
+    // 下载列表
+    Route::any('riddle_active_record/down_excel',[App\Http\Controllers\Admin\RiddleActiveRecord::class,'down_excel']);
+
     /* 灯谜选项 */
     // 列表
     Route::any('riddle_answer/index',[App\Http\Controllers\Admin\RiddleAnswer::class,'index']);