Browse Source

Merge branch 'phoenix' of ssh://120.24.33.109:11022/hyzjshwo/lanzu_api_hyperf into phoenix

master
weigang 5 years ago
parent
commit
752a00e74a
  1. 12
      app/Model/v3/Goods.php

12
app/Model/v3/Goods.php

@ -12,6 +12,7 @@ use Hyperf\Database\Model\SoftDeletes;
use Hyperf\Utils\ApplicationContext;
use Hyperf\Di\Annotation\Inject;
use App\Constants\v3\Goods as GoodsConstants;
use Hyperf\Utils\Collection;
/**
*/
@ -53,6 +54,7 @@ class Goods extends Model
'cart_num',
'is_effective',
'noneffective_note',
'details_imgs_url',
];
protected function boot(): void
@ -108,6 +110,16 @@ class Goods extends Model
return '';
}
public function getDetailsImgsUrlAttribute()
{
$details_imgs = $this->details_imgs;
$img_host = config('alioss.img_host').'/';
return collect($details_imgs)->map(function($item) use ($img_host){
return $img_host . $item;
});
}
public function store()
{
return $this->belongsTo(Store::class, 'store_id', 'id');

Loading…
Cancel
Save