public function view_modify() { $this->smarty->assign('title', '修改小语种国家'); $id = isset($_GET['id']) ? intval(trim($_GET['id'])) : 0; if (empty($id) || !is_numeric($id)) { redirect_to("index.php?mod=countriesSmall&act=index"); exit; } $countriesSmall = new CountriesSmallAct(); $res = $countriesSmall->actModify($id); $countriesList = TransOpenApiModel::getCountriesStandard(); $this->smarty->assign('lists', $countriesList); //标准国家列表 $this->smarty->assign('small_name', $res['small_country']); $this->smarty->assign('en_name', $res['countryName']); $this->smarty->assign('code_name', $res['conversionType']); $this->smarty->assign('id', $res['id']); $this->smarty->display('countriesSmallModify.htm'); }
public function view_modify() { $this->smarty->assign('title', '修改运输方式国家'); $id = isset($_GET['id']) ? intval(trim($_GET['id'])) : 0; if (empty($id) || !is_numeric($id)) { redirect_to("index.php?mod=countriesShip&act=index"); exit; } $countriesShip = new CountriesShipAct(); $res = $countriesShip->actModify($id); $countriesList = TransOpenApiModel::getCountriesStandard(); $this->smarty->assign('countries', $countriesList); //标准国家列表 $carrierList = TransOpenApiModel::getCarrier(2); $this->smarty->assign('lists', $carrierList); //运输方式列表 $this->smarty->assign('carrier_name', $res['carrier_country']); $this->smarty->assign('en_name', $res['countryName']); $this->smarty->assign('ship_id', $res['carrierId']); $this->smarty->assign('id', $res['id']); $this->smarty->display('countriesShipModify.htm'); }
public function view_index() { $trackWarnInfo = new TrackWarnInfoAct(); $this->smarty->assign('title', '跟踪号预警'); //接收参数生成条件 $curpage = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1; $countryId = isset($_GET['countryId']) ? intval($_GET['countryId']) : 0; $carrierId = isset($_GET['carrierId']) ? intval($_GET['carrierId']) : 0; $channelId = isset($_GET['channelId']) ? intval($_GET['channelId']) : 0; $type = isset($_GET['type']) ? trim($_GET['type']) : ''; $key = isset($_GET['key']) ? post_check(trim($_GET['key'])) : ''; $timeNode = isset($_GET['timeNode']) ? post_check(trim($_GET['timeNode'])) : ''; $warnLevel = isset($_GET['warnLevel']) ? intval($_GET['warnLevel']) : ''; $is_warn = isset($_GET['is_warn']) ? intval($_GET['is_warn']) : 1; $status = isset($_GET['status']) ? intval($_GET['status']) : -1; //读取用户细颗粒权限 $competences = $_SESSION['competences']; if (!empty($competences['competence'])) { $competences = json_decode($competences['competence'], true); } if (!in_array($carrierId, $competences['carrierId'])) { if (isset($competences['carrierId'])) { $carrierId = implode(",", $competences['carrierId']); } } if (!in_array($channelId, $competences['channelId'])) { if (isset($competences['channelId'])) { $channelId = implode(",", $competences['channelId']); } } $condition = "1"; if (!empty($countryId)) { $condition .= " AND countryId = '{$countryId}'"; } if ($status >= 0) { $condition .= " AND status = '{$status}'"; } if (!empty($carrierId)) { $condition .= " AND carrierId IN({$carrierId})"; } if (!empty($channelId)) { $condition .= " AND channelId IN({$channelId})"; } if (!empty($timeNode)) { if (!in_array($timeNode, array('scanTime', 'lastTime', 'trackTime'))) { redirect_to("index.php?mod=trackWarnInfo&act=index"); } $startTime = isset($_GET['startTime']) ? strtotime(trim($_GET['startTime']) . " 00:00:00") : strtotime(date("Y-m-d", time()) . " 00:00:00"); $endTime = isset($_GET['endTime']) ? strtotime(trim($_GET['endTime']) . " 23:59:59") : strtotime(date("Y-m-d", time()) . " 23:59:59"); if ($startTime && $endTime) { $condition .= ' AND ' . $timeNode . " BETWEEN '" . $startTime . "' AND " . "'" . $endTime . "'"; } } if ($type && $key) { if (!in_array($type, array('orderSn', 'trackNumber', 'recordId'))) { redirect_to("index.php?mod=trackWarnInfo&act=index"); } $condition .= ' AND ' . $type . " = '" . $key . "'"; } if ($warnLevel === 0) { //全部节点预警 $condition .= " AND warnLevel > 0"; } elseif ($warnLevel === -1) { //没预警节点 $condition .= " AND warnLevel = 0"; } elseif (!empty($warnLevel)) { //某个预警节点 $warnStr = str_pad($warnStr, $warnLevel - 1, "_", STR_PAD_LEFT); switch ($is_warn) { case 1: $condition .= " AND warnLevel like '{$warnStr}1%'"; break; case 2: $condition .= " AND warnLevel like '{$warnStr}0%' AND nodeEff like '{$warnStr}1%'"; break; case 3: $condition .= " AND nodeEff like '{$warnStr}1%'"; break; default: $condition .= " AND warnLevel like '{$warnStr}1%'"; } } // echo $condition,"###",$warnStr; //获取符合条件的数据并分页 $pagenum = 20; //每页显示的个数 $res = $trackWarnInfo->actList($condition, $curpage, $pagenum); $total = $trackWarnInfo->actListCount($condition); //页面总数量 $startTimeValue = $startTime ? date('Y-m-d', $startTime) : ''; $endTimeValue = $endTime ? date('Y-m-d', $endTime) : ''; $page = new Page($total, $pagenum, '', 'CN'); $pageStr = ""; if ($res) { if ($total > $pagenum) { $pageStr = $page->fpage(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $pageStr = $page->fpage(array(0, 1, 2, 3)); } } else { $pageStr = '暂无数据'; } //替换页面内容变量 $this->smarty->assign('key', $key); //关键词 $this->smarty->assign('type', $type); //条件选项 $this->smarty->assign('countryId', $countryId); //国家ID $this->smarty->assign('carrierId', $carrierId); //运输方式ID $this->smarty->assign('status', $status); //跟踪号状态 $this->smarty->assign('is_warn', $is_warn); //跟踪号状态 $this->smarty->assign('lists', $res); //数据集 $carrierList = TransOpenApiModel::getCarrier(2); $this->smarty->assign('carrierList', $carrierList); //运输方式列表 $countrylist = TransOpenApiModel::getCountriesStandard(); //标准国家名称列表 $this->smarty->assign('countrylist', $countrylist); $statusList = C('TRACK_STATUS_DETAIL'); $this->smarty->assign('statusList', $statusList); //跟踪号状态列表 $this->smarty->assign('pageStr', $pageStr); //分页输出 $this->smarty->assign('timeNode', $timeNode); //时间条件 $this->smarty->assign('startTimeValue', $startTimeValue); //开始时间 $this->smarty->assign('endTimeValue', $endTimeValue); //结束时间 $this->smarty->display('trackWarnInfo.htm'); }
/** * TransOpenApiAct::act_getCountriesStandard() * 获取全部或部分标准国家并存入mencache * @param string $type ALL全部,CN中文,EN英文 * @param string $country 国家,默认空 * @param int $is_new 是否强制更新(默认0不强制) * @return array */ public function act_getCountriesStandard() { $type = isset($_REQUEST['type']) ? post_check($_REQUEST['type']) : "ALL"; $country = isset($_REQUEST['country']) ? post_check($_REQUEST['country']) : ""; $is_new = isset($_REQUEST['is_new']) ? $_REQUEST['is_new'] : 0; if (!in_array($is_new, array(0, 1))) { self::$errCode = 10001; self::$errMsg = '强制更新参数有误!'; return false; } if (!in_array($type, array("ALL", "EN", "CN"))) { self::$errCode = 309; self::$errMsg = '参数TYPE类型错误!'; return false; } if ($type == "ALL") { $country = ""; } //防止重复CACHE $cacheName = md5("trans_countries_standard_{$type}{$country}"); $memc_obj = new Cache(C('CACHEGROUP')); $countriesInfo = $memc_obj->get_extral($cacheName); if (!empty($countriesInfo) && empty($is_new)) { return unserialize($countriesInfo); } else { if ($type == "ALL") { $countriesInfo = TransOpenApiModel::getCountriesStandard(); } else { $countriesInfo = TransOpenApiModel::getCountriesStandard($type, $country); } $isok = $memc_obj->set_extral($cacheName, serialize($countriesInfo)); if (!$isok) { self::$errCode = 308; self::$errMsg = 'memcache缓存出错!'; //return false; } return $countriesInfo; } }
Core::getInstance(); $numberList = array(); //跟踪号列表 $data = array(); $trackTime = 0; $page = isset($argv[1]) ? abs(intval($argv[1])) : 1; //页码 $pagenum = isset($argv[2]) ? abs(intval($argv[2])) : 2000; //每页多少条 $carrierId = isset($argv[3]) ? abs(intval($argv[3])) : ""; //运输方式ID $where = isset($argv[4]) ? $argv[4] : ""; //跟踪号状态 $hours = isset($argv[5]) ? $argv[5] : 0; //最近几个小时内数据 $countrys = TransOpenApiModel::getCountriesStandard("ALL"); $nodes = TransOpenApiModel::getTrackNodeList(61); print_r($nodes); if (empty($nodes)) { exit("未设置运德物流预警节点,暂没法分析数据!\n"); } foreach ($countrys as $c) { $country = $c['countryNameEn']; $postion = empty($where) ? "toCountry = '{$country}'" : $where . " AND toCountry = '{$country}'"; $numberList = TransOpenApiModel::getTrackNumberList($page, $pagenum, $carrierId, $postion, $hours, 'DESC'); //获取符合条件的跟踪号列表 $total = count($numberList); echo date('Y-m-d H:i:s', time()) . "===" . $c['countryNameEn'] . "===" . $total . "条数据分析开始!" . "\n\n"; //得到原始数据 foreach ($numberList as $v) { $timestr = date('Y-m-d H:i:s', time());
/** * TrackNumberAct::actModify() * 返回某个跟踪号的信息 * @param int $id 查询ID * @return array */ public function actModify() { $data = array(); $id = isset($_GET['id']) ? intval(trim($_GET['id'])) : 0; if (empty($id)) { show_message($this->smarty, "ID不能为空?", ""); return false; } $data['id'] = $id; $data['countrys'] = TransOpenApiModel::getCountriesStandard(); $data['lists'] = TransOpenApiModel::getCarrier(2); $data['res'] = TrackNumberModel::modModify($id); self::$errCode = TrackNumberModel::$errCode; self::$errMsg = TrackNumberModel::$errMsg; if (self::$errCode != 0) { show_message($this->smarty, self::$errMsg, ""); return false; } $data['chList'] = TransOpenApiModel::getCarrierChannel($data['res']['carrierId']); return $data; }