Merge pull request 'feat: 修改仓库产品逻辑函数,移除数据库事务处理' (#113) from dev into main

Reviewed-on: #113
This commit is contained in:
mkm 2024-08-07 17:34:32 +08:00
commit fc87dbf824

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;
// }
}