12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace app\abutment\model;
- use think\Model;
- //请求记录日志表
- class RequestLog extends Model
- {
- protected $table = 'wsm_abutment_request_log';
- protected $pk = 'id';
- protected $autoWriteTimestamp = 'datetime';
- // 定义时间戳字段名
- protected $createTime = 'addtime';
- protected $updateTime = 'updatetime';
- 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),
- ])->save();
- }
- }
|