feat: 订单派单模块

This commit is contained in:
gcd 2025-03-30 10:23:25 +08:00
parent fd4eecbf99
commit 191156ec96
4 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,21 @@
<?php
namespace app\common\model;
use think\Model;
class OrderDispatch extends Model
{
protected $visible = [
];
protected $hidden = [
];
// public function orderInfo()
// {
// return $this->belongsTo('User','uid');
// }
}

View File

@ -8,6 +8,7 @@ use app\common\model\Worker;
use think\Log;
use app\common\model\WorkerVendor;
use app\common\model\OrderDispatch;
//{%add use model%}
class BaseService
@ -67,5 +68,21 @@ class BaseService
return app(WorkerVendor::class, true);
}
/**
* @return OrderDispatchService
*/
protected function getOrderDispatchService()
{
return app(OrderDispatchService::class);
}
/**
* @return OrderDispatch
*/
protected function getOrderDispatchModel()
{
return app(OrderDispatch::class, true);
}
//{%add function code%}
}

View File

@ -0,0 +1,18 @@
<?php
namespace app\services;
use app\admin\model\OrderDispatch;
class OrderDispatchService extends BaseService
{
public function dispatchList(int $workerId, int $pageSize)
{
$model = $this->getOrderDispatchModel()
->where('status', OrderDispatch::STATUS_TOGET)
->where('worker_id', $workerId)
->field(['id', 'order_id', 'status', 'remark', 'plan_time', 'create_time'])
->paginate($pageSize);
return $model;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace app\worker\controller;
use app\common\controller\WorkerApi;
class OrderDispatch extends WorkerApi
{
protected $noNeedLogin = [];
public function index()
{
$res = $this->getOrderDispatchService()->dispatchList($this->user['id'], $this->request->request('page_size', 20));
$this->success('获取成功', $res);
}
}