forked from typecho-fans/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathService.php
27 lines (24 loc) · 1.02 KB
/
Service.php
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
<?php
/**
* @author gaobinzhan <gaobinzhan@gmail.com>
* @modify 小码农 <chengshongguo@qq.com> 增加���例化方法
*/
require_once 'Contract/ServiceInterface.php';
abstract class Service implements ServiceInterface
{
abstract public function __handler($active, $comment, $plugin);
abstract public static function create();
public function logger($service, $object, $context, $result, $error = '')
{
$db = Typecho_Db::get();
$db->query($db->insert('table.comment_push')
->rows([
'service' => $service,
'object' => is_array($object) ? json_encode($object, JSON_UNESCAPED_UNICODE) : $object,
'context' => is_array($context) ? json_encode($context, JSON_UNESCAPED_UNICODE) : $context,
'result' => is_array($result) ? json_encode($result, JSON_UNESCAPED_UNICODE) : $result,
'error' => is_array($error) ? json_encode($error, JSON_UNESCAPED_UNICODE) : $error,
'time' => time()
]));
}
}