type_text = json_decode(IN_ITEM_TYPE, true);
$this->Administrator(6);
$this->header();
}
public function __destruct()
{
?>
footer();
}
function index($_var_0 = [])
{
$_var_1 = SafeRequest("page", "get");
$this->search = SafeRequest("search", "get");
$this->search && ($_var_0[] = ["name|note", "like", "%" . $this->search . "%"]);
$this->type = SafeRequest("type", "get");
is_numeric($this->type) && ($_var_0[] = ["type", "=", $this->type]);
$_var_2 = db("item")->where($_var_0)->order("sort,id desc")->paginate(["page" => $_var_1]);
$_var_3 = $_var_2->items();
$_var_4 = getRender($_var_2, $_var_1);
$_var_5 = $_var_2->total();
?>
searchForm("可以输入名称、描述等关键词进行搜索", "", function () {
?>
where("id", $_var_9)->find();
?>
ShowMessage("表单来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_14 = intval(SafeRequest("id", "post"));
$_var_15 = SafeRequest("name", "post");
if (!$_var_15) {
$this->ShowMessage("商品名称不能为空", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_16 = SafeRequest("number", "post");
if (!$_var_16) {
$this->ShowMessage("数目不能为空", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_17 = SafeRequest("price", "post");
if (!$_var_17) {
$this->ShowMessage("价格不能为空", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_18 = SafeRequest("old_price", "post");
$_var_19 = SafeRequest("note", "post");
$_var_20 = SafeRequest("type", "post");
$_var_21 = ["name" => $_var_15, "number" => $_var_16, "price" => $_var_17, "old_price" => $_var_18, "type" => $_var_20, "note" => $_var_19];
if ($_var_14) {
$_var_22 = db("item")->where("id", $_var_14)->update($_var_21);
} else {
if (db("item")->where("name", $_var_15)->where("number", $_var_16)->where("price", $_var_17)->where("type", $_var_20)->count()) {
$this->ShowMessage("已存在相同的商品", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_22 = db("item")->insert($_var_21);
}
$_var_22 && $this->ShowMessage("恭喜您,商品保存成功!", $_SERVER["HTTP_REFERER"], "infotitle2", 1000, 1);
$this->ShowMessage("商品保存失败!请稍后重试!", $_SERVER["HTTP_REFERER"], "infotitle3", 3000, 1);
}
function change_status()
{
if (!submitcheck("hash", -1)) {
$this->ShowMessage("链接来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_23 = intval(SafeRequest("id", "get"));
$_var_24 = intval(SafeRequest("status", "get"));
$_var_25 = db("item")->where("id", $_var_23)->update(["status" => $_var_24]);
$this->ShowMessage("恭喜您,状态切换成功!", "?c=item", "infotitle2", 1000, 1);
}
}