修复问题

master
lzq 2025-08-11 22:43:23 +08:00
parent 6e94380244
commit d32457f28b
1 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,7 @@
#include "test.h" #include "test.h"
#include "application.h" #include "application.h"
#include "common/date_util.h"
#include "common/snowflake.h"
namespace zsy namespace zsy
{ {
@ -58,8 +60,7 @@ namespace zsy
{ {
LOGGER_ERROR("错误", e.what()); LOGGER_ERROR("错误", e.what());
j["结果"] = "错误"; j["结果"] = "错误";
} } catch (...)
catch (...)
{ {
LOGGER_ERROR("错误"); LOGGER_ERROR("错误");
j["结果"] = "错误"; j["结果"] = "错误";
@ -79,8 +80,7 @@ namespace zsy
{ {
LOGGER_ERROR("错误", e.what()); LOGGER_ERROR("错误", e.what());
j["结果"] = "错误"; j["结果"] = "错误";
} } catch (...)
catch (...)
{ {
LOGGER_ERROR("错误"); LOGGER_ERROR("错误");
j["结果"] = "错误"; j["结果"] = "错误";
@ -100,8 +100,7 @@ namespace zsy
{ {
LOGGER_ERROR("错误", e.what()); LOGGER_ERROR("错误", e.what());
j["结果"] = "错误"; j["结果"] = "错误";
} } catch (...)
catch (...)
{ {
LOGGER_ERROR("错误"); LOGGER_ERROR("错误");
j["结果"] = "错误"; j["结果"] = "错误";
@ -116,13 +115,16 @@ namespace zsy
{ {
auto sn = req.get_param_value("sn"); auto sn = req.get_param_value("sn");
auto photograph = Application::deviceHolder->getVidicon(sn)->photograph(); auto photograph = Application::deviceHolder->getVidicon(sn)->photograph();
j["结果"] = ""; std::string date = DateUtil::format(Ymd);
auto photoId = Snowflake::genIdStr();
auto [carFrontUrlSucc,carFrontUrl] = Application::oss->upload(date + "/" + "front_" + photoId + ".jpg", photograph);
j["结果"] = carFrontUrlSucc;
j["地址"] = carFrontUrl;
} catch (std::exception &e) } catch (std::exception &e)
{ {
LOGGER_ERROR("错误", e.what()); LOGGER_ERROR("错误", e.what());
j["结果"] = "错误"; j["结果"] = "错误";
} } catch (...)
catch (...)
{ {
LOGGER_ERROR("错误"); LOGGER_ERROR("错误");
j["结果"] = "错误"; j["结果"] = "错误";