Jelajahi Sumber

【Add】新增资讯功能

liuxiangxin 3 bulan lalu
induk
melakukan
328c808128

+ 3 - 10
app/Http/Controllers/Admin/Article.php

@@ -25,28 +25,21 @@ class Article extends Auth{
     public function index(Model $Model){
     public function index(Model $Model){
 		
 		
 		// 接受参数
 		// 接受参数
-		$code					= request('article_code','');
+		$title					= request('title',0);
 		$status					= request('status');
 		$status					= request('status');
 		$startTime				= request('start_time','');
 		$startTime				= request('start_time','');
 		$endTime				= request('end_time','');
 		$endTime				= request('end_time','');
-		// 编码转ID
-		$id						= $code ? $Model->codeToId($code) : 0;
 		// 查询条件
 		// 查询条件
 		$map 					= [];
 		$map 					= [];
 		// 编码ID
 		// 编码ID
-		if( $id )				$map[] = ['id','=',$id];
+		if( $title )			$map[] = ['title','LIKE','%'.$title.'%'];
 		if( $startTime )		$map[] = ['start_time','>=',strtotime($startTime)];
 		if( $startTime )		$map[] = ['start_time','>=',strtotime($startTime)];
 		if( $endTime )			$map[] = ['end_time','<=',strtotime($endTime)];
 		if( $endTime )			$map[] = ['end_time','<=',strtotime($endTime)];
 		if( !is_null($status) )	$map[] = ['status','=',$status];
 		if( !is_null($status) )	$map[] = ['status','=',$status];
 		// 查询数据
 		// 查询数据
-		$list					= $Model->query()->where($map);
-        $list                   =  $list->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
-		
+		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
 		// 循环处理数据
 		// 循环处理数据
 		foreach ($list as $key => $value) {
 		foreach ($list as $key => $value) {
-
-			// id转编号
-			$value['article_code']		= $Model->idToCode($value['id']);
 			// 重组
 			// 重组
 			$list[$key]				= $value;
 			$list[$key]				= $value;
 		}
 		}

+ 0 - 233
app/Http/Controllers/Admin/ArticleComment.php

@@ -1,233 +0,0 @@
-<?php namespace App\Http\Controllers\Admin;
-
-use App\Models\ArticleComment as ArticleCommentModel;
-
-use PhpOffice\PhpSpreadsheet\Cell\DataType;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use PhpOffice\PhpSpreadsheet\Spreadsheet;
-use PhpOffice\PhpSpreadsheet\Style\Alignment;
-use PhpOffice\PhpSpreadsheet\Style\Fill;
-
-
-/**
- * 分享设置
- *
- * @author    huanglei
- *
- */
-class ArticleComment extends Auth{
-	const EVENT_TYPE = [
-		'1' => '阅读',
-		'2' => '点赞',
-		'3' => '分享',
-		'4' => '推荐',
-		'5' => '取消推荐',
-		'6' => '取消点赞'	
-	];
-	protected function _initialize(){
-		parent::_initialize();
-		
-		$this->assign('breadcrumb1','分享设置');
-		$this->assign('breadcrumb2','内容分享>>数据');
-		
-	}
-
-	/**
-	 * 数据列表
-	 * 
-	 * */
-    public function index(ArticleCommentModel $ArticleCommentModel){
-		
-		// 接受参数
-		$tid					= request('tid','');
-		$c_type					= request('c_type');
-		$title				= request('title');
-		$startTime				= request('start_time','');
-		$endTime				= request('end_time','');
-		
-		// 编码转ID
-		// $id						= $code ? $ArticleCommentModel->codeToId($code) : 0;
-		// 查询条件
-		$map 					= [];
-		// 编码ID
-		if( $tid )				$map[] = ['article_comment.article_id','=',$tid];
-		
-		if( $title )			$map[] = ['article.title','LIKE','%'.$title.'%'];
-		if( $startTime )		$map[] = ['article_comment.start_time','>=',strtotime($startTime)];
-		if( $endTime )			$map[] = ['article_comment.end_time','<=',strtotime($endTime)];
-		if( !is_null($c_type) )	$map[] = ['article_comment.event_type','=',$c_type];
-		
-		// 查询数据
-		$list					= $ArticleCommentModel->query()
-									->join('custom','article_comment.uid','=','custom.uid')
-									->leftJoin('article','article_comment.article_id','=','article.id');
-     
-        $list                   = $list->where($map)
-									->orderByDesc('id')
-									->select([
-										'article_comment.*','custom.username as custom_name',
-										'article.title as title'
-									])
-									->paginate(request('limit',config('page_num',10)))->appends(request()->all());
-		
-		// 循环处理数据
-		foreach ($list as $key => $value) {
-
-			// id转编号
-			$value['article_code']		= $ArticleCommentModel->idToCode($value['article_id']);
-			// 事件类型:1阅读;2点赞;3分享;4推荐;5取消点赞;6取消推荐
-			$value['event']			= self::EVENT_TYPE[$value['event_type']];
-			
-			// 重组
-			$list[$key]				= $value;
-		}
-		// 分配数据
-		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
-		$this->assign('list', $list);
-		$this->assign('tid', $tid);
-		// 加载模板
-		return					$this->fetch();
-    }
-
-	/**
-	 * 导出表格导入
-	 * 
-	 * */
-	public function down_excel(ArticleCommentModel $ArticleCommentModel){
-		
-		// 接受参数
-		$tid					= request('tid','');
-		$c_type					= request('c_type');
-		$title					= request('title');
-		$startTime				= request('start_time','');
-		$endTime				= request('end_time','');
-		$map 					= [];
-		// 编码ID
-		if( $tid )				$map[] = ['article_comment.article_id','=',$tid];
-		
-		if( $title )			$map[] = ['article.title','LIKE','%'.$title.'%'];
-		if( $startTime )		$map[] = ['article_comment.start_time','>=',strtotime($startTime)];
-		if( $endTime )			$map[] = ['article_comment.end_time','<=',strtotime($endTime)];
-		if( !is_null($c_type) )	$map[] = ['article_comment.event_type','=',$c_type];
-		
-		// 查询数据
-		$list					= $ArticleCommentModel->query()
-									->join('custom','article_comment.uid','=','custom.uid')
-									->leftJoin('article','article_comment.article_id','=','article.id');
-     
-        $list                   = $list->where($map)
-									->orderByDesc('id')
-									->select([
-										'article_comment.*',
-										'custom.username as custom_name',
-										'article.title as title',
-										'article.content as content',
-
-									])
-									->paginate(request('limit',config('page_num',10)))->appends(request()->all());
-
-		// 返回结果
-		$data						= [];
-		// 循环处理数据
-		foreach ($list as $value) {
-			// id转编号
-			$value['article_id']		= $ArticleCommentModel->idToCode($value['article_id']);
-			$value['content']		= $value['content']? $value['content'] : '';
-			$value['comment']		= $value['comment']? $value['comment'] : '';
-			$value['event']			= $value['event_type']? self::EVENT_TYPE[$value['event_type']]: '';
-			$value['insert_time']		= $value['insert_time']? date('Y-m-d H:i:s',$value['insert_time']) : '';
-			$value['update_time']		= $value['update_time']? date('Y-m-d H:i:s',$value['update_time']) : '';
-			// 重组
-			$data[]					= $value;
-		}
-		
-		try {
-			// 去下载
-			
-			$this->toDown($data);
-			
-		} catch (\Throwable $th) {
-			echo $th->getMessage();
-		}
-		
-	}
-	/**
-	 * 去下载
-	 */
-	private function toDown($data){
-		// 创建新的电子表格对象
-		
-		$spreadsheet			= new Spreadsheet();
-		// 设置合并单元格的行和列,例如合并A1到B2的单元格
-		
-		$sheet					= $this->setStyle($spreadsheet);
-		
-		// 从第二行写入
-		$row					= 2;
-		// 循环写入
-	
-		foreach ($data as $value) {
-			
-			// 单元格内容写入
-			$sheet->setCellValue('A'.$row, $value['article_id']);
-			$sheet->setCellValue('B'.$row, $value['comment']);
-			$sheet->setCellValue('C'.$row, $value['custom_name']);
-			$sheet->setCellValueExplicit('D'.$row, $value['event'],DataType::TYPE_STRING);
-			$sheet->setCellValueExplicit('E'.$row, $value['content'],DataType::TYPE_STRING);
-			// $sheet->setCellValueExplicit('C'.$row, $value['custom_name'],DataType::TYPE_STRING);
-			$sheet->setCellValue('F'.$row, $value['insert_time']);
-			$sheet->setCellValue('G'.$row, $value['update_time']);
-			
-			
-			// 函数自增
-			$row++;
-			
-		}
-		// 创建内容
-		$writer 				= IOFactory::createWriter($spreadsheet, 'Xlsx');
-		header('Pragma: public');
-		header('Content-type:application/vnd.ms-excel');
-		header('Content-Disposition: inline;filename=内容分享数据.xlsx');
-		// 输出数据流
-		return $writer->save('php://output');
-	}
-	/**
-	 * 设置表格样式
-	 * 
-	 */
-	private function setStyle(Spreadsheet $spreadsheet){
-		// 选择当前活动的工作表
-		$sheet					= $spreadsheet->getActiveSheet();
-		// 宽
-		$sheet->getColumnDimension('A')->setWidth(20);
-		$sheet->getColumnDimension('B')->setWidth(30);
-		$sheet->getColumnDimension('C')->setWidth(15);
-		$sheet->getColumnDimension('D')->setWidth(15);
-		$sheet->getColumnDimension('E')->setWidth(50);
-		$sheet->getColumnDimension('F')->setWidth(25);
-		$sheet->getColumnDimension('G')->setWidth(25);
-
-		// 默认高度
-		$sheet->getDefaultRowDimension()->setRowHeight(18);
-		// 加粗第一行
-		$sheet->getStyle('A:U')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
-		$sheet->getStyle('A1:U1')->getFont()->setBold(true);
-		$sheet->getStyle('A1:U1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
-		// 设置表格标题
-		$sheet
-		->setCellValue('A1', '文章ID')
-		->setCellValue('B1', '评论内容')
-		->setCellValue('C1', '用户名称')
-		->setCellValue('D1', '事件类型')
-		->setCellValue('E1', '文章内容')
-		->setCellValue('F1', '文章发布时间')
-		->setCellValue('G1', '操作时间');
-		
-		// 返回结果
-		return 					$sheet;
-	}
-
-
-
-
-}

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

@@ -0,0 +1,187 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Models\ArticleEvent as Model;
+use App\Models\Custom;
+use PhpOffice\PhpSpreadsheet\Cell\DataType;
+use PhpOffice\PhpSpreadsheet\IOFactory;
+use PhpOffice\PhpSpreadsheet\Spreadsheet;
+use PhpOffice\PhpSpreadsheet\Style\Alignment;
+use PhpOffice\PhpSpreadsheet\Style\Fill;
+
+
+/**
+ * 分享设置
+ *
+ * @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();
+        }
+	}
+
+
+
+
+}

+ 67 - 170
app/Http/Controllers/Api/Article/Comment.php

@@ -2,9 +2,8 @@
 
 
 use App\Http\Controllers\Api\Api;
 use App\Http\Controllers\Api\Api;
 use App\Models\Article as Model;
 use App\Models\Article as Model;
-use App\Models\ArticleComment as ArticleCommentModel;
-
-
+use App\Models\ArticleEvent as ArticleEvent;
+use Illuminate\Support\Facades\DB;
 
 
 /**
 /**
  * 分享设置
  * 分享设置
@@ -21,49 +20,28 @@ class Comment extends Api{
 		'5' => '取消推荐',
 		'5' => '取消推荐',
 		'6' => '取消点赞'	
 		'6' => '取消点赞'	
 	];
 	];
-	public function list(Model $Model, ArticleCommentModel $ArticleCommentModel){
-		
-		// 接受参数
-		$code					= request('article_code','');
-
-		$status					= request('status');
-		$startTime				= request('start_time','');
-		$endTime				= request('end_time','');
-		// 编码转ID
-		$id						= $code ? $Model->codeToId($code) : 0;
+	public function get_list(Model $Model){
 		// 查询条件
 		// 查询条件
-		$map 					= [];
-		// 编码ID
-		if( $id )				$map[] = ['id','=',$id];
-		if( $startTime )		$map[] = ['start_time','>=',strtotime($startTime)];
-		if( $endTime )			$map[] = ['end_time','<=',strtotime($endTime)];
-		if( !is_null($status) )	$map[] = ['status','=',$status];
+		$map 						= [['status','=','0']];
 		// 查询文章数据
 		// 查询文章数据
-		$list					= $Model->query()->where($map);
-        $list                   =  $list->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
-		
-
+		$Paginator					= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)));
 		// 循环处理数据
 		// 循环处理数据
-		foreach ($list as $key => $value) {
-			// id转编号
-			$value['article_id']		= $value['id'];
+		foreach ($Paginator as $key => $value) {
 			// 重组
 			// 重组
-			$value['poster']			= $value['poster']? path_compat($value['poster']):'';
-			
-			$value['read_count']        = $ArticleCommentModel->query()
-											->where(['article_id'=>$value['id'],'event_type'=>1])
-											->count();
-
-			$value['like_count']       = $ArticleCommentModel->query()
-											->where(['article_id'=>$value['id'],'event_type'=>2])
-											->count();
-		
-		    $value['update_time']      = date('Y-m-d H:i:s',$value['update_time']);	
-			$list[$key]					= $value;
+			$value['poster']		= path_compat($value['poster']);
+			// 获取数据
+		    $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'=>$list]);
+		return			json_send(['code'=>'success','msg'=>'列表数据','data'=>$data]);
 
 
 		
 		
 		
 		
@@ -73,144 +51,63 @@ class Comment extends Api{
 	 * 数据详情
 	 * 数据详情
 	 * 
 	 * 
 	 * */
 	 * */
-    public function detail(Model $Model, ArticleCommentModel $ArticleCommentModel){
-
+    public function get_detail(Model $Model, ArticleEvent $ArticleEvent){
+		// 检查登录
+		$uid 					= $this->checkLogin();
 		// 接受参数
 		// 接受参数
-		$tid					= request('article_id',0);
-
-		$uid 					= $this->checkLogin(); // custom_uid
-		
-		// 查询条件
-		$map 					= [];
-		// 编码ID
-		if( $tid )				$map[] = ['id','=',$tid];
-		
-		
-		
-
-        $data                   = $Model->query()->where($map)->find($tid,['id','title','poster','content']);
-		$data['like_count']     = $ArticleCommentModel->query()
-											->where(['article_id'=>$tid,'event_type'=>2])
-											->count();
-
-		$data['read_count']     = $ArticleCommentModel->query()
-											->where(['article_id'=>$tid,'event_type'=>1])
-											->count();
-
-		$data['share_count']    = $ArticleCommentModel->query()
-											->where(['article_id'=>$tid,'event_type'=>3])
-											->count();
-
-		$data['recommend_count'] = $ArticleCommentModel->query()
-											->where(['article_id'=>$tid,'event_type'=>4])
-											->count();
-		
-	
-		//用户是否点赞和推荐
-		if ($uid){
-			$user_envent              = $ArticleCommentModel->query()->where(['uid'=>$uid,'article_id'=>$tid])
-										->get();
-			foreach ($user_envent as $value){
-			
-				if ($value['event_type'] == 2){
-					$data['like_type'] = 2;
-				}else{	
-					$data['like_type'] = 6;
-				}
-				if ($value['event_type'] == 4){
-					$data['recommend_type'] = 4;	
-				}else{
-					$data['recommend_type'] = 5;
-				}
-			}
-
-
-			//写入浏览记录
-			$read = [
-				'article_id'	  	=> $tid,
-				'event_type'		=> 1,
-				'uid'				=> $uid,
-				'insert_time'		=> time()
-			];
-			//查询用户是否浏览过
-			$read_type       		=   $ArticleCommentModel->query()->where(['uid'=>$uid,'article_id'=>$tid])->value('event_type');
-			
-			if (!$read_type){
-				$comment_id			= $ArticleCommentModel->add($read);	
-			}
-			
-			
-		}else{
-			
-			$read['event_type'] = 0;//禁止分享、推荐和点赞
-		}
-
-		// 加载模板
-		
-		if ($data){
-			return			json_send(['code'=>'success','msg'=>'数据','data'=>$data]);
-		}
-		return			json_send(['code'=>'success','msg'=>'暂无','data'=>[]]);
+		$id						= request('id',0);
+		// 获取旧数据
+        $articleData            = $Model->query()->where([['status','=',0]])->find($id,['id','title','poster','content','read_count','hand_count','like_count','share_count','insert_time']);
+		// 用户是否点赞
+		if( !$articleData )		return 	json_send(['code'=>'error','msg'=>'文章不存在或者已下架']);
+		// 转数组
+		$articleData			= $articleData->toArray();
+		// 如果用户不存在
+		$oldData 				= $uid ? $ArticleEvent->query()->where([['custom_uid','=',$uid],['article_id','=',$id],['type_id','=',1]])->value('id') : 0;
+		// 阅读数 + 1
+		$Model->query()->where([['id','=',$id]])->increment('read_count');
+		// 如果事件不存在,新增此次事件
+		if( !$oldData && $uid )	$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;
+		// 返回结果
+		return			json_send(['code'=>'success','msg'=>'暂无','data'=>$articleData]);
 		
 		
 	}
 	}
-
+	
 	/**
 	/**
 	 * 数据详情
 	 * 数据详情
 	 * 
 	 * 
 	 * */
 	 * */
-    public function update_event(Model $Model, ArticleCommentModel $ArticleCommentModel){
-		// '1' => '阅读',
-		// '2' => '点赞',
-		// '3' => '分享',
-		// '4' => '推荐',
-		// '5' => '取消推荐',
-		// '6' => '取消点赞'
-		$event 					= request('event_type',0);
-		$tid					= request('article_id',0);
-		$uid 					= $this->checkLogin(); // custom_uid
-
-		// 查询条件
-		$map 					= [];
-		$map[] 					= ['uid','=',$uid];
-		$map[] 					= ['article_id','=',$tid];
-		$map[] 					= ['event_type','=',$event];
-		$user_envent            = $ArticleCommentModel->query()->where($map)->get();
-		switch ($event){
-			case 2:
-				
-				if ($user_envent){
-					$Res       	=   $ArticleCommentModel::query()
-									->where(['uid'=>$uid,'article_id'=>$tid])
-									->update(['event_type'=>'6']);
-					return			json_send(['code'=>'error','msg'=>'取消点赞','data'=>[]]);	
-				}
-				break;
-			case 4:
-				if ($user_envent){
-					$Res       	=   $ArticleCommentModel::query()
-									->where(['uid'=>$uid,'article_id'=>$tid])
-									->update(['event_type'=>'4']);
-					return			json_send(['code'=>'error','msg'=>'取消推荐','data'=>[]]);	
-				}
-				break;
-			case 6:
-				$map[] = ['uid','=',$uid];
-				$map[] = ['article_id','=',$tid];
-				$map[] = ['event_type','=',$event];	
+    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 ){
+			$ArticleEvent->edit($oldData['id'],['status'=>$oldData['status']?0:1]);
+		}else{
+			// 如果事件不存在,新增此次事件
+			if( $uid )			$ArticleEvent->add(['custom_uid'=>$uid,'article_id'=>$articleId,'type_id'=>$typeId,'status'=>0]);
 		}
 		}
-
-		$user_envent            = $ArticleCommentModel->query()->where($map)->get();
-		if( $tid )				$map[] = ['id','=',$tid];
-		// $orderRes       	=   $Model::query()->where('article_id','=',$tid)->update(['status'=>'1']);
-		//用户是否点赞和推荐
-
-		
-		return			json_send(['code'=>'success','msg'=>'成功',
-							'data'=>[
-								'event_type'=>$event,'article_id'=>$tid,'uid'=>$uid]
-							]);
-	
-
+		// 判断数据类型,点赞
+		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'=>'']);
 	}
 	}
     
     
 }
 }

+ 0 - 102
app/Models/ArticleComment.php

@@ -1,102 +0,0 @@
-<?php namespace App\Models;
-
-use App\Facades\Servers\Redis\RedisLock;
-use App\Models\Traits\Coupon\GrantType;
-use Illuminate\Database\Eloquent\Factories\HasFactory;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Carbon;
-
-/**
- * 用户操作模型
- * 
- */
-class ArticleComment extends Model
-{
-    use HasFactory,GrantType;
-
-    // 与模型关联的表名
-    protected $table = 'article_comment';
-    // 是否主动维护时间戳
-    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);
-    }
-
-
-    /**
-     * 过期时间
-     * 
-     * @param  int  $expTime 过期时间
-     * 
-     */
-    public function getExpTime($expTime){
-        // 如果存在过期时间,且小于1000,表示这是一个领取后n天的,按天数返回
-        if ( $expTime && $expTime < 1000 ) return Carbon::now()->addDays($expTime)->endOfDay()->getTimestamp();
-        // 返回时间戳
-        return                          $expTime;
-    }
-
-
-    /**
-     * 获取单个信息
-     * 
-     */
-    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;
+    }
+
+}

+ 1 - 1
app/Models/Orders.php

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

+ 1 - 113
resources/views/admin/article/add.blade.php

