import OMS from '@sdp.nd/oms' export default (omsOptions?: object) => { return function () { const request = Object.assign({}, this.request) // 适配 @gem-mine/request if (this.data.get('buildInRequest')) { const methods = ['get', 'post', 'patch', 'put', 'delete', 'head'] methods.forEach((method) => { const originMethod = request[method] request[method] = (args) => { const { url, ...rest } = args return originMethod(url, rest) } }) } const getUserId = this.uc ? () => this.uc.getToken().user_id : () => 0 this.oms = new OMS({ request, getUserId, env: this.env, ...omsOptions }) } }