<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Store\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\BaseController;
use Modules\Store\Services\StoreService;

class Goods extends BaseController{

	/**
	 * @title 添加商品
	 *
	 * @param Request $request
	 * @param StoreService $service
	 * @return void
	 */
	public function add(Request $request, StoreService $service){
		try {
			$this->data['data'] = $service->addGoods($request);
		} catch (\Exception $e) {
			$this->data['code'] = 0;
			$this->data['message'] = $e->getMessage();
		}

		return response()->json($this->data);
	}

	/**
	 * @title 删除商品
	 *
	 * @param Request $request
	 * @param StoreService $service
	 * @return void
	 */
	public function delete(Request $request, StoreService $service){
		try {
			$this->data['data'] = $service->deleteGoods($request);
		} catch (\Exception $e) {
			$this->data['code'] = 0;
			$this->data['message'] = $e->getMessage();
		}

		return response()->json($this->data);
	}
}
