fastadmin/extend/seven/behavior/TakeAttach.php

39 lines
904 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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->canDelete = 1;
$params->save();
return;
}
if(request()->param('siteid')) {
$params->site_id = request()->param('siteid');
$params->canDelete = 1;
$params->save();
}
}
//del
elseif ($params instanceof \think\Controller) {
//$attId = request()->param('ids');
}
//unknow
else {
}
}
}