12345678910111213141516171819202122232425262728 |
- <?php
- namespace app\model;
- use think\Model;
- //请求日志模型(手机端)
- class AccountLogModel extends Model
- {
- protected $table = 'fc_account_log';
- protected $pk = 'id';
- protected $autoWriteTimestamp = 'datetime';
- //添加一条请求记录
- public static function add(string $request_id = '', array $param = [])
- {
- return self::create([
- 'request_id' => $request_id,
- 'ipaddr' => request()->ip(),
- 'action' => request()->pathinfo(),
- 'param' => json_encode($param, JSON_UNESCAPED_UNICODE),
- 'addtime' => date('Y-m-d H:i:s'),
- 'updatetime' => date('Y-m-d H:i:s'),
- ])->save();
- }
- }
|