MemberLogsServer.php 950 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Servers;
  3. use App\Models\MemberLog;
  4. class MemberLogsServer
  5. {
  6. /**
  7. * 会员日志
  8. * @return $this|\Illuminate\Database\Eloquent\Model
  9. */
  10. static public function write()
  11. {
  12. if('common.base64'==request()->route()->getName()){
  13. return 1;
  14. }
  15. $m_id=empty(request()->member['m_id'])?:0;
  16. $url = request()->url();
  17. $token=request()->header('Authorization');
  18. if(empty($token)){
  19. $token = request()->input('token','');
  20. }
  21. $data=request()->all();
  22. $data['token']=$token;
  23. $ip=CommonServer::creatServer()->getClientIp();
  24. //广播弹幕-进入队列
  25. return MemberLog::create(
  26. [
  27. 'm_id' => $m_id,
  28. 'url' => $url,
  29. 'msg' => '',
  30. 'ip' => $ip,
  31. 'data' => http_build_query($data),
  32. ]
  33. );
  34. }
  35. }