From 678ae7e32d9c5c9ac266a818f57e275e2ac56ea7 Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Thu, 27 Dec 2018 11:05:35 +0800 Subject: [PATCH] =?UTF-8?q?mysql=20=E6=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/routine/model/article/Article.php | 2 +- application/routine/model/store/StoreProductReply.php | 1 - application/wap/model/wap/ArticleCategory.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/application/routine/model/article/Article.php b/application/routine/model/article/Article.php index ad08eb51..c009b766 100644 --- a/application/routine/model/article/Article.php +++ b/application/routine/model/article/Article.php @@ -1 +1 @@ -where('hide',0)->where('id',$id)->order('id desc')->find(); if($list){ $list = $list->toArray(); $list["content"] = Db::name('articleContent')->where('nid',$id)->value('content'); return $list; } else return []; } /** * 获取某个分类底下的文章 * @param $cid * @param $first * @param $limit * @param string $field * @return mixed */ public static function cidByArticleList($cid, $first, $limit, $field = 'id,title,image_input,visit,add_time,synopsis,url') { $model = new self(); if ($cid) $model->where("CONCAT(',',cid,',') LIKE '%,$cid,%'", 'exp'); $model = $model->field($field); $model = $model->where('status', 1); $model = $model->where('hide', 0); $model = $model->order('sort DESC,add_time DESC'); if($limit) $model = $model->limit($first, $limit); return $model->select(); } /** * 获取热门文章 * @param string $field * @return mixed */ public static function getArticleListHot($field = 'id,title,image_input,visit,add_time,synopsis,url'){ $model = new self(); $model = $model->field($field); $model = $model->where('status', 1); $model = $model->where('hide', 0); $model = $model->where('is_hot', 1); $model = $model->order('sort DESC,add_time DESC'); return $model->select(); } /** * 获取轮播文章 * @param string $field * @return mixed */ public static function getArticleListBanner($field = 'id,title,image_input,visit,add_time,synopsis,url'){ $model = new self(); $model = $model->field($field); $model = $model->where('status', 1); $model = $model->where('hide', 0); $model = $model->where('is_banner', 1); $model = $model->order('sort DESC,add_time DESC'); return $model->select(); } } \ No newline at end of file +where('hide',0)->where('id',$id)->order('id desc')->find(); if($list){ $list = $list->toArray(); $list["content"] = Db::name('articleContent')->where('nid',$id)->value('content'); return $list; } else return []; } /** * 获取某个分类底下的文章 * @param $cid * @param $first * @param $limit * @param string $field * @return mixed */ public static function cidByArticleList($cid, $first, $limit, $field = 'id,title,image_input,visit,add_time,synopsis,url') { $model = new self(); if ($cid) $model->where("CONCAT(',',cid,',')" ,'LIKE'," '%,$cid,%'"); $model = $model->field($field); $model = $model->where('status', 1); $model = $model->where('hide', 0); $model = $model->order('sort DESC,add_time DESC'); if($limit) $model = $model->limit($first, $limit); return $model->select(); } /** * 获取热门文章 * @param string $field * @return mixed */ public static function getArticleListHot($field = 'id,title,image_input,visit,add_time,synopsis,url'){ $model = new self(); $model = $model->field($field); $model = $model->where('status', 1); $model = $model->where('hide', 0); $model = $model->where('is_hot', 1); $model = $model->order('sort DESC,add_time DESC'); return $model->select(); } /** * 获取轮播文章 * @param string $field * @return mixed */ public static function getArticleListBanner($field = 'id,title,image_input,visit,add_time,synopsis,url'){ $model = new self(); $model = $model->field($field); $model = $model->where('status', 1); $model = $model->where('hide', 0); $model = $model->where('is_banner', 1); $model = $model->order('sort DESC,add_time DESC'); return $model->select(); } } \ No newline at end of file diff --git a/application/routine/model/store/StoreProductReply.php b/application/routine/model/store/StoreProductReply.php index a0a3c25f..abd044fa 100644 --- a/application/routine/model/store/StoreProductReply.php +++ b/application/routine/model/store/StoreProductReply.php @@ -66,7 +66,6 @@ class StoreProductReply extends ModelBasic return $list; } - public static function tidyProductReply($res) { $res['cart_info'] = json_decode($res['cart_info'],true)?:[]; diff --git a/application/wap/model/wap/ArticleCategory.php b/application/wap/model/wap/ArticleCategory.php index e1f76a85..3320a04f 100644 --- a/application/wap/model/wap/ArticleCategory.php +++ b/application/wap/model/wap/ArticleCategory.php @@ -21,7 +21,7 @@ class ArticleCategory extends ModelBasic public static function cidByArticleList($cid, $first, $limit, $field = '*') { $model = Db::name('article'); - if ($cid) $model->where("CONCAT(',',cid,',') LIKE '%,$cid,%'", 'exp'); + if ($cid) $model->where("CONCAT(',',cid,',')", 'LIKE', "'%,$cid,%'"); return $model->field($field)->where('status', 1)->where('hide', 0)->order('sort DESC,add_time DESC')->limit($first, $limit)->select(); } } \ No newline at end of file