public function actionGetTotal($ridString)
 {
     $uid = Yii::app()->user->id;
     $curUser = User::Model()->findByPk($uid);
     $userType = $curUser->type;
     $ridStrArray = explode(".", $ridString);
     $count = count($ridStrArray);
     $ridArray = array();
     $resArray = array();
     $productArray = array();
     $total = 0;
     $newTotal = 0;
     for ($i = 0; $i < $count; $i++) {
         $ridArray[] = (int) $ridStrArray[$i];
         $resArray[] = Res::Model()->findByPk($ridArray[$i]);
         $productArray[] = Product::Model()->findByPk($resArray[$i]->pid);
         $total = $total + $productArray[$i]->price * $resArray[$i]->amount;
     }
     switch ($userType) {
         case 1:
             $newTotal = $total * 0.9;
             break;
         case 2:
             $newTotal = $total * 0.85;
             break;
         case 3:
             $newTotal = $total * 0.75;
             break;
         default:
             $newTotal = $total;
             break;
     }
     $totalArray = array("total" => $newTotal, "type" => $userType, "former" => $total);
     echo json_encode($totalArray);
 }