Browse Source

【Add】拉新抽奖增加活动

liuxiangxin 2 tháng trước cách đây
mục cha
commit
06a45b8616

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

@@ -81,6 +81,7 @@ class LotteryRecruitment extends Auth{
             $data['rule']			= request('rule','');
             $data['freq']			= request('freq',0);
             $data['lucky_num']		= request('lucky_num',0);
+            $data['tag_scope_type']	= request('tag_scope_type',0);
             $data['max_reward']		= request('max_reward',0);
             $data['start_time']		= request('start_time','');
             $data['end_time']		= request('end_time','');
@@ -138,6 +139,7 @@ class LotteryRecruitment extends Auth{
             $data['rule']			= request('rule','');
             $data['freq']			= request('freq',0);
             $data['lucky_num']		= request('lucky_num',0);
+            $data['tag_scope_type']	= request('tag_scope_type',0);
             $data['max_reward']		= request('max_reward',0);
             $data['start_time']		= request('start_time','');
             $data['end_time']		= request('end_time','');

+ 5 - 5
app/Http/Controllers/Admin/LotteryRecruitmentRecord.php

@@ -14,7 +14,7 @@ class LotteryRecruitmentRecord extends Auth{
 
     protected function _initialize(){
         parent::_initialize();
-        $this->assign('breadcrumb1','下单抽奖');
+        $this->assign('breadcrumb1','拉新抽奖');
         $this->assign('breadcrumb2','抽奖记录');
     }
 
@@ -43,7 +43,7 @@ class LotteryRecruitmentRecord extends Auth{
                                     ->join('lottery_recruitment','lottery_recruitment.id','=','lottery_recruitment_record.lottery_id')
                                     ->join('custom','custom.uid','=','lottery_recruitment_record.custom_uid')
                                     ->where($map)
-                                    ->select(['lottery_recruitment_record.*','custom.weiban_extid','custom.username','lottery_Recruitment.name as active_name'])
+                                    ->select(['lottery_recruitment_record.*','custom.weiban_extid','custom.username','lottery_recruitment.name as active_name'])
                                     ->orderByDesc('id')
                                     ->paginate(config('page_num',10));
         // 循环处理数据
@@ -115,13 +115,13 @@ class LotteryRecruitmentRecord extends Auth{
         if( !is_null($status) )	$map[] = ['lottery_recruitment_record.status','=',$status];
         // 查询数据
         $list					= $Model->query()
-                                    ->join('lottery_Recruitment','lottery_Recruitment.id','=','lottery_recruitment_record.lottery_id')
+                                    ->join('lottery_recruitment','lottery_recruitment.id','=','lottery_recruitment_record.lottery_id')
                                     ->join('custom','custom.uid','=','lottery_recruitment_record.custom_uid')
                                     ->where($map)
                                     ->select([
                                         'lottery_recruitment_record.id',
-                                        'lottery_Recruitment.id as active_id',
-                                        'lottery_Recruitment.name as active_name',
+                                        'lottery_recruitment.id as active_id',
+                                        'lottery_recruitment.name as active_name',
                                         'custom.uid as custom_uid',
                                         'custom.username',
                                         'lottery_recruitment_record.reward_name',

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

@@ -14,7 +14,7 @@ class LotteryRecruitmentReward extends Auth{
 	
 	protected function _initialize(){
 		parent::_initialize();
-		$this->assign('breadcrumb1','下单抽奖');
+		$this->assign('breadcrumb1','拉新抽奖');
 		$this->assign('breadcrumb2','抽奖奖品');
 	}
 

+ 76 - 71
app/Http/Controllers/Api/Lottery/Recruitment.php

@@ -2,7 +2,6 @@
 
 use App\Http\Controllers\Api\Api;
 use App\Models\Lottery\Recruitment as Model;
-use App\Models\Lottery\RecruitmentUsable;
 use App\Models\Custom;
 use App\Models\CustomCoupon;
 use App\Models\CustomScore;
@@ -25,54 +24,70 @@ class Recruitment extends Api{
 	 * 
 	 * 
 	 * */
-	public function get_detail(Model $Model,Custom $Custom,RecruitmentReward $RecruitmentReward,RecruitmentUsable $RecruitmentUsable,WeiBanTags $WeiBanTags){
+	public function get_detail(Model $Model,Custom $Custom,RecruitmentReward $RecruitmentReward,RecruitmentRecord $RecruitmentRecord,WeiBanTags $WeiBanTags){
 		// 接口验签
 		// $this->verify_sign();
 		// 检查登录
 		$uid							= $this->checkLogin();
-		// 获取客户信息
-		$custom							= $Custom->getOne($uid);
-		// 如果存在的话
-		if( !$custom )					return json_send(['code'=>'no_login','msg'=>'请登录','data'=>['error'=>'无对应客户']]);
 		// 接收参数
 		$id 							= request('id',0);
 		// 获取活动
 		$data			                = $Model->getOne($id);
 		// 如果存在的话
 		if( !$data )					return json_send(['code'=>'error','msg'=>'暂无活动','data'=>$data]);
-		// 默认可以参加活动
-		$data['allow_join']				= 1;
+		// 获取客户信息
+		$custom							= $Custom->getOne($uid);
+		// 如果存在的话
+		if( !$custom )					return json_send(['code'=>'no_login','msg'=>'请登录','data'=>['error'=>'无对应客户']]);
+		// 如果客户注册时间不在活动期间
+		if( $data['start_time'] > $custom['insert_time'] || $data['end_time'] < $custom['insert_time'] ) return json_send(['code'=>'error','msg'=>'账号不在活动范围','data'=>['error'=>'不在活动时间内注册']]);
+		// 如果城市限制并且不在在城市范围内,不允许参加
+		if ( $data['city_ids'] && !in_array($custom['city_id'],explode(',',$data['city_ids'])) ) return json_send(['code'=>'error','msg'=>'账号不在城市范围,请核对您的城市','data'=>['error'=>'不在标签范围内']]);
 		// 判断是不是可以参与
 		if( $data['tag_scope'] )		{
 			// 解析数组
 			$data['tag_scope']			= explode(',',$data['tag_scope']);
 			// 查询用户标签
 			$tags						= $WeiBanTags->getListByWeibanExtid($custom['weiban_extid']);
-			// 标签范围限定时,默认不能参与
-			$data['allow_join'] 		= 0;
-			// 判断标签是不是存在
-			foreach ($tags as $value) 	{
-				// 标签范围内,允许参加
-				if( in_array($value['name'],$data['tag_scope']) )  $data['allow_join'] = 1;
+			// 获取用户的标签
+			$tags 						= array_column($tags,'name');
+			$intersect					= count(array_intersect($data['tag_scope'],$tags));
+			// 判断标签是否必须同时满足
+			if( $data['tag_scope_type'] == 1  )	{
+				// 判断用户的标签是否全部满足于标签限制范围内
+				if( $intersect != count($data['tag_scope']) ) 	return json_send(['code'=>'error','msg'=>'账号不在标签范围','data'=>['error'=>'不在标签范围内']]);
+			}else{
+				// 判断标签限制并且不在标签限制范围内,不允许参加
+				if( !$intersect ) 		return json_send(['code'=>'error','msg'=>'账号不在标签范围','data'=>['error'=>'不在标签范围内']]);
 			}
-			// 如果不能参与
-			if( !$data['allow_join'] )	return json_send(['code'=>'error','msg'=>'账号不在标签范围','data'=>['error'=>'不在标签范围内']]);
-		}
-		// 判断是不是可以参与
-		if( $data['city_ids'] )			{
-			// 解析数组
-			$data['city_ids']			= explode(',',$data['city_ids']);
-			// 如果不在城市范围
-			if( !in_array($custom['city_id'],$data['city_ids']) ) $data['allow_join'] = 0;
-			// 如果不能参与
-			if( !$data['allow_join'] )	return json_send(['code'=>'error','msg'=>'账号不在活动城市','data'=>['error'=>'账号不在活动城市']]);
 		}
+		// 默认可以参加活动
+		$data['allow_join']				= 1;
 		// 奖品
 		$reward 						= $RecruitmentReward->getListByLottery($data['id']);
 		// 活动暂无奖品
 		if( !$reward )					return json_send(['code'=>'error','msg'=>'活动暂未配置奖品','data'=>$data]);
+		// 查询条件
+		$map							= [];
+		// 判断周期
+		if( !empty($data['freq']) )		{
+			if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->addMinutes(-10)->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+			// if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->startOfDay()->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+			if( $data['freq'] == 2 )	$map = [['insert_time','>=',now()->startOfWeek()->getTimestamp()],['insert_time','<=',now()->endOfWeek()->getTimestamp()]];
+			if( $data['freq'] == 3 )	$map = [['insert_time','>=',now()->startOfMonth()->getTimestamp()],['insert_time','<=',now()->endOfMonth()->getTimestamp()]];
+		}
 		// logo
 		$data['logo']					= $data['logo'] ? path_compat($data['logo']) : '';
+		// 查询用户已参与次数
+        $data['join_num']				= (int)$RecruitmentRecord->query()->where([['custom_uid','=',$uid],['lottery_id','=',$id]])->where($map)->count();
+        // 计算剩余次数
+        $data['number']					= $data['lucky_num'] - $data['join_num'];
+		// 最少为0,避免显示异常
+		$data['number']				    = $data['number'] < 0 ? 0 : $data['number'];
+		// 时间处理
+		$data['start_date']				= date('Y/m/d H:i',$data['start_time']);
+		// 时间处理
+		$data['end_date']				= date('Y/m/d H:i',$data['end_time']);
 		// 通过活动ID,查询奖品
 		$data['reward_list']			= [];
 		// 奖品数据
@@ -80,14 +95,6 @@ class Recruitment extends Api{
 			// 奖项
 			$data['reward_list'][]		= ['id'=>$value['id'],'name'=>$value['reward_name'],'img'=>$value['reward_thumb'],'reward_type'=>$value['reward_type']];
 		}
-		// 查询用户可用抽奖次数
-        $number							= $RecruitmentUsable->query()->where([['custom_uid','=',$uid],['lottery_id','=',$id]])->value('number');
-		// 最少为0,避免显示异常
-		$data['number']				    = $number < 0 ? 0 : $number;
-		// 时间处理
-		$data['start_date']				= date('Y/m/d H:i',$data['start_time']);
-		// 时间处理
-		$data['end_date']				= date('Y/m/d H:i',$data['end_time']);
 		// 返回结果
 		return							json_send(['code'=>'success','msg'=>'获取成功','data'=>$data]);
 	}
@@ -100,56 +107,62 @@ class Recruitment extends Api{
 		// 接口验签
 		// $this->verify_sign();
 		// 检查登录
-		$uid							= $this->checkLogin();
+		$uid								= $this->checkLogin();
 		// 获取活动
-		$lotteryId						= request('lottery_id',0);
+		$lotteryId							= request('lottery_id',0);
 		// 如果存在的话
-		if( !$lotteryId )				return json_send(['code'=>'error','msg'=>'请选择参与的活动','data'=>['error'=>"抽奖活动ID有误"]]);
+		if( !$lotteryId )					return json_send(['code'=>'error','msg'=>'请选择参与的活动','data'=>['error'=>"抽奖活动ID有误"]]);
 		// 获取客户信息
-		$custom							= $Custom->getOne($uid);
+		$custom								= $Custom->getOne($uid);
 		// 如果存在的话
-		if( !$custom )					return json_send(['code'=>'no_login','msg'=>'请登录','data'=>['error'=>'无对应客户']]);
+		if( !$custom )						return json_send(['code'=>'no_login','msg'=>'请登录','data'=>['error'=>'无对应客户']]);
 		// 通过活动ID,查询奖品
-		$data							= $Model->getOne($lotteryId);
+		$data								= $Model->getOne($lotteryId);
 		// 如果存在的话
-		if( !$data )					return json_send(['code'=>'error','msg'=>'活动不存在或未开始','data'=>$data]);
+		if( !$data )						return json_send(['code'=>'error','msg'=>'活动不存在或未开始','data'=>$data]);
 		// 活动时间判断
-		if( $data['start_time'] > time() ) return json_send(['code'=>'error','msg'=>'活动暂未开始','data'=>$data]);
+		if( $data['start_time'] > time() )	return json_send(['code'=>'error','msg'=>'活动暂未开始','data'=>$data]);
 		// 活动时间判断
-		if( $data['end_time'] < time() ) return json_send(['code'=>'error','msg'=>'活动已结束','data'=>$data]);
-		// 默认可以参加活动
-		$data['allow_join']				= 1;
+		if( $data['end_time'] < time() ) 	return json_send(['code'=>'error','msg'=>'活动已结束','data'=>$data]);
+		// 如果客户注册时间不在活动期间
+		if( $data['start_time'] > $custom['insert_time'] || $data['end_time'] < $custom['insert_time'] ) return json_send(['code'=>'error','msg'=>'账号不在活动范围','data'=>['error'=>'不在活动时间内注册']]);
+		// 如果城市限制并且不在在城市范围内,不允许参加
+		if ( $data['city_ids'] && !in_array($custom['city_id'],explode(',',$data['city_ids'])) ) return json_send(['code'=>'error','msg'=>'账号不在城市范围,请核对您的城市','data'=>['error'=>'不在标签范围内']]);
 		// 判断是不是可以参与
 		if( $data['tag_scope'] )		{
 			// 解析数组
 			$data['tag_scope']			= explode(',',$data['tag_scope']);
 			// 查询用户标签
 			$tags						= $WeiBanTags->getListByWeibanExtid($custom['weiban_extid']);
-			// 标签范围限定时,默认不能参与
-			$data['allow_join'] 		= 0;
-			// 判断标签是不是存在
-			foreach ($tags as $value) 	{
-				// 标签范围内,允许参加
-				if( in_array($value['name'],$data['tag_scope']) )  $data['allow_join'] = 1;
+			// 获取用户的标签
+			$tags 						= array_column($tags,'name');
+			$intersect					= count(array_intersect($data['tag_scope'],$tags));
+			// 判断标签是否必须同时满足
+			if( $data['tag_scope_type'] == 1  )	{
+				// 判断用户的标签是否全部满足于标签限制范围内
+				if( $intersect != count($data['tag_scope']) ) 	return json_send(['code'=>'error','msg'=>'账号不在标签范围','data'=>['error'=>'不在标签范围内']]);
+			}else{
+				// 判断标签限制并且不在标签限制范围内,不允许参加
+				if( !$intersect ) 		return json_send(['code'=>'error','msg'=>'账号不在标签范围','data'=>['error'=>'不在标签范围内']]);
 			}
-			// 如果不能参与
-			if( !$data['allow_join'] )	return json_send(['code'=>'error','msg'=>'不符合参与条件','data'=>['error'=>'不符合参与条件']]);
-		}
-		// 判断是不是可以参与
-		if( $data['city_ids'] )			{
-			// 解析数组
-			$data['city_ids']			= explode(',',$data['city_ids']);
-			// 如果不在城市范围
-			if( !in_array($custom['city_id'],$data['city_ids']) ) $data['allow_join'] = 0;
-			// 如果不能参与
-			if( !$data['allow_join'] )	return json_send(['code'=>'error','msg'=>'账号不在活动城市','data'=>['error'=>'账号不在活动城市']]);
 		}
+		// 默认可以参加活动
+		$data['allow_join']				= 1;
 		// 奖品
 		$reward 						= $RecruitmentReward->getListByLottery($data['id']);
 		// 活动暂无奖品
 		if( !$reward )					return json_send(['code'=>'error','msg'=>'活动暂未配置奖品','data'=>$data]);
+		// 查询条件
+		$map							= [];
+		// 判断周期
+		if( !empty($data['freq']) )		{
+			if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->addMinutes(-10)->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+			// if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->startOfDay()->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
+			if( $data['freq'] == 2 )	$map = [['insert_time','>=',now()->startOfWeek()->getTimestamp()],['insert_time','<=',now()->endOfWeek()->getTimestamp()]];
+			if( $data['freq'] == 3 )	$map = [['insert_time','>=',now()->startOfMonth()->getTimestamp()],['insert_time','<=',now()->endOfMonth()->getTimestamp()]];
+		}
         // 查询用户已参与次数
-        $data['join_num']				= (int)$RecruitmentRecord->query()->where([['custom_uid','=',$uid],['lottery_id','=',$lotteryId]])->count();
+        $data['join_num']				= (int)$RecruitmentRecord->query()->where([['custom_uid','=',$uid],['lottery_id','=',$lotteryId]])->where($map)->count();
         // 计算剩余次数
         $data['join_num']				= $data['lucky_num'] - $data['join_num'];
 		// 如果次数不够
@@ -159,14 +172,6 @@ class Recruitment extends Api{
 		// 开启事务
 		DB::beginTransaction();
 		try{
-			// 查询条件
-			$map							= [];
-			// 判断周期
-			if( !empty($data['freq']) )		{
-				if( $data['freq'] == 1 )	$map = [['insert_time','>=',now()->startOfDay()->getTimestamp()],['insert_time','<=',now()->endOfDay()->getTimestamp()]];
-				if( $data['freq'] == 2 )	$map = [['insert_time','>=',now()->startOfWeek()->getTimestamp()],['insert_time','<=',now()->endOfWeek()->getTimestamp()]];
-				if( $data['freq'] == 3 )	$map = [['insert_time','>=',now()->startOfMonth()->getTimestamp()],['insert_time','<=',now()->endOfMonth()->getTimestamp()]];
-			}
 			// 是否限制中奖次数字段,没有默认中奖一次
 			$data['max_reward']				= isset($data['max_reward']) ? 1 : $data['max_reward'];
 			// 限制中奖则获取中奖次数
@@ -230,7 +235,7 @@ class Recruitment extends Api{
 			// 写入记录
 			$result 						= $RecruitmentRecord->add($record);
 			// 写入失败
-			if( !$result	)				{
+			if( !$result )					{
 				// 回退数据
 				DB::rollBack();
 				// 提示

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

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

+ 24 - 17
resources/views/admin/lottery_recruitment/add.blade.php

@@ -13,19 +13,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<input type="hidden" name="logo" value="" id="input-logo" />
 		</div>
 	</div>
-	<div class="form-group col-sm-4">
+	<div class="form-group col-sm-2">
 		<label class="control-label">活动名称</label>
 		<input class="form-control" required="required" type="text" placeholder="活动名称" name="name" maxlength="45" value="" />
 	</div>
-	<div class="form-group col-sm-3">
+	<div class="form-group col-sm-2">
 		<label class="control-label">开始时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
 	</div>
-	<div class="form-group col-sm-3">
+	<div class="form-group col-sm-2">
 		<label class="control-label">结束时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
 	</div>
-	<div class="form-group col-sm-4">
+	<div class="form-group col-sm-2">
 		<label class="control-label">周期频率</label>
 		<select name="freq" class="form-control" >
 			<option value="0" >活动期间</option>
@@ -34,27 +34,22 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<option value="3" >按月</option>
 		</select>
 	</div>
-	<div class="form-group col-sm-4">
+	<div class="form-group col-sm-2">
 		<label class="control-label">抽奖次数</label>
 		<input class="form-control" required="required" type="number" placeholder="抽奖次数" name="lucky_num" min="1" value="1" />
 	</div>
-	<div class="form-group col-sm-4">
+	<div class="form-group col-sm-2">
 		<label class="control-label">中奖次数</label>
 		<input class="form-control" required="required" type="number" placeholder="中奖次数,0不限制" name="max_reward"  value="1" />
 	</div>
-	<div class="form-group col-sm-5">
-		<label class="control-label">活动城市</label>
-		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
-			@foreach ($cityList as $group)
-			<optgroup label="{{$group['name']}}">
-				@foreach ($group['city'] as $city)
-				<option value="{{$city['id']}}" >{{$city['name']}}</option>
-				@endforeach
-			</optgroup>
-			@endforeach
+	<div class="form-group col-sm-2">
+		<label class="control-label">范围类型</label>
+		<select name="tag_scope_type" class="form-control" >
+			<option value="0" >或</option>
+			<option value="1" >且</option>
 		</select>
 	</div>
-	<div class="form-group col-sm-5">
+	<div class="form-group col-sm-3">
 		<label class="control-label">标签范围(标签存在延迟,请慎用)</label>
 		<select name="tag_scope[]" class="form-control selectpicker" data-max-options="10" data-live-search="true" data-live-search-placeholder="搜索标签" data-none-results-text="未搜索到 {0}" title="选择标签" multiple>
 			@foreach ($tagList as $group=>$tags)
@@ -66,6 +61,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">活动城市</label>
+		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
+			@foreach ($cityList as $group)
+			<optgroup label="{{$group['name']}}">
+				@foreach ($group['city'] as $city)
+				<option value="{{$city['id']}}" >{{$city['name']}}</option>
+				@endforeach
+			</optgroup>
+			@endforeach
+		</select>
+	</div>
 	<div class="form-group col-sm-12">
 		<label class="control-label">活动规则</label>
 		<textarea class="form-control" name="rule" rows="10" placeholder="请输入活动规则" ></textarea>

+ 18 - 11
resources/views/admin/lottery_recruitment/edit.blade.php

@@ -42,19 +42,14 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">中奖次数</label>
 		<input class="form-control" required="required" type="number" placeholder="中奖次数,0不限制" name="max_reward"  value="{{$oldData['max_reward']}}" />
 	</div>
-	<div class="form-group col-sm-4">
-		<label class="control-label">活动城市</label>
-		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
-			@foreach ($cityList as $group)
-			<optgroup label="{{$group['name']}}">
-				@foreach ($group['city'] as $city)
-				<option value="{{$city['id']}}"  @if(in_array($city['id'],$oldData['city_ids'])) selected @endif >{{$city['name']}}</option>
-				@endforeach
-			</optgroup>
-			@endforeach
+	<div class="form-group col-sm-2">
+		<label class="control-label">范围类型</label>
+		<select name="tag_scope_type" class="form-control" >
+			<option value="0"  @if( $oldData['tag_scope_type'] == 0 ) selected @endif >或</option>
+			<option value="1"  @if( $oldData['tag_scope_type'] == 1 ) selected @endif >且</option>
 		</select>
 	</div>
-	<div class="form-group col-sm-4">
+	<div class="form-group col-sm-3">
 		<label class="control-label">标签范围(标签存在延迟,请慎用)</label>
 		<select name="tag_scope[]" class="form-control selectpicker" data-max-options="10" data-live-search="true" data-live-search-placeholder="搜索标签" data-none-results-text="未搜索到 {0}" title="选择标签" multiple>
 			@foreach ($tagList as $group=>$tags)
@@ -66,6 +61,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">活动城市</label>
+		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
+			@foreach ($cityList as $group)
+			<optgroup label="{{$group['name']}}">
+				@foreach ($group['city'] as $city)
+				<option value="{{$city['id']}}"  @if(in_array($city['id'],$oldData['city_ids'])) selected @endif >{{$city['name']}}</option>
+				@endforeach
+			</optgroup>
+			@endforeach
+		</select>
+	</div>
 	<div class="form-group col-sm-12">
 		<label class="control-label">活动规则</label>
 		<textarea class="form-control" name="rule" rows="10" placeholder="请输入活动规则" >{{$oldData['rule']}}</textarea>

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

@@ -58,7 +58,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									@endif
 								@endif
 							</td>
-							<td>/pages/activity/lottery?id={{$a['id']}}</td>
+							<td>/pages/recruitment/lottery?id={{$a['id']}}</td>
 							<td>{{$a['mp_urllink']}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 							<td>