$params['org_id'] ?? 0, 'dept_id' => $params['dept_id'] ?? 0, 'account_sn' => $params['account_sn'] ?? '', 'deposit_bank' => $params['deposit_bank'] ?? '', 'account_name' => $params['account_name'] ?? '', 'account' => $params['account'] ?? '', 'account_opening_date' => $params['account_opening_date'] ?? '', 'opening_amount' => $params['opening_amount'] ?? 0, 'remark' => $params['remark'] ?? '', ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑 * @param array $params * @return bool * @author likeadmin * @date 2023/12/20 15:04 */ public static function edit(array $params): bool { Db::startTrans(); try { BankAccount::where('id', $params['id'])->update([ 'org_id' => $params['org_id'] ?? 0, 'dept_id' => $params['dept_id'] ?? 0, 'account_sn' => $params['account_sn'] ?? '', 'deposit_bank' => $params['deposit_bank'] ?? '', 'account_name' => $params['account_name'] ?? '', 'account' => $params['account'] ?? '', 'account_opening_date' => $params['account_opening_date'] ?? '', 'opening_amount' => $params['opening_amount'] ?? 0, 'remark' => $params['remark'] ?? '', ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除 * @param array $params * @return bool * @author likeadmin * @date 2023/12/20 15:04 */ public static function delete(array $params): bool { return BankAccount::destroy($params['id']); } /** * @notes 获取详情 * @param $params * @return array * @author likeadmin * @date 2023/12/20 15:04 */ public static function detail($params): array { return BankAccount::findOrEmpty($params['id'])->toArray(); } }