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; }
public function Delete() { $AgentPriceID = $this->_GET['AgentPriceID']; $Page = _intval($this->_GET['Page']); $AgentPriceModule = new AgentPriceModule(); if ($AgentPriceModule->DeleteInfoByKeyID($AgentPriceID)) { $this->__Message('已完成删除操作!', UrlRewriteSimple($this->MyModule, 'Lists', true) . '&Page=' . $Page, '继续操作'); } else { $this->__Message('删除失败,请再一次尝试!'); } }
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; }
public function Edit() { if ($this->_POST) { //提交修改 $AgentID = _intval($this->_POST['AgentID']); $Data['PassWord'] = trim($this->_POST['PassWord']); if ($Data['PassWord'] != '') { $Data['PassWord'] = md5($Data['PassWord']); } else { unset($Data['PassWord']); } $Data['EnterpriseName'] = trim($this->_POST['EnterpriseName']); $Data['ContactName'] = trim($this->_POST['ContactName']); $Data['ContactTel'] = trim($this->_POST['ContactTel']); $Data['ContactEmail'] = trim($this->_POST['ContactEmail']); $Data['ContactAddress'] = trim($this->_POST['ContactAddress']); $Data['Remarks'] = trim($this->_POST['Remarks']); $Data['FengXinAgentPriceID'] = trim($this->_POST['FengXinAgentPriceID']); $Data['GBaoPenAgentPriceID'] = trim($this->_POST['GBaoPenAgentPriceID']); $Page = _intval($this->_POST['Page']); if ($Data['EnterpriseName'] == '' || $Data['ContactName'] == '' || $Data['ContactTel'] == '') { $this->__Message('信息填写不完整!'); } $AgentModule = new AgentModule(); if ($AgentModule->UpdateArrayByKeyID($Data, $AgentID)) { $this->__Message('修改代理商成功!', UrlRewriteSimple($this->MyModule, 'Lists', true) . '&Page=' . $Page, '继续操作'); } else { $this->__Message('修改代理商失败,请再一次尝试!'); } } if ($this->_GET) { //获取用户信息 $this->AgentID = _intval($this->_GET['AgentID']); $this->Page = _intval($this->_GET['Page']); $AgentModule = new AgentModule(); $AgentInfo = $AgentModule->GetOneInfoByKeyID($this->AgentID); $this->AgentInfo = $AgentInfo; include 'Include/LevelArray.php'; $AgentPriceModule = new AgentPriceModule(); //风信代理 $LevelArray = $AgentPriceModule->GetLists('where ProjectID=7'); $this->LevelArray = $LevelArray; //G宝盆代理 $GBaoPenLevelArray = $AgentPriceModule->GetLists('where ProjectID=1'); $this->GBaoPenLevelArray = $GBaoPenLevelArray; } }