diff --git a/core/extend/com/Sent.php b/core/extend/com/Sent.php index 95c7f8a4..65cf06b6 100644 --- a/core/extend/com/Sent.php +++ b/core/extend/com/Sent.php @@ -60,10 +60,10 @@ class Sent extends Taglib{ $ids = get_category_child($cid); $ids = implode(',', $ids); $where = "category_id IN ({$ids})"; - $where .= " and model_id = {$model} and status >= 1"; + $where .= " and status >= 1"; $parse = $parse = 'where(\''.$where.'\')->field(\''.$field.'\')->limit(\''.$limit.'\')->order(\''.$order.'\')->select();'; + $parse .= '$__LIST__ = M(\''.$model.'\')->where(\''.$where.'\')->field(\''.$field.'\')->limit(\''.$limit.'\')->order(\''.$order.'\')->select();'; $parse .= 'foreach ($__LIST__ as $key => $'.$tag['name'].') {'; $parse .= '?>'; $parse .= $content; @@ -94,17 +94,15 @@ class Sent extends Taglib{ } public function tagrecom($tag, $content){ - $doc_id = empty($tag['doc_id']) ? '' : $tag['doc_id']; + $model = empty($tag['model']) ? '' : $tag['model']; $field = empty($tag['field']) ? '*' : $tag['field']; $limit = empty($tag['limit']) ? 20 : $tag['limit']; $order = empty($tag['order']) ? 'id desc' : $tag['order']; - - if (!$doc_id) { - return array(); + if (!$model) { + return ''; } - $parse = $parse = 'recom('. $doc_id .',\'' .$field. '\',' .$limit. ',\'' .$order. '\');'; + $parse .= '$__LIST__ = M(\''.$model.'\')->recom(\'' .$field. '\',' .$limit. ',\'' .$order. '\');'; $parse .= 'foreach ($__LIST__ as $key => $'.$tag['id'].') {'; $parse .= '?>'; $parse .= $content; @@ -140,7 +138,7 @@ class Sent extends Taglib{ $model_id = !empty($tag['model']) ? $tag['model'] : ''; $parse = '".' . $id . ';'; + $parse .= '$map = "category_id=" . ' . $cate . '" and id>".' . $id . ';'; $parse .= '$prev = db(\'Document\')->where($map)->order(\'id asc\')->find();if(!empty($prev)){ ?>'; $parse .= $content; $parse .= ''; @@ -150,11 +148,11 @@ class Sent extends Taglib{ public function tagnext($tag, $content){ $id = !empty($tag['id']) ? ($tag['id']) : ''; $cate = !empty($tag['cate']) ? $tag['cate'] : ''; - $model_id = !empty($tag['model']) ? $tag['model'] : ''; + $model = !empty($tag['model']) ? $tag['model'] : ''; $parse = 'where($map)->order(\'id desc\')->find();if(!empty($next)){ ?>'; + $parse .= '$map = "category_id=" . ' . $cate . '" and id<".' . $id . ';'; + $parse .= '$next = db(\''.$model.'\')->where($map)->order(\'id desc\')->find();if(!empty($next)){ ?>'; $parse .= $content; $parse .= ''; return $parse; diff --git a/data/sql.sql b/data/sql.sql index a1e6fc92..3a08d6f9 100644 --- a/data/sql.sql +++ b/data/sql.sql @@ -1034,6 +1034,21 @@ CREATE TABLE `sent_file` ( -- -------------------------------------------------------- +-- +-- 表的结构 `sent_form` +-- + +DROP TABLE IF EXISTS `sent_form`; +CREATE TABLE `sent_form` ( + `id` int(10) UNSIGNED NOT NULL COMMENT '文件ID', + `title` varchar(200) NOT NULL DEFAULT '' COMMENT '表单名称', + `name` varchar(100) NOT NULL DEFAULT '' COMMENT '表单标识', + `create_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '更新时间' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='自定义表单'; + +-- -------------------------------------------------------- + -- -- 表的结构 `sent_hooks` -- @@ -1462,6 +1477,12 @@ ALTER TABLE `sent_district` ALTER TABLE `sent_file` ADD PRIMARY KEY (`id`); +-- +-- Indexes for table `sent_form` +-- +ALTER TABLE `sent_form` + ADD PRIMARY KEY (`id`); + -- -- Indexes for table `sent_hooks` -- @@ -1607,6 +1628,11 @@ ALTER TABLE `sent_district` ALTER TABLE `sent_file` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '文件ID'; -- +-- 使用表AUTO_INCREMENT `sent_form` +-- +ALTER TABLE `sent_form` + MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标识ID'; +-- -- 使用表AUTO_INCREMENT `sent_hooks` -- ALTER TABLE `sent_hooks`