OrderDirMgr.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. #include "stdafx.h"
  2. #include "OrderDirMgr.h"
  3. #include "Global.h"
  4. #include "DataBaseOpt.h"
  5. #include "ffscoex.h"
  6. #include "CharacterConvert.h"
  7. using namespace helper_coffs;
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. OrderDirMgr::OrderDirMgr()
  14. {
  15. }
  16. OrderDirMgr::~OrderDirMgr()
  17. {
  18. ClearShareInfo();
  19. ClearOrderInfo();
  20. }
  21. /************************************************************************/
  22. /*
  23. 函数: InitShareDir
  24. 描述: 初始化共享目录
  25. 参数:
  26. IN DataBaseOpt* pDBOpt 数据库操作
  27. IN LPCTSTR lpLocalDomain 本店域名
  28. 返回: 1成功,0失败
  29. */
  30. /************************************************************************/
  31. int OrderDirMgr::InitShareDir(IN DataBaseOpt* pDBOpt, IN LPCTSTR lpLocalDomain)
  32. {
  33. //获取客户端设置的备份目录和共享目录路径
  34. GetBackupDirFromDB(pDBOpt, lpLocalDomain);
  35. //加载本地目录
  36. LoadLocalShareDir(lpLocalDomain);
  37. GetShareDirFromDB(pDBOpt);
  38. return 1;
  39. }
  40. /************************************************************************/
  41. /*
  42. 函数: GetBackupDirFromDB
  43. 描述: 获取备份目录
  44. 参数:
  45. IN DataBaseOpt* pDBOpt 数据库操作
  46. IN LPCTSTR lpLocalDomain 本店域名
  47. 返回: 1成功,0失败
  48. */
  49. /************************************************************************/
  50. int OrderDirMgr::GetBackupDirFromDB(IN DataBaseOpt* pDBOpt, IN LPCTSTR lpLocalDomain)
  51. {
  52. if(pDBOpt == NULL)
  53. return 0;
  54. if(!pDBOpt->IsOpenDB())
  55. return 0;
  56. //读取vesion表里的备份目录
  57. CArray<CStringArray,CStringArray> bakDirArr;
  58. std::vector<CString> vFields;
  59. vFields.push_back(_T("bak1"));
  60. vFields.push_back(_T("bak2"));
  61. vFields.push_back(_T("bak3"));
  62. vFields.push_back(_T("bak4"));
  63. vFields.push_back(_T("bakserver1"));
  64. vFields.push_back(_T("bakserver2"));
  65. vFields.push_back(_T("bakserver3"));
  66. vFields.push_back(_T("bakserver4"));
  67. if(pDBOpt->Select(bakDirArr, _T("version"), vFields))
  68. {
  69. for(int i=0; i < 4; i++)
  70. {
  71. //过滤不可用的目录
  72. if(_ttoi(bakDirArr.ElementAt(0).ElementAt(i)) == 0 || bakDirArr.ElementAt(0).ElementAt(i+4) == _T(""))
  73. continue;
  74. LPTblNetShareInfo p = new TblNetShareInfo;
  75. p->bEnable = _ttoi(bakDirArr.ElementAt(0).ElementAt(i));
  76. _tcscpy(p->szBranchId, lpLocalDomain);
  77. _tcscpy(p->szShareDirectory, bakDirArr.ElementAt(0).ElementAt(i+4));
  78. CString strLog = _T("");
  79. strLog.Format(_T("%s\n"), p->szShareDirectory);
  80. WriteLogin(strLog);
  81. p->byMinCapacity = 5;
  82. p->byMaxCapacity = 35;
  83. p->byPhotoType = (BYTE)(i+5);
  84. p->byPriority = 255;
  85. m_vShareDir.push_back(p);
  86. }
  87. }
  88. return 1;
  89. }
  90. /************************************************************************/
  91. /*
  92. 函数: GetShareDirFromDB
  93. 描述: 获取备份目录通过数据库
  94. 参数:
  95. IN DataBaseOpt* pDBOpt 数据库操作
  96. 返回: 1成功,0失败
  97. */
  98. /************************************************************************/
  99. int OrderDirMgr::GetShareDirFromDB(IN DataBaseOpt* pDBOpt)
  100. {
  101. if(pDBOpt == NULL)
  102. return 0;
  103. if(!pDBOpt->IsOpenDB())
  104. return 0;
  105. //读取vesion表里的备份目录
  106. CArray<CStringArray,CStringArray> shareDirArr;
  107. std::vector<CString> vFields;
  108. vFields.push_back(_T("enable"));
  109. vFields.push_back(_T("branchid"));
  110. vFields.push_back(_T("sharePath"));
  111. vFields.push_back(_T("mincapacity"));
  112. vFields.push_back(_T("maxcapacity"));
  113. vFields.push_back(_T("photoType"));
  114. vFields.push_back(_T("priority"));
  115. if(pDBOpt->Select(shareDirArr, _T("NetShareInfo"), vFields))
  116. {
  117. for(int i=0; i<shareDirArr.GetSize(); i++)
  118. {
  119. //过滤不可用的目录
  120. if(_ttoi(shareDirArr.ElementAt(i).ElementAt(0)) == 0 || shareDirArr.ElementAt(i).ElementAt(2) == _T(""))
  121. continue;
  122. LPTblNetShareInfo p = new TblNetShareInfo;
  123. p->bEnable = _ttoi(shareDirArr.ElementAt(i).ElementAt(0));
  124. #ifdef _UNICODE
  125. wcscpy(p->szBranchId, shareDirArr.ElementAt(i).ElementAt(1));
  126. wcscpy(p->szShareDirectory, shareDirArr.ElementAt(i).ElementAt(2));
  127. #else
  128. strcpy(p->szBranchId, shareDirArr.ElementAt(i).ElementAt(1));
  129. strcpy(p->szShareDirectory, shareDirArr.ElementAt(i).ElementAt(2));
  130. #endif
  131. CString strLog = _T("");
  132. strLog.Format(_T("%s\n"), p->szShareDirectory);
  133. WriteLogin(strLog);
  134. p->byMinCapacity = _ttoi(shareDirArr.ElementAt(i).ElementAt(3));
  135. p->byMaxCapacity = _ttoi(shareDirArr.ElementAt(i).ElementAt(4));
  136. p->byPhotoType = _ttoi(shareDirArr.ElementAt(i).ElementAt(5));
  137. p->byPriority = _ttoi(shareDirArr.ElementAt(i).ElementAt(6));
  138. m_vShareDir.push_back(p);
  139. }
  140. }
  141. return 1;
  142. }
  143. /************************************************************************/
  144. /*
  145. 函数: LoadLocalShareDir
  146. 描述: 加载本地共享目录
  147. 参数:
  148. IN LPCTSTR lpLocalDomain 本店域名
  149. 返回:
  150. */
  151. /************************************************************************/
  152. void OrderDirMgr::LoadLocalShareDir(IN LPCTSTR lpLocalDomain)
  153. {
  154. TCHAR* pShareHead = _T("\\\\");
  155. TCHAR* szPath[] = {_T("客户原片(管理软件)$"), _T("修好的片(管理软件)$"), _T("精修好的片(管理软件)$"), _T("设计好的片(管理软件)$")};
  156. TCHAR szBuffer[MAX_PATH] = {0};
  157. DWORD dwBuffSize = sizeof(TCHAR)*MAX_PATH;
  158. GetComputerName(szBuffer, &dwBuffSize);
  159. for(int i=0; i<4; i++)
  160. {
  161. CString strOriginalFilmDir = _T("");
  162. strOriginalFilmDir.Format(_T("%s%s\\%s"), pShareHead, szBuffer, szPath[i]);
  163. if(PathFileExists(strOriginalFilmDir))
  164. {
  165. LPTblNetShareInfo p = new TblNetShareInfo;
  166. p->bEnable = 1;
  167. p->byMinCapacity = 3;
  168. p->byMaxCapacity = 25;
  169. p->byPriority = 255;
  170. p->byPhotoType = (BYTE)(i+1);
  171. #ifdef _UNICODE
  172. wcscpy(p->szBranchId, _T(""));
  173. wcscpy(p->szShareDirectory, strOriginalFilmDir);
  174. #else
  175. strcpy(p->szBranchId, lpLocalDomain);
  176. strcpy(p->szShareDirectory, strOriginalFilmDir);
  177. #endif //#ifdef _UNICODE
  178. CString strLog = _T("");
  179. strLog.Format(_T("%s\n"), p->szShareDirectory);
  180. WriteLogin(strLog);
  181. m_vShareDir.push_back(p);
  182. }
  183. }
  184. }
  185. /************************************************************************/
  186. /*
  187. 函数: GetOrderOfDir
  188. 描述: 获取订单目录
  189. 参数:
  190. IN CString strST, 初始时间
  191. IN CString strET 结束时间
  192. IN LPCTSTR lpLocalDomain 本地域名
  193. 返回:
  194. */
  195. /************************************************************************/
  196. void OrderDirMgr::GetOrderOfDir(IN CString& strST, IN CString& strET, IN LPCTSTR lpLocalDomain)
  197. {
  198. ClearOrderInfo();
  199. if(m_vShareDir.size() == 0)
  200. return;
  201. std::vector<LPTblNetShareInfo>::iterator it = m_vShareDir.begin();
  202. for(;it != m_vShareDir.end();)
  203. {
  204. LPTblNetShareInfo p = (*it);
  205. if(p != NULL)
  206. {
  207. //共享目录是否可用
  208. if(p->bEnable == TRUE && p->byPhotoType <= 4)
  209. FindAllOrderDir(strST, strET, lpLocalDomain, p->szShareDirectory, p->szShareDirectory, p->byPhotoType, m_vOrderDir);
  210. }
  211. ++it;
  212. }
  213. }
  214. /************************************************************************/
  215. /*
  216. 函数: FindAllOrderDir
  217. 描述: 获取订单目录
  218. 参数:
  219. IN CString& strST, 开始时间
  220. IN CString& strET 结束时间
  221. IN LPCTSTR lpRootDir, 根目录
  222. IN LPCTSTR lpDir, 查找的目录
  223. IN const BYTE byPhotoType 相片类型
  224. OUT std::vector<LPSORDERDIRINFO>& vOrderDir 所有订单目录
  225. 返回:
  226. */
  227. /************************************************************************/
  228. void OrderDirMgr::FindAllOrderDir(IN CString& strST, IN CString& strET, IN LPCTSTR lpLocalDomain, IN LPCTSTR lpRootDir, IN LPCTSTR lpDir, IN const BYTE byPhotoType, OUT std::vector<LPSORDERDIRINFO>& vOrderDir)
  229. {
  230. if(lpRootDir == NULL || _tcscmp(lpRootDir, _T("")) == 0 || lpDir == NULL || _tcscmp(lpDir, _T("")) == 0)
  231. return;
  232. CTime st(_ttoi(strST.Mid(0, 4)), _ttoi(strST.Mid(5, 2)), _ttoi(strST.Mid(8, 2)), 0, 0, 0);
  233. CTime et(_ttoi(strET.Mid(0, 4)), _ttoi(strET.Mid(5, 2)), _ttoi(strET.Mid(8, 2)), 0, 0, 0);
  234. CString strRootDir = lpRootDir;
  235. strRootDir.TrimRight('\\');
  236. strRootDir += _T("\\");
  237. ffscoex coex;
  238. coex.dirs(1);
  239. #ifdef _UNICODE
  240. char szDir[MAX_PATH + 1] = {0};
  241. unicode2acsii(lpDir, szDir);
  242. coex.find(szDir, "*.*");
  243. #else
  244. coex.find(lpDir, "*.*");
  245. #endif //#ifdef _UNICODE
  246. ffscoex::typeT coo;
  247. ffscoex::typeT::iterator iter;
  248. coo = coex.co_dir();
  249. for(iter = coo.begin(); iter != coo.end(); iter++)
  250. {
  251. //遍历目录
  252. LPSFILEINFO lp = (*iter);
  253. if(_tcscmp(lp->cFileName, _T("ok")) == 0 || _tcscmp(lp->cFileName, _T("modifytime")) == 0)
  254. continue;
  255. //文件创建时间
  256. CTime ct(lp->ftCreationTime);
  257. //CString strTime = _T("");
  258. //strTime.Format(_T("%04d-%02d-%02d"), ct.GetYear(), ct.GetMonth(), ct.GetDay());
  259. if(ct < st || ct > et)
  260. continue;
  261. TCHAR szPath[MAX_PATH +1] = {0};
  262. #ifdef _UNICODE
  263. ascii2unicode(lp->strAllPath.c_str(), szPath);
  264. #else
  265. strcpy(szPath, lp->strAllPath.c_str());
  266. #endif //#ifdef _UNICODE
  267. //共享目录是否与查找的当前目录相同
  268. if(_tcscmp(strRootDir, szPath) == 0)
  269. continue;
  270. //去掉系统定义的目录
  271. CString strPath = szPath;
  272. if(strPath.Find(_T("\\microablum\\")) != -1 || strPath.Find(_T("\\Qrcode\\")) != -1)
  273. continue;
  274. //去掉域名目录
  275. strPath.TrimRight('\\');
  276. CString strR = strPath.Right(strPath.GetLength() - strPath.ReverseFind('\\') - 1);
  277. if(strR.Find(_T(".ly.com")) != -1 || strPath == _T("microablum") || strPath == _T("Qrcode"))
  278. continue;
  279. TCHAR szDomain[64] = {0};
  280. //去掉根目录
  281. CString strL = strPath.Right(strPath.GetLength() - strRootDir.GetLength());
  282. if(strL.Find(_T(".ly.com")) != -1)
  283. {
  284. int npos = strL.Find('\\');
  285. CString strDomain = strL.Left(npos);
  286. strL = strL.Right(strL.GetLength() - npos - 1);
  287. _tcscpy(szDomain, strDomain);
  288. }
  289. else
  290. {
  291. _tcscpy(szDomain, lpLocalDomain);
  292. }
  293. if(strL.Find(_T("\\")) != -1)
  294. continue;
  295. LPSORDERDIRINFO lporderdir = new SORDERDIRINFO;
  296. _tcscpy(lporderdir->szPath, szPath);
  297. lporderdir->byPhotoType = byPhotoType;
  298. #ifdef _UNICODE
  299. wsprintf(lporderdir->szOptTime, _T("%04d-%02d-%02d %02d:%02d:%02d.000"), ct.GetYear(), ct.GetMonth(), ct.GetDay(), ct.GetHour(), ct.GetMinute(), ct.GetSecond());
  300. #else
  301. sprintf(lporderdir->szOptTime, _T("%04d-%02d-%02d %02d:%02d:%02d.000"), ct.GetYear(), ct.GetMonth(), ct.GetDay(), ct.GetHour(), ct.GetMinute(), ct.GetSecond());
  302. #endif
  303. _tcscpy(lporderdir->szOrder, strL);
  304. _tcscpy(lporderdir->szDomain, szDomain);
  305. vOrderDir.push_back(lporderdir);
  306. }
  307. }
  308. void OrderDirMgr::ClearShareInfo()
  309. {
  310. std::vector<LPTblNetShareInfo>::iterator it = m_vShareDir.begin();
  311. for(;it != m_vShareDir.end();)
  312. {
  313. if((*it) != NULL)
  314. delete (*it);
  315. ++it;
  316. }
  317. m_vShareDir.clear();
  318. }
  319. void OrderDirMgr::ClearOrderInfo()
  320. {
  321. std::vector<LPSORDERDIRINFO>::iterator it = m_vOrderDir.begin();
  322. for(;it != m_vOrderDir.end();)
  323. {
  324. if((*it) != NULL)
  325. delete (*it);
  326. ++it;
  327. }
  328. m_vOrderDir.clear();
  329. }
  330. /************************************************************************/
  331. /*
  332. 函数: ScreeningOrderDir
  333. 描述: 筛选相片订单目录
  334. 参数:
  335. IN CArray<CStringArray,CStringArray>& logsArr 备份记录集
  336. IN const CString& strLocalDomain 本地哉名
  337. 返回: 1是数字,0不是纯数字
  338. */
  339. /************************************************************************/
  340. void OrderDirMgr::ScreeningOrderDir(IN CArray<CStringArray,CStringArray>& logsArr, IN const CString& strLocalDomain)
  341. {
  342. for(int i=0; i<logsArr.GetSize(); i++)
  343. {
  344. CString strDomain = logsArr.ElementAt(i).ElementAt(1);
  345. CString strOptTime = logsArr.ElementAt(i).ElementAt(2);
  346. CString strOrder = logsArr.ElementAt(i).ElementAt(3);
  347. BYTE tyPhotoType = _ttoi(logsArr.ElementAt(i).ElementAt(4));
  348. std::vector<LPSORDERDIRINFO>::iterator it = m_vOrderDir.begin();
  349. for(;it != m_vOrderDir.end(); it++)
  350. {
  351. LPSORDERDIRINFO lp = (*it);
  352. if(lp == NULL)
  353. continue;
  354. if(tyPhotoType != lp->byPhotoType)
  355. continue;
  356. if(_tcscmp(strDomain, strLocalDomain) == 0)
  357. {
  358. //本店
  359. if(_tcsstr(lp->szPath, _T(".ly.com")) != NULL)
  360. continue;
  361. if(_tcsstr(lp->szPath, strOrder) != NULL)
  362. {
  363. //删除有相同订单号的
  364. delete lp;
  365. m_vOrderDir.erase(it);
  366. break;
  367. }
  368. }
  369. else
  370. {
  371. //分店
  372. if(_tcsstr(lp->szPath, _T(".ly.com")) == NULL)
  373. continue;
  374. if(_tcsstr(lp->szPath, strOrder) != NULL)
  375. {
  376. //删除有相同订单号的
  377. delete lp;
  378. m_vOrderDir.erase(it);
  379. break;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. /************************************************************************/
  386. /*
  387. 函数:FindBakTargetDir
  388. 描述:增量备份完成回调
  389. 参数:
  390. IN const BYTE nPhotoType 相片类型
  391. OUT CString& strTargetDir 备份的目标目录
  392. 返回:1成功,0失败
  393. */
  394. /************************************************************************/
  395. int OrderDirMgr::FindEnableBakDir(IN const BYTE nPhotoType, OUT CString& strTargetDir)
  396. {
  397. double dTotalNum(0.0), dFreeNum(0.0);
  398. BOOL bEnable = FALSE;
  399. BYTE byOldPriority = 0;
  400. std::vector<LPTblNetShareInfo>::iterator it = m_vShareDir.begin();
  401. for(;it != m_vShareDir.end(); ++it)
  402. {
  403. LPTblNetShareInfo lp = (*it);
  404. if(lp == NULL)
  405. continue;
  406. if(nPhotoType != lp->byPhotoType)
  407. continue;
  408. // 存在且目录容量仍大于mincapacity可用;
  409. if(!PathFileExists(lp->szShareDirectory))
  410. continue;
  411. //优先级
  412. if(lp->byPriority > byOldPriority)
  413. {
  414. if(!GetDiskSpaceInfo(lp->szShareDirectory, dTotalNum, dFreeNum))
  415. continue;
  416. byOldPriority = lp->byPriority;
  417. if(dFreeNum > (*it)->byMinCapacity)
  418. {
  419. bEnable = TRUE;
  420. strTargetDir = lp->szShareDirectory;
  421. break;
  422. }
  423. }
  424. }
  425. return bEnable;
  426. }
  427. /************************************************************************/
  428. /*
  429. 函数:GetDiskSpaceInfo
  430. 描述:获取指定目录或盘符的容量信息;
  431. 参数:
  432. IN: lpRootPathName 根目录名称;
  433. INOUT: dTotalNum 总容量;
  434. INOUT: dFreeNum 可用容量;
  435. 返回:
  436. 注意:
  437. GetDiskFreeSpace函数不能满足当前超过2T的硬盘容量,因为里面的数据类型是UINT,最大支持32位(4G);
  438. GetDiskFreeSpaceEx支持64位(16384P=1024*16384T)
  439. 只能获取本机硬盘信息,且路径必须包含":"冒号;
  440. 调用约定:
  441. */
  442. /************************************************************************/
  443. BOOL OrderDirMgr::GetDiskSpaceInfo(IN LPCTSTR lpRootPathName,IN OUT double &dTotalNum, IN OUT double &dFreeNum)
  444. {
  445. // 校验参数有效性;
  446. if(lpRootPathName == NULL || _tcscmp(lpRootPathName,_T("")) == 0)
  447. {
  448. //OutputDebugString(_T("目录为空\n"));
  449. return FALSE;
  450. }
  451. // 如果长度==1;
  452. int nlen = _tcslen(lpRootPathName);
  453. if((1 == nlen) || ( 2 == nlen && lpRootPathName[nlen-1] != _T(':')))
  454. {
  455. //OutputDebugString(_T("根目录无效\n"));
  456. return FALSE;
  457. }
  458. if ( !PathFileExists(lpRootPathName))
  459. {
  460. //OutputDebugString(_T("根目录不存在\n"));
  461. return FALSE;
  462. }
  463. BOOL fResult = FALSE;
  464. DWORD dwSectPerClust; // 每簇的扇区数;
  465. DWORD dwBytesPerSect; // 每个扇区的字节数;
  466. DWORD dwFreeClusters; // 可用簇数;
  467. DWORD dwTotalClusters; // 总簇数;
  468. typedef BOOL (WINAPI *P_GDFSE)(LPCTSTR, PULARGE_INTEGER,PULARGE_INTEGER, PULARGE_INTEGER);
  469. P_GDFSE pGetDiskFreeSpaceEx = NULL;
  470. /*unsigned*/ __int64 i64FreeBytesToCaller;
  471. /*unsigned*/ __int64 i64TotalBytes;
  472. /*unsigned*/ __int64 i64FreeBytes;
  473. // 调用GetDiskFreeSpaceEx失败则调用GetDiskSpace;
  474. #ifdef UNICODE
  475. pGetDiskFreeSpaceEx = (P_GDFSE)GetProcAddress(GetModuleHandle(_T("kernel32.dll")),"GetDiskFreeSpaceExW");
  476. #else
  477. pGetDiskFreeSpaceEx = (P_GDFSE)GetProcAddress(GetModuleHandle("kernel32.dll"),"GetDiskFreeSpaceExA");
  478. #endif
  479. if ( pGetDiskFreeSpaceEx )
  480. {
  481. fResult = pGetDiskFreeSpaceEx(lpRootPathName,
  482. (PULARGE_INTEGER)&i64FreeBytesToCaller,
  483. (PULARGE_INTEGER)&i64TotalBytes,
  484. (PULARGE_INTEGER)&i64FreeBytes);
  485. if ( fResult )
  486. {
  487. // 将单位由byte转为G byte;
  488. dTotalNum = (double)i64TotalBytes/1024/1024/1024;
  489. dFreeNum = (double)i64FreeBytes/1024/1024/1024;
  490. }
  491. }
  492. else
  493. {
  494. fResult = GetDiskFreeSpace(lpRootPathName,
  495. &dwSectPerClust,
  496. &dwBytesPerSect,
  497. &dwFreeClusters,
  498. &dwTotalClusters);
  499. if ( fResult )
  500. {
  501. // 成功获得容量信息;
  502. i64TotalBytes = (__int64)dwTotalClusters * dwSectPerClust * dwBytesPerSect;
  503. i64FreeBytes = (__int64)dwFreeClusters * dwSectPerClust * dwBytesPerSect;
  504. // 将单位由byte转为G byte;
  505. dTotalNum = (double)i64TotalBytes/1024/1024/1024;
  506. dFreeNum = (double)i64FreeBytes/1024/1024/1024;
  507. }
  508. }
  509. return fResult;
  510. }