<?php

namespace app\api\controller\Flow;

use app\Request;
use app\common\model\Flow\Flow as ModelFlow;
use think\db\Where;
use think\facade\Validate;
use app\BaseController;
use app\exception\ErrorMsg;
use think\facade\Filesystem;

class Flow extends BaseController
{

    /**
     * 添加流量访问记录
     */
    public function AddFlowRecord(Request $request)
    {
        $params = $request->param();
        $this->validate($params, ['flow_target' => 'require']);
        $flow_target = $params['flow_target'];

        try {
            return (new ModelFlow)->track($flow_target);
            return json(msg("添加流量访问记录成功"));
        } catch (\Throwable $th) {
            throwErrorMsg("错误信息：" . $th);
        }
    }

}
