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',