feat: 修改仓库产品逻辑函数,移除数据库事务处理

This commit is contained in:
mkm 2024-08-07 17:33:58 +08:00
parent 1bae9607d8
commit 0375951b3f

View File

@ -29,10 +29,10 @@ class WarehouseProductLogic extends BaseLogic
* @author admin
* @date 2024/07/31 16:55
*/
public static function add(array $params): bool
public static function add(array $params)
{
Db::startTrans();
try {
// Db::startTrans();
// try {
$data = [
'warehouse_id' => $params['warehouse_id'],
'store_id' => $params['store_id']??0,
@ -57,14 +57,14 @@ class WarehouseProductLogic extends BaseLogic
}
$res = WarehouseProduct::create($data);
self::enter($res['id'], $params['financial_pm']);
Db::commit();
// Db::commit();
return $res;
} catch (\Exception $e) {
Db::rollback();
Log::error($e->getMessage().',file:'.$e->getFile().',line:'.$e->getLine());
self::setError($e->getMessage());
return false;
}
// } catch (\Exception $e) {
// Db::rollback();
// Log::error($e->getMessage().',file:'.$e->getFile().',line:'.$e->getLine());
// self::setError($e->getMessage());
// return false;
// }
}