Browse Source

Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix

master
Lemon 5 years ago
parent
commit
d1e8a5b86f
  1. 14
      app/Model/v3/Store.php

14
app/Model/v3/Store.php

@ -3,13 +3,16 @@
declare (strict_types=1);
namespace App\Model\v3;
use App\Constants\v3\OssThumbnail;
use App\Constants\v3\SsdbKeys;
use App\Model\Model;
use App\Service\v3\Interfaces\AttachmentServiceInterface;
use App\TaskWorker\SSDBTask;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\SoftDeletes;
use Hyperf\Utils\ApplicationContext;
use App\Constants\v3\Store as StoreConstants;
use Hyperf\Di\Annotation\Inject;
/**
*/
@ -40,6 +43,12 @@ class Store extends Model
'month_sales'
];
/**
* @Inject
* @var AttachmentServiceInterface
*/
protected $attachmentService;
protected function boot(): void
{
parent::boot();
@ -63,6 +72,11 @@ class Store extends Model
return (integer)$ssdb->exec('get', SsdbKeys::STORE_MONTH_SALES.date('Ym').'_'.$this->id);
}
public function getLogoAttribute($value)
{
return $this->attachmentService->switchImgToAliOss($value, OssThumbnail::THUMBNAIL_300_Q80);
}
public function goods()
{
return $this->hasMany(Goods::class, 'store_id', 'id')->limit(5);

Loading…
Cancel
Save