TgController.php 637 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Created by IntelliJ IDEA.
  4. * User: solu
  5. * Date: 2019/3/26
  6. * Time: 4:59 PM
  7. */
  8. class TgController extends BaseController {
  9. public function actionWebhook($args) {
  10. $content = file_get_contents("php://input");
  11. $update = json_decode($content, true);
  12. file_put_contents('/tmp/telegram_message.log', var_export($update, true), FILE_APPEND);
  13. if (isset($update["message"])) {
  14. try {
  15. Telegram::processMessage($update["message"]);
  16. } catch (Exception $e) {
  17. Response::error(CODE_NORMAL_ERROR, $e->getMessage());
  18. }
  19. }
  20. }
  21. }