From 6f12eadd25c8f5335fd9eccf373bf9835bf3e4c6 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Sat, 15 Nov 2025 18:12:50 +0800
Subject: [PATCH] 添加名片聊天功能(未完成)

---
 admin/app/common/model/branch/Member.php |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/admin/app/common/model/branch/Member.php b/admin/app/common/model/branch/Member.php
index 1ba5f6e..9eaa5f7 100644
--- a/admin/app/common/model/branch/Member.php
+++ b/admin/app/common/model/branch/Member.php
@@ -5,6 +5,7 @@
 use app\common\model\BaseModel;
 use app\common\model\user\User as UserModel;
 use app\common\model\branch\Branch as BranchModel;
+use app\common\model\settings\Region;
 
 /**
  * 连盟成员模型
@@ -13,6 +14,12 @@
 {
     protected $name = 'branch_member';
     protected $pk = 'user_id';
+
+    /**
+     * 追加字段
+     * @var string[]
+     */
+    protected $append = ['region'];
 	
 	/**
 	 * 关联所属分会表
@@ -40,6 +47,32 @@
     }
 
     /**
+	 * 关联职务
+	 */
+	public function position()
+	{
+	    return $this->belongsTo('app\\common\\model\\branch\\Position', 'position_id', 'position_id');
+	}
+
+    /**
+     * 籍贯
+     * @param $value
+     * @param $data
+     * @return array
+     */
+    public function getRegionAttr($value, $data)
+    {
+        if (!isset($data['province_id'])) {
+            return false;
+        }
+        return [
+            'province' => Region::getNameById($data['province_id']),
+            'city' => Region::getNameById($data['city_id']),
+            'region' => $data['region_id'] == 0 ? '' : Region::getNameById($data['region_id']),
+        ];
+    }
+
+    /**
      * 详情
      */
     public static function detail($user_id, $with = ['user'])

--
Gitblit v1.9.2