Răsfoiți Sursa

Merge branch 'liuxiangxin' into jun

jun 3 luni în urmă
părinte
comite
0518c3f45f
58 a modificat fișierele cu 1891 adăugiri și 161 ștergeri
  1. 5 0
      app/Helpers/functions.php
  2. 146 0
      app/Http/Controllers/Admin/Article.php
  3. 181 0
      app/Http/Controllers/Admin/ArticleEvent.php
  4. 13 2
      app/Http/Controllers/Admin/Index.php
  5. 1 1
      app/Http/Controllers/Admin/LotteryOrder.php
  6. 96 7
      app/Http/Controllers/Admin/LotteryOrderRecord.php
  7. 7 3
      app/Http/Controllers/Admin/LotteryRiddle.php
  8. 78 2
      app/Http/Controllers/Admin/LotteryRiddleRecord.php
  9. 22 0
      app/Http/Controllers/Admin/LotteryScore.php
  10. 96 5
      app/Http/Controllers/Admin/LotteryScoreRecord.php
  11. 4 4
      app/Http/Controllers/Admin/RiddleActive.php
  12. 132 0
      app/Http/Controllers/Admin/RiddleActiveRecord.php
  13. 35 1
      app/Http/Controllers/Admin/ShareMessage.php
  14. 113 0
      app/Http/Controllers/Api/Article/Comment.php
  15. 1 1
      app/Http/Controllers/Api/Custom.php
  16. 14 9
      app/Http/Controllers/Api/Lottery/Riddle.php
  17. 1 1
      app/Http/Controllers/Api/Lottery/RiddleRecord.php
  18. 1 1
      app/Http/Controllers/Api/Orders.php
  19. 13 5
      app/Http/Controllers/Api/Riddle/Active.php
  20. 10 2
      app/Http/Controllers/Api/Riddle/ActiveShare.php
  21. 13 5
      app/Http/Controllers/Api/Riddle/Answer.php
  22. 1 1
      app/Http/Controllers/Api/Score/Orders.php
  23. 44 3
      app/Http/Controllers/Api/ShareMessage.php
  24. 54 0
      app/Http/Requests/Admin/Article.php
  25. 7 1
      app/Http/Requests/Admin/ShareMessage.php
  26. 86 0
      app/Models/Article.php
  27. 52 0
      app/Models/ArticleEvent.php
  28. 6 6
      app/Models/Lottery/OrderReward.php
  29. 1 1
      app/Models/Lottery/Riddle.php
  30. 6 6
      app/Models/Lottery/RiddleReward.php
  31. 5 5
      app/Models/Lottery/ScoreReward.php
  32. 1 1
      app/Models/Orders.php
  33. 1 1
      app/Models/Riddle/Active.php
  34. 32 11
      app/Models/ShareMessage.php
  35. 0 5
      public/nginx.htaccess
  36. 54 0
      resources/views/admin/article/add.blade.php
  37. 55 0
      resources/views/admin/article/edit.blade.php
  38. 89 0
      resources/views/admin/article/index.blade.php
  39. 173 0
      resources/views/admin/article_event/index.blade.php
  40. 1 1
      resources/views/admin/image_manager/index.blade.php
  41. 3 0
      resources/views/admin/index/welcome.blade.php
  42. 14 14
      resources/views/admin/lottery_order_record/index.blade.php
  43. 13 0
      resources/views/admin/lottery_riddle/add.blade.php
  44. 13 0
      resources/views/admin/lottery_riddle/edit.blade.php
  45. 2 2
      resources/views/admin/lottery_riddle/index.blade.php
  46. 13 13
      resources/views/admin/lottery_riddle_record/index.blade.php
  47. 4 0
      resources/views/admin/lottery_score/index.blade.php
  48. 14 14
      resources/views/admin/lottery_score_record/index.blade.php
  49. 19 10
      resources/views/admin/riddle_active/add.blade.php
  50. 19 10
      resources/views/admin/riddle_active/edit.blade.php
  51. 7 4
      resources/views/admin/riddle_active/index.blade.php
  52. 71 0
      resources/views/admin/riddle_active_record/index.blade.php
  53. 4 0
      resources/views/admin/share_message/add.blade.php
  54. 4 0
      resources/views/admin/share_message/edit.blade.php
  55. 5 1
      resources/views/admin/share_message/index.blade.php
  56. 8 0
      routes/api.php
  57. 27 1
      routes/web.php
  58. 1 1
      server.php

+ 5 - 0
app/Helpers/functions.php

@@ -300,6 +300,11 @@ function array_sort($array, $key, $sort = SORT_DESC) {
  * @param   string      $phoneNumber        手机号
  */
 function hide_phone($phoneNumber) {
+    // 如果不是手机号
+    if ( !preg_match("/^1[34578]{1}\d{9}$/", $phoneNumber) ) {
+        return $phoneNumber;
+    }
+    // 隐藏手机号
     return substr_replace($phoneNumber, '****', 3, 4);
 }
 

+ 146 - 0
app/Http/Controllers/Admin/Article.php

@@ -0,0 +1,146 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Http\Requests\Admin\Article as Request;
+use App\Models\Article as Model;
+use Illuminate\Support\Facades\DB;
+
+/**
+ * 分享设置
+ *
+ * @author    huanglei
+ *
+ */
+class Article extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','资讯管理');
+		$this->assign('breadcrumb2','资讯列表');
+	}
+
+	/**
+	 * 首页列表
+	 * 
+	 * */
+    public function index(Model $Model){
+		
+		// 接受参数
+		$title					= request('title','');
+		$status					= request('status');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $title )			$map[] = ['title','LIKE','%'.$title.'%'];
+		if( $startTime )		$map[] = ['insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['insert_time','<=',strtotime($endTime)];
+		if( !is_null($status) )	$map[] = ['status','=',$status];
+		// 查询数据
+		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list', $list);
+		// 加载模板
+		return					$this->fetch();
+    }
+	/**
+	 * 状态
+	 * 
+	 * */
+	public function set_status( Request $request, Model $Model){
+		// 验证参数
+		
+		$request->scene('set_status')->validate();
+		// 接收参数
+		$id				= request('id',0);
+		$status			= request('status',0);
+		// 查询数据
+		$result			= $Model->edit($id,['status'=>$status]);
+		// 提示新增失败
+		if( !$result )	return json_send(['code'=>'error','msg'=>'设置失败']);
+
+		// 告知结果
+		return			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
+	}
+
+	/**
+	 * 添加
+	 * 
+	 * */
+	public function add( Request $request, Model $Model){
+		if( request()->isMethod('post') ){
+			// 验证参数
+			$request->scene('add')->validate();
+			// 组合数据
+			$data['thumb']			= request('thumb','');
+			$data['poster']			= request('poster','');
+			$data['title']			= request('title','');
+			$data['path']			= request('path','');
+			$data['appid']			= request('appid','');
+			$data['content']		= request('content','');
+			$data['status']			= request('status',0);
+			// 写入
+			$id						= $Model->add($data);
+			// 提示新增失败
+			if( !$id )				return json_send(['code'=>'error','msg'=>'新增失败']);
+			// 记录行为
+			$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,1,[],$data);
+			// 告知结果
+			return					json_send(['code'=>'success','msg'=>'新增成功','action'=>'add']);
+		}
+		// 分配数据
+		$this->assign('crumbs','新增');
+		// 加载模板
+		return 						$this->fetch();
+	}
+	
+	/**
+	 * 编辑
+	 * 
+	 * */
+	public function edit( Request $request, Model $Model){
+		// 接收参数
+		$id							= request('id',0);
+		// 查询数据
+		$oldData					= $Model->where(['id'=>$id])->first();
+		$oldData					= $oldData ? $oldData->toArray() : [];
+		// 修改
+		if(request()->isMethod('post')){
+			// 验证参数
+			$request->scene('edit')->validate();
+			// 组合数据
+			$data['thumb']			= request('thumb','');
+			$data['poster']			= request('poster','');
+			$data['title']			= request('title','');
+			$data['path']			= request('path','');
+			$data['appid']			= request('appid','');
+			$data['content']		= request('content','');
+			// 写入
+			$result					= $Model->edit($id,$data);
+			// 提示新增失败
+			if( !$result )			return json_send(['code'=>'error','msg'=>'修改失败']);
+			// 删除结果
+			unset($oldData['content']);
+			// 记录行为
+			$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,$oldData,$data);
+			// 告知结果
+			return					json_send(['code'=>'success','msg'=>'修改成功','action'=>'edit']);
+		}
+		// 如果是没有数据
+		if( !$oldData ) 			return $this->error('查无数据');
+		// 分配数据
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','修改');
+		// 加载模板
+		return 						$this->fetch();
+	}
+
+	
+
+}

+ 181 - 0
app/Http/Controllers/Admin/ArticleEvent.php

