|
@@ -3,10 +3,8 @@
|
|
|
namespace App\Modules\Admin\Controllers\Admin;
|
|
|
|
|
|
use App\Base\BaseController;
|
|
|
-use App\Models\Setting;
|
|
|
use App\Modules\Admin\Services\GoodsService;
|
|
|
-use App\Modules\Admin\Services\SettingService;
|
|
|
-use Illuminate\Support\Arr;
|
|
|
+use Faker\Provider\Image;
|
|
|
|
|
|
class GoodsController extends BaseController
|
|
|
{
|
|
@@ -18,6 +16,79 @@ class GoodsController extends BaseController
|
|
|
$this->service = $authService;
|
|
|
}
|
|
|
|
|
|
+ public function paginate()
|
|
|
+ {
|
|
|
+
|
|
|
+ return $this->ok([
|
|
|
+ "total" => 1,
|
|
|
+ "page_total" => 1,
|
|
|
+ "list" => [
|
|
|
+ [
|
|
|
+ "id" => 1,
|
|
|
+ "name" => "商品名称",
|
|
|
+ "thumb" => Image::imageUrl(),
|
|
|
+ "weight" => 1,
|
|
|
+ "status" => 1,
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function changeStatus()
|
|
|
+ {
|
|
|
+// $id = request()->input("id", 0);
|
|
|
+// $m = Setting::whereType(Setting::TYPE_BANNER)->where("id", $id)->firstOrFail();
|
|
|
+// $value = $m->value ?? [];
|
|
|
+//
|
|
|
+// $isUse = 1;
|
|
|
+// if (Arr::get($value, "is_use")) {
|
|
|
+// $isUse = 0;
|
|
|
+// }
|
|
|
+// $value['is_use'] = $isUse;
|
|
|
+// $m->value = $value;
|
|
|
+// $m->save();
|
|
|
+ return $this->ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function info()
|
|
|
+ {
|
|
|
+ return $this->ok([
|
|
|
+ "id" => 1,
|
|
|
+ "image_list" => [
|
|
|
+ Image::image(),
|
|
|
+ Image::image(),
|
|
|
+ ],
|
|
|
+ "category" => [
|
|
|
+ [
|
|
|
+ "id" => 1,
|
|
|
+ "is_public" => 1,
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ "id" => 2,
|
|
|
+ "is_public" => 0,
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ "spec" => [
|
|
|
+ [
|
|
|
+ "id" => 1,
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ "sku" => [
|
|
|
+ [
|
|
|
+ "id" => 0,
|
|
|
+ "sn" => "规格型号",
|
|
|
+ "3d_url" => "",
|
|
|
+ "attr" => ["属性一", "属性二"],
|
|
|
+ "is_use" => 1,
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ "weight" => 1,
|
|
|
+ "desc_html" => "<h1>it's html</h1>",
|
|
|
+ "spec_attr_html" => "<h1>it's html</h1>",
|
|
|
+ "faq_html" => "<h1>it's html</h1>",
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
public function specPaginate()
|
|
|
{
|
|
|
$data = $this->valid([
|
|
@@ -61,20 +132,4 @@ class GoodsController extends BaseController
|
|
|
|
|
|
return $this->ok($this->service->specDelete($data));
|
|
|
}
|
|
|
-
|
|
|
- public function changeStatus()
|
|
|
- {
|
|
|
- $id = request()->input("id", 0);
|
|
|
- $m = Setting::whereType(Setting::TYPE_BANNER)->where("id", $id)->firstOrFail();
|
|
|
- $value = $m->value ?? [];
|
|
|
-
|
|
|
- $isUse = 1;
|
|
|
- if (Arr::get($value, "is_use")) {
|
|
|
- $isUse = 0;
|
|
|
- }
|
|
|
- $value['is_use'] = $isUse;
|
|
|
- $m->value = $value;
|
|
|
- $m->save();
|
|
|
- return $this->ok(true);
|
|
|
- }
|
|
|
}
|