作者 刘朕

用户会员接口优化

... ... @@ -286,8 +286,11 @@ class User extends Api
{
$UserId = $this->IsToken();
$VipInfo = Db::name('user')->where('id', $UserId)->field('vip,exp_time')->find();
if ($VipInfo['vip'] == 0)/*非会员*/ $data = ['vip' => $VipInfo['vip'], 'List' => Db::name('vip')->select()];
else/*会员*/ $data = ['vip' => $VipInfo['vip'], 'exp_time' => ($VipInfo['vip'] == 3) ? '*' : date('Y-m-d H:i:s', $VipInfo['exp_time']), 'days' => ($VipInfo['vip'] == 3) ? '*' : floor(($VipInfo['exp_time'] - time()) / 86400), 'content' => Db::name('vip')->where('id', $VipInfo['vip'])->value('content')];
if ($VipInfo['vip'] == 0)/*非会员*/ {
$data = ['vip' => $VipInfo['vip'], 'List' => Db::name('vip')->select()];
} else/*会员*/ {
$data = ['vip' => $VipInfo['vip'], 'exp_time' => ($VipInfo['vip'] == 3) ? '*' : date('Y-m-d H:i:s', $VipInfo['exp_time']), 'days' => ($VipInfo['vip'] == 3) ? '*' : floor(($VipInfo['exp_time'] - time()) / 86400), 'content' => Db::name('vip')->where('id', $VipInfo['vip'])->value('content'), 'List' => Db::name('vip')->select()];
}
$this->success('成功', $data);
}
... ...