标签和数据库更改

This commit is contained in:
2017-06-26 16:27:33 +08:00
parent 9e6fba335d
commit c3ceff72fc
2 changed files with 36 additions and 12 deletions

View File

@@ -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 = '<?php ';
$parse .= '$__LIST__ = model(\'Document\')->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 = '<?php ';
$parse .= '$__LIST__ = model(\'Document\')->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 = '<?php ';
$parse .= '$map = "category_id=" . ' . $cate . ' . " and model_id=" . ' . $model_id . ' . " and id>".' . $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 .= '<?php } ?>';
@@ -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 = '<?php ';
$parse .= '$map = "category_id=" . ' . $cate . ' . " and model_id=" . ' . $model_id . ' . " and id<".' . $id . ';';
$parse .= '$next = db(\'Document\')->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 .= '<?php } ?>';
return $parse;

View File

@@ -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`