<?php

namespace App\Facades\Wo;

use App\Models\Log as LogModel;

class Log
{

    /**
     * 插入日志
     * @param  [type] $url    [description]
     * @param  [type] $method [description]
     * @param  [type] $params [description]
     * @param  string $type   [description]
     * @return [type]         [description]
     */
    public static function insert($url, $method, $params, $type = 'pingan')
    {
        $params['form_params']['merchantCert'] = '';
        $params['form_params']['merchantSign'] = '';
        $data                                  = [
            'path'      => $url,
            'method'    => $method,
            'type'      => $type,
            'in_source' => $params,
        ];

        $info = LogModel::create($data);
        return $info;
    }

    //更新日志
    public static function update($log, $params)
    {
        $log->out_source = $params;
        $log->save();
    }

}
