ATemplateModuleLogic.php 2.3 KB
<?php

namespace App\Http\Logic\Aside\Template;

use App\Http\Logic\Aside\BaseLogic;
use App\Models\Template\TemplateModule;
use App\Models\Template\BSetting;
use App\Models\Template\TemplateType;

/**
 * @remark :左侧模块管理
 * @name   :ATemplateModuleLogic
 * @author :lyh
 * @time   :2023/6/28 16:58
 */
class ATemplateModuleLogic extends BaseLogic
{
    public function __construct()
    {
        parent::__construct();
        $this->model = new TemplateModule();
        $this->param = $this->requestAll;
    }

    /**
     * @remark :左侧模块列表
     * @name   :aTemplateModuleLists
     * @author :lyh
     * @method :post
     * @time   :2023/6/28 18:01
     */
    public function aTemplateModuleLists($map,$page,$row,$order = 'created_at',$filed = ['*']){
        $map['deleted_status'] = 0;
        $map['status'] = 0;
        $lists = $this->model->lists($map,$page,$row,$order,$filed);
        return $this->success($lists);
    }

    /**
     * @remark :保存左侧模块
     * @name   :aTemplateModuleSave
     * @author :lyh
     * @method :post
     * @time   :2023/6/28 18:01
     */
    public function  aTemplateModuleSave(){
        if(isset($this->param['id'])){
            $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
        }else{
            $rs = $this->model->add($this->param);
        }
        if($rs === false){
            $this->fail('error');
        }
        return $this->success();
    }

    /**
     * @remark :修改左侧模块状态
     * @name   :aTemplateModuleStatus
     * @author :lyh
     * @method :post
     * @time   :2023/6/28 18:02
     */
    public function  aTemplateModuleStatus(){
        $rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
        if($rs === false){
            $this->fail('error');
        }
        return $this->success();
    }

    /**
     * @remark :逻辑删除左侧模块
     * @name   :aTemplateModuleDel
     * @author :lyh
     * @method :post
     * @time   :2023/6/28 18:02
     */
    public function  aTemplateModuleDel(){
        //TODO::查看当前模板是否有模板在使用
        $rs = $this->model->edit(['deleted_status'=>1,'deleted_at'=>date('Y-m-d H:i:s')],['id'=>$this->param['id']]);
        if($rs === false){
            $this->fail('error');
        }
        return $this->success();
    }


}