@@ -17,17 +17,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<div class="form-group col-sm-2">
 	<div class="form-group col-sm-2">
 		<label class="control-label">内容标题</label>
 		<label class="control-label">内容标题</label>
 		<input class="form-control" required="required" type="text" placeholder="内容标题" maxlength="50" name="title" value="" />
 		<input class="form-control" required="required" type="text" placeholder="内容标题" maxlength="50" name="title" value="" />
-	</div>
-	<div class="form-group col-sm-2">
-		<label class="control-label">链接</label>
-		<input class="form-control" required="required" type="text" placeholder="链接地址" maxlength="50" name="link" value="" />
-	</div>
-
-	<div class="form-group col-sm-12" id="add_spec">
-		
-	</div>
-	<div class="form-group col-sm-12" id="add_sku">
-		
 	</div>
 	</div>
 	<div class="form-group col-sm-12">
 	<div class="form-group col-sm-12">
 		<label class="control-label">内容</label>
 		<label class="control-label">内容</label>
@@ -38,105 +27,4 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
 		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
 	</div>
 	</div>
 </form>
 </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>
-
-<script type="text/javascript">
-// 获取类型的规格
-function getSpecHtml(type_id){
-	$.ajax({
-		type: 'get',
-		url: "{{url('admin/product/get_spec_html')}}",
-		data: {type_id:type_id},
-		success: function(data) {
-			$('#add_spec').html(data);
-		},
-		error: function(data) {
-			
-		}
-	});
-}
-
-// 获取节点
-$(function(){
-	// 获取
-	var type_id	= $('#typeId').val();
-	// 获取对应的规格
-	getSpecHtml(type_id);
-	
-	$('#typeId').change(function(){
-		// 获取
-		type_id	= $('#typeId').val();
-		// 获取对应的规格
-		getSpecHtml(type_id);
-	})
-})
-</script>
-<script type="text/javascript">
-	$(function(){
-		// 添加属性
-		$('#add_spec').on('click','.add_attr',function(){
-			// 克隆
-			var copy = $(this).parents('.add_attr_div').prev().clone();
-			$(this).parents('.add_attr_div').before(copy);
-			return false;
-		});
-		// 删除属性
-		$('#add_spec').on('click','.remove_attr',function(){
-			// 只有一个节点时(没有同级节点)。不允许删除
-			// if( $(this).parents('.attr_div').siblings('.attr_div').length < 1 ) return false;
-			$(this).parents('.attr_div').remove();
-			var formData = $('#add_spec input,select').serialize();
-			$.ajax({
-				type: 'get',
-				url: "{{url('admin/product/get_sku_html')}}",
-				data: formData,
-				success: function(data) {
-					$('#add_sku').html(data);
-				},
-				error: function(data) {
-					
-				}
-			});
-			return false;
-		})
-		// 属性名称变更
-		$('#add_spec').on('change','.attr_name',function(){
-			// 获取当前的名称
-			var name = $(this).val();
-			var formData = $('#add_spec input,select').serialize();
-			$.ajax({
-				type: 'get',
-				url: "{{url('admin/product/get_sku_html')}}",
-				data: formData,
-				success: function(data) {
-					$('#add_sku').html(data);
-				},
-				error: function(data) {
-					
-				}
-			});
-			return false;
-		})
-
-	})
-</script>
-
-<script type="text/javascript">
-	$(function(){
-		// 删除规格
-		$('#add_sku').on('click','.remove_sku',function(){
-			// 只有一个节点时(没有同级节点)。不允许删除
-			// if( $(this).parents('tr').siblings('tr').length < 1 ) return false;
-			$(this).parents('tr').remove();
-			return false;
-		})
-	})
-</script>
-@endsection
+@endsection

