sku完成,订单、商品上下架管理正在搞

This commit is contained in:
2025-05-21 17:04:10 +08:00
parent 035ab1105c
commit fc503cb95a
18 changed files with 239579 additions and 22 deletions

View File

@@ -15,4 +15,35 @@ class OrderController extends BaseController
$this->updateField = ["id","user_id","order_no","order_status","total_amount"];
$this->service = OrderService::getInstance();
}
public function generateOrder()
{
// $this->insertField = [
// 'products',
// 'address_id'
// ];
// $params = $this->checkRequiredFields(request()->post());
$params = [
'products' => [
[
'id' => 3,
'sku_id' => 1,
'number' => 2
],
[
'id' => 3,
'sku_id' => 7,
'number' => 10
],
],
'address_id' => 2,
'user_remarks' => '测试订单'
];
return jok(
$this->service->generateOrder($params),
'生成订单成功',
);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Http\Controllers\Api\CodeGeneration;
use App\BaseApp\BaseController;
use App\Service\CodeGeneration\RegionService;
class RegionController extends BaseController
{
//
public function __construct()
{
parent::__construct();
$this->insertField = ["name","pid", 'price'];
$this->updateField = ["id","name","pid", 'price'];
$this->service = RegionService::getInstance();
}
}

View File

@@ -4,6 +4,9 @@ namespace App\Http\Controllers\Api\CodeGeneration;
use App\BaseApp\BaseController;
use App\Service\CodeGeneration\SkuService;
use Illuminate\Http\JsonResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class SkuController extends BaseController
{
@@ -15,4 +18,20 @@ class SkuController extends BaseController
$this->updateField = ["id","product_id","cover", "name","inventory","price"];
$this->service = SkuService::getInstance();
}
/**
* 获取sku列表根据商品id
* @Method GET
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getSkuByProductId()
{
$id = request()->get('id');
if (!$id) {
return jerr('参数错误');
}
return jok($this->service->getSkuByProductId($id));
}
}

View File

@@ -11,8 +11,8 @@ class UserReceivingAddressController extends BaseController
public function __construct()
{
parent::__construct();
$this->insertField = ["user_id","province","city","district","detailed_address","complete_address"];
$this->updateField = ["id","user_id","province","city","district","detailed_address","complete_address"];
$this->insertField = ["user_id", "total_address","detailed_address", "name", "phone", "is_default",];
$this->updateField = ["id","user_id", "total_address","detailed_address", "name", "phone", "is_default",];
$this->service = UserReceivingAddressService::getInstance();
}
}