| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { goCommonSearchUrl, request } from '@/services/request/index';
- import { Method } from 'axios';
- /**
- * go 接口通用查询
- * @param url 接口路径
- * @param params 请求参数
- * @param method 请求方式
- * @returns
- */
- export function commonSearch_go(url: string, params: Object, method: Method = 'get'): Promise<any> {
- return request({
- method,
- url: goCommonSearchUrl(url),
- params,
- })
- .then((value) => value.data.data)
- .catch((err) => Promise.reject(err));
- }
- export interface BaseResponse {
- result: boolean;
- message: String;
- }
- /**
- * go 申请/修改类型返回 (不关心具体返回的数据, 只关心请求是否成功)
- * @param url 接口路径
- * @param params 请求参数
- * @param method 请求方式
- */
- export function commonUpdate_go(url: string, data: Object, method: Method = 'post'): Promise<BaseResponse> {
- return request({
- method,
- url: goCommonSearchUrl(url),
- data,
- })
- .then((value) => {
- return {
- result: value.data.code === 200 ? true : false,
- message: value.data.msg,
- };
- })
- .catch((err) => Promise.reject(err));
- }
|