From 42f74a3c79bbb938eddddff0f9a0fce88552ed8d Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Tue, 19 Nov 2019 14:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=AA=E9=99=A4=E5=A4=9A=E4=BD=99=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/ApiLogs.php | 112 --------------------------- crmeb/crmeb/services/HookService.php | 94 ---------------------- crmeb/crmeb/services/Template.php | 25 ------ 3 files changed, 231 deletions(-) delete mode 100644 crmeb/crmeb/services/ApiLogs.php delete mode 100644 crmeb/crmeb/services/HookService.php delete mode 100644 crmeb/crmeb/services/Template.php diff --git a/crmeb/crmeb/services/ApiLogs.php b/crmeb/crmeb/services/ApiLogs.php deleted file mode 100644 index 792ccc58..00000000 --- a/crmeb/crmeb/services/ApiLogs.php +++ /dev/null @@ -1,112 +0,0 @@ -getConstants(); - if($code) return isset($stants[$code]) ? $stants[$code] : ''; - else return $stants; - } - - /* - * 错误日志记录 - * - * */ - public static function recodeErrorLog(Exception $exception) - { - $data=[ - 'code'=>$exception->getCode(), - 'msg'=>$exception->getMessage(), - 'file'=>$exception->getFile(), - 'line'=>$exception->getLine(), - ]; - $log="[{$data['code']}] {$data['msg']} [{$data['file']} : {$data['line']}]"; - self::writeLog($log,'e'); - } - /* - * 记录日志 - * $param string $contentlog 日志内容 - * $param string $typeLog 日志类型 - * $param string $dirLog 日志目录 - * */ - public static function writeLog($contentlog='',$typeLog='',$dirLog='ebapi') - { - Log::init([ - 'type' => 'File', - 'path' => LOG_PATH.($dirLog ? $dirLog.'/' : '') - ]); - if($contentlog==='') $contentlog=self::$logInfo; - if($contentlog===null) return false; - if(is_array($contentlog)) $contentlog=var_export($contentlog,true); - if(is_object($contentlog)) $contentlog=var_export($contentlog,true); - switch (strtoupper($typeLog)){ - case 'SQL':case 'S': - Log::sql($contentlog); - break; - case 'ERROR':case 'E': - Log::error($contentlog); - break; - case 'INFO':case 'I': - Log::info($contentlog); - break; - case 'NOTICE':case 'N': - Log::notice($contentlog); - break; - case 'ALERT':case 'A': - Log::alert($contentlog); - break; - case 'LOG':case 'L': - Log::log($contentlog); - break; - } - } - -} \ No newline at end of file diff --git a/crmeb/crmeb/services/HookService.php b/crmeb/crmeb/services/HookService.php deleted file mode 100644 index 072c13e9..00000000 --- a/crmeb/crmeb/services/HookService.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @day: 2017/11/24 - */ - -namespace crmeb\services; - -class HookService -{ - - /** - * 监听有返回结果的行为 - * @param $tag - * @param $params - * @param null $extra - * @param bool $once - * @return mixed - */ - public static function resultListen($tag, $params, $extra = null, $once = false,$behavior = null) - { - self::beforeListen($tag,$params,$extra,false,$behavior); - return self::listen($tag,$params,$extra,$once,$behavior); - } - - /** - * 监听后置行为 - * @param $tag - * @param $params - * @param null $extra - */ - public static function afterListen($tag, $params, $extra = null, $once = false, $behavior = null) - { - try{ - return self::listen($tag.'_after',$params,$extra,$once,$behavior); - }catch (\Exception $e){} - } - - public static function beforeListen($tag,$params,$extra = null, $once = false, $behavior = null) - { - try{ - return self::listen($tag.'_before',$params,$extra,$once,$behavior); - }catch (\Exception $e){} - } - - /** - * 监听行为 - * @param $tag - * @param $params - * @param null $extra - * @param bool $once - * @return mixed - */ - public static function listen($tag, $params, $extra = null, $once = false, $behavior = null) - { -// if($behavior && method_exists($behavior,Loader::parseName($tag,1,false))) self::add($tag,$behavior); -// return Hook::listen($tag,$params,$extra,$once); - } - - /** - * 添加前置行为 - * @param $tag - * @param $behavior - * @param bool $first - */ - public static function addBefore($tag, $behavior, $first = false) - { - self::add($tag.'_before',$behavior,$first); - } - - /** - * 添加后置行为 - * @param $tag - * @param $behavior - * @param bool $first - */ - public static function addAfter($tag, $behavior, $first = false) - { - self::add($tag.'_after',$behavior,$first); - } - - /** - * 添加行为 - * @param $tag - * @param $behavior - * @param bool $first - */ - public static function add($tag, $behavior, $first = false) - { - Hook::add($tag,$behavior,$first); - } - -} \ No newline at end of file diff --git a/crmeb/crmeb/services/Template.php b/crmeb/crmeb/services/Template.php deleted file mode 100644 index dd21df6b..00000000 --- a/crmeb/crmeb/services/Template.php +++ /dev/null @@ -1,25 +0,0 @@ - - * Date: 2019/4/3 16:36 - */ - -namespace crmeb\services; - -use crmeb\traits\LogicTrait; - -/** 模版消息类 - * Class Template - * @package crmeb\services - */ -class Template -{ - use LogicTrait; - - protected $providers=[ - 'routine_two'=>ProgramTemplateService::class, - ]; - -} \ No newline at end of file