feat: 异常原因列表接口

This commit is contained in:
苟川东 2025-04-20 09:37:25 +08:00
parent fe91ab5365
commit 84343e17e2
4 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,18 @@
<?php
namespace app\common\model;
use think\Model;
class Abnormal extends Model
{
protected $visible = [
];
protected $hidden = [
];
}

View File

@ -0,0 +1,18 @@
<?php
namespace app\services;
class AbnormalService extends BaseService
{
public function findAll()
{
return $this->getAbnormalModel()
->where('type', 1)
->order('sort', 'desc')
->field([
'id',
'title',
])
->select();
}
}

View File

@ -11,6 +11,7 @@ use think\Log;
use app\common\model\WorkerVendor;
use app\common\model\OrderDispatch;
use app\common\model\Order;
use app\common\model\Abnormal;
//{%add use model%}
class BaseService
@ -110,5 +111,21 @@ class BaseService
return app(OrderLogic::class);
}
/**
* @return AbnormalService
*/
protected function getAbnormalService()
{
return app(AbnormalService::class);
}
/**
* @return Abnormal
*/
protected function getAbnormalModel()
{
return app(Abnormal::class, true);
}
//{%add function code%}
}

View File

@ -0,0 +1,16 @@
<?php
namespace app\worker\controller;
use app\common\controller\WorkerApi;
class Abnormal extends WorkerApi
{
protected $noNeedLogin = [];
public function index()
{
$res = $this->getAbnormalService()->findAll();
$this->success('操作成功', $res);
}
}