function email()
 {
     $email = $_REQUEST["email"];
     import("@.ORG.PostData");
     $send = new postdata();
     $data["msg"] = $this->Config["site_name"] . "网址:" . $this->Config["site_url"];
     $data["mail"] = $email;
     $data["name"] = "尊敬的用户";
     $data["tel"] = $this->Config["fwrx"];
     //$data["back"]=$this->Config["site_url"];
     $url = "http://gzsrex.sinaapp.com";
     $info = "发送成功,请注意稍后邮件信息!";
     $back = $send->send_post($url, $data);
     $status = 1;
     $this->ajaxreturn(1, $info, $status);
 }
 public function add()
 {
     //插入订单
     $model = D("articleorder");
     $_POST["fyear"] = date("Y", c);
     $_POST["fmonth"] = date("m", $_REQUEST["foundday"]);
     $_POST["fday"] = date("d", $_REQUEST["foundday"]);
     if ($_REQUEST["mid"] && $_REQUEST["mx"]) {
         $_POST["belongid"] = M($_REQUEST["mx"])->where("id=" . $_REQUEST["mid"])->getField("userid");
     }
     if (false === $model->create($_POST)) {
         $this->error($model->getError());
     }
     $id = $model->add();
     if ($id !== false) {
         import("@.ORG.PostData");
         $send = new postdata();
         if ($this->Config["message"]) {
             /*短信平台接口anywn*/
             /*去除空格*/
             $msg = "你好" . $_POST["username"] . "你已经成功预订了" . date("Y-m-d", $_POST["foundday"]) . "日," . $_POST["foundtime"] . "车票,请提前半小时到达乘车地点:广州长湴地铁站(changban)A出口搭车,订单详情点击:" . $this->Config["site_url"] . "/l.php?id=" . $id . "#感谢您的支持,更多内容密切关注官方网站!";
             $qian = array(" ", " ", "\t", "\n", "\r");
             $hou = array("", "", "", "", "");
             $url = "http://gzrex.sinaapp.com/index.php?tel=" . $_POST["mobile"] . "&msg=" . urlencode(str_replace($qian, $hou, $msg)) . "&code=s8asddfg7";
             $back = $send->send_post($url, $data);
             M("articleorder")->where("id=" . $id)->setField("postmessage", $msg);
             M("articleorder")->where("id=" . $id)->setInc("message");
         }
         if ($_REQUEST["burl"]) {
             header('Location: ' . $_REQUEST["burl"]);
             exit;
         } else {
             $this->error("订单预订成功");
         }
     } else {
         if ($_REQUEST["burl"]) {
             header('Location: ' . $_REQUEST["burl"]);
             exit;
         } else {
             $this->error("预订错误");
         }
     }
 }
 public function deel()
 {
     $id = intval($_REQUEST['id']);
     $order = M("order")->where("id=" . $id)->find();
     $status = $order["status"] == 1 ? 0 : 1;
     $resule = M("order")->where("id=" . $id)->setField('status', $status);
     if ($resule) {
         if ($status) {
             if ($this->Config["message"]) {
                 $qian = array(" ", " ", "\t", "\n", "\r", "http://");
                 $hou = array("", "", "", "", "", "");
                 import("@.ORG.PostData");
                 $send = new postdata();
                 $url = $order["url"] ? $order["url"] : $this->Config["site_url"];
                 $msg = "你好,尊敬的" . $order["username"] . "(先生/女士).我们已经受理了您" . $order["mcount"] . "张订单," . $order["title"] . ",价格:" . $order["amount"] . "元。感谢您对我们的支持,欢迎再次登录:" . $url . "预订!";
                 $url = "http://gzrex.sinaapp.com/index.php?tel=" . $order["mobile"] . "&msg=" . str_replace($qian, $hou, $msg);
                 $back = $send->send_post($url, $data);
                 M("Order")->where("id=" . $id)->setInc("message");
             }
         }
         $this->success("处理订单成功!");
     }
 }
 public function add()
 {
     //插入订单
     $model = D("piaoorder");
     $_POST["fyear"] = date("Y", c);
     $_POST["fmonth"] = date("m", $_REQUEST["foundday"]);
     $_POST["fday"] = date("d", $_REQUEST["foundday"]);
     $_POST["mcount"] = $_POST["mcount"] > 0 ? $_POST["mcount"] : 1;
     if ($_REQUEST["mid"] && $_REQUEST["mx"]) {
         $_POST["belongid"] = M($_REQUEST["mx"])->where("id=" . $_REQUEST["mid"])->getField("userid");
     }
     $_POST["title"] = M("piaoline")->where(array('id' => $_REQUEST["mid"]))->getfield("title");
     if (false === $model->create($_POST)) {
         $this->error($model->getError());
     }
     $id = $model->add();
     if (isweixin()) {
         $url = U("Api/Pay/wxpay", array('oid' => $id, 'type' => "piao"));
     } else {
         $url = U("Home/Order/pay", array('oid' => $id, 'type' => "piao"));
     }
     if ($id !== false) {
         import("@.ORG.PostData");
         $send = new postdata();
         if ($this->Config["message"]) {
             /*短信平台接口anywn*/
             /*去除空格*/
             if (isweixin()) {
                 $look = $this->Config["site_url"] . U("Api/Pay/wxpay") . "&oid=" . $id . "&type=piao";
             } else {
                 $look = $this->Config["site_url"] . U("Home/Order/pay") . "&oid=" . $id . "&type=piao";
             }
             //$look=$this->Config["site_url"]."/l.php?id=".$id;
             $pay = A('Api/Pay');
             $pr = $pay->alarm($id, "piao");
             if (!$pr) {
                 $msg = "你好" . $_POST["username"] . "你已经成功预订了" . date("Y-m-d", $_POST["foundday"]) . "日," . $_POST["foundtime"] . "车票,请提前半小时到达乘车地点:广州长湴地铁站(changban)A出口搭车,坐车时请提供你的手机号码:" . $_POST["mobile"] . "及订单编号:" . $id . "感谢您的支持,更多内容密切关注官方网站!";
                 $qian = array(" ", " ", "\t", "\n", "\r");
                 $hou = array("", "", "", "", "");
                 $url = "http://gzrex.sinaapp.com/index.php?tel=" . $_POST["mobile"] . "&msg=" . urlencode(str_replace($qian, $hou, $msg)) . "&code=s8asddfg7";
                 $back = $send->send_post($url, $data);
             }
             M("piaoorder")->where("id=" . $id)->setField("postmessage", $msg);
             M("piaoorder")->where("id=" . $id)->setInc("message");
         }
         if ($_REQUEST["burl"]) {
             header('Location: ' . $_REQUEST["burl"]);
             exit;
         } else {
             //echo $look;
             $this->error("订单预订成功", $look);
         }
     } else {
         if ($_REQUEST["burl"]) {
             header('Location: ' . $_REQUEST["burl"]);
             exit;
         } else {
             $this->error("预订错误");
         }
     }
 }
 /**
  * 录入
  *
  */
 public function insert()
 {
     switch ($_POST["typeid"]) {
         case 0:
             $type = "无选择";
             break;
         case 4:
             $type = " 反馈类别";
             break;
         case 5:
             $type = "信息咨询";
             break;
         case 6:
             $type = "请求实名认证";
             break;
         case 7:
             $type = "捐赠求助";
             break;
     }
     $data["name"] = $_POST["username"];
     $data["tel"] = $_POST["telephone"];
     $data["addr"] = $_POST["title"];
     //到站
     $data["msg"] .= " QQ(" . $_POST["email"] . ")";
     //qq
     $data["msg"] .= " 备注信息(" . $_POST["content"] . ")--【" . $type . "】";
     //$data["mail"]="*****@*****.**";//客户信息
     $data["msg"] .= " 用户提交的请求,请尽快处理!";
     $data["all"] = "【满天星捐赠】!";
     import("@.ORG.PostData");
     $send = new postdata();
     $back = $send->send_post("http://1.gzsrex.sinaapp.com/", $data);
     $data["mail"] = "*****@*****.**";
     //客户信息
     // $back=$send->send_post("http://1.gzsrex.sinaapp.com/",$data);
     if ($this->moduleid != 6 && !in_array($this->_groupid, explode(',', $this->categorys[$_POST['catid']]['postgroup']))) {
         $this->error(L('add_no_postgroup'));
     }
     $c = A('Admin/Content');
     $_POST['ip'] = get_client_ip();
     $userid = $this->_userid;
     $username = $this->_username ? $this->_username : get_safe_replace($_POST['username']);
     $c->insert($this->module[$this->moduleid]['name'], $this->fields, $userid, $username, $this->_groupid);
 }
 public function add()
 {
     if ($_GET["act"] == "want") {
         //提交出行意向
         $username = get_safe_replace($_POST["username"]);
         $mx = get_safe_replace($_POST["mx"]);
         $mid = intval($_POST["mid"]);
         $title = get_safe_replace($_POST["title"]);
         $mobile = get_safe_replace($_POST["mobile"]);
         $msg = "客户浏览\"{$title}\"时提交出行意向," . get_safe_replace($_POST["godate"]) . "打算出行,联系电话" . $mobile . "联系人" . $username;
         $qian = array(" ", " ", "\t", "\n", "\r");
         $hou = array("", "", "", "", "");
         $url = "http://gzrex.sinaapp.com/index.php?tel=" . $this->Config["fwrx"] . "&msg=" . str_replace($qian, $hou, $msg) . "&code=s8asddfg7";
         if ($this->Config["message"]) {
             import("@.ORG.PostData");
             $send = new postdata();
             $back = $send->send_post($url, $data);
         }
         $_POST["order_memo"] = $msg;
         $_POST["url"] = $url;
         $model = M("will");
         if (false === $model->create($_POST)) {
             $this->error($model->getError());
         }
         $id = $model->add();
         $this->success("你已经成功提交意向申请,我们将尽快与您联系或直接联系:" . $this->Config["fwrx"]);
         exit;
     }
     $model = D("Order");
     $map = $_POST;
     $mx = $_POST["mx"];
     $mid = intval($_POST["mid"]);
     $mconut = intval($_POST["mcount"]);
     $username = get_safe_replace($_POST["username"]);
     $mobile = get_safe_replace($_POST["mobile"]);
     ////////////////////////防止会员过快添加/////////////////////////////
     $v = M("order")->where(array('sn' => session_id(), "mid" => $mid, "mx" => $mx, "timestatus" => 0))->order("id desc")->find();
     if ($v) {
         $time = time() - $v["add_time"];
         if ($time <= 1800) {
             $this->error("失败!你已经提交此订单,若再购买请点击【再次预定】按钮,避免重复提交订单!");
         }
     }
     //////////////////验证安全把关////////////////////////
     if ($mid > 0 && strlen($mx) > 0) {
         $price = M($mx)->where("id=" . $mid)->getField("price");
     } else {
         $this->error("订单错误");
     }
     if (!strlen($mobile) == 11) {
         $this->error("输入11位手机号码!");
     }
     if (strlen($username) <= 1) {
         $this->error("名字请大于两个字!");
     }
     if (!strlen($_REQUEST["creditno"]) == 18 && isset($_REQUEST["creditno"])) {
         $this->error("输入18位身份证号码");
     } else {
         if (!preg_match("/13\\d{9}|15\\d{9}|18\\d{9}/", $mobile)) {
             $this->error("手机号填写错误!");
         }
     }
     ///////////////////////////
     if (!$price) {
         $groupid = M("user")->where("id=" . $this->_userid)->getFile("groupid");
         if ($groupid == 2) {
             $price = M($mx)->where("id=" . $mid)->getField("pfprice");
             /*批发与零售价的关系*/
         } else {
             $price = "面议";
         }
     }
     ///////////////////////记录此账号含推广所购买数量//////////////////////////
     $uid = $_SESSION["uid"];
     if ($uid) {
         M("user")->where("id=" . $uid)->setInc("sharecount", $mconut);
         $sm["userid"] = $uid;
         $sm["share_ip"] = get_client_ip();
         $sm["share_time"] = time();
         $sm["mx"] = $mx;
         $sm["ma"] = ACTION_NAME;
         $sm["mid"] = $mid;
         $sm["type"] = 1;
         //0点击,1,购买,3,注册
         M("sharehistory")->add($sm);
         $map["shareuid"] = $uid;
     }
     ///////////////////////记录此账号含推广所购买数量////////////////////////
     $paysn = "rex" . time() . "u" . $this->_userid;
     $title = M($mx)->where("id=" . $mid)->getField("title");
     $belongid = M($mx)->where("id=" . $mid)->getField("userid");
     $map["title"] = $title;
     $map["amount"] = $price * $mconut;
     $map["userid"] = $this->_userid;
     $map["belongid"] = $belongid;
     $godate = explode(" ", $_POST["godate"]);
     $backdate = explode(" ", $_POST["backdate"]);
     $map["godate"] = $godate[0] . ":" . $godate[1];
     $map["traveldate"] = strtotime($godate[0]);
     $map["back_date"] = strtotime($backdate[0]);
     $map["add_time"] = time();
     $map["paysn"] = $paysn;
     $map["sn"] = session_id();
     $map["__hash__"] = $_POST["__hash__"];
     /*去除空格*/
     $qian = array(" ", " ", "\t", "\n", "\r");
     $hou = array("", "", "", "", "");
     if (isset($_POST["url"])) {
         $url = get_safe_replace($_POST["url"]);
     } else {
         $url = $this->Config["site_url"];
     }
     $url = $this->Config["site_url"];
     $map["order_memo"] = "你好," . $username . "你以成功预订," . $title . "(" . $mconut . "张订单),请尽快在本平台付款,识别号:" . $paysn . "做为凭证,更多信息请登录" . $url . "!如需协助请拨打" . $this->Config["fwrx"] . "咨询!";
     if (false === $model->create($map)) {
         $this->error($model->getError());
     }
     $id = $model->add();
     if ($_REQUEST["creditno"]) {
         M("user")->where(array('id' => $this->_userid))->setfield("creditno", $_REQUEST["creditno"]);
     }
     if ($id !== false) {
         import("@.ORG.PostData");
         $send = new postdata();
         if ($this->Config["message"]) {
             /*短信平台接口anywn*/
             $url = "http://gzrex.sinaapp.com/index.php?tel=" . $mobile . "&msg=" . str_replace($qian, $hou, $map["order_memo"]) . "&code=s8asddfg7";
             $back = $send->send_post($url, $data);
             M("Order")->where("id=" . $id)->setInc("message");
         }
         if ($this->Config["ifemail"]) {
             /*邮件接收平台接口anywn*/
             $data["name"] = $username;
             $data["tel"] = $mobile;
             $data["msg"] = str_replace($qian, $hou, "用户," . $username . "成功预订," . $this->Config["site_url"] . "/index.php?m=" . $mx . "&a=show&id=" . $mid . "'" . $title . " (" . $mconut . ")张订单!尽快登录后台:" . $this->Config["site_url"] . "/gznet.php ,订单管理 处理!");
             $data["mail"] = $this->Config["site_email"];
             $data["back"] = $this->Config["site_url"];
             $url = "http://gzsrex.sinaapp.com";
             $back = $send->send_post($url, $data);
         }
         if (in_array($name, $this->cache_model)) {
             savecache($name);
         }
         if (isweixin()) {
             $url = U("Api/Pay/wxpay") . "&oid=" . $id;
         } else {
             $url = U("Home/Order/pay") . "&oid=" . $id;
         }
         $this->assign('jumpUrl', $url);
         $this->success("感谢你的预定,稍后请注意短信!请及时付款以便工作人员确认订单!", $url);
     } else {
         $this->error(L('add_error') . ': ' . $model->getDbError());
     }
     exit;
 }