Commit dc8b932f by feixiang

Merge branch 'master' of https://git.dev.2b3.cn/tencent/services

parents 1b0f52b7 5402d3fe
# 1.0.56
- 添加腾讯云日志公共配置文件
# 1.0.55
- 重写Model里的toArray()
# 1.0.54
- 添加续费vip的RPC接口
# 1.0.53
- vip试用类型
# 1.0.52
......
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'clsErrorLogHandler' => [
'class' => \Hdll\Services\Common\ClsLogger\LogHandler::class,
'topicId' => \Hdll\Services\Common\ClsLogger\ClsLog::TOPICID_ERROR,
'formatter' => '${lineFormatter}',
'levels' => [
\Swoft\Log\Logger::ERROR,
\Swoft\Log\Logger::WARNING,
\Swoft\Log\Logger::CRITICAL,
],
],
'clsNoticeLogHandler' => [
'class' => \Hdll\Services\Common\ClsLogger\LogHandler::class,
'topicId' => \Hdll\Services\Common\ClsLogger\ClsLog::TOPICID_NOTICE,
'formatter' => '${lineFormatter}',
'levels' => [
\Swoft\Log\Logger::NOTICE,
\Swoft\Log\Logger::INFO,
\Swoft\Log\Logger::DEBUG,
\Swoft\Log\Logger::TRACE,
],
],
'logger' => [
'name' => APP_NAME,
'enable' => true,
'flushInterval' => 100,
'flushRequest' => true,
'handlers' => [
'${clsErrorLogHandler}',
'${clsNoticeLogHandler}',
],
],
];
......@@ -14,6 +14,7 @@ use Swoft\Db\Bean\Collector\EntityCollector;
use Swoft\Db\Model;
use Swoft\Exception\Exception;
use Swoole\Http\Request;
use Swoft\Helper\StringHelper;
class CommonEntity extends Model
{
......@@ -183,4 +184,32 @@ class CommonEntity extends Model
preg_match('/(?<=Table\(name=").*(?="\))/', $commentString, $matches);
return $tableName = isset($matches[0])?$matches[0]:'';
}
/**
* @return array
*/
public function toArray(): array
{
$entities = EntityCollector::getCollector();
$columns = $entities[static::class]['field'];
$data = [];
foreach ($columns as $propertyName => $column) {
if (!isset($column['column'])) {
continue;
}
$methodName = StringHelper::camel('get' . $propertyName);
if (!\method_exists($this, $methodName)) {
continue;
}
$value = $this->$methodName();
if($value === null){
continue;
}
$data[$propertyName] = $value;
}
return $data;
}
}
\ No newline at end of file
......@@ -11,14 +11,15 @@ namespace Hdll\Services\Vip\Lib;
use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferOpenVip($storeId,$orderId,$money)
* @method ResultInterface deferOpenVip($storeId, $orderId, $money)
* @method ResultInterface deferGetVip($vipId)
* Interface SellerInterface
* @package App\Lib
*/
interface VipInterface
{
public function openVip($storeId,$orderId);
public function openVip($storeId, $orderId);
public function getVip(int $vipId);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment