kphcdr 1 year ago
parent
commit
dfc78e3aae

+ 10 - 0
app/Modules/Mini/Controllers/CartController.php

@@ -29,4 +29,14 @@ class CartController extends BaseController
     {
         return $this->ok();
     }
+
+    public function ask()
+    {
+        return $this->ok([
+            "id" => 1,
+            "thumb" => Image::imageUrl(),
+            "name" => "商品名称",
+            "url" => "http://baidu.com/xxxx",
+        ]);
+    }
 }

+ 1 - 0
app/Modules/Mini/Controllers/GoodsController.php

@@ -92,6 +92,7 @@ class GoodsController extends BaseController
             "id" => 1,
             "thumb" => Image::imageUrl(),
             "name" => "商品名称",
+            "url" => "http://baidu.com/xxxx",
         ]);
     }
 }

+ 55 - 0
app/Modules/Pc/Controllers/AuthController.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace App\Modules\Pc\Controllers;
+
+use App\Base\BaseController;
+use Faker\Provider\Image;
+
+class AuthController extends BaseController
+{
+    public function emailCaptcha()
+    {
+        return $this->ok();
+    }
+
+    public function profile()
+    {
+        return $this->ok([
+            "id" => 1,
+            "token" => "token",
+            "name" => "用户名称",
+            "avatar" => Image::imageUrl(),
+            "company" => [
+                "id" => 1,
+                "name" => "公司名称",
+            ],
+        ]);
+    }
+
+    public function register()
+    {
+        return $this->ok([
+            "token" => "token",
+            "name" => "",
+            "phone" => "",
+        ]);
+    }
+
+    public function login()
+    {
+        return $this->ok([
+            "token" => "token",
+            "name" => "",
+            "phone" => "",
+        ]);
+    }
+
+    public function resetPassword()
+    {
+        return $this->ok([
+            "token" => "token",
+            "name" => "",
+            "phone" => "",
+        ]);
+    }
+}

+ 42 - 0
app/Modules/Pc/Controllers/CartController.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace App\Modules\Pc\Controllers;
+
+use App\Base\BaseController;
+use Faker\Provider\Image;
+
+class CartController extends BaseController
+{
+    public function index()
+    {
+        return $this->ok([
+            "total" => 1,
+            "page_total" => 1,
+            "list" => [
+                [
+                    "id" => 1,
+                    "goods_id" => 1,
+                    "thumb" => Image::imageUrl(),
+                    "goods_name" => 1,
+                    "sn" => "型号-xxxx",
+                    "count" => 1,
+                ],
+            ],
+        ]);
+    }
+
+    public function del()
+    {
+        return $this->ok();
+    }
+
+    public function ask()
+    {
+        return $this->ok([
+            "id" => 1,
+            "thumb" => Image::imageUrl(),
+            "name" => "商品名称",
+            "url" => "http://baidu.com/xxxx",
+        ]);
+    }
+}

+ 97 - 0
app/Modules/Pc/Controllers/GoodsController.php

@@ -0,0 +1,97 @@
+<?php
+
+namespace App\Modules\Pc\Controllers;
+
+use App\Base\BaseController;
+use App\Modules\Mini\Services\PageService;
+use Faker\Provider\Image;
+
+class GoodsController extends BaseController
+{
+    protected PageService $service;
+
+    /**
+     * @param PageService $service
+     */
+    public function __construct(PageService $service)
+    {
+        $this->service = $service;
+    }
+
+    public function goods()
+    {
+        return $this->ok([
+            "id" => 1,
+            "image_list" => [
+                Image::imageUrl(),
+                Image::imageUrl(),
+            ],
+            "spec" => [
+                "id" => 1,
+                "name" => "颜色",
+                "attr" => [
+                    [
+                        "id" => 1,
+                        "name" => "红色",
+                    ],
+                ],
+            ],
+            "sku" => [
+                [
+                    "id" => 1,
+                    "sn" => "sn",
+                    "url_3d" => "",
+                    "spec_attr" => [
+                        [
+                            "id" => 1,
+                            "name" => "白色",
+                        ],
+                        [
+                            "id" => 3,
+                            "name" => "大号",
+                        ],
+                    ],
+                ],
+            ],
+            "desc_html" => "<h1>desc_html</h1>",
+            "spec_attr_html" => "<h1>desc_html</h1>",
+            "faq_html" => "<h1>desc_html</h1>",
+        ]);
+    }
+
+    public function search()
+    {
+        return $this->ok([
+            "total" => 1,
+            "page_total" => 1,
+            "list" => [
+                [
+                    "id" => 1,
+                    "name" => "商品名称",
+                    "thumb" => Image::imageUrl(),
+                ],
+            ],
+            "category" => [
+                [
+                    "id" => 1,
+                    "thumb" => Image::imageUrl(),
+                    "name" => "分类名称",
+                ],
+            ],
+        ]);
+    }
+
+    public function fav()
+    {
+        return $this->ok();
+    }
+
+    public function ask()
+    {
+        return $this->ok([
+            "id" => 1,
+            "thumb" => Image::imageUrl(),
+            "name" => "商品名称",
+        ]);
+    }
+}

