소스 검색

【Add】后台:积分抽奖,增加内部跳转链接、宣发链接

liuxiangxin 3 달 전
부모
커밋
7cd2ce7881
3개의 변경된 파일26개의 추가작업 그리고 1개의 파일을 삭제
  1. 0 1
      app/Http/Controllers/Admin/LotteryOrder.php
  2. 22 0
      app/Http/Controllers/Admin/LotteryScore.php
  3. 4 0
      resources/views/admin/lottery_score/index.blade.php

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

@@ -6,7 +6,6 @@ use App\Models\Lottery\Order as Model;
 use App\Models\City;
 use App\Models\Lottery\OrderReward;
 use App\Models\WeiBan\Tags as WeiBanTags;
-use Illuminate\Support\Facades\DB;
 use Intervention\Image\Facades\Image;
 
 /**

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

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

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

@@ -28,6 +28,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>活动名称</th>
 						<th>开始时间</th>
 						<th>结束时间</th>
+						<th>内部链接</th>
+						<th>宣发链接</th>
 						<th>活动状态</th>
 						<th>修改时间</th>
 						<th>操作</th>									
@@ -41,6 +43,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td>{{$a['name']}}</td>
 							<td>{{date('Y/m/d H:i:s',$a['start_time'])}}</td>
 							<td>{{date('Y/m/d H:i:s',$a['end_time'])}}</td>
+							<td>/pages/score/lottery?id={{$a['id']}}</td>
+							<td>{{$a['mp_urllink']}}</td>
 							<td>
 								@if( $a['status'] )
 								停用