BlogLabelLogic.php 1.6 KB
<?php

namespace App\Http\Logic\Bside\Blog;

use App\Enums\Common\Code;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Blog\BlogLabel as BlogLabelModel;

class BlogLabelLogic extends BaseLogic
{
    public function __construct()
    {
        parent::__construct();

        $this->model = new BlogLabelModel();
        $this->param = $this->requestAll;
    }

    /**
     * @name :新增标签
     * @return void
     * @author :liyuhang
     * @method
     */
    public function add_blog_label(){
        $this->param['create_id'] = $this->user['id'];
        $this->param['Operator_id'] = $this->user['id'];
        $this->param['project_id'] = $this->user['project_id'];
        $rs = $this->model->add($this->param);
        if($rs ===  false){
            $this->fail('error',Code::USER_ERROR);
        }
        return $this->success();
    }

    /**
     * @name :编辑标签
     * @return void
     * @author :liyuhang
     * @method
     */
    public function edit_blog_label(){
        $this->param['operator_id'] = $this->user['id'];
        $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
        //TODO::路由映射
        if($rs ===  false){
            $this->fail('error',Code::USER_ERROR);
        }
        return $this->success();
    }

    /**
     * @name :删除标签
     * @return array
     * @author :liyuhang
     * @method
     */
    public function del_blog_label(){
        $this->param['id'] = ['in',$this->param['id']];
        $rs = $this->model->del($this->param);
        if($rs === false){
            $this->fail('error',Code::USER_ERROR);
        }
        return $this->success();
    }
}