diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index ade2a69..34678f6 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -40,6 +40,7 @@ class ShopsController extends Controller $validator = Validator::make($request->all(), [ 'name' => 'required|string|max:191|unique:shops,name', 'plat_id' => 'required|integer', + 'ratio' => 'required|numeric', ]); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); @@ -49,6 +50,7 @@ class ShopsController extends Controller $shop = new Shop(); $shop->name = $request->name; $shop->plat_id = $request->plat_id; + $shop->ratio = $request->ratio; if (0 == $request->plat_id) { $shop->status = 2; } @@ -57,6 +59,15 @@ class ShopsController extends Controller return response($this->res, $this->res['httpCode']); } + public function update(Request $request, $id) + { + $shop = Shop::query()->find($id); + $shop->ratio = $request->ratio; + $shop->save(); + + return response($this->res, $this->res['httpCode']); + } + public function authBind(Request $request) { [$shopId, $platId] = explode('_', $request->get('state')); diff --git a/database/migrations/2022_08_02_022448_create_shops_table.php b/database/migrations/2022_08_02_022448_create_shops_table.php index e56de65..419e45c 100644 --- a/database/migrations/2022_08_02_022448_create_shops_table.php +++ b/database/migrations/2022_08_02_022448_create_shops_table.php @@ -29,6 +29,7 @@ class CreateShopsTable extends Migration $table->text('scope')->nullable()->comment('接口列表'); $table->text('pop_auth_token_create_response')->nullable()->comment('授权认证信息'); $table->unsignedTinyInteger('status')->index()->default(0)->comment('状态'); + $table->decimal('ratio')->default(1)->comment('成本倍率'); $table->softDeletes(); $table->timestamps(); //索引 diff --git a/resources/frontend/src/api/shop.js b/resources/frontend/src/api/shop.js index c26c067..1712ef7 100644 --- a/resources/frontend/src/api/shop.js +++ b/resources/frontend/src/api/shop.js @@ -4,32 +4,40 @@ import http from "@/util/http.js"; // 店铺平台 export function shopListId() { - return http({ - url: "/api/shop_platforms", - method: "get", - }); + return http({ + url: "/api/shop_platforms", + method: "get", + }); } // 店铺新增 export function shopAdd(data) { - return http({ - url: "/api/shops", - method: "post", - data, - }); + return http({ + url: "/api/shops", + method: "post", + data, + }); } // 店铺列表 export function storeList(params) { - return http({ - url: "/api/shops", - method: "get", - params, - }); + return http({ + url: "/api/shops", + method: "get", + params, + }); } // 下载商品 export function downloadGoods(id) { - return http({ - url: `/api/download/${id}/goods`, - method: "get", - }); + return http({ + url: `/api/download/${id}/goods`, + method: "get", + }); +} + +export function updateStore(id, params) { + return http({ + url: `/api/shops/${id}`, + method: "patch", + params, + }); } diff --git a/resources/frontend/src/views/store/store.vue b/resources/frontend/src/views/store/store.vue index 19451e2..77c92a1 100644 --- a/resources/frontend/src/views/store/store.vue +++ b/resources/frontend/src/views/store/store.vue @@ -5,10 +5,16 @@
- - + + + + +