12 changed files with 262 additions and 39 deletions
-
57app/common.php
-
19app/controller/Audit/AuditController.php
-
21app/controller/substance/RecycleController.php
-
13app/controller/substance/ResourceController.php
-
9app/model/Recycle.php
-
8app/model/Resource.php
-
11app/model/ResourceDir.php
-
57app/service/AuditService.php
-
39app/service/RecycleService.php
-
20app/service/ResourceDirService.php
-
37app/service/ResourceService.php
-
8route/substance.php
@ -0,0 +1,21 @@ |
|||
<?php |
|||
|
|||
namespace app\controller\substance; |
|||
|
|||
use app\model\Resource; |
|||
use app\service\ResourceService; |
|||
use app\service\ShareService; |
|||
use app\validate\ResourceValidate; |
|||
use think\exception\ValidateException; |
|||
use think\facade\Db; |
|||
use think\facade\Lang; |
|||
use think\Request; |
|||
|
|||
class RecycleController |
|||
{ |
|||
public function index() |
|||
{ |
|||
echo 123; |
|||
die; |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
<?php |
|||
|
|||
namespace app\model; |
|||
|
|||
use app\exception\ModelException; |
|||
|
|||
class Recycle extends Model |
|||
{ |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
<?php |
|||
|
|||
namespace app\service; |
|||
|
|||
use app\exception\ModelException; |
|||
use app\model\Recycle; |
|||
use app\model\Resource; |
|||
use app\model\ResourceDir; |
|||
use app\model\Share; |
|||
|
|||
class RecycleService extends Service |
|||
{ |
|||
|
|||
//todo 需要一个脚本处理回收站过期的了数据
|
|||
/** |
|||
* 添加一个资源到回收站 |
|||
* @param Resource $resource |
|||
* @return array |
|||
*/ |
|||
public function putResourceInRecycle(Resource $resource) |
|||
{ |
|||
//todo seller_id user_id 处理
|
|||
$resource_dir_service = new ResourceDirService(); |
|||
$recycle = new Recycle(); |
|||
$recycle->seller_id = 1; |
|||
$recycle->target_id = $resource->id; |
|||
$recycle->table_name = 'resource'; |
|||
$recycle->user_id = 1; |
|||
$recycle->dir_name = $resource_dir_service->getResourceDirNamePath($resource); |
|||
$recycle->expire_time = getdaysLater(90); |
|||
$recycle->save(); |
|||
|
|||
//修改资源的删除状态
|
|||
$resource->is_del = 1; |
|||
$resource->save(); |
|||
|
|||
return dataReturn(0, '加入回收站成功'); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue