Esempio n. 1
0
    public function GetMobileModelRead()
    {
        if ($this->_GET) {
            $Model = new ModelModule();
            $ModelID = _intval($this->_GET['ModelID']);
            //模板ID
            if (!$ModelID) {
                echo 'error';
                exit;
            }
            //读取模板信息
            $ModelInfo = $Model->GetOneInfoByKeyID($ModelID);
            $count = 0;
            //用于计算获取的模板数量
            $cut = array();
            //排除相同 的模板
            $Number = _intval($this->_GET['Number']);
            //每页显示数量
            if ($Number <= 0) {
                $Number = 1;
            }
            //$Offset = ($Page - 1) * $Number;
            //套餐模板推荐
            $Like_array = array();
            $ModelPack = $Model->GetListsAll('tb_model_packages', ' where PCNum = \'' . $ModelInfo['NO'] . '\' and TuiJian>0');
            if (count($ModelPack)) {
                $num = rand(1, count($ModelPack)) - 1;
                $ModelPack = $ModelPack[$num];
                $Like_array = $Model->GetListsAll('tb_model', ' where NO = \'' . $ModelPack['PhoneNum'] . '\' and Type=\'手机\' and TuiJian>0');
                if (count($Like_array)) {
                    $num = rand(1, count($Like_array)) - 1;
                    $cut[] = $Like_array[$num]['ID'];
                    $ModelList[$count] = $Like_array[$num];
                    $count += 1;
                }
            }
            //套餐推荐结束
            //颜色相同推荐
            $Color_array = array();
            if ($count < $Number) {
                $paichu = $cut ? implode(',', $cut) : '\'\'';
                $Color_array = $Model->GetListsAll('tb_model', ' where ID not in (' . $paichu . ') and Color like \'%' . $ModelInfo['Color'] . '%\' and Type=\'手机\' and TuiJian>0');
                if (count($Color_array)) {
                    $num = rand(1, count($Color_array)) - 1;
                    $cut[] = $Color_array[$num]['ID'];
                    $ModelList[$count] = $Color_array[$num];
                    $count += 1;
                }
            }
            //颜色推荐结束
            //类别模板推荐
            $Type_array = array();
            if ($count < $Number) {
                $ModelClassID = $ModelInfo['ModelClassID'];
                $ModelClassID = explode(',', $ModelClassID);
                foreach ($ModelClassID as $v) {
                    if ($v) {
                        $linshi = array();
                        $paichu = $cut ? implode(',', $cut) : '\'\'';
                        $linshi = $Model->GetListsAll('tb_model', ' where ID not in (' . $paichu . ') and Type=\'手机\' and TuiJian>0 and ModelClassID like \'%,' . $v . ',%\'');
                        for ($i = 0; $i < count($linshi); $i++) {
                            $cut[] = $linshi[$i]['ID'];
                            $count += 1;
                        }
                        $Type_array = array_merge($Type_array, $linshi);
                        if ($count >= $Number) {
                            break;
                        }
                    }
                }
            }
            //类别推荐结束
            //如果数量不够,进行补充
            $Add = array();
            if ($count < $Number) {
                $paichu = $cut ? implode(',', $cut) : '\'\'';
                $Add = $Model->GetListsAll('tb_model', ' where ID not in (' . $paichu . ') and Type=\'手机\' and TuiJian>0 order by rand() limit ' . ($Number - $count));
            }
            //补充结束
            $ModelList = $Type_array ? array_merge($ModelList, $Type_array) : NULL;
            $ModelList = $Add ? array_merge($ModelList, $Add) : NULL;
            $String = '';
            $count = 0;
            foreach ($ModelList as $Value) {
                if (!$Value['Url_status']) {
                    $Value['Url'] = '';
                    $Value['EWM'] = '';
                } else {
                    $Value['EWM'] = 'http://s.jiathis.com/qrcode.php?url=' . $Value['Url'];
                }
                $Value['Pic'] = DAILI_DOMAIN . 'uploads/img_url/' . $Value['Pic'];
                $String .= '  <model>
				<id>' . $Value['ID'] . '</id>
				<no>' . $Value['NO'] . '</no>
				<title>' . $Value['Name'] . '</title>
				<color>' . $Value['Color'] . '</color>
				<star>' . $Value['BaiDuXingPing'] . '</star>
				<website>' . $Value['Url'] . '</website>
				<ewm>' . $Value['EWM'] . '</ewm>
				<sort>' . $Value['CName'] . '</sort>
				<tone>' . $Value['ZhuSeDiao'] . '</tone>
				<pl>' . $Value['Language'] . '</pl>
				<price>' . $Value['Price'] . '</price>
				<youhui>' . $Value['Youhui'] . '</youhui>
				<picture>' . $Value['Pic'] . '</picture>
				<time>' . $Value['AddTime'] . '</time>
				</model>
				';
                $count += 1;
                if ($count >= $Number) {
                    break;
                }
            }
            $String = '<?xml version="1.0" encoding="utf-8"?>
			<models>
			' . $String . '  <page>
				<total>' . $count . '</total>
			  </page>
			</models>';
            echo $String;
            exit;
        } else {
            echo '参数错误';
            exit;
        }
    }
