|
@@ -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;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|