作者 王晓刚
1 个管道 的构建 通过 耗费 0 秒

修改问题文档

@@ -559,6 +559,17 @@ class Member extends Frontend @@ -559,6 +559,17 @@ class Member extends Frontend
559 $vipdesc_model = new Vipdesc(); 559 $vipdesc_model = new Vipdesc();
560 $price = $price_model->where('id',1)->find(); 560 $price = $price_model->where('id',1)->find();
561 $vipdesc = $vipdesc_model->where('id',1)->find(); 561 $vipdesc = $vipdesc_model->where('id',1)->find();
  562 + //折合svip价格
  563 + $user_province = Db::name('user_province')->where(['user_id'=>$this->auth->id,'expiration_time'=>['gt',time()]])->select();
  564 + $deduct_price = [];
  565 + $ratio_price = $price['vipprice']/(365);
  566 + foreach($user_province as $key => $u_p){
  567 + $ratio_day = ($u_p['expiration_time']-time())/(24*60*60);
  568 + $deduct_price[] = $ratio_price*$ratio_day;
  569 + }
  570 + $svipprice = ($price['svipprice']-array_sum($deduct_price)) <= 0 ? 0 : ($price['svipprice']-array_sum($deduct_price));
  571 + $price['svipprice'] = round($svipprice,2);
  572 + $this->assign('price',$price);
562 $this->view->assign('price',$price); 573 $this->view->assign('price',$price);
563 $this->view->assign('vipdesc',$vipdesc); 574 $this->view->assign('vipdesc',$vipdesc);
564 return $this->view->fetch(); 575 return $this->view->fetch();