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