SmmPlatformInterface.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace App\Services\Contracts;
  3. //社交媒体管理平台接口
  4. use Illuminate\Http\Request;
  5. interface SmmPlatformInterface
  6. {
  7. /*
  8. * OAuth 2.0 授权登录
  9. * 返回
  10. * ['status'=>true,'data'=>'https://example.com/fb-callback.php']
  11. * or
  12. * ['status'=>false,'data'=>'授权失败']
  13. */
  14. public function login();
  15. /*
  16. * OAuth 2.0 授权回调
  17. * 授权成功后,得到access_token,refresh_token等信息, 保存到数据库中
  18. * 授权成功后,
  19. * 返回 [
  20. * 'status'=>true,
  21. * 'data' => ['access_token' => 'xxxxx','user_name' => 'yyyyy',]
  22. * ]
  23. * or
  24. * 返回 [
  25. * 'status'=>false,
  26. * 'data' => '回调失败'
  27. * ]
  28. */
  29. public function loginCallback(Request $request);
  30. /*
  31. * 发布图片帖子
  32. * $message 帖子内容
  33. * $imagePath 图片路径, 如:/path/to/image.jpg
  34. * $accountIds 帖子发布账号ID列表,smm_user_account表中的id字段, 如:[1,2,3]
  35. * 返回发布结果:
  36. * [
  37. * 'status' => true,
  38. * 'data' => [
  39. * 'page_post_id' => 123, //帖子ID
  40. * 'image_video_url' => 'https://example.com/image.jpg', //帖子图片URL
  41. * ]
  42. * ]
  43. * or
  44. * [
  45. * 'status' => false,
  46. * 'data' => '发布失败'
  47. * ]
  48. */
  49. public function postImage($message,$imagePath,$accountIds);
  50. /*
  51. * 发布视频帖子
  52. * $message 帖子内容
  53. * $videoPath 视频路径, 如:/path/to/video.mp4
  54. * $accountIds 帖子发布账号ID列表,smm_user_account表中的id字段, 如:[1,2,3]
  55. * 返回发布结果:
  56. * [
  57. * 'page_post_id' => 123, //帖子ID
  58. * 'image_video_url' => 'https://example.com/video.mp4', //帖子图片URL
  59. * ]
  60. */
  61. public function postVideo($message,$videoPath,$accountIds);
  62. /*
  63. * 获取帖评论列表
  64. * $postId 帖子ID
  65. * 返回评论列表:
  66. * [
  67. * 'status' => true,
  68. * 'data' => [
  69. * [
  70. * ]
  71. * or
  72. * [
  73. * 'status' => false,
  74. * 'data' => '获取评论失败'
  75. * ]
  76. */
  77. public function getComments($postId);
  78. /*
  79. * 回复帖子评论
  80. * $commentId 评论ID
  81. */
  82. public function replyToComment($commentId);
  83. /*
  84. * 删除帖子评论
  85. */
  86. public function deleteComment($commentId);
  87. }