+ 1 - 113
resources/views/admin/article/edit.blade.php

@@ -17,17 +17,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<div class="form-group col-sm-2">
 	<div class="form-group col-sm-2">
 		<label class="control-label">内容标题</label>
 		<label class="control-label">内容标题</label>
 		<input class="form-control" required="required" type="text" placeholder="内容标题" maxlength="50" name="title" value="{{$oldData['title']}}" />
 		<input class="form-control" required="required" type="text" placeholder="内容标题" maxlength="50" name="title" value="{{$oldData['title']}}" />
-	</div>
-	<div class="form-group col-sm-2">
-		<label class="control-label">链接</label>
-		<input class="form-control" required="required" type="text" placeholder="链接地址" maxlength="50" name="link" value="{{$oldData['qrcode_link']}}" />
-	</div>
-
-	<div class="form-group col-sm-12" id="add_spec">
-		
-	</div>
-	<div class="form-group col-sm-12" id="add_sku">
-		
 	</div>
 	</div>
 	<div class="form-group col-sm-12">
 	<div class="form-group col-sm-12">
 		<label class="control-label">内容</label>
 		<label class="control-label">内容</label>
@@ -38,105 +27,4 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
 		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
 	</div>
 	</div>
 </form>
 </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>
-
-<script type="text/javascript">
-// 获取类型的规格
-function getSpecHtml(type_id){
-	$.ajax({
-		type: 'get',
-		url: "{{url('admin/product/get_spec_html')}}",
-		data: {type_id:type_id},
-		success: function(data) {
-			$('#add_spec').html(data);
-		},
-		error: function(data) {
-			
-		}
-	});
-}
-
-// 获取节点
-$(function(){
-	// 获取
-	var type_id	= $('#typeId').val();
-	// 获取对应的规格
-	getSpecHtml(type_id);
-	
-	$('#typeId').change(function(){
-		// 获取
-		type_id	= $('#typeId').val();
-		// 获取对应的规格
-		getSpecHtml(type_id);
-	})
-})
-</script>
-<script type="text/javascript">
-	$(function(){
-		// 添加属性
-		$('#add_spec').on('click','.add_attr',function(){
-			// 克隆
-			var copy = $(this).parents('.add_attr_div').prev().clone();
-			$(this).parents('.add_attr_div').before(copy);
-			return false;
-		});
-		// 删除属性
-		$('#add_spec').on('click','.remove_attr',function(){
-			// 只有一个节点时(没有同级节点)。不允许删除
-			// if( $(this).parents('.attr_div').siblings('.attr_div').length < 1 ) return false;
-			$(this).parents('.attr_div').remove();
-			var formData = $('#add_spec input,select').serialize();
-			$.ajax({
-				type: 'get',
-				url: "{{url('admin/product/get_sku_html')}}",
-				data: formData,
-				success: function(data) {
-					$('#add_sku').html(data);
-				},
-				error: function(data) {
-					
-				}
-			});
-			return false;
-		})
-		// 属性名称变更
-		$('#add_spec').on('change','.attr_name',function(){
-			// 获取当前的名称
-			var name = $(this).val();
-			var formData = $('#add_spec input,select').serialize();
-			$.ajax({
-				type: 'get',
-				url: "{{url('admin/product/get_sku_html')}}",
-				data: formData,
-				success: function(data) {
-					$('#add_sku').html(data);
-				},
-				error: function(data) {
-					
-				}
-			});
-			return false;
-		})
-
-	})
-</script>
-
-<script type="text/javascript">
-	$(function(){
-		// 删除规格
-		$('#add_sku').on('click','.remove_sku',function(){
-			// 只有一个节点时(没有同级节点)。不允许删除
-			// if( $(this).parents('tr').siblings('tr').length < 1 ) return false;
-			$(this).parents('tr').remove();
-			return false;
-		})
-	})
-</script>
-@endsection
+@endsection