@@ -0,0 +1,181 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Models\ArticleEvent as Model;
+use App\Models\Custom;
+
+/**
+ * 分享设置
+ *
+ * @author    huanglei
+ *
+ */
+class ArticleEvent extends Auth{
+	const EVENT_TYPE = [
+		'1' => '阅读',
+		'2' => '点赞',
+		'3' => '分享',
+		'4' => '推荐',
+	];
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','资讯管理');
+		$this->assign('breadcrumb2','事件记录');
+	}
+
+	/**
+	 * 数据列表
+	 * 
+	 * */
+    public function index(Model $Model){
+		// 接受参数
+		$articleId				= request('article_id','');
+		$typeId					= request('type_id');
+		$title					= request('title');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $articleId )		$map[] = ['article_event.article_id','=',$articleId];
+		if( $title )			$map[] = ['article.title','LIKE','%'.$title.'%'];
+		if( $startTime )		$map[] = ['article_event.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['article_event.insert_time','<=',strtotime($endTime)];
+		if( $typeId )			$map[] = ['article_event.type_id','=',$typeId];
+		// 查询数据
+		$list					= $Model->query()
+									->join('custom','article_event.custom_uid','=','custom.uid')
+									->join('article','article_event.article_id','=','article.id')->where($map)
+									->orderByDesc('article_event.id')
+									->select([
+										'article_event.id',
+										'article_event.status',
+										'article.title as title',
+										'article_event.type_id',
+										'article_event.article_id',
+										'custom.username as custom_name',
+										'custom.uid as custom_uid',
+										'custom.weiban_extid as weiban_extid',
+										'article_event.update_time',
+									])
+									->paginate(request('limit',config('page_num',10)))->appends(request()->all());
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// 事件类型:1阅读;2点赞;3分享;4推荐
+			$value['event']			= isset(self::EVENT_TYPE[$value['type_id']]) ? self::EVENT_TYPE[$value['type_id']] : '';
+			$value['event']			= $value['event'] ? ($value['status']?'取消':'').$value['event'] : '';
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list', $list);
+		// 加载模板
+		return					$this->fetch();
+    }
+
+	/**
+	 * 导出表格导入
+	 * 
+	 * */
+	public function down_excel(Model $Model,Custom $Custom){
+		// 接受参数
+		$title					= request('title');
+		$typeId					= request('type_id');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $title )			$map[] = ['article.title','LIKE','%'.$title.'%'];
+		if( $startTime )		$map[] = ['article_event.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['article_event.insert_time','<=',strtotime($endTime)];
+		if( $typeId )			$map[] = ['article_event.type_id','=',$typeId];
+		
+		// 查询数据
+		$list					= $Model->query()
+									->join('custom','article_event.custom_uid','=','custom.uid')
+									->join('article','article_event.article_id','=','article.id')->where($map)
+									->orderByDesc('article_event.id')
+									->select([
+										'custom.uid as custom_uid',
+										'custom.username as custom_name',
+										'article_event.article_id',
+										'article.title as title',
+										'article_event.status',
+										'article_event.type_id',
+										'custom.weiban_extid as weiban_extid',
+										'article_event.update_time',
+									])->get()->toArray();
+
+		// 返回结果
+		$data						= [];
+		// 循环处理数据
+		foreach ($list as $value) {
+			// id转编号
+			$value['custom_uid']	= $Custom->idToCode($value['custom_uid']);
+			// 事件类型:1阅读;2点赞;3分享;4推荐
+			$value['type_id']		= isset(self::EVENT_TYPE[$value['type_id']]) ? self::EVENT_TYPE[$value['type_id']] : '';
+			$value['type_id']		= $value['type_id'] ? ($value['status']?'取消':'').$value['type_id'] : '';
+			$value['update_time']	= $value['update_time']? date('Y-m-d H:i:s',$value['update_time']) : '';
+			// 删除数据
+			unset($value['status']);
+			// 重组
+			$data[]					= $value;
+		}
+		
+		try {
+			// 去下载
+			
+			$this->toDown($data);
+			
+		} catch (\Throwable $th) {
+			echo $th->getMessage();
+		}
+		
+	}
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+        try {
+            $config     = [
+                'path' => public_path().'/uploads/' // xlsx文件保存路径
+            ];
+            $excel      = new \Vtiful\Kernel\Excel($config);
+            $header     =   [
+				'客户编码',
+                '客户昵称',
+                '资讯ID',
+                '资讯标题',
+                '操作类型',
+				'微伴ID',
+                '操作时间',
+            ];
+            $filePath = $excel->fileName( uniqid().'.xlsx', 'sheet1')
+                ->header($header)
+                ->data($data)
+                ->output();
+            $filename   =   '资讯用户轨迹下载.xlsx';
+            header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            header('Content-Disposition: attachment;filename="' . $filename . '"');
+            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') === false) {
+                dd('下载出错');
+            }
+            @unlink($filePath);
+            exit();
+        }catch (\Throwable $th) {
+            return $th->getMessage();
+        }
+	}
+
+
+
+
+}

+ 13 - 2
app/Http/Controllers/Admin/Index.php

@@ -1,6 +1,7 @@
 <?php namespace App\Http\Controllers\Admin;
 
 use Illuminate\Support\Facades\Cache;
