Compare commits
No commits in common. "504c48c71cdddd95be5c35251c287c9e34be9a03" and "4d0e9951a493820f7f6aa2c6a2fad32bee09fc10" have entirely different histories.
504c48c71c
...
4d0e9951a4
|
@ -133,14 +133,11 @@ class Consumer extends Base
|
||||||
$item->couponName = $item->name;
|
$item->couponName = $item->name;
|
||||||
|
|
||||||
//到期状态 到期前7天!!!!!!!!没做完
|
//到期状态 到期前7天!!!!!!!!没做完
|
||||||
$weekTime = 7 * 86400;
|
// $weekTIme = 7 * 86400;
|
||||||
$endTime = strtotime($item->end_time);
|
// $endTime = strtotime($item->end_time);
|
||||||
if (($endTime - $time) < $weekTime) {
|
// if ($endTime > ($time - $weekTIme) && $endTime < $time) {
|
||||||
$ExpirationTime = ($endTime - $time) / 86400;
|
// $item->couponName
|
||||||
$item->ExpirationTime = ceil($ExpirationTime);
|
// }
|
||||||
} else {
|
|
||||||
$item->ExpirationTime = 0;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->json(0, 'success', $res);
|
return $this->json(0, 'success', $res);
|
||||||
|
|
|
@ -54,12 +54,9 @@ class Coupon extends Base
|
||||||
$fields = [
|
$fields = [
|
||||||
'id',
|
'id',
|
||||||
'is_verificated as isVerificated',
|
'is_verificated as isVerificated',
|
||||||
'type_name',
|
|
||||||
'money',
|
'money',
|
||||||
'name as couponName',
|
'name as couponName',
|
||||||
'business_code',
|
|
||||||
'business_code as businessCode',
|
'business_code as businessCode',
|
||||||
'coupon_id',
|
|
||||||
'end_time as endTime',
|
'end_time as endTime',
|
||||||
'consumer_name as consumerName',
|
'consumer_name as consumerName',
|
||||||
'verificate_time as verificateTime',
|
'verificate_time as verificateTime',
|
||||||
|
@ -89,16 +86,13 @@ class Coupon extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){
|
$res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){
|
||||||
return $q->with(["couponMain","scoreModel","business"]);
|
return $q->with(["couponMain","scoreModel"]);
|
||||||
}, $sortOrder);
|
}, $sortOrder);
|
||||||
$time = time();
|
|
||||||
$res['list'] ->each(function ($item) use($time){
|
$res['list'] ->each(function ($item){
|
||||||
//重置优惠券名称
|
//重置优惠券名称
|
||||||
if(isset($item->couponMain) && $item->couponMain){
|
if(isset($item->couponMain) && $item->couponMain){
|
||||||
$item->couponName = $item->couponMain->name;
|
$item->couponName = $item->couponMain->name;
|
||||||
$item->image_url = $item->couponMain->image_url;
|
|
||||||
}else{
|
|
||||||
$item->image_url = '';
|
|
||||||
}
|
}
|
||||||
//是否已经打分过了
|
//是否已经打分过了
|
||||||
if(isset($item->scoreModel) && $item->scoreModel){
|
if(isset($item->scoreModel) && $item->scoreModel){
|
||||||
|
@ -109,33 +103,6 @@ class Coupon extends Base
|
||||||
$item->score = Score::COMMON_OFF;
|
$item->score = Score::COMMON_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//到期状态
|
|
||||||
$expirationStr = '';
|
|
||||||
$endTime = strtotime($item->endTime);
|
|
||||||
$ExpirationTime = abs(($endTime - $time) / 86400);
|
|
||||||
if (($endTime > $time) ) {
|
|
||||||
$expirationStr = ceil($ExpirationTime)."天后到期";
|
|
||||||
} else {
|
|
||||||
$expirationStr = "到期" . ceil($ExpirationTime) . "天";
|
|
||||||
}
|
|
||||||
$item->expirationStr =$expirationStr;
|
|
||||||
|
|
||||||
|
|
||||||
//商家简称
|
|
||||||
if(!empty($item->business)){
|
|
||||||
$item->business_subtitle = $item->business->business_subtitle;
|
|
||||||
}else{
|
|
||||||
$item->business_subtitle = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
//图片
|
|
||||||
if(!empty($item->business)){
|
|
||||||
$item->business_subtitle = $item->business->business_subtitle;
|
|
||||||
}else{
|
|
||||||
$item->business_subtitle = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$res['list'] = multiTwoArrayKeysExcludeFilter($res['list']->toArray(), ['sort_weight']);
|
$res['list'] = multiTwoArrayKeysExcludeFilter($res['list']->toArray(), ['sort_weight']);
|
||||||
|
|
|
@ -3,7 +3,6 @@ namespace app\middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use app\service\Jwt as JwtService;
|
use app\service\Jwt as JwtService;
|
||||||
use think\facade\Request;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API登录认证(需要先调用JWT解析用户信息)
|
* API登录认证(需要先调用JWT解析用户信息)
|
||||||
|
@ -13,11 +12,9 @@ use think\facade\Request;
|
||||||
class ApiLogin
|
class ApiLogin
|
||||||
{
|
{
|
||||||
public function handle($request, Closure $next) {
|
public function handle($request, Closure $next) {
|
||||||
|
|
||||||
$authorization = $request->authorization ?? '';
|
$authorization = $request->authorization ?? '';
|
||||||
|
|
||||||
if (empty($authorization)) {
|
if (empty($authorization)) {
|
||||||
return json(['code' => 6001, 'msg' => '登陆失效']);
|
return json(['code' => 6001, 'msg' => '请填写token']);
|
||||||
}
|
}
|
||||||
if (!JwtService::validate($authorization)) {
|
if (!JwtService::validate($authorization)) {
|
||||||
return json(['code' => 6001, 'msg' => 'token验证失败或已失效']);
|
return json(['code' => 6001, 'msg' => 'token验证失败或已失效']);
|
||||||
|
|
|
@ -6,6 +6,4 @@
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC]
|
RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC]
|
||||||
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
|
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
|
||||||
#增加如下内容
|
|
||||||
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
|
|
||||||
</IfModule>
|
</IfModule>
|
Loading…
Reference in New Issue