+ 17 - 24
resources/views/admin/article/index.blade.php

@@ -9,15 +9,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	@endif
 	@endif
 </div>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
 <form action="" method="get" class="form-horizontal form-line">
-	
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
-		<select name="status" class="form-control">
-			<option value="" >文章状态</option>
-			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >启用</option>
-			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >停用</option>
-		</select>
+		<input type="text" class="form-control" name="title" value="{{request('title','')}}" placeholder="请输入资讯标题查询" />
 	</div>
 	</div>
-
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
 		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
 	</div>
 	</div>
@@ -34,8 +28,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<table class="table table-striped table-bordered table-hover">
 			<table class="table table-striped table-bordered table-hover">
 				<thead>
 				<thead>
 					<tr>
 					<tr>
-						<th>内容编码</th>
-						<th>内容标题</th>
+						<th>ID</th>
+						<th>资讯标题</th>
+						<th>资讯数据</th>
 						<th>状态</th>
 						<th>状态</th>
 						<th>修改时间</th>
 						<th>修改时间</th>
 						<th>操作</th>
 						<th>操作</th>
@@ -44,19 +39,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<tbody>
 				<tbody>
 					@foreach ($list as $a)
 					@foreach ($list as $a)
 					<tr>
 					<tr>
-						<td> {{$a['article_code']}}</td>
+						<td> {{$a['id']}}</td>
 						<td> {{$a['title']}}</td>
 						<td> {{$a['title']}}</td>
