mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-14 04:12:50 +00:00
刪除多余类
This commit is contained in:
parent
5ba7e7f637
commit
42f74a3c79
@ -1,112 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Created by CRMEB.
|
|
||||||
* User: 136327134@qq.com
|
|
||||||
* Date: 2019/4/12 11:19
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace crmeb\services;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Api 日志和系统字段整合
|
|
||||||
* class ApiLogs
|
|
||||||
* */
|
|
||||||
|
|
||||||
use think\Exception;
|
|
||||||
use think\Log;
|
|
||||||
|
|
||||||
class ApiLogs
|
|
||||||
{
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 缓存前缀配置区域
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
//ACCESS_TOKEN缓存前缀
|
|
||||||
const ACCESS_TOKEN_PREFIX='AccessToken:';
|
|
||||||
//api info 缓存前缀
|
|
||||||
const AB_API_INFO='eb_ApiInfo:';
|
|
||||||
//未支付订单取消
|
|
||||||
const ORDER_UNPAID_PAGE='order_unpaid_page';
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 缓存时间配置区域
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
//缓存时间
|
|
||||||
const EXPIRE=86400;
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 系统预设字段明配置区域
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
//access-token验证字段
|
|
||||||
const ACCESS_TOKEN="access-token";
|
|
||||||
//Api版本字段
|
|
||||||
const API_VERSION='version';
|
|
||||||
//用户token验证字段
|
|
||||||
const USER_TOKEN='user-token';
|
|
||||||
//系统预设日志
|
|
||||||
protected static $logInfo=null;
|
|
||||||
/*
|
|
||||||
* 获取本类所有常量配置
|
|
||||||
* @param string $code 常量名
|
|
||||||
* @return array | string
|
|
||||||
* */
|
|
||||||
public static function getConstants($code='') {
|
|
||||||
$oClass = new \ReflectionClass(__CLASS__);
|
|
||||||
$stants=$oClass->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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,94 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author: xaboy<365615158@qq.com>
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Created by CRMEB.
|
|
||||||
* Copyright (c) 2017~2019 http://www.crmeb.com All rights reserved.
|
|
||||||
* Author: liaofei <136327134@qq.com>
|
|
||||||
* 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,
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user