AccountLogModel.php 697 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. //请求日志模型(手机端)
  5. class AccountLogModel extends Model
  6. {
  7. protected $table = 'fc_account_log';
  8. protected $pk = 'id';
  9. protected $autoWriteTimestamp = 'datetime';
  10. //添加一条请求记录
  11. public static function add(string $request_id = '', array $param = [])
  12. {
  13. return self::create([
  14. 'request_id' => $request_id,
  15. 'ipaddr' => request()->ip(),
  16. 'action' => request()->pathinfo(),
  17. 'param' => json_encode($param, JSON_UNESCAPED_UNICODE),
  18. 'addtime' => date('Y-m-d H:i:s'),
  19. 'updatetime' => date('Y-m-d H:i:s'),
  20. ])->save();
  21. }
  22. }