-						<td>
-							@if ($a['status'] == 0) 启用 @endif
-							@if ($a['status'] == 1) 停用 @endif
+						<td> 
+							阅读: {{$a['read_count']}} ;
+							点赞: {{$a['hand_count']}} ;
+							分享: {{$a['share_count']}} ;
+							收藏: {{$a['like_count']}};
 						</td>
 						</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> {{date('Y/m/d H:i',$a['update_time'])}}</td>
 						<td>
 						<td>
-							@if( check_auth('admin/article_comment/index') )
-							<a class="btn btn-sm btn-success" href="{{url('admin/article_comment/index?'.http_build_query(['tid'=>$a['id']]))}}" title="数据">
-								数据
-							</a>
+							@if( check_auth('admin/article_event/index') )
+							<a class="btn btn-sm btn-primary" href="{{url('admin/article_event/index?'.http_build_query(['tid'=>$a['id']]))}}" title="事件记录">事件记录</a>
 							@endif
 							@endif
 							@if( check_auth('admin/article/edit') )
 							@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 class="btn btn-sm btn-warning" href="{{url('admin/article/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
@@ -64,17 +59,15 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							</a>
 							</a>
 							@endif
 							@endif
 							@if( check_auth('admin/article/set_status') )
 							@if( check_auth('admin/article/set_status') )
