From 0429c08add3e53d743be9eb6742f7315cd1e941f Mon Sep 17 00:00:00 2001 From: guojia <445241500@qq.com> Date: Sun, 28 Apr 2024 15:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E6=AE=B5add?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/Merchant.php | 15 ++++++++++++--- public/install/data/install_struct.sql | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/common/model/Merchant.php b/app/common/model/Merchant.php index f55bb183..907adce0 100644 --- a/app/common/model/Merchant.php +++ b/app/common/model/Merchant.php @@ -28,13 +28,22 @@ class Merchant extends BaseModel // 定义主键 protected $pk = 'merchant_id'; + /** + * 关联logo图片 + * @return HasOne + */ + public function logoImage(): HasOne + { + return $this->hasOne('UploadFile', 'file_id', 'logo_image_id'); + } + /** * 关联logo图片 * @return HasOne */ - public function logoImage(): HasOne + public function licenseImage(): HasOne { - return $this->hasOne('UploadFile', 'file_id', 'logo_image_id'); + return $this->hasOne('UploadFile', 'file_id', 'license_img_id'); } /** @@ -46,7 +55,7 @@ class Merchant extends BaseModel { try { $list = self::withoutGlobalScope() - ->with(['logoImage']) + ->with(['logoImage', "licenseImage"]) ->where('merchant_id', '=', $merchantId) ->find(); return $list ?? null; diff --git a/public/install/data/install_struct.sql b/public/install/data/install_struct.sql index 452e78a8..abaa3138 100644 --- a/public/install/data/install_struct.sql +++ b/public/install/data/install_struct.sql @@ -1716,6 +1716,8 @@ CREATE TABLE `yoshop_merchant` ( `shop_name` varchar(100) NOT NULL DEFAULT '' COMMENT '名称', `shop_label` varchar(100) NOT NULL DEFAULT '' COMMENT '标签', `logo_image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '门店logo图片ID', +`license_img_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '营业执照图片ID', +`user_id` varchar(100) NOT NULL DEFAULT '' COMMENT '买家用户ID', `sort` int(11) NOT NULL DEFAULT '0' COMMENT '门店排序(数字越小越靠前)', `is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除', `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',