Esempio n. 2
0
 function EditCustomerGbaopenInfo()
 {
     $filters = array();
     $filters2 = array();
     $Page = $this->_GET['Page'];
     $CustomersModule = new CustomersModule();
     $CustProModule = new CustProModule();
     $Fuwuqi = new FuwuqiModule();
     $FuwuqiInfo = $Fuwuqi->GetAll();
     $Fuwuqimessage = array();
     $Model = new ModelModule();
     foreach ($FuwuqiInfo as $value) {
         $Fuwuqimessage[$value['FuwuqiName']] = array('ID' => $value['ID'], 'FTP' => $value['FTP'], 'FTPName' => $value['FTPName'], 'FTPPassword' => $value['FTPPassword'], 'FwAdress' => $value['FwAdress'], 'FTPDuankou' => $value['FTPDuankou'], 'FTPMulu' => $value['FTPMulu']);
     }
     if (isset($this->_POST)) {
         $CustomersID = intval($this->_POST['CustomersID']);
         //获取G宝盆项目id
         $ProjectId = intval(GBAOPEN_ID);
         $sql = "Where CustomersID={$CustomersID} and ProjectID={$ProjectId} and AgentID={$_SESSION['AgentID']}";
         $filters2['CustomersID'] = $CustomersID;
         $filters2['AgentID'] = intval($_SESSION['AgentID']);
         $filters2['ProjectID'] = $ProjectId;
         $IsFengxingCustom = $CustProModule->GetInfoByWhere($sql);
         $LogsFunction = new LogsFunction();
         if (!empty($IsFengxingCustom)) {
             $DB = new DB();
             $Data['Remark'] = $this->_POST['Remark'];
             $DataCustoms['AgentID'] = $_SESSION['AgentID'];
             $Data['CustomersID'] = $CustomersID;
             $Data['UpdateTime'] = date('Y-m-d H:i:s', time());
             $Data['G_name'] = $this->_POST['GUserName'];
             $Data['CPhone'] = $this->_POST['CPhone'];
             $Data['FTP'] = $this->_POST['ftp'];
             if ($this->_POST['ftp'] or $this->_POST['xftp']) {
                 $Data['FuwuqiName'] = $this->_POST['fuwuqiName'];
                 $Data['G_Ftp_Address'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTP'];
                 $Data['G_Ftp_User'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPName'];
                 $Data['G_Ftp_Pwd'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPPassword'];
                 $Data['G_Ftp_FwAdress'] = $Fuwuqimessage[$Data['FuwuqiName']]['FwAdress'];
                 $Data['G_Ftp_Duankou'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPDuankou'];
                 $Data['G_Ftp_Mulu'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPMulu'];
             } else {
                 $Data['G_Ftp_Address'] = $this->_POST['G_Ftp_Address'];
                 $Data['G_Ftp_User'] = $this->_POST['G_Ftp_User'];
                 $Data['G_Ftp_Pwd'] = $this->_POST['G_Ftp_Pwd'];
                 $Data['G_Ftp_FwAdress'] = $this->_POST['G_Ftp_FwAdress'];
                 $Data['G_Ftp_Duankou'] = $this->_POST['G_Ftp_Duankou'];
                 $Data['G_Ftp_Mulu'] = $this->_POST['G_Ftp_Mulu'];
             }
             if (preg_match("/[\\x{4e00}-\\x{9fa5}]/u", $Data['G_name'])) {
                 JsMessage('G宝盆账号不能是中文!');
             }
             $Data['GongNeng'] = $this->GetGbaopenPropertyID('基础版');
             $FengXinUserNameNum = $CustProModule->GetListsNum("where G_name='{$Data['G_name']}' and CustomersID!={$CustomersID}");
             if ($FengXinUserNameNum['Num'] > 0) {
                 $LogsFunction->logsinfile('114', 2, $CustomersID);
                 JsMessage('该G宝盆账号已经被使用!');
             }
             if ($DB->UpdateArray($CustProModule->TableName, $Data, $filters2)) {
                 $IsOk = $this->ToGbaoPenEditInfo($IsFengxingCustom['CustomersProjectID']);
                 if (!$IsOk) {
                     JsMessage('修改客户G宝盆资料失败,请再一次尝试!');
                 }
                 $LogsFunction->logsinfile('114', 1, $CustomersID);
                 JsMessage('修改客户G宝盆资料成功!', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
             } else {
                 $LogsFunction->logsinfile('114', 0, $CustomersID);
                 JsMessage('修改客户G宝盆资料失败,请再一次尝试!');
             }
         } else {
             if (isset($this->_POST['create']) && isset($this->_POST['new'])) {
                 $Custom['CompanyName'] = $this->_POST['CompanyName'];
                 $Custom['CustomersName'] = $this->_POST['CustomersName'];
                 $Custom['Tel'] = $this->_POST['Tel'];
                 $Custom['Email'] = $this->_POST['Email'];
                 $Custom['Address'] = $this->_POST['Address'];
                 $Custom['Fax'] = $this->_POST['Fax'];
                 $Custom['AddTime'] = date('Y-m-d H:i:s', time());
                 $Custom['UpdateTime'] = $Custom['AddTime'];
                 $Custom['Address'] = $this->_POST['Address'];
                 $Custom['Remark'] = $this->_POST['Remark'];
                 $Custom['AgentID'] = $_SESSION['AgentID'];
                 if ($Custom['CompanyName'] == '' || $Custom['AgentID'] == '') {
                     JsMessage('信息填写错误!');
                 }
                 $CustomersModule->InsertArray($Custom);
                 $CustomersID = mysql_insert_id();
             }
             $Data['GongNeng'] = $this->GetGbaopenPropertyID('基础版');
             //模板域名处理
             $Data['CPhone'] = $this->_POST['PChone'];
             if ($Data['CPhone'] == 1) {
                 $Data['isPackage'] = 0;
                 $Data['PK_model'] = 0;
                 $id = $this->_POST['choosemodel'];
                 $PC_Model = $Model->GetListsAll('tb_model', 'where Type = \'PC\' and ID = ' . $id);
                 if ($PC_Model) {
                     $Data['PC_model'] = $PC_Model[0]['NO'];
                     if ($this->_POST['pc_domain']) {
                         $Data['PC_domain'] = $this->_POST['pc_domain'];
                     } else {
                         JsMessage('请填写PC域名!');
                     }
                     $Data['Mobile_model'] = 0;
                     if (isset($this->_POST['outmobile_add'])) {
                         $Data['Mobile_domain'] = $this->_POST['outmobile_domain'];
                     }
                 } else {
                     JsMessage('不存在此模板!');
                 }
             } elseif ($Data['CPhone'] == 2) {
                 $Data['isPackage'] = 0;
                 $Data['PK_model'] = 0;
                 $id = $this->_POST['choosemodel'];
                 $Mobile_model = $Model->GetListsAll('tb_model', 'where Type = \'手机\' and ID = ' . $id);
                 if ($Mobile_model) {
                     $Data['PC_model'] = 0;
                     if (isset($this->_POST['outpc_add'])) {
                         $Data['PC_domain'] = $this->_POST['outpc_domain'];
                     }
                     $Data['Mobile_model'] = $Mobile_model[0]['NO'];
                     if ($this->_POST['mobile_domain']) {
                         $Data['Mobile_domain'] = $this->_POST['mobile_domain'];
                     } else {
                         JsMessage('请填写手机域名!');
                     }
                 } else {
                     JsMessage('不存在此模板!');
                 }
             } else {
                 if ($this->_POST['ispackage']) {
                     $Data['isPackage'] = 1;
                     $id = $this->_POST['choosemodel'];
                     $Package_Model = $Model->GetListsAll('tb_model_packages', 'where ID = ' . $id);
                     if ($Package_Model) {
                         $Data['PC_model'] = $Package_Model[0]['PCNum'];
                         $Data['Mobile_model'] = $Package_Model[0]['PhoneNum'];
                         $Data['PK_model'] = $Package_Model[0]['PackagesNum'];
                     } else {
                         JsMessage('不存在此套餐!');
                     }
                 } else {
                     $Data['isPackage'] = 0;
                     $Data['PK_model'] = 0;
                     $id = $this->_POST['pc_choose'];
                     $PC_Model = $Model->GetListsAll('tb_model', 'where Type = \'PC\' and ID = ' . $id);
                     if ($PC_Model) {
                         $Data['PC_model'] = $PC_Model[0]['NO'];
                     } else {
                         JsMessage('不存在此模板!');
                     }
                     $id = $this->_POST['mobile_choose'];
                     $Mobile_model = $Model->GetListsAll('tb_model', 'where Type = \'手机\' and ID = ' . $id);
                     if ($Mobile_model) {
                         $Data['Mobile_model'] = $Mobile_model[0]['NO'];
                     } else {
                         JsMessage('不存在此模板!');
                     }
                 }
                 if ($this->_POST['pc_domain']) {
                     $Data['PC_domain'] = $this->_POST['pc_domain'];
                 } else {
                     JsMessage('请填写PC域名!');
                 }
                 if ($this->_POST['mobile_domain']) {
                     $Data['Mobile_domain'] = $this->_POST['mobile_domain'];
                 } else {
                     JsMessage('请填写手机域名!');
                 }
             }
             //ftp处理
             $Data['FTP'] = $this->_POST['xftp'];
             if ($this->_POST['xftp'] or $this->_POST['ftp']) {
                 if ($this->_POST['xfuwuqiName']) {
                     $Data['FuwuqiName'] = $this->_POST['xfuwuqiName'];
                 } else {
                     $Data['FuwuqiName'] = $this->_POST['fuwuqiName'];
                 }
                 $Data['G_Ftp_Address'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTP'];
                 $Data['G_Ftp_User'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPName'];
                 $Data['G_Ftp_Pwd'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPPassword'];
                 $Data['G_Ftp_FwAdress'] = $Fuwuqimessage[$Data['FuwuqiName']]['FwAdress'];
                 $Data['G_Ftp_Duankou'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPDuankou'];
                 $Data['G_Ftp_Mulu'] = $Fuwuqimessage[$Data['FuwuqiName']]['FTPMulu'];
             } else {
                 $Data['G_Ftp_Address'] = $this->_POST['G_Ftp_Address'];
                 $Data['G_Ftp_User'] = $this->_POST['G_Ftp_User'];
                 $Data['G_Ftp_Pwd'] = $this->_POST['G_Ftp_Pwd'];
                 $Data['G_Ftp_FwAdress'] = $this->_POST['G_Ftp_FwAdress'];
                 $Data['G_Ftp_Duankou'] = $this->_POST['G_Ftp_Duankou'];
                 $Data['G_Ftp_Mulu'] = $this->_POST['G_Ftp_Mulu'];
             }
             if (isset($this->_POST['create'])) {
                 $Coupons = $this->_POST['xCoupons'];
                 if ($Coupons) {
                     $CouponsPrice = file_get_contents(DAILI_DOMAIN . '?module=ApiModel&action=GetCoupons&code=' . $Coupons . '&use=1');
                     if ($CouponsPrice > 0) {
                         $Data['Coupons'] = $Coupons;
                         $Data['CouponsPrice'] = $CouponsPrice;
                     }
                 }
             } else {
                 $Coupons = $this->_POST['Coupons'];
                 if ($Coupons) {
                     $CouponsPrice = file_get_contents(DAILI_DOMAIN . '?module=ApiModel&action=GetCoupons&code=' . $Coupons . '&use=1');
                     if ($CouponsPrice > 0) {
                         $Data['Coupons'] = $Coupons;
                         $Data['CouponsPrice'] = $CouponsPrice;
                     }
                 }
             }
             $Data['ProjectID'] = $ProjectId;
             $Data['AgentID'] = $_SESSION['AgentID'];
             $Data['Remark'] = $this->_POST['Remark'];
             $Data['CustomersID'] = $CustomersID;
             $Data['AddTime'] = date('Y-m-d H:i:s', time());
             $Data['UpdateTime'] = $Data['AddTime'];
             $Data['StartTime'] = $Data['AddTime'];
             $Data['EndTime'] = date('Y-m-d H:i:s', strtotime("{$Data['AddTime']}"));
             $Data['G_name'] = $this->_POST['GUserName'];
             if (preg_match("/[\\x{4e00}-\\x{9fa5}]/u", $Data['G_name'])) {
                 JsMessage('G宝盆账号不能是中文!');
             }
             $Data['AddTime'] = $Data['UpdateTime'];
             if ($Data['CustomersID'] == '') {
                 JsMessage('信息填写错误!');
             }
             //$Data['G_beian'] = $this->_POST['beian'];
             $GnameNum = $CustProModule->GetListsNum("where G_name='" . $Data['G_name'] . "' and CustomersID!={$CustomersID}");
             if ($GnameNum['Num'] > 0) {
                 $LogsFunction->logsinfile('113', 2, $CustomersID);
                 JsMessage('该G宝盆账户已经被使用!');
             }
             $GetCustProjectID = $CustProModule->InsertArray($Data, true);
             if ($GetCustProjectID) {
                 $CustomersProjectID = $GetCustProjectID;
                 $IsOk = $this->ToGbaoPenEditInfo($CustomersProjectID);
                 if (!$IsOk) {
                     $CustomersModule->DeleteInfoByKeyID($CustomersID);
                     $CustProModule->DeleteInfoByKeyID($CustomersProjectID);
                     JsMessage('添加客户为新的G宝盆客户失败,已删除客户信息');
                 }
                 $LogsFunction->logsinfile('113', 1, $CustomersID);
                 JsMessage('添加客户为新的G宝盆客户成功!', UrlRewriteSimple($this->MyModule, 'Customer', true) . '&Page=' . $Page, '继续操作');
             } else {
                 $CustomersModule->DeleteInfoByKeyID($CustomersID);
                 $LogsFunction->logsinfile('113', 0, $CustomersID);
                 JsMessage('修改G宝盆客户失败,请再一次尝试!');
             }
         }
     }
 }