From 7ef588f9da89eea5d0177ee8b2f52bed708d17b6 Mon Sep 17 00:00:00 2001 From: gzydong <837215079@qq.com> Date: Wed, 7 Jul 2021 08:54:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/ContactApplyService.php | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/Service/ContactApplyService.php diff --git a/app/Service/ContactApplyService.php b/app/Service/ContactApplyService.php new file mode 100644 index 0000000..4dff4a3 --- /dev/null +++ b/app/Service/ContactApplyService.php @@ -0,0 +1,55 @@ +where('friend_id', $friend_id)->orderBy('id', 'desc')->first(); + if ($result && $result->status == 0) { + $result->remarks = $remark; + $result->updated_at = date('Y-m-d H:i:s'); + $result->save(); + return true; + } + + $result = UsersFriendsApply::create([ + 'user_id' => $user_id, + 'friend_id' => $friend_id, + 'status' => 0, + 'remarks' => $remark, + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s') + ]); + + return (bool)$result; + } + + /** + * 同意好友申请 + */ + public function accept() + { + + } + + /** + * 拒绝好友申请 + */ + public function decline() + { + + } +}