-								@if ( $a['status'] == 0)
-									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/article/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
+								@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>
 									</a>
-								@endif
-								@if( $a['status'] == 1)
-									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/article/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
+								@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>
 									</a>
 								@endif
 								@endif
-							
 							@endif
 							@endif
 						</td>
 						</td>
 					</tr>
 					</tr>

+ 14 - 26
resources/views/admin/article_comment/index.blade.php → resources/views/admin/article_event/index.blade.php

@@ -7,36 +7,29 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 
 
 
 
 <form action="" method="get" name="thisform" class="form-horizontal form-line">
 <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="tid" value="{{request('tid','')}}" placeholder="请输入内容编码搜索" />
-	</div>
 	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 	<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="请输入标题模糊搜索" />
 		<input type="text" class="form-control" name="title" value="" placeholder="请输入标题模糊搜索" />
 	</div>
 	</div>
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
-		<select name="c_type" class="form-control">
+		<select name="type_id" class="form-control">
 			<option value="" >请选择类型搜索</option>
 			<option value="" >请选择类型搜索</option>
-			<option value="1" @if (request('c_type') === '1' ) selected="selected" @endif >阅读</option>
-			<option value="2" @if (request('c_type') === '2' ) selected="selected" @endif >点赞</option>
-			<option value="3" @if (request('c_type') === '3' ) selected="selected" @endif >分享</option>
-			<option value="4" @if (request('c_type') === '4' ) selected="selected" @endif >推荐</option>
-			<option value="5" @if (request('c_type') === '5' ) selected="selected" @endif >取消推荐</option>
-			<option value="6" @if (request('c_type') === '6' ) selected="selected" @endif >取消点赞</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>
 		</select>
 	</div>
 	</div>
