zilong 4 年之前
父节点
当前提交
78f7b0a530
共有 2 个文件被更改,包括 16 次插入0 次删除
  1. 14 0
      app/Models/ServicePack.php
  2. 2 0
      config/config.php

+ 14 - 0
app/Models/ServicePack.php

xqd xqd
@@ -10,6 +10,7 @@ namespace App\Models;
 
 class ServicePack extends BaseModel
 {
+    protected $appends = ['label_texts'];
     protected $table = 'service_packs';
     protected $casts = [
         'label' => 'json',
@@ -18,4 +19,17 @@ class ServicePack extends BaseModel
     {
         return $this->belongsTo(Team::class);
     }
+
+    public function getLabelTextsAttribute()
+    {
+        $data = [];
+        if (!empty($this->label)) {
+            $map = config('config.pack_label_map');
+            foreach ($this->label as $k => $v) {
+                $data[$k]['name'] = $map[$v];
+            }
+        }
+
+        return $data;
+    }
 }

+ 2 - 0
config/config.php

xqd
@@ -50,4 +50,6 @@ return [
     ],
 
     'no_auth_function_map' => ['docter/docterList', 'docter/docterDetail'],
+
+    'pack_label_map' => [1 => '图文', 2 => '电话', 3 => '门诊', 4 => '计免', 5 => '儿保'],
 ];