<?php
/**
 * @desc: 上传附件时，自动保存站点ID
 * @Author: Dr.Xing <ezfwork@foxmail.com>
 * @Since: 2018/2/9 19:58
 */

namespace seven\behavior;


class TakeAttach
{
    public function run(&$params)
    {
        //upload
        if ($params instanceof \think\Model) {
            if(\think\Session::has('user_site_id')) {
                $params->site_id = \think\Session::get('user_site_id');
                $params->save();
                return;
            }
        }
        //del
        elseif ($params instanceof \think\Controller) {
            //$attId = request()->param('ids');
        }
        //unknow
        else {

        }
    }

}