Tools.php
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Created by PhpStorm.
* User: Ziy
* Date: 14/9/2
* Time: 下午6:31
*/
class YHMUtils_Tools
{
/**
* @param $depotName
* @return Q_Db_Mongo_Core_Base
*/
static function mongo($depotName)
{
return Q_Db::mongo($depotName);
}
static function loggers(array $package, $collection = 'alipay', $depotName = 'PayLoggers')
{
try {
$logPackage = array(
'mongo_date' => new MongoDate(),
'create_time' => time(),
'package' => $package
);
YHMUtils_Tools::mongo($depotName)->collection($collection)->insert($logPackage);
} catch (Exception $e) {
}
}
static function makeAgreementKey($packageData)
{
ksort($packageData);
reset($packageData);
$packageList = array();
foreach ($packageData as $key => $val) {
$packageList[] = trim($key . '=' . $val);
};
return md5(Q_Utils_Function::generateIdHex() . strtolower(implode('&', $packageList)));
}
}