LittleGuide.php 991 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Controllers\Fpdx;
  3. use App\Models\Fpdx\MessageModel;
  4. use App\Models\User\Openid;
  5. /**
  6. * 小象导处理类
  7. * Class LittleGuide
  8. * @package App\Http\Controllers\Fpdx
  9. */
  10. class LittleGuide
  11. {
  12. /**
  13. * 小象导接收消息处理
  14. * @param int $message_id
  15. * @throws \ApiException
  16. */
  17. public function message(int $message_id)
  18. {
  19. $message = MessageModel::find($message_id);
  20. $content = \Turing::send($message->msg_content);
  21. $content = str_replace($content, '小象导', '菲菲');
  22. $add = array(
  23. 'send_uid' => 'xxd',
  24. 'receive_uid' => $message->send_uid,
  25. 'msg_content' => (string)$message->Content,
  26. 'msg_type' => -1,
  27. 'create_time' => time()
  28. );
  29. \DB::table('fpdx_pair_room_messages')->insertGetId($add);
  30. $openid = Openid::ofPublic($message->send_uid)->value('openid');
  31. Message::systemResponse($openid, $content);
  32. }
  33. }