feat : good
This commit is contained in:
42
app/Controller/Admin/GoodController.php
Normal file
42
app/Controller/Admin/GoodController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Middleware\Admin\JwtAuthMiddleware;
|
||||
use App\Request\Admin\DriverRequest;
|
||||
use App\Request\Admin\GoodRequest;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\Middlewares;
|
||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||
use Hyperf\HttpServer\Contract\RequestInterface;
|
||||
use Hyperf\HttpServer\Contract\ResponseInterface;
|
||||
use Hyperf\Validation\Annotation\Scene;
|
||||
|
||||
#[Controller(prefix: "admin/good")]
|
||||
#[Middlewares([
|
||||
JwtAuthMiddleware::class,
|
||||
])]
|
||||
class GoodController
|
||||
{
|
||||
/**
|
||||
* @param GoodRequest $request
|
||||
*/
|
||||
#[RequestMapping(path: "add_spu", methods: "POST")]
|
||||
#[Scene(scene: "add_spu")]
|
||||
public function add_spu(GoodRequest $request)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GoodRequest $request
|
||||
*/
|
||||
#[RequestMapping(path: "add_sku", methods: "POST")]
|
||||
#[Scene(scene: "add_sku")]
|
||||
public function add_sku(GoodRequest $request)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
23
app/Cron/Good/CycleCreateTask.php
Normal file
23
app/Cron/Good/CycleCreateTask.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* This crontab file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Cron\Good;
|
||||
|
||||
use Hyperf\Crontab\Annotation\Crontab;
|
||||
|
||||
#[Crontab(rule: "0 5 * * *", name: "CycleCreateTask", singleton: true , callback: "execute", memo: "这是一个示例的定时任务")]
|
||||
class CycleCreateTask
|
||||
{
|
||||
public function execute()
|
||||
{
|
||||
//todo Write logic
|
||||
var_dump(date('Y-m-d H:i:s', time()));
|
||||
}
|
||||
}
|
||||
28
app/Request/Admin/GoodRequest.php
Normal file
28
app/Request/Admin/GoodRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request\Admin;
|
||||
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class GoodRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user