<?php
namespace app\model;

use think\Model;

class RoleMenu extends Model
{
    protected $table = 'eb_role_menu';
    protected $primaryKey = 'id';
    public $timestamps = false;

    public function saveData(array $param):array
    {
        $info = $this->saveAll($param);
        if ($info) return show(true, '保存成功');
        return show(false, '保存失败,请重试');
    }

    public function delByRoleId(int $roleId):array
    {
        $info = $this->where('role_id', $roleId)->where('delete_time', 0)->update(['delete_time' => time()]);
        if ($info) return show(true, '保存成功');
        return show(false, '保存失败,请重试');
    }
}