Merge pull request '新增材料设置模块' (#111) from zhangwei into dev

Reviewed-on: #111
This commit is contained in:
weiz 2024-01-04 14:13:01 +08:00
commit f444c73fe9
11 changed files with 949 additions and 1 deletions

View File

@ -0,0 +1,105 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\material;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\material\MaterialClassifyLists;
use app\adminapi\logic\material\MaterialClassifyLogic;
use app\adminapi\validate\material\MaterialClassifyValidate;
use app\common\model\material\MaterialClassify;
/**
* 材料分类控制器
* Class MaterialClassifyController
* @package app\adminapi\controller\material
*/
class MaterialClassifyController extends BaseAdminController
{
/**
* @notes 获取材料分类列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function lists()
{
return $this->dataLists(new MaterialClassifyLists());
}
/**
* @notes 添加材料分类
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function add()
{
$params = (new MaterialClassifyValidate())->post()->goCheck('add');
$result = MaterialClassifyLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(MaterialClassifyLogic::getError());
}
/**
* @notes 编辑材料分类
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function edit()
{
$params = (new MaterialClassifyValidate())->post()->goCheck('edit');
$result = MaterialClassifyLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(MaterialClassifyLogic::getError());
}
/**
* @notes 获取材料分类详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function detail()
{
$params = (new MaterialClassifyValidate())->goCheck('detail');
$result = MaterialClassifyLogic::detail($params);
return $this->data($result);
}
public function datas(): \think\response\Json
{
$pid = $this->request->get('pid');
if(!isset($pid) || $pid == ''){
return $this->fail('缺少必要参数');
}
$data = MaterialClassify::field('id,name')->where('pid',$pid)->select()->toArray();
return $this->success('请求成功',$data);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\material;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\material\MaterialLists;
use app\adminapi\logic\material\MaterialLogic;
use app\adminapi\validate\material\MaterialValidate;
/**
* 自购材料控制器
* Class MaterialController
* @package app\adminapi\controller\material
*/
class MaterialController extends BaseAdminController
{
/**
* @notes 获取自购材料列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function lists()
{
return $this->dataLists(new MaterialLists());
}
/**
* @notes 添加自购材料
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function add()
{
$params = (new MaterialValidate())->post()->goCheck('add');
$result = MaterialLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(MaterialLogic::getError());
}
/**
* @notes 编辑自购材料
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function edit()
{
$params = (new MaterialValidate())->post()->goCheck('edit');
$result = MaterialLogic::edit($params,$this->adminId);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(MaterialLogic::getError());
}
/**
* @notes 删除自购材料
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function delete()
{
$params = (new MaterialValidate())->post()->goCheck('delete');
MaterialLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取自购材料详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function detail()
{
$params = (new MaterialValidate())->goCheck('detail');
$result = MaterialLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\material;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\material\MaterialClassify;
use app\common\lists\ListsSearchInterface;
/**
* 材料分类列表
* Class MaterialClassifyLists
* @package app\adminapi\listsmaterial
*/
class MaterialClassifyLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function setSearch(): array
{
return [
'%like%' => ['name'],
];
}
/**
* @notes 获取材料分类列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function lists(): array
{
$data = MaterialClassify::where($this->searchWhere)
->field(['id', 'pid', 'name'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'asc'])
->select()
->toArray();
$tree = buildTree($data,'pid');
return $tree;
}
/**
* @notes 获取材料分类数量
* @return int
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function count(): int
{
return MaterialClassify::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,85 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\material;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\material\Material;
use app\common\lists\ListsSearchInterface;
use app\common\model\material\MaterialClassify;
/**
* 自购材料列表
* Class MaterialLists
* @package app\adminapi\listsmaterial
*/
class MaterialLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function setSearch(): array
{
return [
'=' => ['first_level', 'second_level', 'three_level'],
'%like%' => ['code', 'brand', 'name'],
];
}
/**
* @notes 获取自购材料列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function lists(): array
{
return Material::where($this->searchWhere)
->field(['id', 'first_level', 'second_level', 'three_level', 'code', 'brand', 'name', 'specs', 'unit', 'parameter_description', 'inventory', 'sales_price', 'cost_price', 'annex'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($item){
$classify = MaterialClassify::where('id','in',[$item['first_level'],$item['second_level'],$item['three_level']])->column('name','id');
$item['first_level_name'] = $classify[$item['first_level']];
$item['second_level_name'] = !empty($classify[$item['second_level']]) ? $classify[$item['second_level']] : '';
$item['three_level_name'] = !empty($classify[$item['three_level']]) ? $classify[$item['three_level']] : '';
return $item;
})
->toArray();
}
/**
* @notes 获取自购材料数量
* @return int
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function count(): int
{
return Material::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,107 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\material;
use app\common\model\material\MaterialClassify;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 材料分类逻辑
* Class MaterialClassifyLogic
* @package app\adminapi\logic\material
*/
class MaterialClassifyLogic extends BaseLogic
{
/**
* @notes 添加材料分类
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/01/04 09:47
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
MaterialClassify::create([
'pid' => $params['pid'],
'name' => $params['name'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑材料分类
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/01/04 09:47
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
MaterialClassify::where('id', $params['id'])->update([
'pid' => $params['pid'],
'name' => $params['name'],
'update_time' => time()
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除材料分类
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/01/04 09:47
*/
public static function delete(array $params): bool
{
return MaterialClassify::destroy($params['id']);
}
/**
* @notes 获取材料分类详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/01/04 09:47
*/
public static function detail($params): array
{
return MaterialClassify::field('id,pid,name,create_time')->findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,143 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\material;
use app\common\model\auth\Admin;
use app\common\model\material\Material;
use app\common\logic\BaseLogic;
use app\common\model\material\MaterialClassify;
use think\facade\Db;
/**
* 自购材料逻辑
* Class MaterialLogic
* @package app\adminapi\logic\material
*/
class MaterialLogic extends BaseLogic
{
/**
* @notes 添加自购材料
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/01/04 10:59
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
Material::create([
'first_level' => $params['first_level'],
'second_level' => $params['second_level'] ?? 0,
'three_level' => $params['three_level'] ?? 0,
'code' => $params['code'],
'brand' => $params['brand'] ?? '',
'name' => $params['name'],
'specs' => $params['specs'],
'unit' => $params['unit'],
'parameter_description' => $params['parameter_description'] ?? '',
'inventory' => $params['inventory'] ?? 0,
'sales_price' => $params['sales_price'] ?? 0,
'cost_price' => $params['cost_price'] ?? 0,
'annex' => !empty($params['annex']) ? $params['annex'] : null,
'add_user' => $admin_id,
'update_user' => $admin_id,
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑自购材料
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/01/04 10:59
*/
public static function edit(array $params,$admin_id): bool
{
Db::startTrans();
try {
Material::where('id', $params['id'])->update([
'first_level' => $params['first_level'],
'second_level' => $params['second_level'] ?? 0,
'three_level' => $params['three_level'] ?? 0,
'code' => $params['code'],
'brand' => $params['brand'] ?? '',
'name' => $params['name'],
'specs' => $params['specs'],
'unit' => $params['unit'],
'parameter_description' => $params['parameter_description'] ?? '',
'inventory' => $params['inventory'] ?? 0,
'sales_price' => $params['sales_price'] ?? 0,
'cost_price' => $params['cost_price'] ?? 0,
'annex' => !empty($params['annex']) ? $params['annex'] : null,
'update_user' => $admin_id,
'update_time' => time()
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除自购材料
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/01/04 10:59
*/
public static function delete(array $params): bool
{
return Material::destroy($params['id']);
}
/**
* @notes 获取自购材料详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/01/04 10:59
*/
public static function detail($params): array
{
$field = 'id,first_level,second_level,three_level,code,brand,name,specs,unit,parameter_description,inventory,sales_price,cost_price,annex,add_user,update_user,create_time,update_time';
$data = Material::field($field)->findOrEmpty($params['id'])->toArray();
$classify = MaterialClassify::where('id','in',[$data['first_level'],$data['second_level'],$data['three_level']])->column('name','id');
$admin = Admin::where('id','in',[$data['add_user'],$data['update_user']])->column('name','id');
$data['first_level_name'] = $classify[$data['first_level']];
$data['second_level_name'] = !empty($classify[$data['second_level']]) ? $classify[$data['second_level']] : '';
$data['three_level_name'] = !empty($classify[$data['three_level']]) ? $classify[$data['three_level']] : '';
$data['add_user_name'] = $admin[$data['add_user']];
$data['update_user_name'] = $admin[$data['update_user']];
return $data;
}
}

View File

@ -111,13 +111,14 @@ class ProjectPreSalesMembersLogic extends BaseLogic
public static function detail($params): array
{
$data = ProjectPreSalesMembers::field('id,project_id,technician_ids,business_people_ids,cross_departmental_personnel_ids,add_user,create_time')->findOrEmpty($params['id'])->toArray();
$project = Project::field('id,custom_id,name')->where('id',$data['project_id'])->findOrEmpty();
$project = Project::field('id,custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
$custom = Custom::field('id,name')->where('id',$project['custom_id'])->findOrEmpty();
$technician = Admin::where('id','in',$data['technician_ids'])->column('name');
$business_people = Admin::where('id','in',$data['business_people_ids'])->column('name');
$cross_departmental_personnel = Admin::where('id','in',$data['cross_departmental_personnel_ids'])->column('name');
$add_user = Admin::field('name')->where('id',$data['add_user'])->findOrEmpty();
$data['project_name'] = $project['name'];
$data['project_code'] = $project['project_code'];
$data['custom_name'] = $custom['name'];
$data['technician'] = implode(',',$technician);
$data['business_people'] = implode(',',$business_people);

View File

@ -0,0 +1,102 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\material;
use app\common\model\material\MaterialClassify;
use app\common\validate\BaseValidate;
/**
* 材料分类验证器
* Class MaterialClassifyValidate
* @package app\adminapi\validate\material
*/
class MaterialClassifyValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'pid' => 'require',
'name' => 'require|checkName',
];
protected $message = [
'id.require' => '缺少必要参数',
'pid.require' => '请选择上级分类',
'name.require' => '请填写分类名称',
];
/**
* @notes 添加场景
* @return MaterialClassifyValidate
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function sceneAdd()
{
return $this->only(['pid','name']);
}
/**
* @notes 编辑场景
* @return MaterialClassifyValidate
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function sceneEdit()
{
return $this->only(['id','pid','name']);
}
/**
* @notes 删除场景
* @return MaterialClassifyValidate
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return MaterialClassifyValidate
* @author likeadmin
* @date 2024/01/04 09:47
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkName($value,$rule,$data): bool|string
{
$data = MaterialClassify::where('pid',$data['pid'])->where('name',$value)->findOrEmpty();
if(!$data->isEmpty()){
return '该分类名称已存在';
}
return true;
}
}

View File

@ -0,0 +1,147 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\material;
use app\common\model\material\MaterialClassify;
use app\common\validate\BaseValidate;
/**
* 自购材料验证器
* Class MaterialValidate
* @package app\adminapi\validate\material
*/
class MaterialValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'first_level' => 'require|checkFirstLevel',
'second_level' => 'checkSecondLevel',
'three_level' => 'checkThreeLevel',
'code' => 'require',
'name' => 'require',
'specs' => 'require',
'unit' => 'require',
'inventory' => 'integer|egt:0',
'sales_price' => 'float|egt:0',
'cost_price' => 'float|egt:0',
'annex' => 'checkAnnex'
];
protected $message = [
'id.require' => '缺少必要参数',
'first_level.require' => '请选择材料大类',
'code.require' => '请填写材料编码',
'name.require' => '请填写材料名称',
'specs.require' => '请填写规格型号',
'unit.require' => '请填写单位',
'inventory.integer' => '安全库存量值必须是整数',
'inventory.egt' => '安全库存量值必须大于等于0',
'sales_price.float' => '销售指导价值必须是数字',
'sales_price.egt' => '销售指导价值必须大于等于0',
'cost_price.float' => '预算成本价值必须是数字',
'cost_price.egt' => '预算成本价值必须大于等于0',
];
/**
* @notes 添加场景
* @return MaterialValidate
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function sceneAdd()
{
return $this->remove('id',true);
}
/**
* @notes 编辑场景
* @return MaterialValidate
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function sceneEdit()
{}
/**
* @notes 删除场景
* @return MaterialValidate
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return MaterialValidate
* @author likeadmin
* @date 2024/01/04 10:59
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkFirstLevel($value): bool|string
{
$classify = MaterialClassify::where('id',$value)->where('pid',0)->findOrEmpty();
if($classify->isEmpty()){
return '材料大类不存在';
}
return true;
}
public function checkSecondLevel($value,$rule,$data): bool|string
{
$classify = MaterialClassify::where('id',$value)->where('pid',$data['first_level'])->findOrEmpty();
if($classify->isEmpty()){
return '材料中类不存在';
}
return true;
}
public function checkThreeLevel($value,$rule,$data): bool|string
{
$classify = MaterialClassify::where('id',$value)->where('pid',$data['second_level'])->findOrEmpty();
if($classify->isEmpty()){
return '材料小类不存在';
}
return true;
}
public function checkAnnex($value): bool|string
{
if(!empty($value) && $value != ''){
$annex = json_decode($value,true);
if(empty($annex) || !is_array($annex)){
return '附件格式错误';
}
}
return true;
}
}

View File

@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\material;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 自购材料模型
* Class Material
* @package app\common\model\material
*/
class Material extends BaseModel
{
use SoftDelete;
protected $name = 'material';
protected $deleteTime = 'delete_time';
public function getAnnexAttr($value)
{
return empty($value) ? null : json_decode($value,true);
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\material;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 材料分类模型
* Class MaterialClassify
* @package app\common\model\material
*/
class MaterialClassify extends BaseModel
{
use SoftDelete;
protected $name = 'material_classify';
protected $deleteTime = 'delete_time';
}