|
|
@@ -4,6 +4,7 @@ namespace app\controller\admin;
|
|
|
|
|
|
use app\extra\basic\Base;
|
|
|
use app\middleware\AuthMiddleware;
|
|
|
+use app\service\saas\GoodsService;
|
|
|
use app\service\saas\OrderService;
|
|
|
use DI\Attribute\Inject;
|
|
|
use LinFly\Annotation\Attributes\Route\Controller;
|
|
|
@@ -20,13 +21,23 @@ class Order extends Base
|
|
|
#[Inject]
|
|
|
protected OrderService $service;
|
|
|
|
|
|
+ #[Inject]
|
|
|
+ protected GoodsService $goodsService;
|
|
|
+
|
|
|
#[GetMapping('list')]
|
|
|
public function getOrderList(Request $request): Response
|
|
|
{
|
|
|
try {
|
|
|
$param = $request->all();
|
|
|
- $data = $this->service->setModel()->getList($param,['product' => function($query){
|
|
|
- $query->field("product_id,product_name");
|
|
|
+ $productType = $this->goodsService->productType();
|
|
|
+ $data = $this->service->setModel()->getList($param,['product' => function($query) use($productType){
|
|
|
+ $query->field("product_id,product_name,product_type")->append(['types'])->withAttr(['types' => function($query,$resp) use($productType){
|
|
|
+ $productTypeArr = [];
|
|
|
+ foreach ($productType as $val) {
|
|
|
+ $productTypeArr[$val['key']] = $val['name'];
|
|
|
+ }
|
|
|
+ return $productTypeArr[$resp['product_type']]??'';
|
|
|
+ }]);
|
|
|
}]);
|
|
|
return successTrans("success.data",pageFormat($data),200);
|
|
|
} catch (\Throwable $throwable) {
|