-
 	<div class="form-group col-sm-2 col-md-1">
 	<div class="form-group col-sm-2 col-md-1">
 		<input class="form-control" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
 		<input class="form-control" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
 	</div>
 	</div>
 	<div class="form-group col-sm-2 col-md-1" style="margin-right: 2px;">
 	<div class="form-group col-sm-2 col-md-1" style="margin-right: 2px;">
 		<input class="form-control" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
 		<input class="form-control" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
 	</div>
 	</div>
-
 	<div class="form-group col col-xs-4 col-md-2" style="margin-right: 2px;">
 	<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>
 		<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_comment/index')}}" class="btn btn-sm btn-default" style="margin-right: 20px;" >重置</a>
-		@if( check_auth('admin/article_comment/down_excel') )
-		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/article_comment/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载表格</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
 		@endif
 	</div>
 	</div>
 	@csrf
 	@csrf
@@ -47,9 +40,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<table class="table table-striped table-bordered table-hover">
 		<table class="table table-striped table-bordered table-hover">
 				<thead>
 				<thead>
 					<tr>
 					<tr>
-						<th>内容编码</th>
-						<th>内容标题</th>
-						<th>操作人员</th>
+						<th>资讯ID</th>
+						<th>资讯标题</th>
+						<th>客户昵称</th>
 						<th>操作类型</th>
 						<th>操作类型</th>
 						<th>操作时间</th>
 						<th>操作时间</th>
 					</tr>
 					</tr>
@@ -57,16 +50,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				<tbody>
 				<tbody>
 					@foreach ($list as $a)
 					@foreach ($list as $a)
 					<tr>
 					<tr>
-						<td> {{$a['article_code']}}</td>
+						<td> {{$a['article_id']}}</td>
 						<td> {{$a['title']}}</td>
 						<td> {{$a['title']}}</td>
-						<td>
-							{{$a['custom_name']}}
-						</td>
-						<td>
-							{{$a['event']}}
-						</td>						
+						<td> {{$a['custom_name']}}</td>
+						<td> {{$a['event']}} </td>						
 						<td> {{date('Y/m/d H:i',$a['update_time'])}}</td>
 						<td> {{date('Y/m/d H:i',$a['update_time'])}}</td>
-						
 					</tr>
 					</tr>
 					@endforeach
 					@endforeach
 					<tr>
 					<tr>

+ 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>
         	<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-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-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>-->	
           <!--<button type="button" data-toggle="tooltip" title="确定" id="button-check" class="btn btn-success"><i class="fa fa-check"></i></button>-->	
         </div>
         </div>
         <div class="col-sm-7">
         <div class="col-sm-7">

+ 2 - 2
routes/api.php

@@ -273,6 +273,6 @@ Route::any('riddle_answer/check_answer',[\App\Http\Controllers\Api\Riddle\Answer
 /**
 /**
  * 文章详情
  * 文章详情
  */
  */
-Route::any('article/list',[App\Http\Controllers\Api\Article\Comment::class,'list']);
-Route::any('article/detail',[App\Http\Controllers\Api\Article\Comment::class,'detail']);
+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']);
 Route::any('article/update_event',[App\Http\Controllers\Api\Article\Comment::class,'update_event']);

+ 2 - 2
routes/web.php

@@ -553,9 +553,9 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     // 状态
     // 状态
     Route::any('article/set_status',[App\Http\Controllers\Admin\Article::class,'set_status']);
     Route::any('article/set_status',[App\Http\Controllers\Admin\Article::class,'set_status']);
     //数据
     //数据
-    Route::any('article_comment/index',[App\Http\Controllers\Admin\ArticleComment::class,'index']);
+    Route::any('article_event/index',[App\Http\Controllers\Admin\ArticleEvent::class,'index']);
     // 订单下载
     // 订单下载
-    Route::any('article_comment/down_excel',[App\Http\Controllers\Admin\ArticleComment::class,'down_excel']);
+    Route::any('article_event/down_excel',[App\Http\Controllers\Admin\ArticleEvent::class,'down_excel']);
 
 
 
 
     /* 红包活动 */
     /* 红包活动 */