|
|
|
@ -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); |
|
|
|
|