...
|
...
|
@@ -559,16 +559,20 @@ class Member extends Frontend |
|
|
$vipdesc_model = new Vipdesc();
|
|
|
$price = $price_model->where('id',1)->find();
|
|
|
$vipdesc = $vipdesc_model->where('id',1)->find();
|
|
|
//折合svip价格
|
|
|
$user_province = Db::name('user_province')->where(['user_id'=>$this->auth->id,'expiration_time'=>['gt',time()]])->select();
|
|
|
$deduct_price = [];
|
|
|
$ratio_price = $price['vipprice']/(365);
|
|
|
foreach($user_province as $key => $u_p){
|
|
|
$ratio_day = ($u_p['expiration_time']-time())/(24*60*60);
|
|
|
$deduct_price[] = $ratio_price*$ratio_day;
|
|
|
$userModel = new \app\index\model\User();
|
|
|
$user = $userModel->findData(['id'=>$this->auth->id]);
|
|
|
if($user['svip_passtime'] < time()){
|
|
|
//折合svip价格
|
|
|
$user_province = Db::name('user_province')->where(['user_id'=>$this->auth->id,'expiration_time'=>['gt',time()]])->select();
|
|
|
$deduct_price = [];
|
|
|
$ratio_price = $price['vipprice']/(365);
|
|
|
foreach($user_province as $key => $u_p){
|
|
|
$ratio_day = ($u_p['expiration_time']-time())/(24*60*60);
|
|
|
$deduct_price[] = $ratio_price*$ratio_day;
|
|
|
}
|
|
|
$svipprice = ($price['svipprice']-array_sum($deduct_price)) <= 0 ? 0 : ($price['svipprice']-array_sum($deduct_price));
|
|
|
$price['svipprice'] = round($svipprice,2);
|
|
|
}
|
|
|
$svipprice = ($price['svipprice']-array_sum($deduct_price)) <= 0 ? 0 : ($price['svipprice']-array_sum($deduct_price));
|
|
|
$price['svipprice'] = round($svipprice,2);
|
|
|
$this->assign('price',$price);
|
|
|
$this->view->assign('price',$price);
|
|
|
$this->view->assign('vipdesc',$vipdesc);
|
...
|
...
|
|