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() + { + + } +}