상속: extends yupe\components\WebModule
예제 #1
0
 public function FinalRenewals()
 {
     $CustomersProjectID = $this->_POST['CustoProID'];
     $Year = $this->_POST['ryear'];
     $LogsFunction = new LogsFunction();
     $CustProModule = new CustProModule();
     $CustProInfo = $CustProModule->GetOneInfoByKeyID($CustomersProjectID);
     //获取项目版本名称
     $vesion = $this->GetGBaoPenVesion($CustProInfo['GongNeng']);
     $CustomersModule = new CustomersModule();
     $CustomersInfo = $CustomersModule->GetOneInfoByKeyID($CustProInfo['CustomersID']);
     //验证项目id是否属于本代理
     if ($CustProInfo['AgentID'] == $_SESSION['AgentID']) {
         $data = $this->GetRenewals($CustomersProjectID, $Year);
         $AgentAccountModule = new AgentAccountModule();
         //获取G宝盆项目id
         $ProjectId = TONGYI_ID;
         $sqlwhere = "where Agentid={$_SESSION['AgentID']} and ProjectID={$ProjectId}";
         $AgentAccountInfo = $AgentAccountModule->GetLists($sqlwhere);
         if ($AgentAccountInfo[0]['Balance'] < $data['StandardCost']) {
             $LogsFunction->logsinfile('115', 4, $CustomersID);
             JsMessage('账户余额不足,请充值!', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
             exit;
         } else {
             $update['EndTime'] = date('Y-m-d H:i:s', strtotime("{$CustProInfo['EndTime']}+{$Year} years"));
             $LogOldEndTime = date('Y-m-d', strtotime($CustProInfo['EndTime']));
             $LogEndTime = date('Y-m-d', strtotime($update['EndTime']));
             $update['UpdateTime'] = date('Y-m-d H:i:s');
             $filter['CustomersProjectID'] = $CustomersProjectID;
             $filter['ProjectID'] = intval($ProjectId);
             $filter['AgentID'] = intval($_SESSION['AgentID']);
             $a = $CustProModule->UpdateArray($update, $filter);
             $sql = "update {$AgentAccountModule->TableName} set Balance=Balance-{$data['StandardCost']} where Agentid={$_SESSION['AgentID']} and ProjectID={$ProjectId}";
             //dd($sql);
             $b = $AgentAccountModule->Update($sql);
             if ($a) {
                 $OrderModule = new OrderModule();
                 $OrderDescriptionModule = new OrderDescriptionModule();
                 $Description['Description'] = $CustomersInfo['CompanyName'] . $vesion . 'G宝盆项目续费成功:原定到期时间' . $LogOldEndTime . '+' . $Year . '年=' . $LogEndTime . ',消费金额¥' . $data['StandardCost'] . '(' . $data['AgenDiscount'] . '折)';
                 $OrderDescriptionModule->InsertArray($Description);
                 $DescriptionID = mysql_insert_id();
                 $Order['OrderNO'] = GetOrderNO();
                 $Order['AgentID'] = $filter['AgentID'];
                 $Order['CustomersID'] = $CustProInfo['CustomersID'];
                 $Order['AddTime'] = $update['UpdateTime'];
                 $Order['FromIP'] = GetIP();
                 $Order['ProjectID'] = $filter['ProjectID'];
                 $Order['DescriptionID'] = $DescriptionID;
                 $Order['Type'] = 0;
                 $Order['Amount'] = $data['StandardCost'];
                 $OrderModule->InsertArray($Order);
                 $LogsFunction->logsinfile('115', 1, $CustomersID, '', $Order['OrderNO']);
                 $Sync = $this->ToGbaoPenEditInfo($CustomersProjectID);
                 if ($Sync) {
                     $LogsFunction->logsinfile('115', 5, $CustomersID, $Description['Description'], $Order['OrderNO']);
                 } else {
                     $LogsFunction->logsinfile('115', 6, $CustomersID, $Description['Description'], $Order['OrderNO']);
                 }
                 JsMessage('续费成功!', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
             } else {
                 $LogsFunction->logsinfile('115', 0, $CustomersID);
                 JsMessage('续费失败!', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
                 exit;
             }
         }
     } else {
         $LogsFunction->logsinfile('115', 3, $CustomersID);
         JsMessage('警告!非法操作...', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
         exit;
     }
 }
예제 #2
0
 public function FinalRenewals()
 {
     $CustomersProjectID = intval($this->_POST['CustoProID']);
     $Year = $this->_POST['ryear'];
     $Across = $this->_POST['across'];
     $Page = _intval($this->_GET['Page']);
     $LogsFunction = new LogsFunction();
     $CustProModule = new CustProModule();
     $where = "where CustomersProjectID={$CustomersProjectID} and AgentID={$_SESSION['AgentID']}";
     $CustProInfo = $CustProModule->GetInfoByWhere($where);
     $time = date('H:i:s');
     $NewEndTime = $Year . ' ' . $time;
     if (empty($CustProInfo)) {
         JsMessage('数据错误或者非法操作!', UrlRewriteSimple('FengXin', 'Customer', true) . '&Page=' . $Page, '继续操作');
     } else {
         $Version = $CustProInfo['GongNeng'];
         $PropertyModule = new PropertyModule();
         $PropertyInfo = $PropertyModule->GetOneInfoByKeyID($Version);
         $MarketPrice = $PropertyInfo['MarketPrice'];
         //获取当前代理的等级
         $AgentModule = new AgentModule();
         $Agentinfo = $AgentModule->GetOneInfoByKeyID($_SESSION['AgentID']);
         $LevelID['AgentPriceID'] = $Agentinfo['FengXinAgentPriceID'];
         //获取该等级的折扣
         $AgentPriceModule = new AgentPriceModule();
         $AgentPriceinfo = $AgentPriceModule->GetOneInfoByArrayKeys($LevelID);
         $AgenDiscount = $AgentPriceinfo['AgenDiscount'];
         $CustomersModule = new CustomersModule();
         $CustomersInfo = $CustomersModule->GetOneInfoByKeyID($CustProInfo['CustomersID']);
         $CustomersID = $CustomersInfo['CustomersID'];
         $OldEndTime = date('Y-m-d', strtotime($CustProInfo['EndTime']));
         $cost = 0;
         $description = '';
         $sql_version = '';
         if (strtotime($Year) > strtotime($OldEndTime)) {
             $sql_version = "update tb_customers_project set EndTime ='{$NewEndTime}' where CustomersProjectID={$CustomersProjectID}";
             $update1 = $CustProModule->UpdateArrayByKeyID($update1, $CustomersProjectID);
             $versioncost = (strtotime($Year) - strtotime($OldEndTime)) / (3600 * 24) * $MarketPrice * $AgenDiscount / 365;
             $cost += $versioncost;
             $description .= '版本约消费¥' . round($versioncost);
         }
         $CustFuwuModule = new CustFuwuModule();
         $mysqlwhere = "where CustomersProjectID={$CustomersProjectID}";
         $CustFuwuInfo = $CustFuwuModule->GetAll($mysqlwhere);
         $FuwuModule = new FuwuModule();
         foreach ($CustFuwuInfo as $v) {
             $FuwuEndTime = date('Y-m-d', strtotime($v['EndTime']));
             $FuwuInfo = $FuwuModule->GetOneInfoByKeyID($v['FuWuID']);
             $FuWuPrice = $FuwuInfo['FuWuPrice'];
             $FuWuName = $FuwuInfo['FuWuName'];
             $filter['FuWuID'] = intval($v['FuWuID']);
             $filter['CustomersProjectID'] = $CustomersProjectID;
             if (strtotime($FuwuEndTime) < strtotime(date('Y-m-d'))) {
                 $FuwuEndTime = date('Y-m-d');
             }
             if (in_array($v['FuWuID'], $Across)) {
                 if (strtotime($Year) > strtotime($FuwuEndTime)) {
                     $sqlfuwu[$FuWuName] = "update tbl_customers_fuwu set EndTime ='{$NewEndTime}' where  FuWuID={$v['FuWuID']} and CustomersProjectID={$CustomersProjectID}";
                     $fuwucost = (strtotime($Year) - strtotime($FuwuEndTime)) / (3600 * 24) * $FuWuPrice * $AgenDiscount / 365;
                     $cost += $fuwucost;
                     $description .= ',' . $FuWuName . '约消费¥' . round($fuwucost);
                 }
             } else {
                 $array_search = array($FuWuName => $FuwuInfo['EndTime']);
                 $seletname = 'upselect' . $v['FuWuID'];
                 $selectEndTime = $this->_POST["{$seletname}"];
                 if (strtotime($selectEndTime) > strtotime($FuwuEndTime)) {
                     $update3['EndTime'] = $selectEndTime . ' ' . $time;
                     $sqlfuwu[$FuWuName] = "update tbl_customers_fuwu set EndTime ='{$update3['EndTime']}' where  FuWuID={$v['FuWuID']} and CustomersProjectID={$CustomersProjectID}";
                     $fuwucost = (strtotime($selectEndTime) - strtotime($FuwuEndTime)) / (3600 * 24) * $FuWuPrice * $AgenDiscount / 365;
                     $cost += $fuwucost;
                     $description .= ',' . $FuWuName . '约消费¥' . round($fuwucost);
                 }
             }
         }
         $cost = round($cost);
         $description .= ',合计消费¥' . $cost;
         //代理扣款
         $AgentAccountModule = new AgentAccountModule();
         $ProjectId = FENGXIN_ID;
         $sqlwhere = "where Agentid={$_SESSION['AgentID']} and ProjectID={$ProjectId}";
         $AgentAccountInfo = $AgentAccountModule->GetLists($sqlwhere);
         if ($AgentAccountInfo[0]['Balance'] < $cost) {
             JsMessage('余额不足!', UrlRewriteSimple('FengXin', 'Customer', true) . '&Page=' . $Page, '继续操作');
         } else {
             $sql = "update {$AgentAccountModule->TableName} set Balance=Balance-{$cost} where Agentid={$_SESSION['AgentID']} and ProjectID={$ProjectId}";
             $b = $AgentAccountModule->Update($sql);
             if ($b) {
                 if ($sql_version == '' || mysql_query($sql_version)) {
                 } else {
                     $description .= '(版本已扣款未延期到' . $Year . ',此次续费需手动操作!)';
                 }
                 foreach ($sqlfuwu as $k => $s) {
                     if (mysql_query($s)) {
                     } else {
                         $description .= '(' . $array_search[$k] . '已扣款未延期到,此次续费需手动操作!)';
                     }
                 }
                 $OrderModule = new OrderModule();
                 $OrderDescriptionModule = new OrderDescriptionModule();
                 $Description['Description'] = $CustomersInfo['CompanyName'] . '本次续费' . $description;
                 $OrderDescriptionModule->InsertArray($Description);
                 $DescriptionID = mysql_insert_id();
                 $Order['OrderNO'] = GetOrderNO();
                 $Order['AgentID'] = $_SESSION['AgentID'];
                 $Order['CustomersID'] = $CustomersID;
                 $Order['AddTime'] = date('Y-m-d') . ' ' . $time;
                 $Order['FromIP'] = GetIP();
                 $Order['ProjectID'] = $ProjectId;
                 $Order['DescriptionID'] = $DescriptionID;
                 $Order['Type'] = 0;
                 $Order['Amount'] = $cost;
                 $OrderModule->InsertArray($Order);
                 $LogsFunction->logsinfile('109', 1, $CustomersID, '', $Order['OrderNO']);
                 $Sync = $this->ToFengXinEditInfo($CustomersProjectID);
                 if ($Sync) {
                     $LogsFunction->logsinfile('109', 5, $CustomersID, $Description['Description'], $Order['OrderNO']);
                 } else {
                     $LogsFunction->logsinfile('109', 6, $CustomersID, $Description['Description'], $Order['OrderNO']);
                 }
                 JsMessage('续费成功!', UrlRewriteSimple('FengXin', 'Customer', true) . '&Page=' . $Page, '继续操作');
             } else {
                 JsMessage('续费异常!', UrlRewriteSimple('FengXin', 'Customer', true) . '&Page=' . $Page, '继续操作');
             }
         }
     }
 }
예제 #3
0
 public function Recharge()
 {
     $this->MyAction = 'Recharge';
     $Page = intval($this->_GET['Page']);
     $type = $this->_GET['type'];
     $Page = $Page ? $Page : 1;
     $OrderModule = new OrderModule();
     $OrderDescriptionModule = new OrderDescriptionModule();
     $MysqlWhere = "where AgentID={$_SESSION['AgentID']} and Type=1";
     $Searchtxt = $this->_POST['searchtxt'];
     $FengxinID = FENGXIN_ID;
     $GBaoPenID = GBAOPEN_ID;
     if ($Searchtxt != '') {
         $MysqlWhere .= " and OrderNO='{$Searchtxt}'";
     }
     if ($type == 'f') {
         $MysqlWhere .= " and ProjectID='{$FengxinID}'";
     } elseif ($type == 'g') {
         $MysqlWhere .= " and ProjectID='{$GBaoPenID}'";
     } else {
     }
     $OrderInfo = $OrderModule->GetLists($MysqlWhere);
     $ListsNum = $OrderModule->GetListsNum($MysqlWhere);
     $Rscount = $ListsNum['Num'];
     $PageSize = 10;
     if ($Rscount) {
         $Data['RecordCount'] = $Rscount;
         $Data['PageSize'] = $PageSize ? $PageSize : $Data['RecordCount'];
         $Data['PageCount'] = ceil($Data['RecordCount'] / $PageSize);
         $Data['Page'] = min($Page, $Data['PageCount']);
         $Offset = ($Page - 1) * $Data['PageSize'];
         if ($Page > $Data['PageCount']) {
             $Page = $Data['PageCount'];
         }
         $Data['Data'] = $OrderModule->GetLists($MysqlWhere, $Offset, $Data['PageSize']);
         //dd($Data);
         foreach ($Data['Data'] as $k => $v) {
             $Description = $OrderDescriptionModule->GetOneInfoByKeyID($v[DescriptionID]);
             $Data['Data'][$k]['Description'] = $Description['Description'];
             if ($v['ProjectID'] == $FengxinID) {
                 $Data['Data'][$k]['ProjectID'] = '风信';
             }
             if ($v['ProjectID'] == $GBaoPenID) {
                 $Data['Data'][$k]['ProjectID'] = 'G宝盆';
             }
         }
         MultiPage($Data, 10);
         $this->Data = $Data;
     }
 }
예제 #4
0
 public function AddOrder($AgentID = 0, $ProjectID = 0, $Balance = 0, $JinE = 0)
 {
     if ($ProjectID == 0 || $JinE == 0) {
         return 0;
     }
     //求产品详情
     $ProjectModule = new ProjectModule();
     $ProjectInfo = $ProjectModule->GetOneInfoByKeyID($ProjectID);
     //入账记录
     $InsertInfo['Description'] = '线下入账' . $JinE . '元用于购买' . $ProjectInfo['ProjectName'] . ',' . $ProjectInfo['ProjectName'] . '可用余额为' . $Balance . '。';
     $OrderDescriptionModule = new OrderDescriptionModule();
     $InsertOrderInfo['DescriptionID'] = $OrderDescriptionModule->InsertArray($InsertInfo, true);
     if ($InsertOrderInfo['DescriptionID'] > 0) {
         $OrderModule = new OrderModule();
         $InsertOrderInfo['OrderNO'] = GetOrderNO();
         $InsertOrderInfo['AgentID'] = $AgentID;
         $InsertOrderInfo['ProjectID'] = $ProjectID;
         $InsertOrderInfo['Amount'] = $JinE;
         $InsertOrderInfo['AddTime'] = date("Y-m-d H:i:s");
         $InsertOrderInfo['FromIP'] = GetIP();
         $InsertOrderInfo['Remarks'] = '';
         $InsertOrderInfo['Type'] = 1;
         $AllIsOk = $OrderModule->InsertArray($InsertOrderInfo);
         if ($AllIsOk) {
             return 1;
         } else {
             return 0;
         }
     }
     return 0;
 }
예제 #5
0
 public function Info()
 {
     $this->OrderID = _intval($this->_GET['OrderID']);
     $this->Page = _intval($this->_GET['Page']);
     $OrderModule = new OrderModule();
     $OrderInfo = $OrderModule->GetOneInfoByKeyID($this->OrderID);
     $AgentModule = new AgentModule();
     $AgentInfo = $AgentModule->GetOneInfoByKeyID($OrderInfo['AgentID']);
     $OrderInfo['AgentUserName'] = $AgentInfo['UserName'];
     $ProjectModule = new ProjectModule();
     $ProjectInfo = $ProjectModule->GetOneInfoByKeyID($OrderInfo['ProjectID']);
     $OrderInfo['ProjectName'] = $ProjectInfo['ProjectName'];
     $OrderDescriptionModule = new OrderDescriptionModule();
     $OrderDescriptionInfo = $OrderDescriptionModule->GetOneInfoByKeyID($OrderInfo['DescriptionID']);
     $OrderInfo['Description'] = $OrderDescriptionInfo['Description'];
     if ($OrderInfo['Type'] == 1) {
         $OrderInfo['TypeName'] = '入账';
     } else {
         $OrderInfo['TypeName'] = '消费';
     }
     $this->OrderInfo = $OrderInfo;
 }