Merge branch 'main' of https://gitea.lihaink.cn/mkm/multi-store
This commit is contained in:
commit
285b9e68b6
@ -44,11 +44,11 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreOrder::where($this->searchWhere)
|
||||
return StoreOrder::with('user')->where($this->searchWhere)
|
||||
->when(!empty($this->request->adminInfo['store_id']), function ($query) {
|
||||
$query->where('store_id', '=', $this->request->adminInfo['store_id']);
|
||||
})
|
||||
->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status'])
|
||||
->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status', 'uid'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
|
@ -6,6 +6,7 @@ use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\user\User;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
@ -37,4 +38,10 @@ class StoreOrder extends BaseModel
|
||||
$status = OrderEnum::getOrderType($data['status'])??'';
|
||||
return $status;
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'uid')->bind(['nickname', 'avatar']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ namespace app\store\controller\store_order;
|
||||
|
||||
|
||||
use app\admin\lists\store_order\StoreOrderLists;
|
||||
use app\common\controller\Definitions;
|
||||
use app\store\controller\BaseAdminController;
|
||||
use app\store\logic\store_order\StoreOrderLogic;
|
||||
use app\store\validate\store_order\StoreOrderValidate;
|
||||
@ -15,29 +16,48 @@ use hg\apidoc\annotation as ApiDoc;
|
||||
* Class StoreOrderController
|
||||
* @package app\store\controller\store_order
|
||||
*/
|
||||
#[ApiDoc\NotParse()]
|
||||
#[ApiDoc\title('订单')]
|
||||
class StoreOrderController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取订单列表列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
#[
|
||||
ApiDoc\Title('订单列表'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'order_id', type: 'int', require: false, desc: '分类id'),
|
||||
ApiDoc\Query(name: 'pay_type', type: 'string', require: false, desc: '商品名称'),
|
||||
ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:1上架,2下架,3售罄,4库存告警'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
['name' => 'image', 'desc' => '图片', 'type' => 'string'],
|
||||
['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
|
||||
['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
|
||||
['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
|
||||
['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
|
||||
['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
|
||||
['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
|
||||
['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
|
||||
['name' => 'status', 'desc' => '状态:1上架,0下架', 'type' => 'string'],
|
||||
]),
|
||||
]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreOrderLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加订单列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
#[
|
||||
ApiDoc\Title('添加订单'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/add'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function add()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->post()->goCheck('add');
|
||||
@ -48,13 +68,15 @@ class StoreOrderController extends BaseAdminController
|
||||
return $this->fail(StoreOrderLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑订单列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
#[
|
||||
ApiDoc\Title('编辑订单'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/edit'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function edit()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->post()->goCheck('edit');
|
||||
@ -65,13 +87,15 @@ class StoreOrderController extends BaseAdminController
|
||||
return $this->fail(StoreOrderLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除订单列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
#[
|
||||
ApiDoc\Title('删除订单'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/delete'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function delete()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->post()->goCheck('delete');
|
||||
@ -79,13 +103,15 @@ class StoreOrderController extends BaseAdminController
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取订单列表详情
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:02
|
||||
*/
|
||||
#[
|
||||
ApiDoc\Title('订单详情'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function detail()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->goCheck('detail');
|
||||
|
@ -225,7 +225,7 @@ class AdminLogic extends BaseLogic
|
||||
public static function detail($params, $action = 'detail'): array
|
||||
{
|
||||
$admin = SystemStoreStaff::field([
|
||||
'id', 'account', 'staff_name', 'avatar', 'is_admin', 'is_manager'
|
||||
'id', 'account', 'staff_name', 'avatar', 'is_admin', 'is_manager', 'store_id'
|
||||
])->findOrEmpty($params['id'])->toArray();
|
||||
|
||||
if ($action == 'detail') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user