/** * WebAdAct::act_addWebAd() * 添加网站广告 * @param string $topic 名称 * @param string $content 内容 * @param int $is_enable 是否启用 * @param int $layer 排序层级 * @param int $typeId 类型 * @return bool */ public function act_addWebAd() { $topic = isset($_POST["topic"]) ? post_check($_POST["topic"]) : ""; $content = isset($_POST["content"]) ? $_POST["content"] : ""; $is_enable = isset($_POST["is_enable"]) ? abs(intval($_POST["is_enable"])) : 0; $layer = isset($_POST["layer"]) ? abs(intval($_POST["layer"])) : 0; $typeId = isset($_POST["typeId"]) ? abs(intval($_POST["typeId"])) : 0; $act = isset($_REQUEST["act"]) ? post_check($_REQUEST["act"]) : ""; $mod = isset($_REQUEST["mod"]) ? post_check($_REQUEST["mod"]) : ""; if (!AuthUser::checkLogin($mod, $act)) { self::$errCode = 10000; self::$errMsg = "对不起,您无数据添加权限!"; return false; } if (empty($topic)) { self::$errCode = 10001; self::$errMsg = "名称参数有误!"; return false; } if (empty($content)) { self::$errCode = 10002; self::$errMsg = "内容参数有误!"; return false; } if (!in_array($is_enable, array(0, 1))) { self::$errCode = 10003; self::$errMsg = "是否启用参数有误!"; return false; } if (!in_array($typeId, array(1, 2, 3))) { self::$errCode = 10004; self::$errMsg = "类型参数有误!"; return false; } $addTime = time(); $uid = $_SESSION[C('USER_AUTH_SYS_ID')]; $data = array("topic" => $topic, "content" => $content, "is_enable" => $is_enable, "layer" => $layer, "typeId" => $typeId, "addTime" => $addTime, "add_user_id" => $uid); $res = WebAdModel::addWebAd($data); self::$errCode = WebAdModel::$errCode; self::$errMsg = WebAdModel::$errMsg; return $res; }