From deb09ebb2fc6e005b71f183a711e77b10a0e38cc Mon Sep 17 00:00:00 2001 From: wanyongkang <937888580@qq.com> Date: Fri, 20 Nov 2020 16:01:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=95=E5=B1=82=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastphp/base/Model.php | 6 +++--- fastphp/db/Sql.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/fastphp/base/Model.php b/fastphp/base/Model.php index 77a30f9..d15a7d8 100644 --- a/fastphp/base/Model.php +++ b/fastphp/base/Model.php @@ -2,7 +2,7 @@ /* * @Author: your name * @Date: 2020-09-30 17:32:46 - * @LastEditTime: 2020-11-16 16:09:31 + * @LastEditTime: 2020-11-17 15:17:09 * @LastEditors: kangkang * @Description: In User Settings Edit * @FilePath: /phptest/fastphp/base/Model.php @@ -77,9 +77,9 @@ class Model extends Sql * @param {*} * @return {*} */ - public function getNewOne($fields = '*') + public function getNewOne($fields = '*',$where = []) { - return $this->field($fields)->order('id desc')->fetch(); + return $this->field($fields)->where($where)->order('id desc')->fetch(); } /** * @description: 更新一条数据 diff --git a/fastphp/db/Sql.php b/fastphp/db/Sql.php index 90ec041..953d54e 100644 --- a/fastphp/db/Sql.php +++ b/fastphp/db/Sql.php @@ -85,6 +85,20 @@ class Sql } } + /** + * left join + * @param array $order 排序条件 + * @return $this + * $order='id desc' + */ + public function join($condition = '') + { + if ($condition) { + $this->filter = ' LEFT JOIN ' . $condition . ' '; + } + return $this; + } + /** * 拼装排序条件 * @param array $order 排序条件