wesmiler 5 дней назад
Родитель
Сommit
cc9824b45f
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      app/Models/GoodsCategoryModel.php

+ 8 - 1
app/Models/GoodsCategoryModel.php

@@ -22,6 +22,8 @@ class GoodsCategoryModel extends BaseModel
     // 设置数据表
     protected $table = 'goods_categorys';
 
+    protected $appends = ['type_name'];
+
     // 封面图
     public function getIconAttribute($value)
     {
@@ -33,5 +35,10 @@ class GoodsCategoryModel extends BaseModel
     {
         return $value ? get_image_path($value) : '';
     }
-
+    
+    public function getTypeNameAttribute()
+    {
+        $types = ['',1=>'自营品专区',2=>'延时专区',3=>'深度体验',4=>'男神玩具',5=>'女神玩具',6=>'私密养护',7=>'情趣服饰(香水)',8=>'SM房趣(套装)',9=>'体感娃娃',10=>'周边产品'];
+        return isset($types[$this->type]) ? $types[$this->type] : '';
+    }
 }