jun 4 kuukautta sitten
vanhempi
sitoutus
9d47e1c3e1

+ 2 - 0
app/Http/Controllers/Admin/Orders.php

@@ -467,6 +467,7 @@ class Orders extends Auth{
                 'contact_city'		=> $value['contact_city'],
                 'contact_area'		=> $value['contact_area'],
                 'contact_addr'		=> $value['contact_addr'],
+                'contact_shop'		=> $value['contact_shop'],
                 'shop_type'		    => $value['shop_type'] ? $Shoptype->getOne($value['shop_type'],'name') : '',
                 'product_id'		=> $value['product_id'] ? $Product->idToCode($value['product_id']) : '— —',
                 'product_name'		=> $value['product_name'],
@@ -510,6 +511,7 @@ class Orders extends Auth{
                 '市',
                 '区县',
                 '收货地址',
+                '店铺名称',
                 '终端类型',
                 '产品编码',
                 '产品名称',

+ 128 - 0
app/Http/Controllers/Admin/Poster.php

@@ -0,0 +1,128 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Facades\Servers\WechatMini\Mini;
+use App\Models\City;
+use App\Models\WeiBan\Tags as WeiBanTags;
+use Illuminate\Support\Facades\DB;
+use Intervention\Image\Facades\Image;
+
+/**
+ * 拉新活动
+ *
+ * @author    刘相欣
+ *
+ */
+class Poster extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','海报');
+		$this->assign('breadcrumb2','生成海报');
+	}
+
+	/**
+	 * 列表页
+	 * 
+	 * */
+    public function index(){
+		// 加载模板
+		return 					$this->fetch();
+    }
+
+	/**
+	 * 获取小程序链接
+	 * 
+	 */
+	private function getUrlLink($id){
+		// 结果数据
+        $link                  = cache('admin:recruitment:active:urllink:'.$id);
+        // 不存在数据
+        if ( is_null($link) ) {
+            // 从数据库获取数据
+            $link              = Mini::getUrlLink('pages/recruitment/index','id='.$id);
+            // 存起来
+            cache(['admin:recruitment:active:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
+        }
+        // 返回结果
+        return                  $link;
+	}
+
+	/**
+	 * 获取小程序海报
+	 * 
+	 */
+	public function get_poster(){
+        // 接收参数
+        $id								= request('id',0);
+        $url							= request('url',0);
+        $position						= request('position',0);
+        $thumb						    = request('thumb',0);
+        if( !$thumb ) 				    return json_send(['code'=>'error','msg'=>'请上传海报图片']);
+        // 获取分享海报图片
+        $result 						= $this->getShareImage('id='.$id,$thumb,$url,$position);
+        $this->assign('image',$result);
+        $this->assign('crumbs','海报');
+		// 加载模板
+		return 							$this->fetch();
+	}
+
+	/**
+	 * 获取分享海报图片
+	 * @param  int $scene  场景值
+	 * 
+	 */
+	private function getShareImage($scene,$thumb,$url,$position){
+		// 尝试执行
+		try {
+			// 加载图片
+			$image							= Image::make(public_path('uploads/').$thumb);
+			// 生成小程序二维码
+			$qrcode							= Mini::getUnlimit($scene,['page'=>$url,'width'=>480,'is_hyaline'=>true]);
+			// 错误提示
+			if( isset($qrcode['error']) )	return $qrcode;
+			// 加载图片
+			$qrcode							= Image::make($qrcode);
+			// 插入图片
+            switch ($position) {
+                case 1:
+                    $image->insert($qrcode,'top-left',0,0);
+                    break;
+                case 2:
+                    $image->insert($qrcode,'top-center',0,0);
+                    break;
+                case 3:
+                    $image->insert($qrcode,'top-right',0,0);
+                    break;
+                case 4:
+                    $image->insert($qrcode,'center-left',0,0);
+                    break;
+                case 5:
+                    $image->insert($qrcode,'center-center',0,0);
+                    break;
+                case 6:
+                    $image->insert($qrcode,'center-right',0,0);
+                    break;
+                case 7:
+                    $image->insert($qrcode,'bottom-left',0,0);
+                    break;
+                case 8:
+                    $image->insert($qrcode,'bottom-center',0,0);
+                    break;
+                case 9:
+                    $image->insert($qrcode,'bottom-right',0,0);
+                    break;
+            }
+			// 转码成字符串
+			$image							= $image->encode('jpg', 90)->__toString();
+			// 转base64
+			$base64							= 'data:image/jpg;base64,' . base64_encode($image);
+			// 返回结果
+			return							$base64;
+		} catch (\Throwable $th) {
+			// 错误提示
+			return 							['error'=>$th->getMessage()];
+		}
+	}
+
+
+}

+ 14 - 0
resources/views/admin/poster/get_poster.blade.php

@@ -0,0 +1,14 @@
+@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-12">
+		<label class="control-label">活动海报</label>
+		<div class="form-group col-sm-12">
+			<img src="{{$image}}" alt="" height="300" title="">
+		</div>
+	</div>
+</form>
+@endsection

+ 48 - 0
resources/views/admin/poster/index.blade.php

@@ -0,0 +1,48 @@
+@extends('admin.public.base')
+@section('body_class')
+	style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+	<form class="" action="get_poster" method="post">
+		<div class="form-group col-sm-12">
+			<label class="control-label">海报主图</label>
+			<div id="thumb">
+				<a id="thumb-image" href="#" data-toggle="image" class="img-thumb">
+					<img src="{{path_compat('')}}" height="300"/>
+				</a>
+				<input class="form-control" type="hidden" name="thumb" value="" id="input-image" required="required" />
+			</div>
+		</div>
+		<div class="form-group col-sm-12">
+			<label class="control-label">活动地址</label>
+			<select name="url" class="form-control" id="typeId" required="required">
+				<option value="pages/coupon/active" >领劵活动地址</option>
+				<option value="pages/score/clockin">打卡活动地址</option>
+				<option value="pages/recruitment/index">拉新活动地址</option>
+				<option value="pages/orders/lottery">下单抽奖活动</option>
+			</select>
+		</div>
+		<div class="form-group col-sm-12">
+			<label class="control-label">活动ID</label>
+			<input class="form-control" required="required" type="text" placeholder="活动ID" name="id" maxlength="20" value="" />
+		</div>
+		<div class="form-group col-sm-4">
+			<label class="control-label">二维码位置</label>
+			<select name="position" class="form-control" id="typeId">
+				<option value="1"  >上左</option>
+				<option value="2"  >上中</option>
+				<option value="3"  >上右</option>
+				<option value="4"  >中左</option>
+				<option value="5"  >中中</option>
+				<option value="6"  >中右</option>
+				<option value="7"  >下左</option>
+				<option value="8"  >下中</option>
+				<option value="9"  >下右</option>
+			</select>
+		</div>
+		<div class="form-group col-sm-12">
+			@csrf
+			<input id="send" type="submit" value="生成海报" class="btn btn-primary btn-block"/>
+		</div>
+	</form>
+@endsection

+ 32 - 34
resources/views/admin/recruitment_active/index.blade.php

@@ -4,21 +4,18 @@
 @endsection
 @section('content')
 
-	@if(check_auth('admin/regiment_active/add'))
+	@if(check_auth('admin/recruitment_active/add'))
 		<div class="page-header">
-			<a href="{{url('admin/regiment_active/add')}}" class="btn btn-primary">新增</a>
+			<a href="{{url('admin/recruitment_active/add')}}" class="btn btn-primary">新增</a>
 		</div>
 	@endif
 
 	<form action="" method="get" 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="code" value="{{request('code','')}}" 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="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="product_name" value="{{request('product_name','')}}" placeholder="请输入产品名称查询" />
+			<input type="text" class="form-control" name="id_code" value="{{request('id_code','')}}" placeholder="请输入活动编码查询" />
 		</div>
 		<div class="form-group col col-md-1" style="margin-right: 2px;">
 			<select name="status" class="form-control">
@@ -35,7 +32,7 @@
 			<input type="date" 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/regiment_active/index')}}" class="btn btn-sm btn-default" >重置</a>
+		<a href="{{url('admin/recruitment_active/index')}}" class="btn btn-sm btn-default" >重置</a>
 	</form>
 
 	<div class="row">
@@ -44,16 +41,15 @@
 				<table class="table table-striped table-bordered table-hover">
 					<thead>
 					<tr>
-						<th>活动编码</th>
+						<th>活动ID</th>
 						<th>活动名称</th>
-						<th>产品名称</th>
-						<th>拼团人数(人)</th>
-						<th>活动价格(元)</th>
-						<th>拼团有效期</th>
-						<th>商业公司</th>
-						<th>状态</th>
-						<th>活动时间</th>
-						<th>创建时间</th>
+						<th>活动城市</th>
+						<th>标签范围</th>
+						<th>开始时间</th>
+						<th>结束时间</th>
+						<th>内部跳转</th>
+						<th>宣发链接</th>
+						<th>活动状态</th>
 						<th>修改时间</th>
 						<th>操作</th>
 					</tr>
@@ -62,15 +58,16 @@
 					<tbody>
 					@foreach ($list as $a)
 						<tr>
-							<th>{{$a['code']}}</th>
-							<td style="white-space:pre">{{$a['name']}}</td>
-							<td>{{$a['product_name']}}</td>
-							<td>{{$a['number']}}</td>
-							<td>{{$a['regiment_price']}}</td>
-							<td>{{$a['expiration']}}</td>
-							<td>{{$a['business_name']}}</td>
+							<th>{{$a['id_code']}}</th>
+							<td>{{$a['name']}}</td>
+							<td>{{$a['city_ids']}}</td>
+							<td>{{$a['tag_scope']}}</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/recruitment/index?id={{$a['id']}}</td>
+							<td>{{$a['mp_urllink']}}</td>
 							<td>
-								@if( $a['status'] === 2)
+								@if( $a['status'] )
 									停用
 								@else
 									@if( $a['start_time'] <= time() && $a['end_time'] <= time() )
@@ -84,23 +81,24 @@
 									@endif
 								@endif
 							</td>
-							<td>{{date('Y/m/d H:i:s',$a['start_time'])}}<br/>{{date('Y/m/d H:i:s',$a['end_time'])}}</td>
-							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 							<td>
-								@if(check_auth('admin/regiment_active/edit'))
-									<a href="{{url('admin/regiment_active/edit?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-warning" >编辑</a>
+								@if(check_auth('admin/recruitment_active_prize/edit'))
+									<a href="{{url('admin/recruitment_active_prize/edit?'.http_build_query(['active_id'=>$a['id']]))}}" class="btn btn-sm btn-primary" >奖励配置</a>
 								@endif
-								@if(check_auth('admin/regiment_active/copy'))
-									<a href="{{url('admin/regiment_active/copy?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >复制</a>
+								@if(check_auth('admin/recruitment_active/edit'))
+									<a href="{{url('admin/recruitment_active/edit?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-warning" >编辑</a>
 								@endif
-								@if(check_auth('admin/regiment_active/set_status'))
-									@if($a['status'] === 2)
-										<a data-url="{{url('admin/regiment_active/set_status?'.http_build_query(['id'=>$a['id'],'status'=>1]))}}" class="set_status btn btn-sm btn-success" >启用</a>
+								@if(check_auth('admin/recruitment_active/set_status'))
+									@if($a['status'])
+										<a data-url="{{url('admin/recruitment_active/set_status?'.http_build_query(['id'=>$a['id'],'status'=>0]))}}" class="set_status btn btn-sm btn-success" >启用</a>
 									@else
-										<a data-url="{{url('admin/regiment_active/set_status?'.http_build_query(['id'=>$a['id'],'status'=>2]))}}" class="set_status btn btn-sm btn-danger" >停用</a>
+										<a data-url="{{url('admin/recruitment_active/set_status?'.http_build_query(['id'=>$a['id'],'status'=>1]))}}" class="set_status btn btn-sm btn-danger" >停用</a>
 									@endif
 								@endif
+								@if(check_auth('admin/recruitment_active/get_poster'))
+									<a href="{{url('admin/recruitment_active/get_poster?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >海报</a>
+								@endif
 							</td>
 						</tr>
 					@endforeach

+ 6 - 6
resources/views/admin/regiment_active/index.blade.php

@@ -39,7 +39,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 </form>
 
 <div class="row">
-	<div class="col-xs-12">	
+	<div class="col-xs-12">
 		<div class="table-responsive">
 			<table class="table table-striped table-bordered table-hover">
 				<thead>
@@ -55,10 +55,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>活动时间</th>
 						<th>创建时间</th>
 						<th>修改时间</th>
-						<th>操作</th>									
+						<th>操作</th>
 					</tr>
 				</thead>
-				
+
 				<tbody>
 						@foreach ($list as $a)
 						<tr>
@@ -101,8 +101,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									<a data-url="{{url('admin/regiment_active/set_status?'.http_build_query(['id'=>$a['id'],'status'=>2]))}}" class="set_status btn btn-sm btn-danger" >停用</a>
 									@endif
 								@endif
-							</td>							
-						</tr>  
+							</td>
+						</tr>
 						@endforeach
 						<tr>
 							<td colspan="20" class="page">{{$list->render()}}</td>
@@ -111,7 +111,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td colspan="20">总计 {{$list->total()}} 个商店</td>
 						</tr>
 				</tbody>
-				
+
 			</table>
 		</div>
 	</div>

+ 4 - 0
routes/web.php

@@ -568,4 +568,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('amount_record/index',[App\Http\Controllers\Admin\AmountRecord::class,'index']);
     // 状态
     Route::any('amount_record/down_excel',[App\Http\Controllers\Admin\AmountRecord::class,'down_excel']);
+
+    //生成海报
+    Route::any('poster/index',[App\Http\Controllers\Admin\Poster::class,'index']);
+    Route::any('poster/get_poster',[App\Http\Controllers\Admin\Poster::class,'get_poster']);
 });