Files
pdd_AI/native/src/Util.h
T
zhangyu 2b55aa5a44 Add native client with image adjustment and AI hybrid intent mode
Switch to WebView2 host with embedded resources, save chat images by order, and support buyer photo replace/delete via rules, dHash matching, and optional model-assisted intent parsing.
2026-11-11 02:19:26 +08:00

48 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <windows.h>
#include <string>
#include <string_view>
namespace pddai {
std::wstring Utf8ToWide(std::string_view s);
std::string WideToUtf8(std::wstring_view s);
// 复刻 Node 的 new Date().toISOString():2026-11-01T12:34:56.789Z
std::string IsoNowUtc();
// 复刻 getNextDailyTime:解析 "H:MM"/"HH:MM",返回本地时区的下一次触发时刻
bool NextDailyTime(const std::string& hhmm, SYSTEMTIME& out);
std::string FormatLocalDateTime(const SYSTEMTIME& st);
// 常量时间比较(先比长度)
bool SafeTokenEqual(std::string_view a, std::string_view b);
// 与 server/index.js escapeHtml 完全一致
std::string EscapeHtml(std::string_view value);
std::string Trim(std::string_view s);
std::wstring GetLocalAppDataDir();
// 程序所在目录
std::wstring ExeDir();
// 数据目录(WebView2 缓存、店铺登录态、日志):
// 优先 <exe 目录>\data(绿色分发);exe 目录不可写时回落到 %LOCALAPPDATA%\PddAI
std::wstring DataDir();
std::string Base64Encode(const std::string& bytes);
std::string Base64Decode(const std::string& text);
std::string Sha256Hex(const std::string& data);
// 复刻 JS 的 new Date().toUTCString():Mon, 02 Nov 2026 12:34:56 GMT
std::string Rfc2822NowUtc();
std::string ComputerNameUtf8();
void SleepMs(int ms);
std::string LowerAscii(std::string_view s);
}