feature/main20240421
guojia 7 months ago
parent d16105ff65
commit 0429c08add
  1. 15
      app/common/model/Merchant.php
  2. 2
      public/install/data/install_struct.sql

@ -28,13 +28,22 @@ class Merchant extends BaseModel
// 定义主键 // 定义主键
protected $pk = 'merchant_id'; protected $pk = 'merchant_id';
/**
* 关联logo图片
* @return HasOne
*/
public function logoImage(): HasOne
{
return $this->hasOne('UploadFile', 'file_id', 'logo_image_id');
}
/** /**
* 关联logo图片 * 关联logo图片
* @return HasOne * @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 { try {
$list = self::withoutGlobalScope() $list = self::withoutGlobalScope()
->with(['logoImage']) ->with(['logoImage', "licenseImage"])
->where('merchant_id', '=', $merchantId) ->where('merchant_id', '=', $merchantId)
->find(); ->find();
return $list ?? null; return $list ?? null;

@ -1716,6 +1716,8 @@ CREATE TABLE `yoshop_merchant` (
`shop_name` varchar(100) NOT NULL DEFAULT '' COMMENT '名称', `shop_name` varchar(100) NOT NULL DEFAULT '' COMMENT '名称',
`shop_label` 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', `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 '门店排序(数字越小越靠前)', `sort` int(11) NOT NULL DEFAULT '0' COMMENT '门店排序(数字越小越靠前)',
`is_delete` int(11) unsigned 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', `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',

Loading…
Cancel
Save