+ 142 - 0
app/Modules/Pc/Controllers/PageController.php

@@ -0,0 +1,142 @@
+<?php
+
+namespace App\Modules\Pc\Controllers;
+
+use App\Base\BaseController;
+use App\Modules\Mini\Services\PageService;
+use Faker\Provider\Image;
+
+class PageController extends BaseController
+{
+    protected PageService $service;
+
+    /**
+     * @param PageService $service
+     */
+    public function __construct(PageService $service)
+    {
+        $this->service = $service;
+    }
+
+    public function filterConfig()
+    {
+        return $this->ok([
+            [
+                "id" => 1,
+                "name" => "类目示例",
+                "type" => "category",
+                "child" => [
+                    [
+                        "id" => 1,
+                        "name" => "名称",
+                    ],
+                ],
+            ],
+            [
+                "id" => 1,
+                "name" => "属性示例",
+                "type" => "attr",
+                "child" => [
+                    [
+                        "id" => 1,
+                        "name" => "名称",
+                    ],
+                ],
+            ],
+        ]);
+    }
+
+    public function home()
+    {
+        return $this->ok([
+            "banner" => $this->service->banner(),
+            "categoryTree" => [
+                [
+                    "id" => 1,
+                    "name" => "一级分类",
+                    "child" => [
+                        [
+                            "id" => 1,
+                            "name" => "二级分类",
+                        ],
+                    ],
+                ],
+            ],
+            "hot_goods" => [
+                [
+                    "id" => 1,
+                    "name" => "商品名称",
+                    "thumb" => Image::imageUrl(),
+                ],
+            ],
+            "recommend_goods" => [
+                [
+                    "id" => 1,
+                    "name" => "商品名称",
+                    "thumb" => Image::imageUrl(),
+                ],
+            ],
+        ]);
+    }
+
+    public function categoryGoods()
+    {
+        return $this->ok([
+            "total" => 1,
+            "page_total" => 1,
+            "list" => [
+                [
+                    "id" => 1,
+                    "name" => "商品名称",
+                    "thumb" => Image::imageUrl(),
+                ],
+            ],
+        ]);
+    }
+
+    public function categoryTree()
+    {
+        return $this->ok([
+            "categoryTree" => [
+                [
+                    "id" => 1,
+                    "name" => "一级分类",
+                    "child" => [
+                        [
+                            "id" => 1,
+                            "name" => "二级分类",
+                            "child" => [
+                                [
+                                    "id" => 1,
+                                    "name" => "二级分类",
+                                ],
+                            ],
+                        ],
+                    ],
+                ],
+            ],
+        ]);
+    }
+
+    public function search()
+    {
+        return $this->ok([
+            "total" => 1,
+            "page_total" => 1,
+            "list" => [
+                [
+                    "id" => 1,
+                    "name" => "商品名称",
+                    "thumb" => Image::imageUrl(),
+                ],
+            ],
+            "category" => [
+                [
+                    "id" => 1,
+                    "thumb" => Image::imageUrl(),
+                    "name" => "分类名称",
+                ],
+            ],
+        ]);
+    }
+}

+ 63 - 0
app/Modules/Pc/Controllers/UserController.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace App\Modules\Pc\Controllers;
+
+use App\Base\BaseController;
+use Faker\Provider\Image;
+
+class UserController extends BaseController
+{
+    public function company()
+    {
+        return $this->ok();
+    }
+
+    public function fav()
+    {
+        return $this->ok([
+            "total" => 1,
+            "page_total" => 1,
+            "list" => [
+                [
+                    "id" => 1,
+                    "goods_id" => 1,
+                    "thumb" => Image::imageUrl(),
+                    "goods_name" => 1,
+                ],
+            ],
+        ]);
+    }
+
+    public function favDel()
+    {
+        return $this->ok();
+    }
+
+    public function address()
+    {
+        return $this->ok([
+            "total" => 1,
+            "page_total" => 1,
+            "list" => [
+                [
+                    "id" => 1,
+                    "is_default" => 1,
+                    "name" => "收件人姓名",
+                    "address" => "余杭良睦路地铁鼎创中心**位置",
+                    "phone" => "15012341234",
+                    "location" => "浙江省杭州市余杭区",
+                ],
+            ],
+        ]);
+    }
+
+    public function addressDel()
+    {
+        return $this->ok();
+    }
+
+    public function addressStore()
+    {
+        return $this->ok();
+    }
+}

