コード例 #1
0
ファイル: LineAction.class.php プロジェクト: anywn3773/gzsrex
 public function check()
 {
     $id = intval($_REQUEST["id"]);
     $mx = $_REQUEST["mx"];
     if ($mx == "Piaoline") {
         $r = M("Piaoorder")->where(array('id' => $id))->find();
         $r["title"] = M("piaoline")->where(array('id' => $r["mid"]))->getfield("title");
         $r["body"] = "出发时间:" . $r['fmonth'] . "月" . $r['fday'] . "日<br/> 搭车时间:" . $r["foundtime"] . "<br/> 身份证:" . $r["certificate"] . "<br/>备注:" . $r["note"];
     } else {
         $r = M("order")->where(array('id' => $id))->find();
     }
     if ($mx == "Article") {
         //旅游线路
         $r['body'] = "游玩时间:" . $r['godate'] . "<br/>  用户身份证:" . $r['creditno'] . "&nbsp;&nbsp;&nbsp;&nbsp;<br/> 订单金额:" . $r['amount'];
     } elseif ($mx == "Picture") {
         $addr = M("Picture")->where("id=" . $r["mid"])->getfield("addr");
         $r['body'] = "进住时间:" . $r['godate'] . "<br/>  退房时间:" . date($r['back_date'], "Y-m-d H:i:s") . "<br/> 酒店地址:" . $addr . "&nbsp;&nbsp;&nbsp;&nbsp;<br/>订购数量:" . $r["mcount"] . "<br/>订单金额:" . $r['amount'];
     }
     if ($r["status"] == 0) {
         if (isweixin()) {
             $r["payurl"] = U('Api/Pay/wxpay', array('oid' => $r['id']));
         } else {
             $r["payurl"] = U('Home/Order/pay', array('oid' => $r['id']));
         }
     } else {
         $r["payurl"] = "JavaScript:alert(\"你已经付款了!感谢你的支持\");";
     }
     $this->assign("vo", $r);
     if ($this->Config["wap"] && is_mobile()) {
         $tmp = THEME_PATH . "wap/Line_check.html";
     }
     $this->display($tmp);
 }
コード例 #2
0
ファイル: PiaoAction.class.php プロジェクト: anywn3773/gzsrex
 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("预订错误");
         }
     }
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public function order()
 {
     $id = intval($_REQUEST["id"]);
     $type = $_REQUEST["type"];
     if ($id > 0) {
         $order = M($type . "order")->where("id=" . $id)->find();
         if (empty($order)) {
             $type = "piao";
             $order = M($type . "order")->where("id=" . $id)->find();
         }
         if ($order['userid'] > 0) {
             $u = M("user")->field("wxpas,id")->where("id=" . $order['userid'])->find();
         }
         //$this->assign("order",$order);
         $order['now'] = date("y-m-d H:i:s", time());
         if (isweixin()) {
             $look = $this->Config["site_url"] . U("Api/Pay/wxpay") . "&oid=" . $id . "&type=" . $type;
         } else {
             $look = $this->Config["site_url"] . U("Home/Order/pay") . "&oid=" . $id . "&type=" . $type;
         }
         $order["payurl"] = $look;
         if (empty($order["title"])) {
             $status = 0;
         } else {
             $status = 1;
         }
         $this->ajaxreturn($order, $info, $status);
         //$this->assign("now",date("y-m-d H:i:s",time()));
     } else {
         if ($this->Config["wap"] && is_mobile()) {
             /*开启手机访问*/
             $tmp = THEME_PATH . "wap/" . MODULE_NAME . "_" . ACTION_NAME . ".html";
         }
         $this->display($tmp);
     }
 }