Пример #1
0
 /**
  * ajax返回提示应付金额或是否允许操作
  */
 public function action_ajax()
 {
     $info = explode(',', base64_decode(trim($this->getQuery('t'))));
     $upgrade = new Upgrade($this->auth, $info[0], $info[1]);
     $payPrice = $upgrade->calculate()->getMoney();
     // 订单金额
     $getGroupPrice = $upgrade->getGroupPrice();
     // 订单金额
     if ($payPrice < 1) {
         echo '<span style="color:#FF7E00;">无法升级';
     } else {
         echo "应付:<span style=\"color:#FF7E00;\">" . $payPrice . "</span>元";
     }
     $this->auto_render = false;
 }
Пример #2
0
 /**
  * 计算升级用户所需费用
  */
 public function action_fee()
 {
     $uid = (int) $this->getQuery('uid');
     $groupId = (int) $this->getQuery('group');
     $time = (int) $this->getQuery('time');
     $status = (int) $this->getQuery('status');
     if ($status) {
         $time = $time * 12;
     }
     $userInfo = DB::select()->from('users')->where('uid', '=', $uid)->execute()->current();
     $upgrade = new Upgrade($userInfo, $groupId, $time);
     $payPrice = $upgrade->calculate()->getMoney();
     // 订单金额
     echo json_encode(array('price' => ceil($payPrice)));
     $this->auto_render = false;
 }