Преглед на файлове

分享设置-分享内容模块,用户数据模块提交

huanglei преди 3 месеца
родител
ревизия
9a8b5eda77

+ 5 - 0
.htaccess

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

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

@@ -0,0 +1,200 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Http\Requests\Admin\Article as Request;
+use App\Models\Article as Model;
+use App\Models\ArticleComment;
+use Illuminate\Support\Facades\DB;
+use App\Models\City;
+
+/**
+ * 分享设置
+ *
+ * @author    huanglei
+ *
+ */
+class Article extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','分享设置');
+		$this->assign('breadcrumb2','内容分享');
+	}
+
+	/**
+	 * 首页列表
+	 * 
+	 * */
+    public function index(Model $Model,ArticleComment $ArticleComment){
+		
+		// 接受参数
+		$code					= request('article_code','');
+		$status					= request('status');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 编码转ID
+		$id						= $code ? $Model->codeToId($code) : 0;
+		// 查询条件
+		$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];
+		// 查询数据
+		$list					= $Model->query()->where($map);
+        $list                   =  $list->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
+		
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+
+			// id转编号
+			$value['article_code']		= $Model->idToCode($value['id']);
+			// 重组
+			$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,City $City,Product $Product){
+		if( request()->isMethod('post') ){
+			// 验证参数
+			$request->scene('add')->validate();
+			// 组合数据
+			$data['poster']			= request('poster',0);
+			$data['title']			= request('title',0);
+			$data['qrcode_link']			= request('link',0);
+			$data['content']	= request('description',0);
+			$data['status']			= request('status',0);
+
+			// 验证信息
+			// if( $data['rebate_type'] == 2 && $data['rebate'] > 9.99 ) return json_send(['code'=>'error','msg'=>'不能设置大于9.99折']);
+
+
+			// 组合数据,写入订单表,子表
+			DB::beginTransaction();
+			try {
+				// 写入
+				$id						= $Model->add($data);
+				// 提示新增失败
+				if( !$id )				{
+					// 回滚
+					DB::rollBack();
+					// 提示
+					return json_send(['code'=>'error','msg'=>'新增失败']);
+				}
+			
+				// 提交
+				DB::commit();
+				// 记录行为
+				$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,1,[],$data);
+				// 告知结果
+				return					json_send(['code'=>'success','msg'=>'新增成功','action'=>'add']);
+			} catch (\Throwable $th) 	{
+				// 回滚
+				DB::rollBack();
+				// 提示失败
+				return					json_send(['code'=>'error','msg'=>'内部错误,请重试','data'=>['error'=>$th->getMessage()]]);
+			}
+		}
+		// 获取列表
+		$cityList					= $City->getCityList();
+
+		// 分配数据
+		$this->assign('cityList',$cityList);
+
+		$this->assign('crumbs','新增');
+		// 加载模板
+		return 						$this->fetch();
+	}
+	
+	/**
+	 * 编辑
+	 * 
+	 * */
+	public function edit( Request $request, Model $Model){
+		// 接收参数
+		$id							= request('id',0);
+		// 查询数据
+		$oldData					= $Model->where(['id'=>$id])->first();
+
+		// 修改
+		if(request()->isMethod('post')){
+			// 验证参数
+			$request->scene('edit')->validate();
+			// 组合数据
+			$data['poster']			= request('poster',0);
+			$data['title']			= request('title',0);
+			$data['qrcode_link']			= request('link',0);
+			$data['content']	= request('description',0);
+			$data['status']			= request('status',0);
+
+			// 转换时间,默认现在现在生效
+			$data['update_time']		= time();
+
+			// 组合数据,写入订单表,子表
+			DB::beginTransaction();
+			try {
+				// 写入
+				$result				= $Model->edit($id,$data);
+				// 提示新增失败
+				if( !$result )		{
+					// 回滚
+					DB::rollBack();
+					// 提示
+					return json_send(['code'=>'error','msg'=>'修改失败']);
+				}
+				
+				// 提交
+				DB::commit();
+				// 记录行为
+				$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,[],$data);
+				// 告知结果
+				return				json_send(['code'=>'success','msg'=>'修改成功','action'=>'edit']);
+			} catch (\Throwable $th) {
+				// 回滚
+				DB::rollBack();
+				// 提示失败
+				return				json_send(['code'=>'error','msg'=>'内部错误,请重试','data'=>['error'=>$th->getMessage()]]);
+			}
+		}
+		// 如果是没有数据
+		if( !$oldData ) 			return $this->error('查无数据');
+		
+		// 分配数据
+	
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','修改');
+		// 加载模板
+		return 					$this->fetch();
+	}
+
+	
+
+}

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

