import { request } from 'umi';
import { getDataBaseUrl,getStoremanagement } from '@/global_data';

export default {
	GetAllStore() {
		return request(getStoremanagement()+'/api/shop/alllist', {
			method: 'GET'
		});
	},
	GetCosRequestURL(data) {
		return request(getStoremanagement()+`/api/SysService/GetPresignUploadUrl`, {
			method: 'POST',
			data: data,
		});
	},

	//-----------------------页面管理 start---------------------
	//分页查询
	MiniPageList(params) {
		return request(getStoremanagement()+'/api/AppletService/page', {
			method: 'POST',
			data: {
				...params
			}
		});
	},

	/**
		 * 添加页面
		 * @param {*} params 
		 * @returns 
		 */
	MiniPageAdd(params) {
		return request(getStoremanagement()+'/api/AppletService/add', {
			method: 'POST',
			data: {
				...params
			}
		});
	},

	/**
		 * 更新页面
		 * @param {*} params 
		 */
	MiniPageUpdate(params) {
		return request(getStoremanagement()+'/api/AppletService/update', {
			method: 'POST',
			data: {
				...params
			}
		});
	},

	/**
		 * 删除
		 * @param {*} id 
		 * @returns 
		 */
	MiniPageDelete(id) {
		return request(getStoremanagement()+'/api/AppletService/del', {
			method: 'POST',
			data: {
				id
			}
		});
	},



	//-----------------------页面管理 end---------------------


	//-----------------------素材管理 start---------------------

	/**
		 * 根据店铺id查询素材
		 */
	MinimaterialListByStore(params) {
		return request(getStoremanagement()+`/api/AppletService/MiniStoreMaterial`, {
			method: 'POST',
			data: params,
		});
	},

	/**
		 * 添加素材
		 * @param {*} params 
		 * @returns 
		 */
	AddMinimaterial(params) {
		return request(getStoremanagement()+`/api/AppletService/MaterialAdd`, {
			method: 'POST',
			data: params,
		});
	},

	/**
	 * 更新素材
	 * @param {*} params 
	 */
	UpdateMiniMaterial(params) {
		return request(getStoremanagement()+`/api/AppletService/MaterialUpdate`, {
			method: 'POST',
			data: params,
		});
	},

		/**
	 * 删除素材
	 */
		DeleteMiniMaterial(id) {
			return request(getStoremanagement()+`/api/AppletService/MaterialDel`, {
				method: 'POST',
				data: {
					id
				},
			});
		},


	//-----------------------素材管理 end---------------------


}