/** * CarrierManageAct::act_delCarrierManage() * 删除运输方式 * @param int $id 运输方式ID * @return bool */ public function act_delCarrierManage() { $id = isset($_POST["id"]) ? intval(trim($_POST["id"])) : 0; $status = isset($_POST["status"]) ? trim($_POST["status"]) : ""; $act = isset($_REQUEST["act"]) ? post_check($_REQUEST["act"]) : ""; $mod = isset($_REQUEST["mod"]) ? post_check($_REQUEST["mod"]) : ""; if (!AuthUser::checkLogin($mod, $act)) { self::$errCode = 10002; self::$errMsg = "对不起,您无数据(禁用或启用)权限!"; return false; } if (empty($id) || !is_numeric($id)) { self::$errCode = 10000; self::$errMsg = "运输方式ID有误!"; return false; } if (!in_array($status, array(0, 1))) { self::$errCode = 10001; self::$errMsg = "状态参数有误!"; return false; } $res = CarrierManageModel::delCarrierManage($id, $status); self::$errCode = CarrierManageModel::$errCode; self::$errMsg = CarrierManageModel::$errMsg; return $res; }
public function view_update() { $errMsg = ""; $id = isset($_POST["act-id"]) ? abs(intval(post_check($_POST["act-id"]))) : 0; $cn_name = isset($_POST["cn_name"]) ? post_check($_POST["cn_name"]) : ""; $en_name = isset($_POST["en_name"]) ? post_check($_POST["en_name"]) : ""; $ship_ali = isset($_POST["ship_ali"]) ? post_check($_POST["ship_ali"]) : ""; $ship_abb = isset($_POST["ship_abb"]) ? post_check($_POST["ship_abb"]) : ""; $ship_logo = isset($_POST["ship_logo"]) ? post_check($_POST["ship_logo"]) : ""; $ship_index = isset($_POST["ship_index"]) ? post_check($_POST["ship_index"]) : ""; $ship_add = isset($_POST["ship_add"]) ? post_check($_POST["ship_add"]) : 0; $plat_arr = isset($_POST["plat_name"]) ? $_POST["plat_name"] : ""; $ship_type = isset($_POST["ship_type"]) ? post_check($_POST["ship_type"]) : ""; $min_weight = isset($_POST["min_weight"]) ? post_check($_POST["min_weight"]) : 0; $max_weight = isset($_POST["max_weight"]) ? post_check($_POST["max_weight"]) : 0; $ship_day = isset($_POST["ship_day"]) ? post_check($_POST["ship_day"]) : 0; $ship_note = isset($_POST["ship_note"]) ? post_check($_POST["ship_note"]) : ""; $is_track = isset($_POST["is_track"]) ? post_check($_POST["is_track"]) : 1; if (empty($id)) { $errMsg .= "运输方式ID有误!<br/>"; } if (empty($cn_name)) { $errMsg .= "运输方式中文名称有误!<br/>"; } if (empty($en_name)) { $errMsg .= "运输方式英文名称有误!<br/>"; } if (empty($ship_ali)) { $errMsg .= "运输方式简称有误!<br/>"; } if (empty($ship_abb) || !preg_match("/^[A-Z]{5,5}\$/", $ship_abb)) { $errMsg .= "运输方式简码有误!<br/>"; } if (empty($ship_index) || !preg_match("/^[A-Z]{1,1}\$/", $ship_index)) { $errMsg .= "运输方式字母索引有误!<br/>"; } if (!count($plat_arr)) { $errMsg .= "所属平台有误!<br/>"; } if (empty($ship_add)) { $errMsg .= "发货地址有误!<br/>"; } if (!in_array($ship_type, array("0", "1"))) { $errMsg .= "物流类型有误!<br/>"; } $res = 0; $where = "id <> {$id} AND (carrierNameEn = '{$en_name}' OR carrierNameCn = '{$cn_name}' OR carrierAbb = '{$ship_abb}')"; $res = CarrierManageModel::modListCount($where); if ($res > 0) { $errMsg .= "修改失败:运输方式已存在,中文名或英文名或简码都不能重复!"; } if (!$errMsg) { $data = array("carrierNameCn" => $cn_name, "carrierNameEn" => $en_name, "carrierAli" => $ship_ali, "carrierAbb" => $ship_abb, "carrierLogo" => $ship_logo, "carrierIndex" => $ship_index, "plat_arr" => $plat_arr, "type" => $ship_type, "ship_add" => $ship_add, "weightMin" => $min_weight, "weightMax" => $max_weight, "timecount" => $ship_day, "note" => $ship_note, "is_track" => $is_track); $carrierObj = new CarrierManageAct(); $res = $carrierObj->actUpdateCarrierManage($id, $data); if ($res) { $errMsg = "修改成功!"; } } $this->smarty->assign('title', '修改运输方式结果'); $this->smarty->assign('errMsg', $errMsg); $this->smarty->display('carrierManageModify.htm'); }