From ecaad731d6e28023b7fcd65b491ba21ff03ad354 Mon Sep 17 00:00:00 2001 From: v-Brocloni Date: Mon, 9 Aug 2021 17:25:00 +0800 Subject: [PATCH] 1 --- Common/zzfxUtils.class.php | 277 +++++++++++++++++++++++++++++++++ hotel/checkAliExpireTime.php | 14 ++ hotel/clearReservingRoom.php | 14 ++ hotel/getCtripNewOrder.php | 11 ++ hotel/priceComparedWarning.php | 18 +++ motocade/autoCreateProtocolFee.php | 14 ++ motocade/autoFinishOutsideBusOrder.php | 13 ++ motocade/finishBusOrder.php | 7 + motocade/makeBusOrder.php | 18 +++ motocade/notifyCustomerToRide.php | 7 + motocade/roomCountWarning.php | 18 +++ motocade/roomPriceWarning.php | 18 +++ motocade/syncBusOrder.php | 14 ++ motocade/uploadGpsData.php | 14 ++ motocade/uploadGpsDataNew.php | 17 ++ 15 files changed, 474 insertions(+) create mode 100644 Common/zzfxUtils.class.php create mode 100644 hotel/checkAliExpireTime.php create mode 100644 hotel/clearReservingRoom.php create mode 100644 hotel/getCtripNewOrder.php create mode 100644 hotel/priceComparedWarning.php create mode 100644 motocade/autoCreateProtocolFee.php create mode 100644 motocade/autoFinishOutsideBusOrder.php create mode 100644 motocade/finishBusOrder.php create mode 100644 motocade/makeBusOrder.php create mode 100644 motocade/notifyCustomerToRide.php create mode 100644 motocade/roomCountWarning.php create mode 100644 motocade/roomPriceWarning.php create mode 100644 motocade/syncBusOrder.php create mode 100644 motocade/uploadGpsData.php create mode 100644 motocade/uploadGpsDataNew.php diff --git a/Common/zzfxUtils.class.php b/Common/zzfxUtils.class.php new file mode 100644 index 0000000..a387a37 --- /dev/null +++ b/Common/zzfxUtils.class.php @@ -0,0 +1,277 @@ + true, + 'info' => '' + ); + foreach ($params as $attr => $type) { + $list = explode(',', $attr); + foreach ($list as $item) { + $item = trim($item); + if($item != ''){ + if (!isset($post[$item]) || $post[$item] == '') { + $result['status'] = false; + $result['info'] = '请填写所有必填项'; + return $result; + } elseif (zzcsUtils::validate($post[$item], $type)) { + continue; + + } else { + $result['status'] = false; + $result['info'] = ' 数据格式不正确'; + return $result; + } + } + + } + } + return $result; + } + + /* + * 验证字段是否合法,URL必须带http(s),合法return true,非法return false + * @input mixed需要验证的参数 + * @type 需要的方法,Number, Float, Integer, ID, Email, Phone, URL, ShenFenZheng, + */ + static function validate($input, $type = '') + { + $typeArr = explode(',', $type); + foreach ($typeArr as $type) { + switch (strtolower($type)) { + case 'amount': + $reg = '/^([1-9]\d*\.?\d{0,2}$)|0\.?\d{0,2}$/'; + $message = '金额'; + break; + case 'number': + $reg = '/^-?[0-9]*$/'; + $message = '数字'; + break; + case 'email': + $reg = '/^[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'; + $message = '邮箱'; + break; + case 'telorphone': //正则不正确,需再完善 + $reg = '/^(d{3}-\d{8}|\d{4}-\d{7})|((0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8})$/'; + $message = '电话'; + break; + case 'tel': + $reg = '/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/'; + $message = '手机'; + break; + case 'phone': + $reg = '/^d{3}-\d{8}|\d{4}-\d{7}$/'; + $message = '电话'; + break; + case 'url': + $reg = '/^https?:\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(?::\d{1,5})?(?:$|[?\/#])$/i'; + $message = '链接'; + break; + case 'card': + $reg = '/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/'; + $message = '身份证'; + break; + case 'dcode': + $reg = '/^[1-9]\d{5}(?!\d)$/'; + $message = '邮编'; + break; + case 'time': + $reg = '/^(([0-1][0-9])|(2[0-3])):([0-5][0-9])$/'; + $message = '时间'; + break; + case 'empty': + default: + $reg = '/^[\s\S]*$/'; + + } + + $result = preg_match($reg, $input); + if ($result == 0) + return false; + } + + return true; + } + + /* + * 上传多张图片,不确定图片张数, + * 图片路径以逗号分隔, + * + */ + static function uploadMultiple($name, $dirPath = '../coding/resource/upload/car/', $realPath = '../../resource/upload/car/') + { + $maxSize = 2000000; + $allow = array('image/gif', 'image/jpeg', 'image/png', 'image/pjpeg'); + $path = ''; + $type = ''; + if (is_array($_FILES[$name]['name'])) { //多个文件 + foreach ($_FILES[$name]['name'] as $key => $item) { + //图片不为空,且图片对应的类型也不为空 + if ($_POST['bus_img_type'][$key] != '' && $item != '' && in_array($_FILES[$name]['type'][$key], $allow) && $_FILES[$name]['size'][$key] <= $maxSize) { + $newName = zzcsUtils::initFileName($path, zzcsUtils::getSuffix($_FILES[$name]['name'][$key])); + move_uploaded_file($_FILES[$name]["tmp_name"][$key], + __DIR__ . DIRECTORY_SEPARATOR . $dirPath . $newName); + + if ($path == '') { + $path .= $realPath . $newName; + $type .= $_POST['bus_img_type'][$key]; + } else { + $path .= ',' . $realPath . $newName; + $type .= ',' . $_POST['bus_img_type'][$key]; + + } + } + } + } else { //单个文件 + + } + if ($path != '') + return array('path' => $path, 'type' => $type); + else + return false; + } + + + /* + * 上传文件 + * @type 上传类型,主要是图片,还有附件rar, word, excel,还没有需求 + */ + static function upload($type, $file) + { + if ((($_FILES[$file]["type"] == "image/gif") + || ($_FILES[$file]["type"] == "image/jpeg") + || ($_FILES[$file]["type"] == "image/png") + || ($_FILES[$file]["type"] == "image/pjpeg")) + && ($_FILES[$file]["size"] < 200000) + ) { + if ($_FILES[$file]["error"] > 0) { + return ''; + } else { + $path = '../upload/car/'; + $newName = zzcsUtils::initFileName($path, zzcsUtils::getSuffix($_FILES[$file]["name"])); + move_uploaded_file($_FILES[$file]["tmp_name"], + __DIR__ . DIRECTORY_SEPARATOR . $path . $newName); + return $path . $newName; + } + } else { + return ''; + } + } + + /* + * 在upload目录上传文件时,初始化一个不存在的文件名 + */ + static function initFileName($path, $suffix) + { + $flag = true; + + while ($flag) { + $name = time() . rand(10000, 99999); + if (!file_exists("$path$name$suffix")) { + $flag = false; + } + } + return $name . $suffix; + } + + static function getSuffix($imgName)//获取图像文件类型 + { + if (preg_match("/\.(jpg|jpeg|gif|png|bmp)$/i", $imgName, $matches)) { + $type = strtolower($matches[0]); + } else { + $type = "string"; + } + return $type; + } + + /* + * 删除车辆之前存放的图片 + */ + static function deleteFiles($oldPath, $newPath) + { + if (is_string($oldPath)) + $oldPath = explode(',', $oldPath); + if (is_string($newPath)) + $newPath = explode(',', $newPath); + foreach ($oldPath as $item) { + if (!in_array($item, $newPath)) { + if (file_exists($item) && is_file($item)) + unlink($item); + } + } + } +} \ No newline at end of file diff --git a/hotel/checkAliExpireTime.php b/hotel/checkAliExpireTime.php new file mode 100644 index 0000000..3c5bdd3 --- /dev/null +++ b/hotel/checkAliExpireTime.php @@ -0,0 +1,14 @@ +>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +* 0,5-23 * * * sleep 25 ;php /usr/share/nginx/Cron/motocade/uploadGpsDataNew.php >>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +*/ diff --git a/motocade/autoCreateProtocolFee.php b/motocade/autoCreateProtocolFee.php new file mode 100644 index 0000000..b5fdb0f --- /dev/null +++ b/motocade/autoCreateProtocolFee.php @@ -0,0 +1,14 @@ + $date +); +$res = zzcsUtils::httpsPost('http://dllfo.zhizhuchuxing.com//motorcade/zizai/auto-order', $param); +if (!$res) { + zzcsUtils::sendMessageToRTX('定时任务之生成出车任务异常',$res); +} diff --git a/motocade/notifyCustomerToRide.php b/motocade/notifyCustomerToRide.php new file mode 100644 index 0000000..fc9d477 --- /dev/null +++ b/motocade/notifyCustomerToRide.php @@ -0,0 +1,7 @@ +>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +* 0,5-23 * * * sleep 25 ;php /usr/share/nginx/Cron/motocade/uploadGpsDataNew.php >>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +*/ diff --git a/motocade/roomPriceWarning.php b/motocade/roomPriceWarning.php new file mode 100644 index 0000000..3aeebfb --- /dev/null +++ b/motocade/roomPriceWarning.php @@ -0,0 +1,18 @@ +>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +* 0,5-23 * * * sleep 25 ;php /usr/share/nginx/Cron/motocade/uploadGpsDataNew.php >>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +*/ diff --git a/motocade/syncBusOrder.php b/motocade/syncBusOrder.php new file mode 100644 index 0000000..84e4b15 --- /dev/null +++ b/motocade/syncBusOrder.php @@ -0,0 +1,14 @@ +>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +* 0,5-23 * * * sleep 25 ;php /usr/share/nginx/Cron/motocade/uploadGpsDataNew.php >>/usr/share/nginx/Cron/Log/uploadGpsDataNew.log 2>&1 +*/