imcallback.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. header("Content-Type:text/html; charset=utf-8");
  3. $json = $GLOBALS['HTTP_RAW_POST_DATA'];
  4. $post = json_decode($json,true);
  5. define("CTL",'ctl');
  6. define("ACT",'act');
  7. if(!defined('APP_ROOT_PATH'))
  8. define('APP_ROOT_PATH', str_replace('imcallback.php', '', str_replace('\\', '/', __FILE__)));
  9. require APP_ROOT_PATH.'public/directory_init.php';
  10. require APP_ROOT_PATH.'system/define.php';
  11. require APP_ROOT_PATH."system/cache/Rediscache/Rediscache.php";
  12. if ($post['CallbackCommand'] == 'Group.CallbackAfterNewMemberJoin'){
  13. define("FANWE_REQUIRE",true);
  14. //require './system/system_init.php';
  15. require(APP_ROOT_PATH.'mapi/lib/redis/BaseRedisService.php');
  16. require(APP_ROOT_PATH.'mapi/lib/redis/VideoViewerRedisService.php');
  17. $video_viewer_obj = new VideoViewerRedisService();
  18. $video_viewer_obj->member_join($post);
  19. }else if ($post['CallbackCommand'] == 'Group.CallbackAfterMemberExit'){
  20. define("FANWE_REQUIRE",true);
  21. //require './system/system_init.php';
  22. require(APP_ROOT_PATH.'mapi/lib/redis/BaseRedisService.php');
  23. require(APP_ROOT_PATH.'mapi/lib/redis/VideoViewerRedisService.php');
  24. $video_viewer_obj = new VideoViewerRedisService();
  25. $video_viewer_obj->member_exit($post);
  26. }
  27. $data = array();
  28. $data['ActionStatus'] = 'OK';
  29. $data['ErrorCode'] = 0;
  30. $data['ErrorInfo'] = '';
  31. echo json_encode($data);
  32. exit;
  33. // 打印log
  34. function log_result2($word)
  35. {
  36. $file="./imcallback_log/notify_url.log";//log文件路径
  37. $fp = fopen($file,"a");
  38. flock($fp, LOCK_EX) ;
  39. fwrite($fp,"执行日期:".strftime("%Y-%m-%d-%H:%M:%S",time())."\n".$word."\n\n");
  40. flock($fp, LOCK_UN);
  41. fclose($fp);
  42. }
  43. ?>