mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-31 18:48:09 +00:00
96 lines
2.4 KiB
Plaintext
96 lines
2.4 KiB
Plaintext
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | Niucloud-admin 企业快速开发的saas管理平台
|
||
// +----------------------------------------------------------------------
|
||
// | 官方网址:https://www.niucloud-admin.com
|
||
// +----------------------------------------------------------------------
|
||
// | niucloud团队 版权所有 开源版本可自由商用
|
||
// +----------------------------------------------------------------------
|
||
// | Author: Niucloud Team
|
||
// +----------------------------------------------------------------------
|
||
|
||
{NAMESPACE}
|
||
|
||
{USE}
|
||
use core\base\BaseAdminService;
|
||
|
||
/**
|
||
* {NOTES}服务层
|
||
* Class {UCASE_NAME}Service
|
||
* @package app\service\admin{PACKAGE_NAME}
|
||
*/
|
||
class {UCASE_NAME}Service extends BaseAdminService
|
||
{
|
||
public function __construct()
|
||
{
|
||
parent::__construct();
|
||
$this->model = new {UCASE_NAME}();
|
||
}
|
||
|
||
/**
|
||
* 获取{NOTES}列表
|
||
* @param array $where
|
||
* @return array
|
||
*/
|
||
public function getPage(array $where = [])
|
||
{
|
||
$where[] = ['site_id', '=', $this->site_id];
|
||
$field = '{FIELDS}';
|
||
$order = '';
|
||
|
||
$search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch([{SEARCH_FIELDS}], $where)->field($field)->order($order);
|
||
$list = $this->pageQuery($search_model);
|
||
return $list;
|
||
}
|
||
|
||
/**
|
||
* 获取{NOTES}信息
|
||
* @param int $id
|
||
* @return array
|
||
*/
|
||
public function getInfo(int $id)
|
||
{
|
||
$field = '{FIELDS}';
|
||
|
||
$info = $this->model->field($field)->where([['{PK}', '=', $id], ['site_id', '=', $this->site_id]])->findOrEmpty()->toArray();
|
||
return $info;
|
||
}
|
||
|
||
/**
|
||
* 添加{NOTES}
|
||
* @param array $data
|
||
* @return mixed
|
||
*/
|
||
public function add(array $data)
|
||
{
|
||
$data['site_id'] = $this->site_id;
|
||
$res = $this->model->create($data);
|
||
return $res->{PK};
|
||
|
||
}
|
||
|
||
/**
|
||
* {NOTES}编辑
|
||
* @param int $id
|
||
* @param array $data
|
||
* @return bool
|
||
*/
|
||
public function edit(int $id, array $data)
|
||
{
|
||
|
||
$this->model->where([['{PK}', '=', $id], ['site_id', '=', $this->site_id]])->update($data);
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* 删除{NOTES}
|
||
* @param int $id
|
||
* @return bool
|
||
*/
|
||
public function del(int $id)
|
||
{
|
||
$res = $this->model->where([['{PK}', '=', $id], ['site_id', '=', $this->site_id]])->delete();
|
||
return $res;
|
||
}
|
||
|
||
} |