@@ -0,0 +1,237 @@
+<?php namespace App\Http\Controllers\Admin;
+
+// use App\Http\Requests\Admin\Article as Request;
+// use App\Models\Article as Model;
+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;
+// use App\Models\Custom as CustomModel;
+// use Illuminate\Support\Facades\DB;
+// use App\Models\City;
+
+/**
+ * 分享设置
+ *
+ * @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;
+	}
+
+
+
+
+}

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

@@ -44,6 +44,7 @@ class LotteryOrder extends Auth{
 			$list[$key]			= $value;
 		}
 		// 分配数据
+		
 		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
 		$this->assign('list',$list);
 		// 加载模板

+ 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'   		        => '状态格式错误',
+        ];
+    }
+
+}

+ 118 - 0
app/Models/Article.php

@@ -0,0 +1,118 @@
+<?php namespace App\Models;
+
+use App\Facades\Servers\Redis\Redis;
+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 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);
+    }
+
+
+    /**
+     * 优惠券过期时间
+     * 
+     * @param  int  $expTime 过期时间
+     * 
+     */
+    public function getExpTime($expTime){
+        // 如果存在过期时间,且小于1000,表示这是一个领取后n天的,按天数返回
+        if ( $expTime && $expTime < 1000 ) return Carbon::now()->addDays($expTime)->endOfDay()->getTimestamp();
+        // 返回时间戳
+        return                          $expTime;
+    }
+
+    /**
+     * 过期状态设置
+     * 
+    */
+    // public function setStatusByExpire(){
+    //     // 上锁
+    //     if(RedisLock::lock('coupon::set::status::by::expire',1,30)){
+    //         // 修改
+    //         $result                 = $this->query()->where([['status','=',0],['end_time','>',0],['end_time','<=',time()]])->update(['status'=>3,'update_time'=>time()]);
+    //         // 不管成功失败,都解锁
+    //         RedisLock::unlock('coupon::set::status::by::expire',1);
+    //         // 返回结果
+    //         return                   $result;
+    //     }
+    // }
+
+    /**
+     * 获取优惠券信息
+     * 
+     */
+    public function getOne($id,$field=''){
+        // 返回结果
+        $result                      = $this->query()->find($id);
+        // 返回结果
+        $result                      = $result ? $result->toArray() : [];
+        // 返回值
+        return                       empty($field) ? $result : ( isset($result[$field]) ? $result[$field] : null);
+    }
+
+}

+ 118 - 0
app/Models/ArticleComment.php

@@ -0,0 +1,118 @@
+<?php namespace App\Models;
+
+use App\Facades\Servers\Redis\Redis;
+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 setStatusByExpire(){
+        // 上锁
+        if(RedisLock::lock('coupon::set::status::by::expire',1,30)){
+            // 修改
+            $result                 = $this->query()->where([['status','=',0],['end_time','>',0],['end_time','<=',time()]])->update(['status'=>3,'update_time'=>time()]);
+            // 不管成功失败,都解锁
+            RedisLock::unlock('coupon::set::status::by::expire',1);
+            // 返回结果
+            return                   $result;
+        }
+    }
+
+    /**
+     * 获取优惠券信息
+     * 
+     */
+    public function getOne($id,$field=''){
+        // 返回结果
+        $result                      = $this->query()->find($id);
+        // 返回结果
+        $result                      = $result ? $result->toArray() : [];
+        // 返回值
+        return                       empty($field) ? $result : ( isset($result[$field]) ? $result[$field] : null);
+    }
+
+}

+ 0 - 0
nginx.htaccess


+ 0 - 0
public/.htaccess


+ 4 - 0
public/desktop.ini

@@ -0,0 +1,4 @@
+[ViewState]
+Mode=
+Vid=
+FolderType=Generic

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

@@ -0,0 +1,142 @@
+@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="poster" value="" id="input-image" />
+		</div>
+	</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="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 class="form-group col-sm-12">
+		<label class="control-label">内容</label>
+		<textarea required="required" id="container" name="description" 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>
+
+<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

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

@@ -0,0 +1,142 @@
+@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['poster'])}}" height="100" />
+			</a>
+			<input type="hidden" name="poster" value="{{$oldData['poster']}}" id="input-image" />
+		</div>
+	</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="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 class="form-group col-sm-12">
+		<label class="control-label">内容</label>
+		<textarea required="required" id="container" name="description" placeholder="内容" maxlength="1500">{{$oldData['content']}}</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>
+
+<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

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

@@ -0,0 +1,94 @@
+@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-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>
+	</div>
+
+	<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="请输入开始时间查询" />
+	</div>
+	<div class="form-group col col-md-1" 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>内容编码</th>
+						<th>内容标题</th>
+						<th>状态</th>
+						<th>修改时间</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['article_code']}}</td>
+						<td> {{$a['title']}}</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_comment/index') )
+							<a class="btn btn-sm btn-success" href="{{url('admin/article_comment/index?'.http_build_query(['tid'=>$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'] == 0)
+									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/article/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
+										启用
+									</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']))}}">
+										停用
+									</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

+ 182 - 0
resources/views/admin/article_comment/index.blade.php

@@ -0,0 +1,182 @@
+@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="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;">
+		<input type="text" class="form-control" name="title" value="" placeholder="请输入标题模糊搜索" />
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<select name="c_type" class="form-control">
+			<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>
+		</select>
+	</div>
+
+	<div class="form-group col-sm-2 col-md-1">
+		<input class="form-control" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
+	</div>
+	<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="" />
+	</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_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>
+		@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>内容编码</th>
+						<th>内容标题</th>
+						<th>操作人员</th>
+						<th>操作类型</th>
+						<th>操作时间</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['article_code']}}</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

+ 14 - 0
routes/web.php

@@ -539,5 +539,19 @@ 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_comment/index',[App\Http\Controllers\Admin\ArticleComment::class,'index']);
+    // 订单下载
+    Route::any('article_comment/down_excel',[App\Http\Controllers\Admin\ArticleComment::class,'down_excel']);
 
 });