request->param(); $typeid = $param["typeid"]; $model = $param["model"]; $type = $param["type"]; if (!empty($typeid) && !empty($model) && !empty($type)) { if ($type == "view") { //新增并且返回 Db::name($model)->where("id", $typeid)->update(['click' => Db::raw('click + 1')]); } $view_num = Db::name($model)->where("id", $typeid)->value("click"); echo "document.write('" . $view_num . "');"; exit; } else { echo "document.write(0);"; exit; } } }