erp/app/admin/logic/operation/OpurchaseclassLogic.php
2024-04-27 11:41:34 +08:00

94 lines
1.9 KiB
PHP

<?php
namespace app\admin\logic\operation;
use app\common\model\operation\Opurchaseclass;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 采购订单逻辑
* Class OpurchaseclassLogic
* @package app\admin\logic\operation
*/
class OpurchaseclassLogic extends BaseLogic
{
/**
* @notes 添加采购订单
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/27 11:26
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Opurchaseclass::create([
]);
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/04/27 11:26
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Opurchaseclass::where('id', $params['id'])->update([
]);
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/04/27 11:26
*/
public static function delete(array $params): bool
{
return Opurchaseclass::destroy($params['id']);
}
/**
* @notes 获取采购订单详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/27 11:26
*/
public static function detail($params): array
{
return Opurchaseclass::findOrEmpty($params['id'])->toArray();
}
}