+use App\Facades\Servers\WechatMini\Mini;
 
 /**
  * 后台控制器
@@ -26,9 +27,19 @@ class Index extends Auth{
 	 * */
 	public function welcome()
 	{
-	   
+		// 结果数据
+        $link                  = cache('admin:wechat:mini:index:mpurl');
+        // 不存在数据
+        if ( is_null($link) ) {
+            // 从数据库获取数据
+            $link              = Mini::getUrlLink('pages/index/index');
+            // 存起来
+            cache(['admin:wechat:mini:index:mpurl'=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
+        }
+		// 分配参数
+		$this->assign('link',$link);
 		// 加载模板
-		return $this->fetch();
+		return 					$this->fetch();
 	}
 
 

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

@@ -6,7 +6,6 @@ use App\Models\Lottery\Order as Model;
 use App\Models\City;
 use App\Models\Lottery\OrderReward;
 use App\Models\WeiBan\Tags as WeiBanTags;
-use Illuminate\Support\Facades\DB;
 use Intervention\Image\Facades\Image;
 
 /**
@@ -44,6 +43,7 @@ class LotteryOrder extends Auth{
 			$list[$key]			= $value;
 		}
 		// 分配数据
+		
 		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
 		$this->assign('list',$list);
 		// 加载模板

+ 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(uniqid().'.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);
+	}
+
 }

+ 7 - 3
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));
         }
@@ -126,7 +126,7 @@ class LotteryRiddle extends Auth{
      * 添加
      *
      * */
-    public function add(Request $request,Model $Model,City $City,WeiBanTags $WeiBanTags){
+    public function add(Request $request,Model $Model){
         if( request()->isMethod('post') ){
             // 验证参数
             $request->scene('add')->validate();
@@ -134,6 +134,8 @@ class LotteryRiddle extends Auth{
             $data['logo']			= request('logo','');
             $data['name']			= request('name','');
             $data['rule']			= request('rule','');
+            $data['freq']			= request('freq',0);
+            $data['max_reward']		= request('max_reward',0);
             $data['start_time']		= request('start_time','');
             $data['end_time']		= request('end_time','');
             $data['start_time']		= $data['start_time'] ? strtotime($data['start_time']) : 0;
@@ -158,7 +160,7 @@ class LotteryRiddle extends Auth{
      * 修改
      *
      * */
-    public function edit(Request $request,Model $Model,City $City,WeiBanTags $WeiBanTags){
+    public function edit(Request $request,Model $Model){
         // 接收参数
         $id							= request('id',0);
         // 查询用户
@@ -171,6 +173,8 @@ class LotteryRiddle extends Auth{
             $data['logo']			= request('logo','');
             $data['name']			= request('name','');
             $data['rule']			= request('rule','');
+            $data['freq']			= request('freq',0);
+            $data['max_reward']		= request('max_reward',0);
             $data['start_time']		= request('start_time','');
             $data['end_time']		= request('end_time','');
             $data['start_time']		= $data['start_time'] ? strtotime($data['start_time']) : 0;

+ 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(uniqid().'.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);
+	}
+
 }

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

@@ -5,6 +5,7 @@ use App\Models\Lottery\Score as Model;
 use App\Models\City;
 use App\Models\Lottery\ScoreReward;
 use App\Models\WeiBan\Tags as WeiBanTags;
+use App\Facades\Servers\WechatMini\Mini;
 
 /**
  * 优惠券自动发放规则
@@ -35,6 +36,8 @@ class LotteryScore extends Auth{
 		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(config('page_num',10));
 		// 循环处理数据
 		foreach ($list as $key => $value) {
+			// 小程序链接
+			$value['mp_urllink']= $this->getUrlLink($value['id']);
 			// 重组
 			$list[$key]			= $value;
 		}
@@ -45,6 +48,25 @@ class LotteryScore extends Auth{
 		return 					$this->fetch();
     }
 
+	/**
+	 * 获取小程序链接
+	 * 
+	 */
+	private function getUrlLink($id){
+		// 结果数据
+        $link                  = cache('admin:lottery:score:urllink:'.$id);
+        // 不存在数据
+        if ( is_null($link) ) {
+            // 从数据库获取数据
+            $link              = Mini::getUrlLink('pages/score/lottery','id='.$id);
+            // 存起来
+            cache(['admin:lottery:score:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
+        }
+        // 返回结果
+        return                  $link;
+
+	}
+
 	/**
 	 * 添加
 	 * 

+ 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(uniqid().'.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);
+	}
 }

+ 4 - 4
app/Http/Controllers/Admin/RiddleActive.php

@@ -53,14 +53,12 @@ class RiddleActive extends Auth{
 	 * 
 	 */
 	private function getUrlLink($id){
-
-		return                 '';
 		// 结果数据
         $link                  = cache('admin:riddle:active:urllink:'.$id);
         // 不存在数据
         if ( is_null($link) ) {
             // 从数据库获取数据
-            $link              = Mini::getUrlLink('pages/riddle/active','id='.$id);
+            $link              = Mini::getUrlLink('pages/activity/index','id='.$id);
             // 存起来
             cache(['admin:riddle:active:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
         }
@@ -103,7 +101,7 @@ class RiddleActive extends Auth{
 			// 加载图片
 			$image							= Image::make(public_path('uploads/images/poster/').'score_reward.png');
 			// 生成小程序二维码
-			$qrcode							= Mini::getUnlimit($scene,['page'=>'pages/orders/lottery','width'=>280,'is_hyaline'=>true]);
+			$qrcode							= Mini::getUnlimit($scene,['page'=>'pages/activity/index','width'=>280,'is_hyaline'=>true]);
 			// 错误提示
 			if( isset($qrcode['error']) )	return $qrcode;
 			// 加载图片
@@ -134,6 +132,7 @@ class RiddleActive extends Auth{
 			$data['logo']			= request('logo','');
 			$data['name']			= request('name','');
 			$data['rule']			= request('rule','');
+			$data['freq']			= request('freq',0);
 			$data['join_total']		= request('join_total',0);
 			$data['join_share']		= request('join_share',0);
 			$data['lottery_id']		= request('lottery_id',0);
@@ -190,6 +189,7 @@ class RiddleActive extends Auth{
 			$data['logo']			= request('logo','');
 			$data['name']			= request('name','');
 			$data['rule']			= request('rule','');
+			$data['freq']			= request('freq',0);
 			$data['join_total']		= request('join_total',0);
 			$data['join_share']		= request('join_share',0);
 			$data['lottery_id']		= request('lottery_id',0);

+ 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);
+	}
+
+}

+ 35 - 1
app/Http/Controllers/Admin/ShareMessage.php

@@ -1,6 +1,11 @@
 <?php namespace App\Http\Controllers\Admin;
 
 use App\Http\Requests\Admin\ShareMessage as Request;
+use App\Models\Product;
+use App\Models\Coupon\Active as CouponActive;
+use App\Models\Riddle\Active as RiddleActive;
+use App\Models\Score\ClockinActive;
+use App\Models\RecruitmentActive;
 use App\Models\ShareMessage as Model;
 
 /**
@@ -21,11 +26,38 @@ class ShareMessage extends Auth{
 	 * 列表页
 	 * 
 	 * */
-    public function index(Model $Model){
+    public function index(Model $Model,Product $Product,CouponActive $CouponActive,RecruitmentActive $RecruitmentActive,RiddleActive $RiddleActive,ClockinActive $ClockinActive){
 		// 查询条件
 		$map 					= [];
 		// 查询数据
 		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(config('page_num',10));
+		// 循环处理数据
+		foreach($list as $key=>$value){
+			// 产品名称/活动名称
+			$value['item_name']	= '';
+			// 判断页面,获取对应的数据
+			if( $value['pages'] == 'pages/product/index' && $value['item_id'] ) {
+				$value['item_name']	= $Product->getOne($value['item_id'],'name');
+			}
+			// 判断页面,获取对应的数据
+			if( $value['pages'] == 'pages/coupon/active' && $value['item_id'] ) {
+				$value['item_name']	= $CouponActive->getOne($value['item_id'],'name');
+			}
+			// 判断页面,获取对应的数据
+			if( $value['pages'] == 'pages/recruitment/index' && $value['item_id'] ) {
+				$value['item_name']	= $RecruitmentActive->getOne($value['item_id'],'name');
+			}
+			// 判断页面,获取对应的数据
+			if( $value['pages'] == 'pages/activity/index' && $value['item_id'] ) {
+				$value['item_name']	= $RiddleActive->getOne($value['item_id'],'name');
+			}
+			// 判断页面,获取对应的数据
+			if( $value['pages'] == 'pages/score/clockin' && $value['item_id'] ) {
+				$value['item_name']	= $ClockinActive->getOne($value['item_id'],'name');
+			}
+			// 赋值数据
+			$list[$key]			= $value;
+		}
 		// 页面列表
 		$pagesList 				= $Model->getPagesList();
 		// 分配数据
@@ -48,6 +80,7 @@ class ShareMessage extends Auth{
 			$data['pages']			= request('pages','');
 			$data['title']			= request('title','');
 			$data['image_url']		= request('image_url','');
+			$data['item_id']		= request('item_id',0);
 			// 写入数据表
 			$id						= $Model->add($data);
 			// 如果操作失败
@@ -83,6 +116,7 @@ class ShareMessage extends Auth{
 			$data['pages']			= request('pages','');
 			$data['title']			= request('title','');
 			$data['image_url']		= request('image_url','');
+			$data['item_id']		= request('item_id',0);
 			// 写入数据表
 			$result					= $Model->edit($id,$data);
 			// 如果操作失败

+ 113 - 0
app/Http/Controllers/Api/Article/Comment.php

@@ -0,0 +1,113 @@
+<?php namespace App\Http\Controllers\Api\Article;
+
+use App\Http\Controllers\Api\Api;
+use App\Models\Article as Model;
+use App\Models\ArticleEvent as ArticleEvent;
+
+/**
+ * 分享设置
+ *
+ * @author    huanglei
+ *
+ */
+class Comment extends Api{
+	const EVENT_TYPE = [
+		'1' => '阅读',
+		'2' => '点赞',
+		'3' => '分享',
+		'4' => '推荐',
+		'5' => '取消推荐',
+		'6' => '取消点赞'	
+	];
+	public function get_list(Model $Model){
+		// 查询条件
+		$map 						= [['status','=','0']];
+		// 查询文章数据
+		$Paginator					= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)));
+		// 循环处理数据
+		foreach ($Paginator as $key => $value) {
+			// 如果没有缩略图,使用海报图
+			$value['thumb']			= path_compat($value['thumb']);
+			// 获取数据
+		    $value['insert_time']   = date('Y-m-d',$value['insert_time']);
+			// 重组
+			$Paginator[$key]		= $value;
+		}
+		// 获取数据
+		$data['total']				= $Paginator->total();
+		$data['current_page']		= $Paginator->currentPage();
+		$data['per_page']			= $Paginator->perPage();
+		$data['last_page']			= $Paginator->lastPage();
+		$data['data']				= $Paginator->items();
+		// 分配数据
+		return			json_send(['code'=>'success','msg'=>'列表数据','data'=>$data]);
+    }
+	/**
+	 * 数据详情
+	 * 
+	 * */
+    public function get_detail(Model $Model, ArticleEvent $ArticleEvent){
+		// 检查登录
+		$uid 					= $this->checkLogin();
+		// 接受参数
+		$id						= request('id',0);
+		// 获取旧数据
+        $articleData            = $Model->query()->where([['status','=',0]])->find($id,['id','title','poster','content','path','appid','read_count','hand_count','like_count','share_count','insert_time']);
+		// 用户是否点赞
+		if( !$articleData )		return 	json_send(['code'=>'error','msg'=>'文章不存在或者已下架']);
+		// 转数组
+		$articleData			= $articleData->toArray();
+		// 阅读数 + 1
+		$Model->query()->where([['id','=',$id]])->increment('read_count');
+		// 如果事件不存在,新增此次事件
+		$ArticleEvent->add(['custom_uid'=>$uid,'article_id'=>$id,'type_id'=>1,'status'=>0]);
+		// 用户是否点赞和推荐
+		$articleData['is_hand']	= $uid ? (int) $ArticleEvent->query()->where([['custom_uid','=',$uid],['article_id','=',$id],['type_id','=',2],['status','=',0]])->value('id') : 0;
+		$articleData['is_like']	= $uid ? (int) $ArticleEvent->query()->where([['custom_uid','=',$uid],['article_id','=',$id],['type_id','=',4],['status','=',0]])->value('id') : 0;
+		$articleData['read_count'] += 1;
+		$articleData['insert_time'] = date('Y年m月d日 H:s',$articleData['insert_time']);
+		$articleData['poster']	= $articleData['poster'] ? path_compat($articleData['poster']) : '';
+		// 返回结果
+		return			json_send(['code'=>'success','msg'=>'暂无','data'=>$articleData]);
+		
+	}
+	
+	/**
+	 * 数据详情
+	 * 
+	 * */
+    public function update_event(Model $Model, ArticleEvent $ArticleEvent){
+		// 检查登录
+		$uid 					= $this->checkLogin();
+		// 接收参数
+		$typeId 				= request('type_id',0);
+		$articleId				= request('article_id',0);
+		// 如果用户不存在
+		$oldData 				= $uid ? $ArticleEvent->query()->where([['custom_uid','=',$uid],['article_id','=',$articleId],['type_id','=',$typeId]])->first(['id','status']) : [];
+		// 判断事件。
+		$oldData				= $oldData ? $oldData->toArray() : [];
+		// 事件已存在,并且是点赞或者喜欢
+		if( $oldData && in_array($typeId,[2,4]) ){
+			// 更新事件状态
+			$ArticleEvent->edit($oldData['id'],['status'=>$oldData['status']?0:1]);
+		}else{
+			// 新增事件
+			$ArticleEvent->add(['custom_uid'=>$uid,'article_id'=>$articleId,'type_id'=>$typeId,'status'=>0]);
+		}
+		// 判断数据类型,点赞
+		if( $typeId == 2 )		{
+			// 如果旧数据是未点赞或者取消点赞,继续点赞
+			( !$oldData || !empty($oldData['status']) ) ? $Model->query()->where([['id','=',$articleId]])->increment('hand_count') : $Model->query()->where([['id','=',$articleId],['hand_count','>=',1]])->decrement('hand_count');
+		}
+		// 判断数据类型,分享
+		if( $typeId == 3 )		$Model->query()->where([['id','=',$articleId]])->increment('share_count');
+		// 判断数据类型,喜欢
+		if( $typeId == 4 )		{
+			// 如果旧数据是未喜欢或者取消喜欢或,继续喜欢
+			( !$oldData || !empty($oldData['status']) ) ? $Model->query()->where([['id','=',$articleId]])->increment('like_count') : $Model->query()->where([['id','=',$articleId],['like_count','>=',1]])->decrement('like_count') ;
+		}
+		// 返回结果
+		return					json_send(['code'=>'success','msg'=>'操作成功','data'=>'']);
+	}
+    
+}

+ 1 - 1
app/Http/Controllers/Api/Custom.php

@@ -74,7 +74,7 @@ class Custom extends Api{
 		// 所需数组组合
 		$custom							= [
 											'uid'=>$custom['uid'],
-											'have_follow'=>$custom['weiban_extid']?1:0,
+											'have_follow'=>$custom['weiban_extid']?1:1,
 											'username'=>$custom['username'],
 											'userpic'=>$custom['userpic'],
 											'phone'=>$custom['phone'],

+ 14 - 9
app/Http/Controllers/Api/Lottery/Riddle.php

@@ -9,8 +9,6 @@ use App\Models\CustomScore;
 use App\Models\CustomAmount;
 use App\Models\Lottery\RiddleRecord;
 use App\Models\Lottery\RiddleReward as RiddleReward;
-use App\Models\OrdersProduct;
-use App\Models\WeiBan\Tags as WeiBanTags;
 use Illuminate\Support\Facades\DB;
 
 /**
@@ -113,13 +111,20 @@ class Riddle extends Api{
 				DB::rollBack();
 				return 						json_send(['code'=>'error','msg'=>'抽奖次数扣减失败','data'=>['error'=>'抽奖次数扣减失败']]);
 			}
-            //查询用户是否已中过奖
-            $rewardData						= $RiddleRecord->query()->where(['lottery_id'=>$data['id'],'custom_uid'=>$uid])->first();
-            $rewardIndex                    = 0;
-            if (!$rewardData)				{
-                // 获取奖励结果
-                $rewardIndex 				= $RiddleReward->getRewardResult($reward);
-            }
+			// 查询条件
+			$map							= [];
+			// 判断周期
+			if( !empty($data['freq']) )		{
+				if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->startOfDay()->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+				if( $data['freq'] == 2 )	$map = [['insert_time','>=',now()->startOfWeek()->getTimestamp()],['insert_time','<=',now()->endOfWeek()->getTimestamp()]];
+				if( $data['freq'] == 3 )	$map = [['insert_time','>=',now()->startOfMonth()->getTimestamp()],['insert_time','<=',now()->endOfMonth()->getTimestamp()]];
+			}
+			// 是否限制中奖次数字段,没有默认中奖一次
+			$data['max_reward']				= isset($data['max_reward']) ? 1 : $data['max_reward'];
+			// 限制中奖则获取中奖次数
+			$rewarTotal						= $data['max_reward'] ? $RiddleRecord->query()->where(['lottery_id'=>$data['id'],'custom_uid'=>$uid])->where($map)->count() : 0;
+			// 中奖上限以后不再中奖
+			$rewardIndex                    = ($data['max_reward'] && $rewarTotal >= $data['max_reward']) ? 0 : $RiddleReward->getRewardResult($reward);
 			// 如果中奖,下标不是0
             if( $rewardIndex )				{
                 // 获取奖品

+ 1 - 1
app/Http/Controllers/Api/Lottery/RiddleRecord.php

@@ -99,7 +99,7 @@ class RiddleRecord extends Api{
             // 处理数据
             $value['insert_time'] 		= date('m/d H:i',$value['insert_time']);
             $value['state'] 			= $Model->getRecordState($value['status'],'name');
-            $value['reward_info'] 		= $RiddleReward->query()->where('id',$value['reward_id'])->first()->value('reward_info');
+            $value['reward_info'] 		= $RiddleReward->query()->where('id',$value['reward_id'])->value('reward_info');
             $value['username'] 		    = $Custom->query()->where('uid',$value['custom_uid'])->value('username');
             // 重组数据
             $list[$key]					= $value;

+ 1 - 1
app/Http/Controllers/Api/Orders.php

@@ -56,7 +56,7 @@ class Orders extends Api{
 		// 如果不存在数据
 		if( !$addr )					return json_send(['code'=>'error','msg'=>'地址有误,请核对','data'=>['error'=>'没有找到对应的地址']]);
 		// 如果不存在的话
-		if( !$addr['contact_shop'] )	return json_send(['code'=>'error','msg'=>'所用地址请补充店铺名称','data'=>['error'=>'所用地址请补充店铺名称']]);
+		if( !$addr['contact_shop'] )	return json_send(['code'=>'error','msg'=>'请在店铺名称处填写具体药店名称','data'=>['error'=>'所用地址请补充店铺名称']]);
 		// 重组数据
 		$addr							= ['contact_name'=>$addr['contact_name'],'contact_shop'=>$addr['contact_shop'],'shop_type'=>$addr['shop_type'],'contact_phone'=>$addr['contact_phone'],'contact_province'=>$addr['contact_province'],'contact_city'=>$addr['contact_city'],'contact_area'=>$addr['contact_area'],'contact_addr'=>$addr['contact_addr']];
 		// 获取客户城市ID

+ 13 - 5
app/Http/Controllers/Api/Riddle/Active.php

@@ -67,11 +67,19 @@ class Active extends Api{
 			// 如果不能参与
 			if( !$data['allow_join'] )	return json_send(['code'=>'error','msg'=>'账号不在活动城市','data'=>['error'=>'账号不在活动城市']]);
 		}
-		// 获取参与次数
-		$joinTotal						= $ActiveRecord->query()->where([['active_id','=',$id],['custom_uid','=',$uid]])->count();
-		// 获取答题次数
-		$shareTotal						= $ActiveShare->query()->where([['active_id','=',$id],['custom_uid','=',$uid]])->count();
-		// 计算答题次数
+		// 查询条件
+		$map							= [];
+		// 判断周期
+		if( !empty($data['freq']) )		{
+			if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->startOfDay()->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+			if( $data['freq'] == 2 )	$map = [['insert_time','>=',now()->startOfWeek()->getTimestamp()],['insert_time','<=',now()->endOfWeek()->getTimestamp()]];
+			if( $data['freq'] == 3 )	$map = [['insert_time','>=',now()->startOfMonth()->getTimestamp()],['insert_time','<=',now()->endOfMonth()->getTimestamp()]];
+		}
+		// 获取已参与次数
+		$joinTotal						= $ActiveRecord->query()->where([['active_id','=',$id],['custom_uid','=',$uid]])->where($map)->count();
+		// 获取已分享次数
+		$shareTotal						= $ActiveShare->query()->where([['active_id','=',$id],['custom_uid','=',$uid]])->where($map)->count();
+		// 计算总答题次数
 		$data['join_total']				= $data['join_total'] + ( $shareTotal >= $data['join_share'] ? $data['join_share'] : $shareTotal);
 		// 计算剩余参与次数
 		$data['join_last']				= $data['join_total'] - $joinTotal;

+ 10 - 2
app/Http/Controllers/Api/Riddle/ActiveShare.php

@@ -27,8 +27,16 @@ class ActiveShare extends Api{
 		$data			                = $Active->getOne($activeId);
 		// 如果存在的话
 		if( !$data )					return json_send(['code'=>'error','msg'=>'活动已下线或不存在','data'=>'']);
-		// 获取答题次数
-		$shareTotal						= $Model->query()->where([['active_id','=',$activeId],['custom_uid','=',$uid]])->count();
+		// 查询条件
+		$map							= [];
+		// 判断周期
+		if( !empty($data['freq']) )		{
+			if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->startOfDay()->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+			if( $data['freq'] == 2 )	$map = [['insert_time','>=',now()->startOfWeek()->getTimestamp()],['insert_time','<=',now()->endOfWeek()->getTimestamp()]];
+			if( $data['freq'] == 3 )	$map = [['insert_time','>=',now()->startOfMonth()->getTimestamp()],['insert_time','<=',now()->endOfMonth()->getTimestamp()]];
+		}
+		// 获取已分享次数
+		$shareTotal						= $Model->query()->where([['active_id','=',$activeId],['custom_uid','=',$uid]])->where($map)->count();
 		// 计算剩余分享次数
 		$data['share_last']				= ($data['join_share'] - $shareTotal <= 0 ? 0 : $data['join_share'] - $shareTotal);
 		// 如果次数不够

+ 13 - 5
app/Http/Controllers/Api/Riddle/Answer.php

@@ -34,11 +34,19 @@ class Answer extends Api{
 		$data			                = $Active->getOne($activeId);
 		// 如果存在的话
 		if( !$data )					return json_send(['code'=>'error','msg'=>'活动已下线或不存在','data'=>'']);
-		// 获取参与次数
-		$joinTotal						= $ActiveRecord->query()->where([['active_id','=',$activeId],['custom_uid','=',$uid]])->count();
-		// 获取答题次数
-		$shareTotal						= $ActiveShare->query()->where([['active_id','=',$activeId],['custom_uid','=',$uid]])->count();
-		// 计算答题次数
+		// 查询条件
+		$map							= [];
+		// 判断周期
+		if( !empty($data['freq']) )		{
+			if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->startOfDay()->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+			if( $data['freq'] == 2 )	$map = [['insert_time','>=',now()->startOfWeek()->getTimestamp()],['insert_time','<=',now()->endOfWeek()->getTimestamp()]];
+			if( $data['freq'] == 3 )	$map = [['insert_time','>=',now()->startOfMonth()->getTimestamp()],['insert_time','<=',now()->endOfMonth()->getTimestamp()]];
+		}
+		// 获取已参与次数
+		$joinTotal						= $ActiveRecord->query()->where([['active_id','=',$activeId],['custom_uid','=',$uid]])->where($map)->count();
+		// 获取已分享次数
+		$shareTotal						= $ActiveShare->query()->where([['active_id','=',$activeId],['custom_uid','=',$uid]])->where($map)->count();
+		// 计算总答题次数
 		$data['join_total']				= $data['join_total'] + ( $shareTotal >= $data['join_share'] ? $data['join_share'] : $shareTotal);
 		// 计算剩余参与次数
 		$data['join_last']				= $data['join_total'] - $joinTotal;

+ 1 - 1
app/Http/Controllers/Api/Score/Orders.php

@@ -88,7 +88,7 @@ class Orders extends Api{
 				// 回退数据
 				DB::rollBack();
 				// 提示信息
-				return					json_send(['code'=>'error','msg'=>'兑换失败','data'=>['error'=>result['error']]]);
+				return					json_send(['code'=>'error','msg'=>'兑换失败','data'=>['error'=>$result['error']]]);
 			}
 			// 订单ID
 			$addr['order_id']			= $orderId;

+ 44 - 3
app/Http/Controllers/Api/ShareMessage.php

@@ -13,7 +13,7 @@ class ShareMessage extends Api{
 	
 	
 	/**
-	 * 获取客户信息			/api/share_message/get_list
+	 * 获取分享配置页面列表			/api/share_message/get_list
 	 * 
 	 * */
 	public function get_list(Model $Model){
@@ -22,11 +22,52 @@ class ShareMessage extends Api{
 		// 检查登录
 		$uid							= $this->getUid();
 		// 查新客户类型
-		$list			                = $Model->getList();
-
+		$list			                = $Model->getPagesList();
+		// 循环页面
+		foreach ($list as $pages => $value) {
+			// 获取页面数据
+			$value						= $Model->getOneByPage($pages,0);
+			// 如果没有配置的话
+			if( !$value )				{
+				// 删除本条
+				unset($list[$pages]);
+				// 跳过本次循环
+				continue;
+			}
+			// 重新赋值
+			$list[$pages]				= $value;
+		}
+		// 返回结果
 		$list							= array_values($list);
 		// 返回结果
 		return							json_send(['code'=>'success','msg'=>'获取成功','data'=>$list]);
 	}
+
+	/**
+	 * 获取页面分享配置			/api/share_message/get_item
+	 * 
+	 * @param   string	pages			小程序前端页面路径
+	 * @param   int	 	item_id			产品ID/活动ID
+	 * 
+	 * */
+	public function get_item(Model $Model){
+		// 接口验签
+		// $this->verify_sign();
+		// 检查登录
+		$uid							= $this->getUid();
+		// 接收参数
+		$pages							= request('pages','pages/index/index');
+		// 兼容前端
+		$pages							= trim($pages,'/');
+		$itemId							= request('item_id',0);
+		// 查询对应配置
+		$data			                = $Model->getOneByPage($pages,$itemId);
+		// 如果没有对应的配置,获取默认的配置
+		if( !$data ) 					$data = $Model->getOneByPage($pages,0);
+		// 如果都没有
+		$data							= $data ? $data : ['id'=>0,'pages'=>$pages,'title'=>'','image_url'=>'','item_id'=>0,'path'=>''];
+		// 返回结果
+		return							json_send(['code'=>'success','msg'=>'获取成功','data'=>$data]);
+	}
 	
 }

+ 54 - 0
app/Http/Requests/Admin/Article.php

@@ -0,0 +1,54 @@
+<?php namespace App\Http\Requests\Admin;
+
+use App\Http\Requests\BaseRequest;
+/**
+ * 入库验证器
+ * 
+ */
+class Article extends BaseRequest
+{
+    /**
+     * 获取应用于请求的规则
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        // 编辑时排除ID
+        // 返回结果
+        return      [
+            // 有时候我们希望某个字段在第一次验证失败后就停止运行验证规则,只需要将 bail 添加到规则中:
+            // 验证字段,验证规则,提示信息
+            'id'            => 'required|integer|gt:0',
+            'product_code'  => 'required|size:13',
+            'status'        => 'required|integer|gte:0',
+        ];
+    }
+
+    // 场景列表
+    protected   $scenes         = [
+        'add'                   => [],
+        'edit'                  => ['id'],
+        'set_status'            => ['id','status'],
+	];
+
+    /**
+     * 获取已定义验证规则的错误消息
+     *
+     * @return array
+     */
+    public function messages()
+    {
+        return [
+            'id.required'   		    => 'ID未知',
+            'id.integer'   		        => 'ID格式错误',
+            'id.gt'   		            => 'ID格式错误',
+            'product_code.required'   	=> '产品编码必填',
+            'product_code.size'   	=> '请核对编码格式',
+            'status.required'   		=> '请选择状态',
+            'status.integer'   		    => '状态格式错误',
+            'status.gte'   		        => '状态格式错误',
+        ];
+    }
+
+}

+ 7 - 1
app/Http/Requests/Admin/ShareMessage.php

@@ -16,11 +16,17 @@ class ShareMessage extends BaseRequest
      */
     public function rules()
     {
+        // 编辑时排除ID 
+        $id			= request('id',null);
+		// 非重规则
+		$unique  	= Rule::unique('share_message')->where(function ($query) {
+						return $query->where(['pages'=>request('pages',''),'item_id'=>request('item_id',0)]);
+					})->ignore($id);
         // 返回结果
         return      [
             // 有时候我们希望某个字段在第一次验证失败后就停止运行验证规则,只需要将 bail 添加到规则中:
             // 验证字段,验证规则,提示信息
-	        'pages' 			=> 'required|unique:share_message,pages,'.request('id',0),
+	        'pages' 			=> ['required',$unique],
 	        'id'                => 'required|integer|gt:0',
         ];
     }

+ 86 - 0
app/Models/Article.php

@@ -0,0 +1,86 @@
+<?php namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
+
+/**
+ * 内容分享模型
+ * 
+ */
+class Article extends Model
+{
+    use HasFactory;
+
+    // 与模型关联的表名
+    protected $table = 'article';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function add($data)
+    {
+        // 时间
+        $data['insert_time']				= time();
+        $data['update_time']				= time();
+        // 写入数据表
+        $id						            = $this->query()->insertGetId($data);
+        
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['id'=>$id])->update($data);
+        // 返回结果
+        return                              $result;
+    }
+
+    /**
+     * 编码转id
+     * 
+     * @param  string $code 编码
+     * 
+     */
+    public function codeToId($code){
+        return intval(str_ireplace('klyhq','',$code));
+     }
+ 
+    /**
+     * id转编码
+     * 
+     * @param  int  $id 编码
+     * 
+     */
+    public function idToCode($id){
+        return 'klyhq'. str_pad($id, 9, '0', STR_PAD_LEFT);
+    }
+
+    /**
+     * 获取单个信息
+     * 
+     */
+    public function getOne($id,$field=''){
+        // 返回结果
+        $result                      = $this->query()->find($id);
+        // 返回结果
+        $result                      = $result ? $result->toArray() : [];
+        // 返回值
+        return                       empty($field) ? $result : ( isset($result[$field]) ? $result[$field] : null);
+    }
+
+}

+ 52 - 0
app/Models/ArticleEvent.php

@@ -0,0 +1,52 @@
+<?php namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
+
+/**
+ * 用户操作模型
+ * 
+ */
+class ArticleEvent extends Model
+{
+    use HasFactory;
+
+    // 与模型关联的表名
+    protected $table = 'article_event';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function add($data)
+    {
+        // 时间
+        $data['insert_time']				= time();
+        $data['update_time']				= time();
+        // 写入数据表
+        $id						            = $this->query()->insertGetId($data);
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['id'=>$id])->update($data);
+        // 返回结果
+        return                              $result;
+    }
+
+}

+ 6 - 6
app/Models/Lottery/OrderReward.php

@@ -133,10 +133,10 @@ class OrderReward extends Model
      * 
      */
     public function getRewardResult($reward){
-        // 从1开始
-		$offset							= 1;
-		// 判断抽奖结果
-		$randInt						= random_int($offset,100);
+        // 从0开始, 包含0
+		$offset							= 0;
+		// 随机数,包含起始值,不含结束值
+		$randInt						= random_int($offset,10000);
 		// 中奖下标
 		$index							= 0;
 		// 循环奖品
@@ -146,9 +146,9 @@ class OrderReward extends Model
 			// 开始数值
 			$start 						= $offset;
 			// 结束数值
-			$end						= $value['probability'] ? $offset + $value['probability'] : 0;
+			$end						= $value['probability'] ? $start + intval($value['probability'] * 100) : 0;
 			// 重新计算开始数值
-			$offset						= $offset ? $end : $offset;
+			$offset						= $end ? $end : $offset;
 			// 区间内即抽中
 			if( $start <= $randInt && $end >= $randInt ) $index = $key;
 		}

+ 1 - 1
app/Models/Lottery/Riddle.php

@@ -68,7 +68,7 @@ class Riddle extends Model
         // 不存在数据
         if ( !$list ) {
             // 从数据库获取数据
-            $data              = $this->query()->where([['status','=',0]])->get(['id','name','logo','rule','status','start_time','end_time','tag_scope','city_ids']);
+            $data              = $this->query()->where([['status','=',0]])->get(['id','name','logo','rule','freq','max_reward','status','start_time','end_time','tag_scope','city_ids']);
             // 是否有数据
             $data              = $data ? $data->toArray() : [];
             // 循环处理数据

+ 6 - 6
app/Models/Lottery/RiddleReward.php

@@ -133,10 +133,10 @@ class RiddleReward extends Model
      * 
      */
     public function getRewardResult($reward){
-        // 从1开始
-		$offset							= 1;
-		// 判断抽奖结果
-		$randInt						= random_int($offset,100);
+        // 从0开始
+		$offset							= 0;
+		// 随机数,包含起始值,不含结束值
+		$randInt						= random_int($offset,10000);
 		// 中奖下标
 		$index							= 0;
 		// 循环奖品
@@ -146,9 +146,9 @@ class RiddleReward extends Model
 			// 开始数值
 			$start 						= $offset;
 			// 结束数值
-			$end						= $value['probability'] ? $offset + $value['probability'] : 0;
+			$end						= $value['probability'] ? $start + intval($value['probability'] * 100) : 0;
 			// 重新计算开始数值
-			$offset						= $offset ? $end : $offset;
+			$offset						= $end ? $end : $offset;
 			// 区间内即抽中
 			if( $start <= $randInt && $end >= $randInt ) $index = $key;
 		}

+ 5 - 5
app/Models/Lottery/ScoreReward.php

@@ -133,9 +133,9 @@ class ScoreReward extends Model
      * 
      */
     public function getRewardResult($reward){
-        // 从1开始
-		$offset							= 1;
-		// 判断抽奖结果
+        // 从0开始
+		$offset							= 0;
+		// 随机数,包含起始值,不含结束值
 		$randInt						= random_int($offset,10000);
 		// 中奖下标
 		$index							= 0;
@@ -146,9 +146,9 @@ class ScoreReward extends Model
 			// 开始数值
 			$start 						= $offset;
 			// 结束数值
-			$end						= $value['probability'] ? $offset + $value['probability']*100 : 0;
+			$end						= $value['probability'] ? $start + intval($value['probability'] * 100) : 0;
 			// 重新计算开始数值
-			$offset						= $offset ? $end : $offset;
+			$offset						= $end ? $end : $offset;
 			// 区间内即抽中
 			if( $start <= $randInt && $end >= $randInt ) $index = $key;
 		}

+ 1 - 1
app/Models/Orders.php

@@ -91,7 +91,7 @@ class Orders extends Model
         // 提示新增失败
         if( !$result )	    {
             // 提示信息
-            return          ['error'=>'子订单修改失败'];json_send(['code'=>'error','msg'=>'取消失败','data'=>['error'=>'']]);
+            return          ['error'=>'子订单修改失败'];
         }
         // 如果是取消订单,恢复库存
         if( $status == 4 )  $this->restoreProductStock($id,$OrdersProduct);

+ 1 - 1
app/Models/Riddle/Active.php

@@ -68,7 +68,7 @@ class Active extends Model
         // 不存在数据
         if ( !$list ) {
             // 从数据库获取数据
-            $data              = $this->query()->where(['status'=>0])->get(['id','name','logo','rule as active_rule','lottery_id','join_total','join_share','status','start_time','end_time','tag_scope','city_ids'])->toArray();
+            $data              = $this->query()->where([['status','=',0]])->get(['id','name','logo','lottery_id','freq','join_total','join_share','status','start_time','end_time','tag_scope','city_ids','rule as active_rule'])->toArray();
             // 循环处理数据
             $list              = [];
             // 进行更新

+ 32 - 11
app/Models/ShareMessage.php

@@ -23,10 +23,15 @@ class ShareMessage extends Model
     private  $pagesList = [
                             'pages/index/index'=>'首页',
                             'pages/car/index'=>'购物车',
-                            'pages/score/clockin'=>'积分签到',
-                            'pages/score/index'=>'积分产品',
                             'pages/user/index'=>'个人中心',
-                            'pages/score/lottery'=>'积分抽奖'
+                            'pages/score/clockin'=>'积分签到',
+                            'pages/score/index'=>'积分产品列表',
+                            'pages/score/product'=>'积分产品',
+                            'pages/score/lottery'=>'积分抽奖',
+                            'pages/coupon/active'=>'领券活动',
+                            'pages/recruitment/index'=>'拉新活动',
+                            'pages/activity/index'=>'答题活动',
+                            'pages/product/index'=>'产品详情',
                         ];
 
     /**
@@ -85,26 +90,42 @@ class ShareMessage extends Model
     public function getList($force = false)
     {
         // 结果数据
-        $list                  = $force ? [] : cache('admin:share:message:list');
+        $list                           = $force ? [] : cache('admin:share:message:list');
         // 不存在数据
         if ( !$list ) {
             // 从数据库获取数据
-            $data              = $this->query()->where([['status','=',0]])->get(['id','pages','title','image_url','path']);
+            $data                       = $this->query()->where([['status','=',0]])->get(['id','pages','title','image_url','item_id','path']);
             // 是否有数据
-            $data              = $data ? $data->toArray() : [];
+            $data                       = $data ? $data->toArray() : [];
             // 循环处理数据
-            $list              = [];
+            $list                       = [];
             // 进行更新
             foreach ($data as $value) {
                 // 数据处理
                 $value['image_url']	   = $value['image_url'] ? path_compat($value['image_url']) : '';
                 // 重组数据
-                $list[$value['pages']] = $value;
+                $list[$value['pages']][$value['item_id']] = $value;
             }
             // 存起来
             cache(['admin:share:message:list'=>$list]);
         }
         // 返回结果
+        return                          $list;
+    }
+
+    /**
+     * 获取配置
+     * 
+     * @param   string    $pages      页面
+     * 
+     */
+    public function getListByPage($pages)
+    {
+        // 获取列表数据
+        $list                   = $this->getList();
+        // 获取数据
+        $list                   = isset($list[$pages]) ? $list[$pages] : [];
+        // 返回值
         return                  $list;
     }
 
@@ -115,12 +136,12 @@ class ShareMessage extends Model
      * @param   string    $field     指定字段
      * 
      */
-    public function getOneByPage($pages,$field='')
+    public function getOneByPage($pages,$itemId=0,$field='')
     {
         // 获取列表数据
-        $list                   = $this->getList();
+        $list                   = $this->getListByPage($pages);
         // 获取数据
-        $one                    = isset($list[$pages]) ? $list[$pages] : [];
+        $one                    = isset($list[$itemId]) ? $list[$itemId] : [];
         // 返回值
         return                  empty($field) ? $one : ( isset($one[$field]) ? $one[$field] : null);
     }

+ 0 - 5
public/nginx.htaccess

@@ -1,5 +0,0 @@
-location / {
-if (!-e $request_filename){
-rewrite ^/(.*)$ /index.php/$1 last;
-}
-}

+ 54 - 0
resources/views/admin/article/add.blade.php

@@ -0,0 +1,54 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-2">
+		<label class="control-label">资讯配图</label>
+		<div id="thumb">
+			<a id="thumb-image" href="#" data-toggle="image" class="img-thumb">
+				<img src="{{path_compat('')}}" height="100" />
+			</a>
+			<input type="hidden" name="thumb" value="" id="input-image" />
+		</div>
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">资讯海报</label>
+		<div id="poster">
+			<a id="poster-image" href="#" data-toggle="image" class="img-thumbnail">
+				<img src="{{path_compat('')}}" height="100" />
+			</a>
+			<input type="hidden" name="poster" value="" id="input-poster" />
+		</div>
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">资讯标题</label>
+		<input class="form-control" required="required" type="text" placeholder="内容标题" maxlength="50" name="title" value="" />
+	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">跳转链接</label>
+		<input class="form-control" type="text" placeholder="海报跳转链接" maxlength="120" name="path" value="" />
+	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">appid</label>
+		<input class="form-control" type="text" placeholder="跳转的小程序appid" maxlength="32" name="appid" value="" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">资讯内容</label>
+		<textarea required="required" id="container" name="content" placeholder="内容" maxlength="1500"></textarea>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection
+@section('javascript')
+<script src="/static/ueditor/ueditor.config.js"></script>  
+<script src="/static/ueditor/ueditor.all.js"></script>
+<script type="text/javascript">
+	var editor = new UE.ui.Editor();
+	editor.render("container");
+</script>
+@endsection

+ 55 - 0
resources/views/admin/article/edit.blade.php

@@ -0,0 +1,55 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-2">
+		<label class="control-label">资讯配图</label>
+		<div id="thumb">
+			<a id="thumb-image" href="#" data-toggle="image" class="img-thumb">
+				<img src="{{path_compat($oldData['thumb'])}}" height="100" />
+			</a>
+			<input type="hidden" name="thumb" value="{{$oldData['thumb']}}" id="input-image" />
+		</div>
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">资讯海报</label>
+		<div id="poster">
+			<a id="poster-image" href="#" data-toggle="image" class="img-thumbnail">
+				<img src="{{path_compat($oldData['poster'])}}" height="100" />
+			</a>
+			<input type="hidden" name="poster" value="{{$oldData['poster']}}" id="input-poster" />
+		</div>
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">资讯标题</label>
+		<input class="form-control" required="required" type="text" placeholder="内容标题" maxlength="50" name="title" value="{{$oldData['title']}}" />
+	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">跳转链接</label>
+		<input class="form-control" type="text" placeholder="海报跳转链接" maxlength="120" name="path" value="{{$oldData['path']}}" />
+	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">appid</label>
+		<input class="form-control" type="text" placeholder="跳转的小程序appid" maxlength="32" name="appid" value="{{$oldData['appid']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">资讯内容</label>
+		<textarea required="required" id="container" name="content" placeholder="资讯内容" maxlength="1500">{{$oldData['content']}}</textarea>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input type="hidden" name="id" value="{{$oldData['id']}}" />
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection
+@section('javascript')
+<script src="/static/ueditor/ueditor.config.js"></script>  
+<script src="/static/ueditor/ueditor.all.js"></script>
+<script type="text/javascript">
+	var editor = new UE.ui.Editor();
+	editor.render("container");
+</script>
+@endsection

+ 89 - 0
resources/views/admin/article/index.blade.php

@@ -0,0 +1,89 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<div class="page-header">
+	@if( check_auth('admin/article/add') )
+	<a href="{{url('admin/article/add')}}" class="btn btn-primary">新增</a>
+	@endif
+</div>
+<form action="" method="get" class="form-horizontal form-line">
+	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="title" value="{{request('title','')}}" placeholder="请输入资讯标题查询" />
+	</div>
+	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
+	</div>
+	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束时间查询" />
+	</div>
+	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
+	<a href="{{url('admin/article/index')}}" class="btn btn-sm btn-default" >重置</a>
+	@csrf
+</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>资讯标题</th>
+						<th>资讯数据</th>
+						<th>跳转链接</th>
+						<th>资讯状态</th>
+						<th>修改时间</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['id']}}</td>
+						<td> {{$a['title']}}</td>
+						<td> 
+							阅读: {{$a['read_count']}} ;
+							点赞: {{$a['hand_count']}} ;
+							分享: {{$a['share_count']}} ;
+							收藏: {{$a['like_count']}};
+						</td>
+						<td> {{$a['path']}}  {{$a['appid']}} </td>
+						<td> @if ($a['status'] == 0) 启用 @endif @if ($a['status'] == 1) 停用 @endif</td>
+						<td> {{date('Y/m/d H:i',$a['update_time'])}}</td>
+						<td>
+							@if( check_auth('admin/article_event/index') )
+							<a class="btn btn-sm btn-primary" href="{{url('admin/article_event/index?'.http_build_query(['article_id'=>$a['id']]))}}" title="事件记录">事件记录</a>
+							@endif
+							@if( check_auth('admin/article/edit') )
+							<a class="btn btn-sm btn-warning" href="{{url('admin/article/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
+								修改
+							</a>
+							@endif
+							@if( check_auth('admin/article/set_status') )
+								@if ( $a['status'] )
+									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/article/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
+										启用
+									</a>
+								@else
+									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/article/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
+										停用
+									</a>
+								@endif
+							@endif
+						</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

+ 173 - 0
resources/views/admin/article_event/index.blade.php

@@ -0,0 +1,173 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+
+
+
+<form action="" method="get" name="thisform" class="form-horizontal form-line">
+	<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="article_id" value="{{request('article_id','')}}" placeholder="请输入资讯ID" />
+	</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="title" value="" placeholder="请输入标题模糊搜索" />
+	</div>
+	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<select name="type_id" class="form-control">
+			<option value="" >请选择类型搜索</option>
+			<option value="1" @if (request('type_id') === '1' ) selected="selected" @endif >阅读</option>
+			<option value="2" @if (request('type_id') === '2' ) selected="selected" @endif >点赞</option>
+			<option value="3" @if (request('type_id') === '3' ) selected="selected" @endif >分享</option>
+			<option value="4" @if (request('type_id') === '4' ) selected="selected" @endif >推荐</option>
+		</select>
+	</div>
+	<div class="form-group col-sm-2 col-lg-2 col-md-2 col-sm-2 col-xs-12">
+		<input class="form-control" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
+	</div>
+	<div class="form-group col-sm-2 col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<input class="form-control" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
+	</div>
+	<div class="form-group col col-xs-4 col-md-2" style="margin-right: 2px;">
+		<button type="button" onclick="alter_from_attr({'method':'get','action':''})" class="btn btn-sm btn-primary" style="margin-right: 20px;"> 查询</button>
+		<a href="{{url('admin/article_event/index')}}" class="btn btn-sm btn-default" style="margin-right: 20px;" >重置</a>
+		@if( check_auth('admin/article_event/down_excel') )
+		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/article_event/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载表格</button>
+		@endif
+	</div>
+	@csrf
+</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>资讯标题</th>
+						<th>客户昵称</th>
+						<th>操作类型</th>
+						<th>操作时间</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['article_id']}}</td>
+						<td> {{$a['title']}}</td>
+						<td> {{$a['custom_name']}}</td>
+						<td> {{$a['event']}} </td>						
+						<td> {{date('Y/m/d H:i',$a['update_time'])}}</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
+@section('javascript')
+<script src="/static/fileupload/jquery.ui.widget.js"></script>
+<script src="/static/fileupload/jquery.fileupload.js"></script>
+<script type="text/javascript">
+ $(function(){
+	$('.upload').on('click', function() {
+		$('#form-upload').remove();
+		$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_file" type="file" name="order_file" multiple="multiple" /></form>');
+		$('#form-upload input[name=\'order_file\']').trigger('click');
+		$('[osctype="btn_upload_file"]').fileupload({
+			dataType: 'json',
+			url: "{{url('admin/orders/import_execl')}}",
+			singleFileUploads: false,
+			beforeSend: function() {
+				art.dialog({
+					id: 'loading',
+					lock: true,
+					title: '文件上传中'
+				});
+			},
+			done: function(e, data) {
+				art.dialog.list['loading'].close();
+				var result = data.result;
+				if (result.code == 'error') {
+					art.dialog({
+						content: result.msg,
+						lock: true,
+						ok: function() {}
+					});
+				}
+				if (result.code == 'success') {
+					art.dialog({
+						content: result.msg,
+						lock: true,
+						ok: function() {
+							location.reload();
+						}
+					});
+				}
+			},
+			fail: function(e,c) {
+				art.dialog.list['loading'].close();
+				art.dialog({
+					content: '<p>'+c.jqXHR.status+'=>'+c.jqXHR.statusText+'</p>',
+					lock: true,
+					ok: function() {}
+				});
+			}
+		});
+	});
+	$('.upload_status').on('click', function() {
+		$('#form-upload').remove();
+		$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_file" type="file" name="order_file" multiple="multiple" /></form>');
+		$('#form-upload input[name=\'order_file\']').trigger('click');
+		$('[osctype="btn_upload_file"]').fileupload({
+			dataType: 'json',
+			url: "{{url('admin/orders/import_execl_status')}}",
+			singleFileUploads: false,
+			beforeSend: function() {
+				art.dialog({
+					id: 'loading',
+					lock: true,
+					title: '文件上传中'
+				});
+			},
+			done: function(e, data) {
+				art.dialog.list['loading'].close();
+				var result = data.result;
+				if (result.code == 'error') {
+					art.dialog({
+						content: result.msg,
+						lock: true,
+						ok: function() {}
+					});
+				}
+				if (result.code == 'success') {
+					art.dialog({
+						content: result.msg,
+						lock: true,
+						ok: function() {
+							location.reload();
+						}
+					});
+				}
+			},
+			fail: function(e,c) {
+				art.dialog.list['loading'].close();
+				art.dialog({
+					content: '<p>'+c.jqXHR.status+'=>'+c.jqXHR.statusText+'</p>',
+					lock: true,
+					ok: function() {}
+				});
+			}
+		});
+	});
+ })
+</script>
+@endsection

+ 1 - 1
resources/views/admin/image_manager/index.blade.php

@@ -14,7 +14,7 @@
         	<a href="<?php echo $data['refresh']; ?>" data-toggle="tooltip" title="刷新" id="button-refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
           <button type="button" data-toggle="tooltip" title="上传" id="button-upload" class="btn btn-primary"><i class="fa fa-upload"></i></button>
           <button type="button" data-toggle="tooltip" title="新建" id="button-folder" class="btn btn-default"><i class="fa fa-folder"></i></button>
-          <button type="button" data-toggle="tooltip" title="删除" id="button-delete" class="btn btn-danger"><i class="fa fa-trash-o"></i></button>
+          <!-- <button type="button" data-toggle="tooltip" title="删除" id="button-delete" class="btn btn-danger"><i class="fa fa-trash-o"></i></button> -->
           <!--<button type="button" data-toggle="tooltip" title="确定" id="button-check" class="btn btn-success"><i class="fa fa-check"></i></button>-->	
         </div>
         <div class="col-sm-7">

+ 3 - 0
resources/views/admin/index/welcome.blade.php

@@ -11,6 +11,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<tr>
 			<td colspan="10">欢迎使用 {{config('app.name')}}系统后台管理系统 </td>
 		</tr>
+		<tr>
+			<td colspan="10"> 小程序首页链接 : <p class="text-red">{{$link}}</p>  </td>
+		</tr>
 		<!-- <tr>
 			<td class="active" colspan="10">系统信息</td>
 		</tr>

+ 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>
 				

+ 13 - 0
resources/views/admin/lottery_riddle/add.blade.php

@@ -25,6 +25,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">结束时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
 	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">周期频率</label>
+		<select name="freq" class="form-control" >
+			<option value="0" >活动期间</option>
+			<option value="1" >按日</option>
+			<option value="2" >按周</option>
+			<option value="3" >按月</option>
+		</select>
+	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">中奖次数</label>
+		<input class="form-control" required="required" type="number" placeholder="中奖次数,0不限制" name="max_reward"  value="1" />
+	</div>
 	<div class="form-group col-sm-12">
 		<label class="control-label">活动规则</label>
 		<textarea class="form-control" name="rule" rows="10" placeholder="请输入活动规则" ></textarea>

+ 13 - 0
resources/views/admin/lottery_riddle/edit.blade.php

@@ -25,6 +25,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">结束时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="{{date('Y-m-d H:i',$oldData['end_time'])}}" />
 	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">周期频率</label>
+		<select name="freq" class="form-control" >
+			<option value="0" @if( $oldData['freq'] == 0 ) selected @endif >活动期间</option>
+			<option value="1" @if( $oldData['freq'] == 1 ) selected @endif >按日</option>
+			<option value="2" @if( $oldData['freq'] == 2 ) selected @endif >按周</option>
+			<option value="3" @if( $oldData['freq'] == 3 ) selected @endif >按月</option>
+		</select>
+	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">中奖次数</label>
+		<input class="form-control" required="required" type="number" placeholder="中奖次数,0不限制" name="max_reward"  value="{{$oldData['max_reward']}}" />
+	</div>
 	<div class="form-group col-sm-12">
 		<label class="control-label">活动规则</label>
 		<textarea class="form-control" name="rule" rows="10" placeholder="请输入活动规则" >{{$oldData['rule']}}</textarea>

+ 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>

+ 4 - 0
resources/views/admin/lottery_score/index.blade.php

@@ -28,6 +28,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>									
@@ -41,6 +43,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td>{{$a['name']}}</td>
 							<td>{{date('Y/m/d H:i:s',$a['start_time'])}}</td>
 							<td>{{date('Y/m/d H:i:s',$a['end_time'])}}</td>
+							<td>/pages/score/lottery?id={{$a['id']}}</td>
+							<td>{{$a['mp_urllink']}}</td>
 							<td>
 								@if( $a['status'] )
 								停用

+ 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>
 				

+ 19 - 10
resources/views/admin/riddle_active/add.blade.php

@@ -8,7 +8,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">活动首图 [1180*490]</label>
 		<div id="logo">
 			<a id="logo-image" href="#" data-toggle="image" class="img-thumb">
-				<img src="{{path_compat('')}}" width="120" />
+				<img src="{{path_compat('')}}" height="120" />
 			</a>
 			<input type="hidden" name="logo" value="" id="input-logo" />
 		</div>
@@ -17,6 +17,23 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">活动名称</label>
 		<input class="form-control" required="required" type="text" placeholder="活动名称" name="name" maxlength="45" value="" />
 	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">开始时间</label>
+		<input class="form-control" required="required" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
+	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">结束时间</label>
+		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
+	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">周期频率</label>
+		<select name="freq" class="form-control" >
+			<option value="0" >活动期间</option>
+			<option value="1" >按日</option>
+			<option value="2" >按周</option>
+			<option value="3" >按月</option>
+		</select>
+	</div>
 	<div class="form-group col-sm-3">
 		<label class="control-label">参与次数</label>
 		<input class="form-control" required="required" type="number" placeholder="默认参与答题次数"  name="join_total" value="" />
@@ -30,14 +47,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input class="form-control" required="required" type="number" placeholder="灯谜抽奖活动的ID" name="lottery_id" value="" />
 	</div>
 	<div class="form-group col-sm-4">
-		<label class="control-label">开始时间</label>
-		<input class="form-control" required="required" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
-	</div>
-	<div class="form-group col-sm-4">
-		<label class="control-label">结束时间</label>
-		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
-	</div>
-	<div class="form-group col-sm-5">
 		<label class="control-label">活动城市</label>
 		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
 			@foreach ($cityList as $group)
@@ -49,7 +58,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col-sm-5">
+	<div class="form-group col-sm-4">
 		<label class="control-label">标签范围(标签存在延迟,请慎用)</label>
 		<select name="tag_scope[]" class="form-control selectpicker" data-max-options="10" data-live-search="true" data-live-search-placeholder="搜索标签" data-none-results-text="未搜索到 {0}" title="选择标签" multiple>
 			@foreach ($tagList as $group=>$tags)

+ 19 - 10
resources/views/admin/riddle_active/edit.blade.php

@@ -8,7 +8,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">活动首图 [1180*490]</label>
 		<div id="logo">
 			<a id="logo-image" href="#" data-toggle="image" class="img-thumb">
-				<img src="{{path_compat($oldData['logo'])}}" width="120" />
+				<img src="{{path_compat($oldData['logo'])}}" height="120" />
 			</a>
 			<input type="hidden" name="logo" value="{{$oldData['logo']}}" id="input-logo" />
 		</div>
@@ -17,6 +17,23 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">活动名称</label>
 		<input class="form-control" required="required" type="text" placeholder="活动名称" name="name" maxlength="45" value="{{$oldData['name']}}" />
 	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">开始时间</label>
+		<input class="form-control" required="required" type="datetime-local" placeholder="开始时间"  name="start_time" value="{{date('Y-m-d H:i',$oldData['start_time'])}}" />
+	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">结束时间</label>
+		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="{{date('Y-m-d H:i',$oldData['end_time'])}}" />
+	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">周期频率</label>
+		<select name="freq" class="form-control" >
+			<option value="0" @if( $oldData['freq'] == 0 ) selected @endif >活动期间</option>
+			<option value="1" @if( $oldData['freq'] == 1 ) selected @endif >按日</option>
+			<option value="2" @if( $oldData['freq'] == 2 ) selected @endif >按周</option>
+			<option value="3" @if( $oldData['freq'] == 3 ) selected @endif >按月</option>
+		</select>
+	</div>
 	<div class="form-group col-sm-3">
 		<label class="control-label">参与次数</label>
 		<input class="form-control" required="required" type="number" placeholder="默认参与答题次数"  name="join_total" value="{{$oldData['join_total']}}" />
@@ -30,14 +47,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input class="form-control" required="required" type="number" placeholder="灯谜抽奖活动的ID" name="lottery_id" value="{{$oldData['lottery_id']}}" />
 	</div>
 	<div class="form-group col-sm-4">
-		<label class="control-label">开始时间</label>
-		<input class="form-control" required="required" type="datetime-local" placeholder="开始时间"  name="start_time" value="{{date('Y-m-d H:i',$oldData['start_time'])}}" />
-	</div>
-	<div class="form-group col-sm-4">
-		<label class="control-label">结束时间</label>
-		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="{{date('Y-m-d H:i',$oldData['end_time'])}}" />
-	</div>
-	<div class="form-group col-sm-5">
 		<label class="control-label">活动城市</label>
 		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
 			@foreach ($cityList as $group)
@@ -49,7 +58,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col-sm-5">
+	<div class="form-group col-sm-4">
 		<label class="control-label">标签范围(标签存在延迟,请慎用)</label>
 		<select name="tag_scope[]" class="form-control selectpicker" data-max-options="10" data-live-search="true" data-live-search-placeholder="搜索标签" data-none-results-text="未搜索到 {0}" title="选择标签" multiple>
 			@foreach ($tagList as $group=>$tags)

+ 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/activity/index?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

+ 4 - 0
resources/views/admin/share_message/add.blade.php

@@ -25,6 +25,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
+	<div class="form-group col-sm-5">
+		<label class="control-label">产品/活动ID</label>
+		<input class="form-control" type="number" placeholder="产品/活动ID" name="item_id" value="0" />
+	</div>
 	<div class="form-group col-sm-12">
 		@csrf
 		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />

+ 4 - 0
resources/views/admin/share_message/edit.blade.php

@@ -25,6 +25,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
+	<div class="form-group col-sm-5">
+		<label class="control-label">产品/活动ID</label>
+		<input class="form-control" type="number" placeholder="产品/活动ID" name="item_id" value="{{$oldData['item_id']}}" />
+	</div>
 	<div class="form-group col-sm-12">
 		@csrf
 		<input type="hidden" name="id" id="id" value="{{$oldData['id']}}" />

+ 5 - 1
resources/views/admin/share_message/index.blade.php

@@ -17,7 +17,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<thead>
 					<tr>
 						<th>ID</th>
-						<th>分享页面</th>
+						<th>配置页面</th>
+						<th>产品编码/活动ID</th>
+						<th>产品名称/活动名称</th>
 						<th>分享标题</th>
 						<th>分享图标</th>
 						<th>状态</th>
@@ -37,6 +39,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									@endif
 								@endforeach
 							</td>
+							<td>{{$a['item_id']}}</td>
+							<td>{{$a['item_name']}}</td>
 							<td>{{$a['title']}}</td>
 							<td> <img src="{{path_compat($a['image_url'])}}" alt="" height="30"> </td>
 							<td>{{$a['status']?'停用':'启用'}}</td>

+ 8 - 0
routes/api.php

@@ -203,6 +203,7 @@ Route::any('orders/cancel_regiment',[\App\Http\Controllers\Api\Orders::class,'ca
  * 
  * */
 Route::any('share_message/get_list',[\App\Http\Controllers\Api\ShareMessage::class,'get_list']);
+Route::any('share_message/get_item',[\App\Http\Controllers\Api\ShareMessage::class,'get_item']);
 
 /**
  * 拉新活动
@@ -268,3 +269,10 @@ Route::any('riddle_question/get_question',[\App\Http\Controllers\Api\Riddle\Ques
 Route::any('riddle_active_share/add',[\App\Http\Controllers\Api\Riddle\ActiveShare::class,'add']);
 // 判断回答是否正确
 Route::any('riddle_answer/check_answer',[\App\Http\Controllers\Api\Riddle\Answer::class,'check_answer']);
+
+/**
+ * 文章详情
+ */
+Route::any('article/get_list',[App\Http\Controllers\Api\Article\Comment::class,'get_list']);
+Route::any('article/get_detail',[App\Http\Controllers\Api\Article\Comment::class,'get_detail']);
+Route::any('article/update_event',[App\Http\Controllers\Api\Article\Comment::class,'update_event']);

+ 27 - 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']);
 
     /* 下单抽奖-商品范围 */
     // 列表
@@ -539,6 +542,20 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('recruitment_active_prize/edit',[App\Http\Controllers\Admin\RecruitmentActivePrize::class,'edit']);
     // 拉新活动数据列表
     Route::any('recruitment_record/index',[App\Http\Controllers\Admin\RecruitmentRecord::class,'index']);
+    
+    /* 营销管理 */
+    //分享设置列表Promo
+    Route::any('article/index',[App\Http\Controllers\Admin\Article::class,'index']);
+    // 新增
+    Route::any('article/add',[App\Http\Controllers\Admin\Article::class,'add']);
+    // 编辑
+    Route::any('article/edit',[App\Http\Controllers\Admin\Article::class,'edit']);
+    // 状态
+    Route::any('article/set_status',[App\Http\Controllers\Admin\Article::class,'set_status']);
+    //数据
+    Route::any('article_event/index',[App\Http\Controllers\Admin\ArticleEvent::class,'index']);
+    // 订单下载
+    Route::any('article_event/down_excel',[App\Http\Controllers\Admin\ArticleEvent::class,'down_excel']);
 
 
     /* 红包活动 */
@@ -600,6 +617,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 +643,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']);

+ 1 - 1
server.php

@@ -10,7 +10,7 @@
 $uri = urldecode(
     parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
 );
-
+echo '';
 // This file allows us to emulate Apache's "mod_rewrite" functionality from the
 // built-in PHP web server. This provides a convenient way to test a Laravel
 // application without having installed a "real" web server software here.