Commit ab545899 authored by hangjun83's avatar hangjun83

1、、增加查看日志

parent 8d5cc256
......@@ -27,6 +27,7 @@ class RepositoryServiceProvider extends LumenRepositoryServiceProvider
'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',
];
/**
......
<?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 ToolsTaskRepository 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 BhSorderRefundTaskLogCriteria extends Criteria
{
protected function condition(Builder $query): void
{
if($this->request->has('type')){
$query->where('type', '=', $this->request->get('type'));
}
}
}
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\Contracts\ToolsTaskRepository;
use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Eloquent\BaseRepository;
use App\Repositories\Models\SysLog;
use App\Repositories\Models\ToolsTask;
use Prettus\Validator\Contracts\ValidatorInterface;
/**
* Class UserRepositoryEloquent.
*/
class ToolsTaskRepositoryEloquent extends BaseRepository implements ToolsTaskRepository
{
protected $fieldSearchable = [
];
/**
* 定义validator的检索规则
* @var \string[][]
*/
public $rules = [
ValidatorInterface::RULE_CREATE => [
'menu_name' => 'required',
'title' => 'required',
'menu_path' => 'required',
'parent_id' => 'required',
'menu_type' => 'required',
'status' => 'required',
'sort' => 'required',
'is_show' => 'required',
'sys_default' => 'required'
],
ValidatorInterface::RULE_UPDATE => [
'menu_name' => 'required',
'title' => 'required',
'menu_path' => 'required',
'parent_id' => 'required',
'menu_type' => 'required',
'status' => 'required',
'sort' => 'required',
'is_show' => 'required',
'sys_default' => 'required'
]
];
/**
* Specify Model class name.
*
* @return string
*/
public function model()
{
return ToolsTask::class;
}
/**
* Boot up the repository, pushing criteria.
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/
public function boot()
{
$this->pushCriteria(app(RequestCriteria::class));
}
public function getTaskLogsFromType($type,$task_id=null)
{
$taskLogsList = $this
->join('task_log','tools_task.id','task_log.task_id')
->where('tools_task.type',$type);
if(!is_null($task_id)){
$taskLogsList = $taskLogsList->where('tools_task.id',$task_id);
}
$taskLogsList = $taskLogsList->get();
if($taskLogsList){
return $taskLogsList->toArray();
}
return [];
}
}
<?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 ToolsTask extends Model
{
protected $table = 'tools_task';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [
];
}
......@@ -24,7 +24,7 @@ $api->version('v1', function($api) {
$api->post('/adminapi/tools/bh/getBhSordersDetail', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@getBhSordersDetail']);
$api->get('/adminapi/tools/bh/getBhSorderRefundTask', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@getBhSorderRefundTaskToPage']);
$api->post('/adminapi/tools/bh/execBhSorderRefundTask', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@execBhSorderRefundTask']);
$api->get('/adminapi/tools/bh/getSorderRefundTaskLogs', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@getSorderRefundTaskLogs']);
$api->post('/adminapi/tools/bh/getSorderRefundTaskLogs', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@getSorderRefundTaskLogsToPage']);
});
......
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