Commit 5b8f23d2 authored by hangjun83's avatar hangjun83

openapi

parent 3e4efe21
<?php
/**
* Created by PhpStorm.
* User: jun.hang
* Date: 2018/9/17
* Time: 下午11:44
*/
namespace App\Console\Commands;
use App\Jobs\InteglePlatformJob;
use App\Jobs\WuxiLabJob;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
class IntegleJobCommand extends Command
{
use ConfirmableTrait;
/**
* 命令行的名称及用法。
*
* @var string
*/
protected $signature = 'integle:job
{--action_type= : 任务操作类型}
{--params= : 任务参数}';
/**
* 命令行的概述。
*
* @var string
*/
protected $description = '';
/**
* 创建新的命令实例。
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* 运行命令。
* @throws \Exception
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return 1;
}
if($this->hasArgument('help')){
$this->help();
}else{
$action_type = $this->option('action_type');
$params = $this->option('params');
if(empty($action_type)){
$this->error('缺少命令参数,请输入具体的参数命令.如需帮助请输入 --help');
exit;
}
$productUpdateJob = (new InteglePlatformJob($action_type,$params))->delay(100)->onQueue('slow');
app('Illuminate\Contracts\Bus\Dispatcher')->dispatch($productUpdateJob);
}
}
public function help()
{
$helpStr = "参数帮助说明";
$this->comment($this->setHelp($helpStr)->getProcessedHelp());
$this->line("action_type: 具体动作参数\n\nbatchUpdateProduct => 批量更新商品\n\nparams : 操作需要传入的参数.非必填项");
}
}
<?php
namespace App\Console\Commands;
use App\Services\Kafka\KafkaService;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
class KafkaConsumerCommand extends Command
{
use ConfirmableTrait;
/**
* 命令行的名称及用法。
*
* @var string
*/
protected $signature = 'kafka:consumer';
/**
* 命令行的概述。
*
* @var string
*/
protected $description = 'kafka 消费模式';
/**
* 创建新的命令实例。
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* 运行命令。
* @throws \Exception
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return 1;
}
//开启消费者模式
app(KafkaService::class)->startConsumer();
}
}
<?php
namespace App\Console\Commands;
use App\Jobs\WuxiLabJob;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
class WuxiLabJobCommand extends Command
{
use ConfirmableTrait;
/**
* 命令行的名称及用法。
*
* @var string
*/
protected $signature = 'wuxilab:job
{--action_type= : 任务操作类型}
{--params= : 任务参数}';
/**
* 命令行的概述。
*
* @var string
*/
protected $description = '药名康德任务命令行';
/**
* 创建新的命令实例。
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* 运行命令。
* @throws \Exception
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return 1;
}
if($this->hasArgument('help')){
$this->help();
}else{
$action_type = $this->option('action_type');
$params = $this->option('params');
if(empty($action_type)){
$this->error('缺少命令参数,请输入具体的参数命令.如需帮助请输入 --help');
exit;
}
$productUpdateJob = (new WuxiLabJob($action_type,$params))->delay(100)->onQueue('slow');
app('Illuminate\Contracts\Bus\Dispatcher')->dispatch($productUpdateJob);
}
}
public function help()
{
$helpStr = "参数帮助说明";
$this->comment($this->setHelp($helpStr)->getProcessedHelp());
$this->line("action_type: 具体动作参数\n\n initProductToExcel => 初始化批量商品 \n batchUpdateProduct => 批量更新商品\n\nparams : 操作需要传入的参数.非必填项");
}
}
...@@ -22,7 +22,7 @@ class Kernel extends ConsoleKernel ...@@ -22,7 +22,7 @@ class Kernel extends ConsoleKernel
* @var array * @var array
*/ */
protected $commands = [ protected $commands = [
\Laravelista\LumenVendorPublish\VendorPublishCommand::class \Laravelista\LumenVendorPublish\VendorPublishCommand::class,
]; ];
/** /**
......
<?php
namespace App\Export;
use App\Services\SysLogService;
use Maatwebsite\Excel\Facades\Excel;
use Maatwebsite\Excel\Excel as BaseExcel;
/**
* 导出基础类
*/
class BaseExport
{
protected $expand = '';
public function __construct()
{
$this->setFileExpand(BaseExcel::XLSX);
}
public function setFileExpand($name)
{
$this->expand = $name;
}
public function storeExcel($excelContent, $filePath, $diskType = null){
if($diskType == null){
$diskType = config('filesystem.default');
}
$result = Excel::store($excelContent,$filePath,$diskType, $this->expand);
$logContent = [
'filePath' => $filePath,
'diskType' => $diskType,
'datetime' => time()
];
app(SysLogService::class)->addOperationLogs($logContent);
}
}
<?php
namespace App\Export\WuxiLab\Models;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadings;
class WuxiLabPackagesExportModel implements FromArray,WithHeadings, ShouldAutoSize
{
private $exportContent = [];
public function __construct($exportContent)
{
$this->setExportContent($exportContent);
}
public function setExportContent($content)
{
$this->exportContent = $this->toMap($content);
}
public function array(): array
{
return $this->exportContent;
}
public function toMap($rows): array
{
$exportRows = [];
foreach($rows as $key => $row){
array_push($exportRows,[
$row['r_code'], '', $row['p_pack'].'/'.$row['p_pack_unit'], $row['p_stock'] == 0 ? '0' : $row['p_stock'], 'CN-SH', $row['p_price'], $row['p_avg_cost'],
'RMB', 'CN', '0.00'
]);
}
return $exportRows;
}
public function headings(): array
{
return $this->getHeaderTitle();
}
private function getHeaderTitle()
{
return [
'ProductId', 'PackageItemNumber', 'PackageUnitDescription', 'PackageStockQuantity', 'PackageStockLocation', 'ListPrice', 'discount', 'Currency', 'PriceCountry',
'LNCost'
];
}
}
<?php
namespace App\Export\WuxiLab\Models;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadings;
class WuxiLabProductsExportModel implements FromArray,WithHeadings, ShouldAutoSize
{
private $exportContent = [];
public function __construct($exportContent)
{
$this->setExportContent($exportContent);
}
public function setExportContent($content)
{
$this->exportContent = $this->toMap($content);
}
public function array(): array
{
return $this->exportContent;
}
public function toMap($rows): array
{
$exportRows = [];
foreach($rows as $key => $row){
array_push($exportRows,[
$row['r_code'], $row['c_cas'], $row['c_mdl'], $row['c_fzs'], $row['c_fzl'], 'N/A', '',
$row['c_en_name'], $row['c_cn_name'], 'rhawn', '0', '0', '0', 1, 3, '', $row['r_level'], 'AMINO_ACIDS_PEPTIDES', ''
]);
}
return $exportRows;
}
public function headings(): array
{
return $this->getHeaderTitle();
}
private function getHeaderTitle()
{
return [
'ProductId', 'CAS', 'MDL', 'MolecularFormula', 'MolecularWeight', 'ComplianceType', 'UN', 'EnglishName', 'ChineseName', 'Brand', 'StorageCondition',
'TransportationCondition', 'IsImported', 'LeadTimeMinDays', 'LeadTimeMaxDays', 'LeadTimeBackOrderDays', 'Purity', 'ProductCategory',
'ShipsAdditionalDescription'
];
}
}
<?php
namespace App\Export\WuxiLab\Models;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadings;
class WuxiLabStocksExportModel implements FromArray,WithHeadings, ShouldAutoSize
{
private $exportContent = [];
public function __construct($exportContent)
{
$this->setExportContent($exportContent);
}
public function setExportContent($content)
{
$this->exportContent = $this->toMap($content);
}
public function array(): array
{
return $this->exportContent;
}
public function toMap($rows): array
{
$exportRows = [];
foreach($rows as $key => $row){
array_push($exportRows,[
$row['r_code'], 'CN', $row['p_pack_unit'], $row['p_stock'] == 0 ? '0' : $row['p_stock']
]);
}
return $exportRows;
}
public function headings(): array
{
return $this->getHeaderTitle();
}
private function getHeaderTitle()
{
return [
'ProductId', 'StockCountry', 'StockUnits', 'StockQuantity'
];
}
}
<?php
namespace App\Export\WuxiLab;
use App\Export\BaseExport;
use App\Export\WuxiLab\Models\WuxiLabPackagesExportModel;
use App\Export\WuxiLab\Models\WuxiLabProductsExportModel;
use App\Export\WuxiLab\Models\WuxiLabStocksExportModel;
class WuxiLabExport extends BaseExport
{
protected $defaultExportModel = ['product','package','stock'];
protected $filePath = '';
public function __construct()
{
parent::__construct();
}
public function getSavePath($fileName)
{
if($this->filePath == ''){
$this->filePath = config('filesystem.default').'/public/Excel/';
}
return $this->filePath.date('Ymd',time()).'/'.$fileName;
}
public function getFileName($model)
{
return 'wuxiLab_'.$model.'_'.date('Y_m_d_His',time()).'.'.$this->expand;
}
/**
* 存储到excel文件
* @param $saveContent
* @param null $model
*/
public function saveExcel($saveContent,$model = null)
{
if($model == null){
$model = $this->defaultExportModel;
}
if(!is_array($model) && $model != null){
$model = explode(',',$model);
}
foreach($model as $m){
switch($m){
case 'product' :
$export = new WuxiLabProductsExportModel($saveContent['rawList']);
break;
case 'package' :
$export = new WuxiLabPackagesExportModel($saveContent['packageList']);
break;
case 'stock' :
$export = new WuxiLabStocksExportModel($saveContent['packageList']);
break;
}
$savePath = $this->getSavePath(
$this->getFileName($m)
);
$this->storeExcel($export,$savePath);
}
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Jobs;
use App\Repositories\Contracts\BhSorderRefundRepository;
use App\Services\BhOrdersService;
use Illuminate\Support\Facades\DB;
class BhSorderRefundJob extends Job
{
protected $refundInfo;
public function __construct($refundInfo)
{
$this->refundInfo = $refundInfo;
}
/**
* Execute the job.
*/
public function handle()
{
try{
app(BhSorderRefundRepository::class)->update(['status' => 'running'],$this->refundInfo['id']);
$note = null;
$refundInfo = json_decode($this->refundInfo['exec_content']);
$service = app(BhOrdersService::class);
$service->sOrderRefund($refundInfo,$note);
//对任务进行更新
$update = [];
$update['status'] = 'finish';
$update['exec_nums'] = $this->refundInfo['exec_nums'] + 1;
$update['error_message'] = '';
if($note && count($note) > 0){
$update['error_message'] = json_encode($note,JSON_UNESCAPED_UNICODE);
}
}catch(\Exception $e){
//对任务进行更新
$update = [];
$update['status'] = 'error';
$update['error_message'] = $e->getMessage();
$update['exec_nums'] = intval($this->refundInfo['exec_nums'] + 1);
}
try{
$db = DB::connection('mysql');
$db->beginTransaction();
$update['updated_at'] = date('Y-m-d H:i:s',time());
app(BhSorderRefundRepository::class)->update($update,$this->refundInfo['id']);
$logInsert = [];
$logInsert['task_id'] = $this->refundInfo['id'];
if(isset($update['error_message']) && !empty($update['error_message'])){
$logInsert['content'] = $update['error_message'];
}else{
$logInsert['content'] = '执行完成';
}
$logInsert['created_at'] = date('Y-m-d H:i:s',time());
$logInsert['updated_at'] = date('Y-m-d H:i:s',time());
$db->table('task_log')->insertGetId($logInsert);
$db->commit();
}catch(\Exception $e){
$db->rollback();
throw $e;
}
}
}
...@@ -11,19 +11,27 @@ ...@@ -11,19 +11,27 @@
namespace App\Jobs; namespace App\Jobs;
class ExampleJob extends Job use App\Services\InteglePlatformService;
class InteglePlatformJob extends Job
{ {
/** protected $actionType = null;
* Create a new job instance. protected $params = null;
*/
public function __construct() public function __construct($actionType,$params)
{ {
$this->actionType = $actionType;
$this->params = $params;
} }
/**
* Execute the job.
*/
public function handle() public function handle()
{ {
$service = app(InteglePlatformService::class);
switch($this->actionType){
case 'batchUpdateProduct' :
$service->batchUpdateProducts();
break;
default:
}
} }
} }
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Jobs;
use App\Repositories\Contracts\RhawnSorderRefundRepository;
use App\Services\RhawnOrdersService;
use Illuminate\Support\Facades\DB;
class RhawnSorderRefundJob extends Job
{
protected $refundInfo;
public function __construct($refundInfo)
{
$this->refundInfo = $refundInfo;
}
/**
* Execute the job.
*/
public function handle()
{
try{
app(RhawnSorderRefundRepository::class)->update(['status' => 'running'],$this->refundInfo['id']);
$note = null;
$refundInfo = json_decode($this->refundInfo['exec_content']);
$service = app(RhawnOrdersService::class);
$service->sOrderRefund($refundInfo,$note);
//对任务进行更新
$update = [];
$update['status'] = 'finish';
$update['exec_nums'] = $this->refundInfo['exec_nums'] + 1;
$update['error_message'] = '';
if($note && count($note) > 0){
$update['error_message'] = json_encode($note,JSON_UNESCAPED_UNICODE);
}
}catch(\Exception $e){
//对任务进行更新
$update = [];
$update['status'] = 'error';
$update['error_message'] = $e->getMessage();
$update['exec_nums'] = intval($this->refundInfo['exec_nums'] + 1);
}
try{
$db = DB::connection('mysql');
$db->beginTransaction();
$update['updated_at'] = date('Y-m-d H:i:s',time());
app(RhawnSorderRefundRepository::class)->update($update,$this->refundInfo['id']);
$logInsert = [];
$logInsert['task_id'] = $this->refundInfo['id'];
if(isset($update['error_message']) && !empty($update['error_message'])){
$logInsert['content'] = $update['error_message'];
}else{
$logInsert['content'] = '执行完成';
}
$logInsert['created_at'] = date('Y-m-d H:i:s',time());
$logInsert['updated_at'] = date('Y-m-d H:i:s',time());
$db->table('task_log')->insertGetId($logInsert);
$db->commit();
}catch(\Exception $e){
$db->rollback();
throw $e;
}
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Jobs;
use App\Services\WuxiLabService;
class WuxiLabJob extends Job
{
protected $actionType = null;
protected $params = null;
public function __construct($actionType,$params)
{
$this->actionType = $actionType;
$this->params = $params;
}
public function handle()
{
$service = app(WuxiLabService::class);
switch($this->actionType){
case 'initProductToExcel' :
if(!isset($params) || $params == 0){
$params['limit'] = 1000;
}
$service->initCreateProductsToExcel($params['limit']);
break;
case 'batchUpdateProduct' :
$service->batchUpdateProducts();
break;
default:
}
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Listeners;
use App\Events\ExampleEvent;
class ExampleListener
{
/**
* Create the event listener.
*/
public function __construct()
{
}
/**
* Handle the event.
*
* @param \App\Events\ExampleEvent $event
*/
public function handle(ExampleEvent $event)
{
}
}
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
namespace App\Providers; namespace App\Providers;
use App\Observers\UserObserver; use App\Services\Kafka\KafkaService;
use App\Repositories\Models\AdminUsers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Laravel\Lumen\Application as LumenApplication;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
...@@ -33,11 +33,28 @@ class AppServiceProvider extends ServiceProvider ...@@ -33,11 +33,28 @@ class AppServiceProvider extends ServiceProvider
public function boot() public function boot()
{ {
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
$this->registerObservers(); // 注册观察者
if( $this->app instanceof LumenApplication ){
$this->app->configure('kafka');
$this->setupConfig();
}
//单例绑定,初始化kafka
$this->app->singleton(KafkaService::class,function($app){
return new KafkaService(config('kafka.kafka'));
});
$this->commands([
\App\Console\Commands\IntegleJobCommand::class,
\App\Console\Commands\WuxiLabJobCommand::class,
\App\Console\Commands\KafkaConsumerCommand::class
]);
} }
protected function registerObservers(): void protected function setupConfig()
{ {
AdminUsers::observe(UserObserver::class); $path = dirname(__DIR__, 2).'/config/kafka.php';
$this->mergeConfigFrom($path, 'kafka');
} }
} }
...@@ -11,45 +11,30 @@ ...@@ -11,45 +11,30 @@
namespace App\Providers; namespace App\Providers;
use App\Repositories\Eloquent\BaseRepository; use Illuminate\Filesystem\Filesystem;
use Prettus\Repository\Contracts\RepositoryInterface;
use Prettus\Repository\Providers\LumenRepositoryServiceProvider; use Prettus\Repository\Providers\LumenRepositoryServiceProvider;
class RepositoryServiceProvider extends LumenRepositoryServiceProvider class RepositoryServiceProvider extends LumenRepositoryServiceProvider
{ {
protected $bindsClass = public function register()
[
'App\Repositories\Contracts\UsersRepository' => 'App\Repositories\Eloquent\UsersRepositoryEloquent',
'App\Repositories\Contracts\MenusRepository' => 'App\Repositories\Eloquent\MenusRepositoryEloquent',
'App\Repositories\Contracts\RolesRepository' => 'App\Repositories\Eloquent\RolesRepositoryEloquent',
'App\Repositories\Contracts\BhPordersRepository' => 'App\Repositories\Eloquent\BhPordersRepositoryEloquent',
'App\Repositories\Contracts\BhSordersRepository' => 'App\Repositories\Eloquent\BhSordersRepositoryEloquent',
'App\Repositories\Contracts\BhSoitemsRepository' => 'App\Repositories\Eloquent\BhSoitemsRepositoryEloquent',
'App\Repositories\Contracts\BhSorderRefundRepository' => 'App\Repositories\Eloquent\BhSorderRefundRepositoryEloquent',
'App\Repositories\Contracts\ToolsTaskRepository' => 'App\Repositories\Eloquent\ToolsTaskRepositoryEloquent',
'App\Repositories\Contracts\RhawnSordersRepository' => 'App\Repositories\Eloquent\RhawnSordersRepositoryEloquent',
'App\Repositories\Contracts\RhawnSoitemsRepository' => 'App\Repositories\Eloquent\RhawnSoitemsRepositoryEloquent',
'App\Repositories\Contracts\RhawnSorderRefundRepository' => 'App\Repositories\Eloquent\RhawnSorderRefundRepositoryEloquent',
];
/**
* Bootstrap services.
*/
public function boot()
{ {
parent::register(); // TODO: Change the autogenerated stub
$this->bindRepository(); $this->bindRepository();
} }
protected function bindRepository() protected function bindRepository()
{ {
if(empty($this->bindsClass)){ $fileObj = (new Filesystem());
return ; $files = $fileObj->files(base_path('app/Repositories/Contracts'));
} if($files){
collect($files)->map(function ($file){
foreach($this->bindsClass as $class => $concrete){ $fileName = $file->getRelativePathname();
$this->app->bind($class,$concrete); list($name,$extend) = explode('.',$fileName);
$class = "App\Repositories\Contracts\\".$name;
$concrete = "App\Repositories\Eloquent\\".$name."Eloquent";
$this->app->bind($class,$concrete);
});
} }
} }
} }
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Contracts;
use Prettus\Repository\Contracts\RepositoryInterface;
/**
* Interface UserRepository.
*/
interface BhSorderRefundRepository extends RepositoryInterface
{
}
...@@ -16,6 +16,6 @@ use Prettus\Repository\Contracts\RepositoryInterface; ...@@ -16,6 +16,6 @@ use Prettus\Repository\Contracts\RepositoryInterface;
/** /**
* Interface UserRepository. * Interface UserRepository.
*/ */
interface BhPordersRepository extends RepositoryInterface interface RhawnRawRepository extends RepositoryInterface
{ {
} }
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Contracts;
use Prettus\Repository\Contracts\RepositoryInterface;
/**
* Interface UserRepository.
*/
interface RhawnSoitemsRepository extends RepositoryInterface
{
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Contracts;
use Prettus\Repository\Contracts\RepositoryInterface;
/**
* Interface UserRepository.
*/
interface RhawnSorderRefundRepository extends RepositoryInterface
{
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Contracts;
use Prettus\Repository\Contracts\RepositoryInterface;
/**
* Interface UserRepository.
*/
interface RhawnSordersRepository extends RepositoryInterface
{
}
...@@ -16,6 +16,6 @@ use Prettus\Repository\Contracts\RepositoryInterface; ...@@ -16,6 +16,6 @@ use Prettus\Repository\Contracts\RepositoryInterface;
/** /**
* Interface UserRepository. * Interface UserRepository.
*/ */
interface BhSordersRepository extends RepositoryInterface interface ThirdApiPlatformRepository extends RepositoryInterface
{ {
} }
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Criteria;
use Illuminate\Database\Eloquent\Builder;
use App\Repositories\Criteria\Criteria;
class BhPordersCriteria extends Criteria
{
protected function condition(Builder $query): void
{
if ($orderNo = $this->request->get('bhOrderNo')) {
$query->where('po_no', '=', $orderNo);
}
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Criteria;
use Illuminate\Database\Eloquent\Builder;
use App\Repositories\Criteria\Criteria;
class BhSorderRefundCriteria extends Criteria
{
protected function condition(Builder $query): void
{
if($this->request->has('type')){
$query->where('type', '=', $this->request->get('type'));
}
}
protected function after($model)
{
$model->orderbyDesc('id');
return $model;
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Criteria;
use Illuminate\Database\Eloquent\Builder;
use App\Repositories\Criteria\Criteria;
class BhSorderRefundTaskLogCriteria extends Criteria
{
protected function condition(Builder $query): void
{
if($this->request->has('type')){
$query->where('type', '=', $this->request->get('type'));
}
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Criteria;
use Illuminate\Database\Eloquent\Builder;
use App\Repositories\Criteria\Criteria;
class RhawnSorderRefundCriteria extends Criteria
{
protected function condition(Builder $query): void
{
if($this->request->has('type')){
$query->where('type', '=', $this->request->get('type'));
}
}
protected function after($model)
{
$model->orderbyDesc('id');
return $model;
}
}
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\BhSoitemsRepository;
use App\Repositories\Contracts\BhSordersRepository;
use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Models\BhSoitems;
use App\Repositories\Eloquent\BaseRepository;
use Prettus\Validator\Contracts\ValidatorInterface;
/**
* Class UserRepositoryEloquent.
*/
class BhSoitemsRepositoryEloquent extends BaseRepository implements BhSoitemsRepository
{
protected $fieldSearchable = [
];
/**
* Specify Model class name.
*
* @return string
*/
public function model()
{
return BhSoitems::class;
}
/**
* Boot up the repository, pushing criteria.
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/
public function boot()
{
$this->pushCriteria(app(RequestCriteria::class));
}
/**
* 获取订单详情
* @param $orderId
* @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
*/
public function getSorderItemsDetailFromOrderId($orderId)
{
$order = app(BhSordersRepository::class)->find($orderId);
if(!$order){
throw new \LogicException('该订单不存在!',500);
}
//查询订单的详情
$soItems = BhSoitems::query()
->join('products','soitems.p_id','products.p_id')
->join('chemicals','products.c_id','chemicals.c_id')
->join('brands','products.b_id','brands.b_id')
->where('soitems.so_id',$order->so_id)->get();
return $soItems;
}
public function getSorderItemsDetailFromItemId($itemId,$pid=null)
{
//查询订单的详情
$soItems = BhSoitems::query()
->join('sorders','sorders.so_id','soitems.so_id')
->join('products','soitems.p_id','products.p_id')
->join('chemicals','products.c_id','chemicals.c_id')
->join('brands','products.b_id','brands.b_id')
->where('soitems.si_id',$itemId);
if(!is_null($pid)){
$soItems = $soItems->where('soitems.p_id',$pid);
}
$soItems = $soItems->get();
return $soItems;
}
/**
* 根据si_id获取订单明细项
* @param $si_id
* @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
*/
public function getSorderItemFromItemId($si_id)
{
$item = $this->find($si_id);
if(!$item){
throw new \LogicException('该订单项不存在!',500);
}
//查询订单的详情
$soItems = BhSoitems::query()
->join('products','soitems.p_id','products.p_id')
->where('soitems.si_id',$si_id)->get();
return $soItems;
}
}
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\BhSordersRepository;
use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Models\BhSorders;
use App\Repositories\Eloquent\BaseRepository;
use Illuminate\Support\Facades\DB;
use Prettus\Validator\Contracts\ValidatorInterface;
/**
* Class UserRepositoryEloquent.
*/
class BhSordersRepositoryEloquent extends BaseRepository implements BhSordersRepository
{
protected $fieldSearchable = [
];
/**
* Specify Model class name.
*
* @return string
*/
public function model()
{
return BhSorders::class;
}
/**
* Boot up the repository, pushing criteria.
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/
public function boot()
{
$this->pushCriteria(app(RequestCriteria::class));
}
/**
* 返回指定订单编号的订单信息
* @param $order_no
* @return mixed
*/
public function getSorderFromOrderNo($orderNo)
{
$where = [
'so_no' => $orderNo
];
return $this->findWhere($where)->first();
}
/**
* 获取订单详情
* @param $orderNo
* @return mixed
*/
public function getSorderItemsFromOrderNo($orderNo){
$soItems = $this
->join('soitems','soitems.so_id','sorders.so_id')
->where('sorders.so_no',$orderNo)->get();
return $soItems;
}
/**
* 获取订单相关信息(包括,产品,客户,品牌等)
* @param $so_id
* @return mixed
*/
public function getSorderDetailFromOrderId($so_id)
{
$sOrderInfo = $this
->join('customers','sorders.cus_id','customers.cus_id')
->where('sorders.so_id',$so_id)
->get();
if(!$sOrderInfo){
return ;
}
$sOrderInfo = current($sOrderInfo->toArray());
$items = DB::connection('bh_mysql')->table('soitems')
->join('products','soitems.p_id','products.p_id')
->join('chemicals','products.c_id','chemicals.c_id')
->join('brands','products.b_id','brands.b_id')
->where('soitems.so_id',$so_id)
->get();
if(!$items){
$sOrderInfo['items'] = [];
}
$sOrderInfo['items'] = $items->toArray();
return $sOrderInfo;
}
}
...@@ -2,18 +2,19 @@ ...@@ -2,18 +2,19 @@
namespace App\Repositories\Eloquent; namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\BhSorderRefundRepository; use App\Repositories\Contracts\RhawnRawRepository;
use App\Repositories\Criteria\RequestCriteria; use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Models\BhSorderRefund;
use App\Repositories\Eloquent\BaseRepository; use App\Repositories\Eloquent\BaseRepository;
use App\Repositories\Models\RhawnProducts;
use App\Repositories\Models\RhawnRaw;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Prettus\Validator\Contracts\ValidatorInterface; use Prettus\Validator\Contracts\ValidatorInterface;
/** /**
* Class UserRepositoryEloquent. * Class UserRepositoryEloquent.
*/ */
class BhSorderRefundRepositoryEloquent extends BaseRepository implements BhSorderRefundRepository class RhawnRawRepositoryEloquent extends BaseRepository implements RhawnRawRepository
{ {
protected $fieldSearchable = [ protected $fieldSearchable = [
]; ];
...@@ -25,7 +26,7 @@ class BhSorderRefundRepositoryEloquent extends BaseRepository implements BhSorde ...@@ -25,7 +26,7 @@ class BhSorderRefundRepositoryEloquent extends BaseRepository implements BhSorde
*/ */
public function model() public function model()
{ {
return BhSorderRefund::class; return RhawnRaw::class;
} }
/** /**
...@@ -38,49 +39,34 @@ class BhSorderRefundRepositoryEloquent extends BaseRepository implements BhSorde ...@@ -38,49 +39,34 @@ class BhSorderRefundRepositoryEloquent extends BaseRepository implements BhSorde
$this->pushCriteria(app(RequestCriteria::class)); $this->pushCriteria(app(RequestCriteria::class));
} }
/** public function total(){
* 添加退款任务 return $this->count();
* @param $request }
*/
public function addRefundTask($params)
{
if(empty($params)){
throw new \LogicException('参数为空!',500);
}
$task = [];
$task['name'] = $params['name'];
unset($params['name']);
$task['exec_content'] = json_encode($params); public function getRawProductList($pageSize = 1000, $offset = 0)
$task['create_by'] = auth()->user()->id; {
$task['status'] = 'notexec'; $rawList = RhawnRaw::query()
$task['type'] = 'sorder_refund'; ->join('chemicals', 'chemicals.c_id','raw.c_id')
->offset($offset)
->limit($pageSize)
->get();
if(isset($params['task_id']) && !empty($params['task_id'])){ return $rawList->toArray();
$id = $params['task_id'];
return $this->update($task,$id);
}else{
return $this->create($task);
}
} }
public function delRefundTask($params) public function getProductPackage($rawProductIds)
{ {
if(empty($params)){ $packagesList = RhawnProducts::query()
throw new \LogicException('参数为空!',500); ->join('raw','raw.r_id','products.r_id')
} ->join('chemicals', 'chemicals.c_id','raw.c_id');
DB::beginTransaction(); if(is_array($rawProductIds)){
try{ $packagesList = $packagesList->whereIn('raw.r_id',$rawProductIds);
$this->delete($params['task_id']); }else{
DB::table('task_log') $packagesList = $packagesList->where('raw.r_id',$rawProductIds);
->where('task_id',$params['task_id'])
->delete();
DB::commit();
}catch(\Exception $e){
DB::rollback();
} }
$packagesList = $packagesList->get();
return $packagesList->toArray();
} }
} }
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\RhawnSoitemsRepository;
use App\Repositories\Contracts\RhawnSordersRepository;
use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Eloquent\BaseRepository;
use App\Repositories\Models\RhawnSoitems;
use Prettus\Validator\Contracts\ValidatorInterface;
/**
* Class UserRepositoryEloquent.
*/
class RhawnSoitemsRepositoryEloquent extends BaseRepository implements RhawnSoitemsRepository
{
protected $fieldSearchable = [
];
/**
* Specify Model class name.
*
* @return string
*/
public function model()
{
return RhawnSoitems::class;
}
/**
* Boot up the repository, pushing criteria.
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/
public function boot()
{
$this->pushCriteria(app(RequestCriteria::class));
}
/**
* 获取订单详情
* @param $orderId
* @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
*/
public function getSorderItemsDetailFromOrderId($orderId)
{
$order = app(RhawnSordersRepository::class)->find($orderId);
if(!$order){
throw new \LogicException('该订单不存在!',500);
}
//查询订单的详情
$soItems = RhawnSoitems::query()
->join('products','soitems.p_id','products.p_id')
->join('chemicals','products.c_id','chemicals.c_id')
->join('brands','products.b_id','brands.b_id')
->where('soitems.so_id',$order->so_id)->get();
return $soItems;
}
public function getSorderItemsDetailFromItemId($itemId,$pid=null)
{
//查询订单的详情
$soItems = RhawnSoitems::query()
->join('sorders','sorders.so_id','soitems.so_id')
->join('products','soitems.p_id','products.p_id')
->join('chemicals','products.c_id','chemicals.c_id')
->join('brands','products.b_id','brands.b_id')
->where('soitems.si_id',$itemId);
if(!is_null($pid)){
$soItems = $soItems->where('soitems.p_id',$pid);
}
$soItems = $soItems->get();
return $soItems;
}
/**
* 根据si_id获取订单明细项
* @param $si_id
* @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
*/
public function getSorderItemFromItemId($si_id)
{
$item = $this->find($si_id);
if(!$item){
throw new \LogicException('该订单项不存在!',500);
}
//查询订单的详情
$soItems = RhawnSoitems::query()
->join('products','soitems.p_id','products.p_id')
->where('soitems.si_id',$si_id)->get();
return $soItems;
}
public function getOrderItemsStockFromItemIds($id)
{
if(!is_array($id)){
$item = $this->find($id);
$id = (array)$id;
}else{
$item = RhawnSoitems::query()->whereIn('si_id',$id)->get();
}
if(!$item){
throw new \LogicException('该订单项不存在!',500);
}
//查询订单的详情
$soItemStock = RhawnSoitems::query()
->join('dpdetail','dpdetail.si_id','soitems.si_id')
->join('pstock','pstock.pstk_id','dpdetail.pstk_id')
->join('products','soitems.p_id','products.p_id')
->whereIn('soitems.si_id',$id)
->where('si_if_cancel',0)
//->where('dpdetail.dpd_invoiced','=',0)
->get();
return $soItemStock;
}
}
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\RhawnSorderRefundRepository;
use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Models\RhawnSorderRefund;
use App\Repositories\Eloquent\BaseRepository;
use Illuminate\Support\Facades\DB;
use Prettus\Validator\Contracts\ValidatorInterface;
/**
* Class UserRepositoryEloquent.
*/
class RhawnSorderRefundRepositoryEloquent extends BaseRepository implements RhawnSorderRefundRepository
{
protected $fieldSearchable = [
];
/**
* Specify Model class name.
*
* @return string
*/
public function model()
{
return RhawnSorderRefund::class;
}
/**
* Boot up the repository, pushing criteria.
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/
public function boot()
{
$this->pushCriteria(app(RequestCriteria::class));
}
/**
* 添加退款任务
* @param $request
*/
public function addRefundTask($params)
{
if(empty($params)){
throw new \LogicException('参数为空!',500);
}
$task = [];
$task['name'] = $params['name'];
unset($params['name']);
$task['exec_content'] = json_encode($params);
$task['create_by'] = auth()->user()->id;
$task['status'] = 'notexec';
$task['type'] = 'rhawn_sorder_refund';
if(isset($params['task_id']) && !empty($params['task_id'])){
$id = $params['task_id'];
return $this->update($task,$id);
}else{
return $this->create($task);
}
}
public function delRefundTask($params)
{
if(empty($params)){
throw new \LogicException('参数为空!',500);
}
DB::beginTransaction();
try{
$this->delete($params['task_id']);
DB::table('task_log')
->where('task_id',$params['task_id'])
->delete();
DB::commit();
}catch(\Exception $e){
DB::rollback();
}
}
}
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\RhawnSordersRepository;
use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Models\RhawnSorders;
use App\Repositories\Eloquent\BaseRepository;
use Illuminate\Support\Facades\DB;
use Prettus\Validator\Contracts\ValidatorInterface;
/**
* Class UserRepositoryEloquent.
*/
class RhawnSordersRepositoryEloquent extends BaseRepository implements RhawnSordersRepository
{
protected $fieldSearchable = [
];
/**
* Specify Model class name.
*
* @return string
*/
public function model()
{
return RhawnSorders::class;
}
/**
* Boot up the repository, pushing criteria.
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/
public function boot()
{
$this->pushCriteria(app(RequestCriteria::class));
}
/**
* 返回指定订单编号的订单信息
* @param $order_no
* @return mixed
*/
public function getSorderFromOrderNo($orderNo)
{
$where = [
'so_no' => $orderNo
];
return $this->findWhere($where)->first();
}
/**
* 获取订单详情
* @param $orderNo
* @return mixed
*/
public function getSorderItemsFromOrderNo($orderNo){
$soItems = $this
->join('soitems','soitems.so_id','sorders.so_id')
->where('sorders.so_no',$orderNo)->get();
return $soItems;
}
/**
* 获取订单相关信息(包括,产品,客户,品牌等)
* @param $so_id
* @return mixed
*/
public function getSorderDetailFromOrderId($so_id)
{
$sOrderInfo = $this
->join('customers','sorders.cus_id','customers.cus_id')
->where('sorders.so_id',$so_id)
->get();
if(!$sOrderInfo){
return ;
}
$sOrderInfo = current($sOrderInfo->toArray());
$items = DB::connection('bh_mysql')->table('soitems')
->join('products','soitems.p_id','products.p_id')
->join('chemicals','products.c_id','chemicals.c_id')
->join('brands','products.b_id','brands.b_id')
->where('soitems.so_id',$so_id)
->get();
if(!$items){
$sOrderInfo['items'] = [];
}
$sOrderInfo['items'] = $items->toArray();
return $sOrderInfo;
}
}
...@@ -2,20 +2,21 @@ ...@@ -2,20 +2,21 @@
namespace App\Repositories\Eloquent; namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\BhPordersRepository; use App\Repositories\Contracts\ThirdApiPlatformRepository;
use App\Repositories\Criteria\RequestCriteria; use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Models\BhPorders;
use App\Repositories\Eloquent\BaseRepository; use App\Repositories\Eloquent\BaseRepository;
use Illuminate\Support\Facades\DB; use App\Repositories\Models\ThirdApiPlatform;
use Illuminate\Container\Container as Application;
use Prettus\Validator\Contracts\ValidatorInterface; use Prettus\Validator\Contracts\ValidatorInterface;
/** /**
* Class UserRepositoryEloquent. * Class UserRepositoryEloquent.
*/ */
class BhPordersRepositoryEloquent extends BaseRepository implements BhPordersRepository class ThirdApiPlatformRepositoryEloquent extends BaseRepository implements ThirdApiPlatformRepository
{ {
protected $fieldSearchable = [ protected $fieldSearchable = [
'platform_name', 'platform_title',
]; ];
/** /**
...@@ -24,29 +25,26 @@ class BhPordersRepositoryEloquent extends BaseRepository implements BhPordersRep ...@@ -24,29 +25,26 @@ class BhPordersRepositoryEloquent extends BaseRepository implements BhPordersRep
*/ */
public $rules = [ public $rules = [
ValidatorInterface::RULE_CREATE => [ ValidatorInterface::RULE_CREATE => [
'menu_name' => 'required', 'platform_name' => 'required',
'title' => 'required', 'platform_title' => 'required',
'menu_path' => 'required', 'platform_type' => 'required',
'parent_id' => 'required', 'platform_token' => 'required',
'menu_type' => 'required', 'platform_status' => 'required',
'status' => 'required',
'sort' => 'required',
'is_show' => 'required',
'sys_default' => 'required'
], ],
ValidatorInterface::RULE_UPDATE => [ ValidatorInterface::RULE_UPDATE => [
'menu_name' => 'required', 'platform_name' => 'required',
'title' => 'required', 'platform_title' => 'required',
'menu_path' => 'required', 'platform_type' => 'required',
'parent_id' => 'required', 'platform_token' => 'required',
'menu_type' => 'required', 'platform_status' => 'required',
'status' => 'required',
'sort' => 'required',
'is_show' => 'required',
'sys_default' => 'required'
] ]
]; ];
public function __construct(Application $app)
{
parent::__construct($app);
}
/** /**
* Specify Model class name. * Specify Model class name.
* *
...@@ -54,7 +52,7 @@ class BhPordersRepositoryEloquent extends BaseRepository implements BhPordersRep ...@@ -54,7 +52,7 @@ class BhPordersRepositoryEloquent extends BaseRepository implements BhPordersRep
*/ */
public function model() public function model()
{ {
return BhPorders::class; return ThirdApiPlatform::class;
} }
/** /**
...@@ -67,27 +65,13 @@ class BhPordersRepositoryEloquent extends BaseRepository implements BhPordersRep ...@@ -67,27 +65,13 @@ class BhPordersRepositoryEloquent extends BaseRepository implements BhPordersRep
$this->pushCriteria(app(RequestCriteria::class)); $this->pushCriteria(app(RequestCriteria::class));
} }
public function getPlatformInfoByPlatformName($platformName)
/**
* 获取采购订单详情
* @param $po_id
* @return array
*/
public function getPorderItemsFromPoId($po_id,$pi_id = null)
{ {
$pOrder = $this->findWhere(['po_id' => $po_id])->toArray(); $platformInfo = $this->findWhere(['platform_name' => $platformName]);
if($platformInfo){
$db = DB::connection('bh_mysql'); $platformInfo = $platformInfo[0];
$rowQueryobj = $db->table('poitems') return $platformInfo->toArray();
->join('products','poitems.p_id','products.p_id')
->join('chemicals','products.c_id','chemicals.c_id')
->join('brands','products.b_id','brands.b_id');
$rowQueryobj->where('poitems.po_id',$po_id);
if(!is_null($pi_id)){
$rowQueryobj->where('poitems.pi_id',$pi_id);
} }
$pOrder['poitems'] = $rowQueryobj->get()->toArray(); return null;
return $pOrder;
} }
} }
...@@ -15,4 +15,6 @@ use Jiannei\Enum\Laravel\Repositories\Enums\LogEnum as BaseLogEnum; ...@@ -15,4 +15,6 @@ use Jiannei\Enum\Laravel\Repositories\Enums\LogEnum as BaseLogEnum;
class LogEnum extends BaseLogEnum class LogEnum extends BaseLogEnum
{ {
const SYSTEM_OPERATION = 'system:operation';
const SYSTEM_API = 'system:api';
} }
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Models;
class BhPorders extends Model
{
protected $table = 'porders';
protected $connection = 'bh_mysql';
protected $primaryKey = 'po_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'po_sup_order','po_if_direct'
];
protected $guarded = ['updated_at'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [
];
/**
* update时不做自动更新时间操作
* @return null
*/
public function getUpdatedAtColumn()
{
return null;
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Models;
class BhSoitems extends Model
{
// 销售订单
protected $table = 'soitems';
protected $connection = 'bh_mysql';
protected $primaryKey = 'si_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
];
protected $guarded = ['created_at', 'updated_at'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [
];
/**
* update时不做自动更新时间操作
* @return null
*/
public function getUpdatedAtColumn()
{
return null;
}
public function getCreatedAtColumn()
{
return null;
}
}
\ No newline at end of file
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Models;
class BhSorderRefund extends Model
{
protected $table = 'tools_task';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id','name','exec_content','status','error_message','type','exec_nums','create_by'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [
];
}
\ No newline at end of file
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Models;
class BhSorders extends Model
{
// 销售订单
protected $table = 'sorders';
protected $connection = 'bh_mysql';
protected $primaryKey = 'so_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
];
protected $guarded = ['created_at', 'updated_at'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [
];
/**
* update时不做自动更新时间操作
* @return null
*/
public function getUpdatedAtColumn()
{
return null;
}
public function getCreatedAtColumn()
{
return null;
}
}
\ No newline at end of file
...@@ -11,15 +11,15 @@ ...@@ -11,15 +11,15 @@
namespace App\Repositories\Models; namespace App\Repositories\Models;
class RhawnSorders extends Model class RhawnProducts extends Model
{ {
// 销售订单 // 产品
protected $table = 'sorders'; protected $table = 'products';
protected $connection = 'rhawn_mysql'; protected $connection = 'rhawn_mysql';
protected $primaryKey = 'so_id'; protected $primaryKey = 'p_id';
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
...@@ -29,8 +29,6 @@ class RhawnSorders extends Model ...@@ -29,8 +29,6 @@ class RhawnSorders extends Model
protected $fillable = [ protected $fillable = [
]; ];
protected $guarded = ['created_at', 'updated_at'];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
* *
......
...@@ -11,15 +11,15 @@ ...@@ -11,15 +11,15 @@
namespace App\Repositories\Models; namespace App\Repositories\Models;
class RhawnSoitems extends Model class RhawnRaw extends Model
{ {
// 销售订单 // 产品
protected $table = 'soitems'; protected $table = 'raw';
protected $connection = 'rhawn_mysql'; protected $connection = 'rhawn_mysql';
protected $primaryKey = 'si_id'; protected $primaryKey = 'r_id';
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
...@@ -29,8 +29,6 @@ class RhawnSoitems extends Model ...@@ -29,8 +29,6 @@ class RhawnSoitems extends Model
protected $fillable = [ protected $fillable = [
]; ];
protected $guarded = ['created_at', 'updated_at'];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
* *
......
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Models;
class RhawnSorderRefund extends Model
{
protected $table = 'tools_task';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id','name','exec_content','status','error_message','type','exec_nums','create_by'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [
];
}
\ No newline at end of file
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
namespace App\Repositories\Models; namespace App\Repositories\Models;
class ToolsTask extends Model class ThirdApiPlatform extends Model
{ {
protected $table = 'tools_task'; protected $connection = 'mysql';
protected $table = 'third_api_platform';
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
...@@ -22,15 +23,15 @@ class ToolsTask extends Model ...@@ -22,15 +23,15 @@ class ToolsTask extends Model
* @var array * @var array
*/ */
protected $fillable = [ protected $fillable = [
'platform_name','platform_title','platform_url','platform_desc','platform_icon','platform_params','platform_type','platform_token','platform_status','created_by','updated_by'
]; ];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
* *
* @var array * @var array
*/ */
protected $hidden = [ protected $hidden = [
];
];
} }
This diff is collapsed.
<?php
namespace App\Services;
use App\Repositories\Contracts\RhawnRawRepository;
use App\Repositories\Contracts\ThirdApiPlatformRepository;
use App\Services\Kafka\KafkaService;
use App\Services\ThirdPlatform\Api\IntegleApiService;
use App\Services\ThirdPlatform\PlatformAbstractService;
class InteglePlatformService extends PlatformAbstractService
{
public function __construct(ThirdApiPlatformRepository $thirdApiPlatformRepository)
{
$this->setPlatformName('integle');
parent::__construct($thirdApiPlatformRepository);
}
/**
* 批量更新产品到integle平台
*/
public function batchUpdateProducts()
{
$status = $this->checkApiPlatformStatus($this->platformName);
if($status){
$this->getPlatformInfo($this->platformName);
$rhawnChemicalsService = app(RhawnChemicalsService::class);
$limit = $this->platformInfo['platform_params']['batchNums'];
$page = 0;
while(true) {
$rawList = $rhawnChemicalsService->getChemicalRawList($page * $limit, $limit);
if (!$rawList) {
break;
}
$rawIdList = [];
foreach ($rawList as $raw) {
$rawIdList[] = $raw['r_id'];
}
$packages = $rhawnChemicalsService->getChemicalPackage($rawIdList);
$newPackages = [];
if($packages){
foreach($packages as $pack){
$newPackages[$pack['r_code']] = $pack;
}
}
if(!empty($rawList)){
app(KafkaService::class)->produerSend(
[
'params' => ['rawList' => $rawList,'packageList' => $newPackages],
'consumer' => 'App\Services\InteglePlatformService',
'method' => 'batchUpdateApi'
]
);
$page ++;
}
}
}
}
public function batchUpdateApi($updateData)
{
$result = app(IntegleApiService::class)->pushBatchUpdateProduct($updateData);
if($result){
if($result['status'] === false){
app(KafkaService::class)->produerSend(
[
'consumer' => 'App\Services\InteglePlatformService',
'method' => 'batchUpdateApi',
'params' => $updateData
]
);
}
}
unset($result['status']);
$logsContent = [
'apiParams' => $updateData,
'apiReturn' => $result
];
app(SysLogService::class)->addApiLogs($logsContent);
}
}
<?php
namespace App\Services\Kafka;
use App\Services\SysLogService;
use App\Support\Traits\KafkaConfigHelpers;
use longlang\phpkafka\Consumer\ConsumeMessage;
use longlang\phpkafka\Consumer\Consumer;
use longlang\phpkafka\Producer\Producer;
class KafkaService
{
use KafkaConfigHelpers;
protected $kafkaProducerConfig = null;
protected $kafkaConsumerConfig = null;
protected $config = null;
public function __construct($config)
{
$this->kafkaProducerConfig = $this->getProducerConfig($config);
$this->kafkaConsumerConfig = $this->getConsumerConfig($config);
$this->config = $config;
}
/**
* 推送记录
* @param $contentValue
* @param null $topic
*/
public function produerSend($contentValue, $topic = null)
{
try {
$kafkaTopic = $topic;
if ($kafkaTopic == null) {
$kafkaTopic = $this->config['topic'];
}
$key = uniqid($kafkaTopic, true);
$producer = new Producer($this->kafkaProducerConfig);
$producer->send($kafkaTopic, json_encode($contentValue), $key);
app(SysLogService::class)->addOperationLogs(
[
'content' => $contentValue
]
);
} catch (\Exception $exception) {
$this->errLog($exception);
throw $exception;
}
}
/**
* 开启消费者
*/
public function startConsumer()
{
$consumer = new Consumer($this->kafkaConsumerConfig, function (ConsumeMessage $message) {
$consumer = $message->getConsumer();
$kafkaMessage = json_decode($message->getValue(),true);
try{
app($kafkaMessage['consumer'])->{$kafkaMessage['method']}($kafkaMessage['params']);
$consumer->ack($message); // 手动提交
}catch(\Exception $exception){
$this->errLog($exception);
}
$consumer->stop();
});
$consumer->start();
$consumer->close();
}
public function errLog($exception)
{
app(SysLogService::class)->addOperationLogs(
[
'error' => $exception->getCode(),
'message' => $exception->getMessage()
]
);
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Services;
use App\Repositories\Contracts\RhawnRawRepository;
use App\Repositories\Enums\ResponseCodeEnum;
use Illuminate\Support\Facades\DB;
class RhawnChemicalsService
{
public $rhawnRawRepository = null;
public function __construct(RhawnRawRepository $rhawnRawRepository)
{
$this->rhawnRawRepository = $rhawnRawRepository;
}
/**
* @param int $offset
* @param int $limit
*/
public function getChemicalRawList($offset = 0, $limit = 100)
{
$rawList = $this->rhawnRawRepository->getRawProductList($limit, $offset);
return $rawList;
}
public function getChemicalPackage($rawIds)
{
$packageList = $this->rhawnRawRepository->getProductPackage($rawIds);
return $packageList;
}
}
This diff is collapsed.
...@@ -12,21 +12,10 @@ ...@@ -12,21 +12,10 @@
namespace App\Services; namespace App\Services;
use App\Repositories\Contracts\SysLogRepository; use App\Repositories\Contracts\SysLogRepository;
use App\Repositories\Enums\ResponseCodeEnum; use App\Repositories\Enums\LogEnum;
use App\Support\Traits\Helpers;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Spatie\Permission\Models\Role;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use App\Repositories\Models\AdminUsers;
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
class SysLogService class SysLogService
{ {
use Helpers;
protected $sysLogRepository = null; protected $sysLogRepository = null;
public function __construct(SysLogRepository $sysLogRepository) public function __construct(SysLogRepository $sysLogRepository)
...@@ -34,13 +23,26 @@ class SysLogService ...@@ -34,13 +23,26 @@ class SysLogService
$this->sysLogRepository = $sysLogRepository; $this->sysLogRepository = $sysLogRepository;
} }
public function addOperationLogs($logsContent)
public function addSysLog($request)
{ {
$requestContent = []; $context = [
$requestContent['content'] = $request->all(); 'content' => $logsContent,
//$requestContent['ip'] = $request->ip(); 'optime' => microtime(true),
//$requestContent['path'] = $request->url(); ];
logger_async(LogEnum::SYSTEM_OPERATION, $context)
->onConnection(\config('logging.request.connection'))
->onQueue(\config('logging.request.queue'));
}
public function addApiLogs($logsContent)
{
$context = [
'content' => $logsContent,
'optime' => microtime(true),
];
logger_async(LogEnum::SYSTEM_API, $context)
->onConnection(\config('logging.request.connection'))
->onQueue(\config('logging.request.queue'));
} }
} }
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Services\ThirdPlatform\Api;
use App\Repositories\Contracts\ThirdApiPlatformRepository;
use App\Services\ThirdPlatform\PlatformAbstractService;
use App\Support\Traits\HttpClientHelpers;
class IntegleApiService extends PlatformAbstractService
{
use HttpClientHelpers;
public function __construct(ThirdApiPlatformRepository $thirdApiPlatformRepository)
{
$this->setPlatformName('integle');
parent::__construct($thirdApiPlatformRepository);
}
/**
* 批量更新商品信息
* @param $product
*/
public function pushBatchUpdateProduct($product)
{
$this->getPlatformInfo($this->platformName);
if(!$this->platformInfo){
throw new \LogicException('第三方平台信息无法获取!',500);
}
try{
$params = [];
$params['ak'] = $this->platformInfo['platform_params']['ak'];
$params['product'] = $this->mergeApiMetaData($product);
$response = $this->getPostClient('http://suppliers.integle.com/openapi/chem/batch-save',$params);
return $this->apiResponse($response);
}catch(\Exception $e){
return $this->requestError($e);
}
}
/**
* 整理组装 api 数据
* @param $metaData
* @return array
*/
public function mergeApiMetaData($metaData)
{
if(empty($metaData)){
return [];
}
$mergeData = [];
foreach($metaData['rawList'] as $datas){
$tempData['in_product_id'] = $datas['r_code'];
$tempData['cas'] = $datas['c_cas'];
$tempData['cn_name'] = $datas['r_cn_name'];
$tempData['en_name'] = $datas['r_en_name'];
$tempData['brand'] = '罗恩';
$tempData['package'] = [];
if(isset($metaData['packageList'][$datas['r_code']])){
$package = $metaData['packageList'][$datas['r_code']];
$pack['in_product_id'] = $package['p_code'];
$pack['purity'] = $package['r_level'];
$pack['package_size'] = $package['p_pack'];
$pack['package_unit'] = $package['p_pack_unit'];
$pack['price'] = $package['p_price'];
$pack['ship_within_time'] = 0;
$pack['area_stock'] = ['location' => '上海', 'inventory' => $package['p_stock']];
$pack['promotion_tag'] = '';
$pack['status'] = $package['p_status'] == '1' ? 1 : 0;
array_push($tempData['package'],$pack);
}
array_push($mergeData,$tempData);
unset($tempData);
}
return $mergeData;
}
protected function apiResponse($response)
{
$returnResult = [];
$decodeResponse = json_decode($response,true);
$returnResult['resultContent'] = $decodeResponse;
$returnResult['status'] = false;
if($decodeResponse){
if($decodeResponse['status'] == 1){
$returnResult['status'] = true;
}
}
return $returnResult;
}
protected function requestError($response)
{
return [
'status' => false,
'resultContent' => [
'error_code' => $response->getCode(),
'error_message' => $response->getMessage()
],
];
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Services\ThirdPlatform\Api;
use App\Repositories\Contracts\ThirdApiPlatformRepository;
use App\Support\Traits\HttpClientHelpers;
class WuxiApiService
{
use HttpClientHelpers;
protected $platformInfo = null;
public function __construct()
{
$this->platformInfo = app(ThirdApiPlatformRepository::class)->getPlatformInfoByPlatformName('wuxi_appTec');
$this->platformInfo['platform_params'] = json_decode($this->platformInfo['platform_params'], true);
}
/**
* 批量更新商品信息
* @param $product
* @return bool
*/
public function pushBatchUpdateProduct($product){
if(!$this->platformInfo){
throw new \LogicException('第三方平台信息无法获取!',500);
}
try{
$params = [];
$params['chemicalProducts'] = $this->mergeApiMetaData($product);
$response = $this->getPostClient('https://api.uploadcatalog.com/api/v1/update',$params, [
$this->platformInfo['platform_params']['username'], $this->platformInfo['platform_params']['password']
]);
return $this->apiResponse($response);
}catch(\Exception $e){
return $this->requestError($e);
}
}
/**
* 整理组装 api 数据
* @param $metaData
* @return array
*/
public function mergeApiMetaData($metaData)
{
if(empty($metaData)){
return [];
}
$mergeData = [];
foreach($metaData['rawList'] as $datas){
$tempData['supplier_product_id'] = $datas['r_code'];
$tempData['mdl'] = '';
$tempData['cas'] = $datas['c_cas'];
$tempData['nu'] = '';
$tempData['chinese_name'] = $datas['r_cn_name'];
$tempData['english_name'] = $datas['r_en_name'];
$tempData['chemicalformula'] = '';
$tempData['purity'] = $datas['r_level'];
/*$tempData['usually_ships_days_min'] = '';
$tempData['usually_ships_within_days'] = '';
$tempData['backorder_lead_time'] = '';*/
$tempData['status'] = $datas['r_status'] == '1' ? 'ACTIVE' : 'INACTIVE';
$tempData['inventorys'][] = [
'type' => $datas['r_unit'],
'quantity' => floatval($datas['r_stock']),
'country' => 'CN',
'stock_status' => $datas['r_stock'] > 0 ? 'INSTOCK' : 'OUTSTOCK',
];
$tempData['package'] = [];
if(isset($metaData['packageList'][$datas['r_code']])){
$package = $metaData['packageList'][$datas['r_code']];
$pack['unit_description'] = $package['p_pack_unit'];
$pack['package_status'] = $package['p_status'] == '1' ? 'ACTIVE' : 'INACTIVE';
$pack['inventorys'] = [
'package_quantity' => $package['p_stock'],
'stock_status' => $package['p_stock'] > 0 ? 'INSTOCK' : 'OUTSTOK',
'country' => 'CN'
];
$pack['prices'] = [
'price' => $package['p_price'],
'currency' => 'RMB',
'status' => 'ACTIVE'
];
$pack['costs'] = [
'In_cost' => $package['p_avg_cost'],
'In_cost_currency' => 'RMB',
'status' => $package['p_stock'] > 0 ? 'ACTIVE' : 'INACTVIE',
];
$pack['wuxiPackagePricings'] = [
'discount'=> 0.00,
'currency' => 'RMB',
'status' => 'INACTIVE'
];
array_push($tempData['package'],$pack);
}
array_push($mergeData,$tempData);
unset($tempData);
}
return $mergeData;
}
protected function apiResponse($response)
{
$decodeResponse = json_decode($response,true);
if($decodeResponse){
if(!empty($decodeResponse['successProduct'])){
return true;
}
}
return false;
}
protected function requestError($response)
{
return false;
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Services\ThirdPlatform;
use App\Repositories\Contracts\ThirdApiPlatformRepository;
abstract class PlatformAbstractService
{
protected $thirdApiPlatformRepository = null;
protected $platformName = '';
protected $platformInfo = null;
public function __construct(ThirdApiPlatformRepository $thirdApiPlatformRepository)
{
$this->thirdApiPlatformRepository = $thirdApiPlatformRepository;
//app(ThirdApiPlatformRepository::class)->getPlatformInfoByPlatformName($this->platformName);
}
protected function setPlatformName($platformName){
$this->platformName = $platformName;
}
/**
* 根据平台名称查询平台的状态(关闭或开启)
* @param $platformName
*/
protected function checkApiPlatformStatus($platformName)
{
$status = false;
$platformStatus = $this->getPlatformInfo($platformName);
if($platformStatus){
$status = $platformStatus['platform_status'] == 1 ? true : false;
}
return $status;
}
protected function getPlatformInfo($platformName)
{
if($this->platformInfo == null){
$platform = $this->thirdApiPlatformRepository->getPlatformInfoByPlatformName($platformName);
if(!$platform){
return null;
}
$platform['platform_params'] = json_decode($platform['platform_params'], true);
$this->platformInfo = $platform;
}
return $this->platformInfo;
}
protected function batchUpdateProducts()
{
}
protected function batchUpdateApi($apiParams)
{
}
}
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Services;
use App\Export\BaseExport;
use App\Export\WuxiLab\WuxiLabExport;
use App\Repositories\Contracts\ThirdApiPlatformRepository;
use App\Services\Kafka\KafkaService;
use App\Services\ThirdPlatform\Api\WuxiApiService;
use App\Services\ThirdPlatform\PlatformAbstractService;
use longlang\phpkafka\Protocol\ApiVersions\ApiVersionsResponse;
class WuxiLabService extends PlatformAbstractService
{
public function __construct(ThirdApiPlatformRepository $thirdApiPlatformRepository)
{
$this->setPlatformName('wuxi_appTec');
parent::__construct($thirdApiPlatformRepository);
}
/**
* 批量更新商品
*/
public function batchUpdateProducts()
{
$status = $this->checkApiPlatformStatus($this->platformName);
if($status){
$this->getPlatformInfo($this->platformName);
$rhawnChemicalsService = app(RhawnChemicalsService::class);
$limit = $this->platformInfo['platform_params']['batchNums'];
$page = 0;
while(true) {
$rawList = $rhawnChemicalsService->getChemicalRawList($page * $limit, $limit);
if (!$rawList) {
break;
}
$rawIdList = [];
foreach ($rawList as $raw) {
$rawIdList[] = $raw['r_id'];
}
$packages = $rhawnChemicalsService->getChemicalPackage($rawIdList);
$newPackages = [];
if($packages){
foreach($packages as $pack){
$newPackages[$pack['r_code']] = $pack;
}
}
if(!empty($rawList)){
/*if(
$this->batchUpdateApi(
['rawList' => $rawList,'packageList' => $newPackages]
)
){
//$page = intval($count / $limit) * $limit;
$page ++;
usleep(3000);
}*/
app(KafkaService::class)->produerSend(
[
'params' => ['rawList' => $rawList,'packageList' => $newPackages],
'consumer' => 'App\Services\WuxiLabService',
'method' => 'batchUpdateApi'
]
);
}
break;
}
}
}
public function batchUpdateApi($updateData)
{
$result = app(WuxiApiService::class)->pushBatchUpdateProduct($updateData);
if($result){
if($result['status'] === false){
app(KafkaService::class)->produerSend(
[
'' =>'',
'params' => $updateData
]
);
}
}
unset($result['status']);
$logsContent = [
'apiParams' => $updateData,
'apiReturn' => $result
];
app(SysLogService::class)->addApiLogs($logsContent);
}
/**
* 初始化生成产品excel文档
*/
public function initCreateProductsToExcel($exportLimit)
{
$rhawnChemicalsService = app(RhawnChemicalsService::class);
$limit = $exportLimit;
$page = 0;
while(true) {
$rawList = $rhawnChemicalsService->getChemicalRawList($page * $limit, $limit);
if (!$rawList) {
break;
}
$rawIdList = [];
foreach ($rawList as $raw) {
$rawIdList[] = $raw['r_id'];
}
$packages = $rhawnChemicalsService->getChemicalPackage($rawIdList);
$newPackages = [];
if($packages){
foreach($packages as $pack){
$newPackages[$pack['r_code']] = $pack;
}
}
if(!empty($rawList)){
app(WuxiLabExport::class)->saveExcel(
['rawList' => $rawList,'packageList' => $newPackages]
);
}
break;
}
}
}
...@@ -58,7 +58,7 @@ trait Helpers ...@@ -58,7 +58,7 @@ trait Helpers
return $data; return $data;
} }
public static function print($arr){ public static function printArr($arr){
echo "<pre>"; echo "<pre>";
print_R($arr); print_R($arr);
} }
......
<?php
namespace App\Support\Traits;
use Illuminate\Support\Str;
trait HttpClientHelpers
{
protected function getPostClient($uri, $paramsBody, $auth = null, $json = true)
{
$client = app(\GuzzleHttp\Client::class);
$options = [];
if($json) {
$options['headers'] = [
'Content-type'=> 'application/json',
"Accept" => "application/json"
];
$options['json'] = $paramsBody;
}
else{
$options['form_params'] = $paramsBody;
}
if($auth && is_array($auth)){
$options['auth'] = $auth;
}
$options['debug'] = env('API_DEBUG');
$response = $client->request('post',$uri,$options);
return $response->getBody()->getContents();
}
}
<?php
namespace App\Support\Traits;
use longlang\phpkafka\Consumer\ConsumerConfig;
use longlang\phpkafka\Producer\ProducerConfig;
trait KafkaConfigHelpers
{
public function getProducerConfig($config)
{
$kafkaConfig = app(ProducerConfig::class);
$kafkaConfig->setBootstrapServer($config['host'].":".$config['port']);
$kafkaConfig->setUpdateBrokers(true);
$kafkaConfig->setAcks(-1);
return $kafkaConfig;
}
public function getConsumerConfig($config)
{
$kafkaConfig = new ConsumerConfig();
$kafkaConfig->setBroker([$config['host'].":".$config['port']]);
$kafkaConfig->setTopic($config['topic']); // 主题名称
$kafkaConfig->setGroupId($config['groupid']); // 分组ID
$kafkaConfig->setClientId($config['clientid']); // 客户端ID
$kafkaConfig->setGroupInstanceId($config['clientid']); // 分组实例ID
return $kafkaConfig;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -71,6 +71,7 @@ return [ ...@@ -71,6 +71,7 @@ return [
'retry_after' => 90, 'retry_after' => 90,
'block_for' => null, 'block_for' => null,
], ],
], ],
/* /*
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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