From ce9895d43d8f14f7241dd9feb2ecc5a6be327599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 15:33:23 +0800 Subject: [PATCH] =?UTF-8?q?CP=20=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/UserCp.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/application/api/model/UserCp.php b/application/api/model/UserCp.php index 95aa59c..27be9ef 100644 --- a/application/api/model/UserCp.php +++ b/application/api/model/UserCp.php @@ -172,4 +172,24 @@ class UserCp extends Model return ['code' => 0, 'msg' => '暂无Cp空间', 'data' => null]; } } + + + /* + * 用户的Cp空间 + * @param $user_id 用户ID + */ + public function userCpZone($user_id) + { + $res = Db::name('user_cp_zone')->where(['user_id1' => $user_id,'status' => 1])->select(); + if(!$res){ + $res = Db::name('user_cp_zone')->where(['user_id2' => $user_id,'status' => 1])->select(); + } + if($res){ + $res['user_info1'] = Db::name('user')->where(['id' => $res['user_id1']])->field('id user_id,nickname,avatar')->find(); + $res['user_info2'] = Db::name('user')->where(['id' => $res['user_id2']])->field('id user_id,nickname,avatar')->find(); + return ['code' => 1, 'msg' => '成功', 'data' => $res ]; + }else{ + return ['code' => 0, 'msg' => '暂无Cp空间', 'data' => null]; + } + } } \ No newline at end of file