+ 3 - 0
app/Providers/RouteServiceProvider.php

@@ -36,6 +36,9 @@ class RouteServiceProvider extends ServiceProvider
             Route::middleware('api')
                 ->prefix("mini")
                 ->group(base_path('routes/mini.php'));
+            Route::middleware('api')
+                ->prefix("pc")
+                ->group(base_path('routes/pc.php'));
 //            Route::middleware('web')
 //                ->group(base_path('routes/web.php'));
         });

+ 1 - 0
routes/mini.php

@@ -30,6 +30,7 @@ Route::post("/user/favDel", [\App\Modules\Mini\Controllers\UserController::class
 Route::get("/cart", [\App\Modules\Mini\Controllers\CartController::class, "index"]);
 Route::post("/cart/del", [\App\Modules\Mini\Controllers\CartController::class, "del"]);
 Route::post("/cart/store", [\App\Modules\Mini\Controllers\CartController::class, "store"]);
+Route::post("/cart/ask", [\App\Modules\Mini\Controllers\CartController::class, "ask"]);
 
 Route::get("/config", function () {
     return [

+ 44 - 0
routes/pc.php

@@ -0,0 +1,44 @@
+<?php
+
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Route;
+
+Route::get('/', [\App\Http\Controllers\Controller::class, "ping"]);
+
+Route::post("/auth/emailCaptcha", [\App\Modules\Pc\Controllers\AuthController::class, "emailCaptcha"]);
+Route::post("/auth/register", [\App\Modules\Pc\Controllers\AuthController::class, "register"]);
+Route::post("/auth/login", [\App\Modules\Pc\Controllers\AuthController::class, "login"]);
+Route::post("/auth/resetPassword", [\App\Modules\Pc\Controllers\AuthController::class, "resetPassword"]);
+
+Route::get("/auth/profile", [\App\Modules\Pc\Controllers\AuthController::class, "profile"]);
+
+Route::get("/page/home", [\App\Modules\Pc\Controllers\PageController::class, "home"]);
+Route::get("/page/categoryTree", [\App\Modules\Pc\Controllers\PageController::class, "categoryTree"]);
+Route::get("/page/categoryGoods", [\App\Modules\Pc\Controllers\PageController::class, "categoryGoods"]);
+Route::get("/page/filterConfig", [\App\Modules\Pc\Controllers\PageController::class, "filterConfig"]);
+Route::get("/page/search", [\App\Modules\Pc\Controllers\PageController::class, "search"]);
+
+Route::get("/goods", [\App\Modules\Pc\Controllers\GoodsController::class, "goods"]);
+Route::post("/goods/fav", [\App\Modules\Pc\Controllers\GoodsController::class, "fav"]);
+Route::post("/goods/ask", [\App\Modules\Pc\Controllers\GoodsController::class, "ask"]);
+
+Route::get("/user/address", [\App\Modules\Pc\Controllers\UserController::class, "address"]);
+Route::post("/user/addressDel", [\App\Modules\Pc\Controllers\UserController::class, "addressDel"]);
+Route::post("/user/addressStore", [\App\Modules\Pc\Controllers\UserController::class, "addressStore"]);
+
+Route::get("/user/fav", [\App\Modules\Pc\Controllers\UserController::class, "fav"]);
+Route::post("/user/favDel", [\App\Modules\Pc\Controllers\UserController::class, "favDel"]);
+
+Route::get("/cart", [\App\Modules\Pc\Controllers\CartController::class, "index"]);
+Route::post("/cart/del", [\App\Modules\Pc\Controllers\CartController::class, "del"]);
+Route::post("/cart/store", [\App\Modules\Pc\Controllers\CartController::class, "store"]);
+Route::post("/cart/ask", [\App\Modules\Pc\Controllers\CartController::class, "ask"]);
+
+Route::get("/config", function () {
+    return [
+        "code" => 200,
+        "data" => [
+            "search_keywords" => ["热搜词1", "热搜词2", "热搜词3"],
+        ],
+    ];
+});