示例#1
0
 public function GetRenewals($CustomersProjectID = 0, $Year = 1)
 {
     //获取G宝盆项目id
     $ProjectId = TONGYI_ID;
     $CustProModule = new CustProModule();
     $PropertyModule = new PropertyModule();
     $AgentModule = new AgentModule();
     $where = "Where CustomersProjectID={$CustomersProjectID} and AgentID={$_SESSION['AgentID']} and ProjectId={$ProjectId}";
     $CustProInfo = $CustProModule->GetLists($where);
     $EndTime = $CustProInfo[0]['EndTime'];
     $GongNeng = $CustProInfo[0]['GongNeng'];
     $NowTime = Date('Y');
     if (Date('Y', $EndTime) - $NowTime > 10) {
         die('达最高上限年限');
     }
     //获取当前代理的G宝盆等级
     $Agentinfo = $AgentModule->GetOneInfoByKeyID($_SESSION['AgentID']);
     $LevelID['AgentPriceID'] = $Agentinfo['GBaoPenAgentPriceID'];
     //获取该等级的折扣
     $AgentPriceModule = new AgentPriceModule();
     $AgentPriceinfo = $AgentPriceModule->GetOneInfoByArrayKeys($LevelID);
     $AgenDiscount = $AgentPriceinfo['AgenDiscount'];
     //获取该功能的价格
     $Propertyinfo = $PropertyModule->GetProjectPropertyLists("where ProjectID={$ProjectId} and ProjectPropertyID={$GongNeng}");
     $MarketPrice = $Propertyinfo[0]['MarketPrice'];
     $StandardCost = ceil($MarketPrice * $AgenDiscount * $Year);
     $data['newEndTime'] = date('Y-m-d', strtotime("{$EndTime}+ {$Year} years"));
     $data['StandardCost'] = $StandardCost;
     $data['AgenDiscount'] = $AgentPriceinfo['AgenDiscount'];
     return $data;
 }
示例#2
0
 public function showRenewalscost()
 {
     $json = stripcslashes($this->_GET['cost']);
     $data = json_decode($json, TRUE);
     $CustomersProjectID = $data['CustoProID'];
     $versiontime = $data['version'];
     unset($data['CustoProID']);
     unset($data['version']);
     $where = "where CustomersProjectID={$CustomersProjectID}";
     //获取风信项目id
     $ProjectId = FENGXIN_ID;
     $where .= " and ProjectID={$ProjectId} and AgentID={$_SESSION['AgentID']}";
     $AgentModule = new AgentModule();
     $CustFuwuModule = new CustFuwuModule();
     $FuWuModule = new FuWuModule();
     //获取当前代理的等级
     $Agentinfo = $AgentModule->GetOneInfoByKeyID($_SESSION['AgentID']);
     $LevelID['AgentPriceID'] = $Agentinfo['FengXinAgentPriceID'];
     //获取该等级的折扣
     $AgentPriceModule = new AgentPriceModule();
     $CustProModule = new CustProModule();
     $AgentPriceinfo = $AgentPriceModule->GetOneInfoByArrayKeys($LevelID);
     $AgenDiscount = $AgentPriceinfo['AgenDiscount'];
     $CustProInfo = $CustProModule->GetInfoByWhere($where);
     if (!empty($CustProInfo)) {
         $cost = 0;
         $Endtime = date('Y-m-d', strtotime($CustProInfo['EndTime']));
         $PropertyModule = new PropertyModule();
         $PropertyInfo = $PropertyModule->GetOneInfoByKeyID($CustProInfo['GongNeng']);
         $MarketPrice = $PropertyInfo['MarketPrice'];
         if (strtotime($Endtime) < strtotime(date('Y-m-d'))) {
             $cost = (strtotime($versiontime) - strtotime(date('Y-m-d'))) / (3600 * 24) * $MarketPrice * $AgenDiscount / 365;
         } else {
             $cost = (strtotime($versiontime) - strtotime($Endtime)) / (3600 * 24) * $MarketPrice * $AgenDiscount / 365;
         }
         foreach ($data as $k => $v) {
             $FuWuInfo = $FuWuModule->GetOneInfoByKeyID($k);
             $FuWuPrice = $FuWuInfo['FuWuPrice'];
             $sql = "where CustomersProjectID={$CustomersProjectID} and FuWuID={$k}";
             $CustFuwuInfo = $CustFuwuModule->GetInfoByWhere($sql);
             //dd($CustFuwuInfo);
             $FuwuEndTime = date('Y-m-d', strtotime($CustFuwuInfo['EndTime']));
             if (strtotime($FuwuEndTime) < strtotime(date('Y-m-d'))) {
                 $cost += (strtotime($v) - strtotime(date('Y-m-d'))) / (3600 * 24) * $FuWuPrice * $AgenDiscount / 365;
             } else {
                 $cost += (strtotime($v) - strtotime($FuwuEndTime)) / (3600 * 24) * $FuWuPrice * $AgenDiscount / 365;
             }
         }
     }
     echo '此次续费将消费金额<span class="red font22">¥:' . round($cost) . '</span>';
     exit;
 }