Compare commits

..

No commits in common. "504c48c71cdddd95be5c35251c287c9e34be9a03" and "4d0e9951a493820f7f6aa2c6a2fad32bee09fc10" have entirely different histories.

4 changed files with 9 additions and 50 deletions

View File

@ -133,14 +133,11 @@ class Consumer extends Base
$item->couponName = $item->name;
//到期状态 到期前7天!!!!!!!!没做完
$weekTime = 7 * 86400;
$endTime = strtotime($item->end_time);
if (($endTime - $time) < $weekTime) {
$ExpirationTime = ($endTime - $time) / 86400;
$item->ExpirationTime = ceil($ExpirationTime);
} else {
$item->ExpirationTime = 0;
}
// $weekTIme = 7 * 86400;
// $endTime = strtotime($item->end_time);
// if ($endTime > ($time - $weekTIme) && $endTime < $time) {
// $item->couponName
// }
});
return $this->json(0, 'success', $res);

View File

@ -54,12 +54,9 @@ class Coupon extends Base
$fields = [
'id',
'is_verificated as isVerificated',
'type_name',
'money',
'name as couponName',
'business_code',
'business_code as businessCode',
'coupon_id',
'end_time as endTime',
'consumer_name as consumerName',
'verificate_time as verificateTime',
@ -89,16 +86,13 @@ class Coupon extends Base
}
$res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){
return $q->with(["couponMain","scoreModel","business"]);
return $q->with(["couponMain","scoreModel"]);
}, $sortOrder);
$time = time();
$res['list'] ->each(function ($item) use($time){
$res['list'] ->each(function ($item){
//重置优惠券名称
if(isset($item->couponMain) && $item->couponMain){
$item->couponName = $item->couponMain->name;
$item->image_url = $item->couponMain->image_url;
}else{
$item->image_url = '';
}
//是否已经打分过了
if(isset($item->scoreModel) && $item->scoreModel){
@ -109,33 +103,6 @@ class Coupon extends Base
$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']);

View File

@ -3,7 +3,6 @@ namespace app\middleware;
use Closure;
use app\service\Jwt as JwtService;
use think\facade\Request;
/**
* API登录认证需要先调用JWT解析用户信息
@ -13,11 +12,9 @@ use think\facade\Request;
class ApiLogin
{
public function handle($request, Closure $next) {
$authorization = $request->authorization ?? '';
if (empty($authorization)) {
return json(['code' => 6001, 'msg' => '登陆失效']);
return json(['code' => 6001, 'msg' => '请填写token']);
}
if (!JwtService::validate($authorization)) {
return json(['code' => 6001, 'msg' => 'token验证失败或已失效']);

View File

@ -6,6 +6,4 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC]
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
#增加如下内容
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>