feat: 订单派单模块
This commit is contained in:
parent
fd4eecbf99
commit
191156ec96
21
application/common/model/OrderDispatch.php
Normal file
21
application/common/model/OrderDispatch.php
Normal 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');
|
||||
// }
|
||||
}
|
||||
|
|
@ -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%}
|
||||
}
|
||||
|
|
|
|||
18
application/services/OrderDispatchService.php
Normal file
18
application/services/OrderDispatchService.php
Normal 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;
|
||||
}
|
||||
}
|
||||
16
application/worker/controller/OrderDispatch.php
Normal file
16
application/worker/controller/OrderDispatch.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user