var extendCommand = {
	launchBrowser: function (params) {
		if (!params.url) {
			return {
				status: 'error',
				code: ErrorCode.ParameterNotValid,
				msg: 'url必须不可为空',
			}
		}
		if (!params.type) {
			return {
				status: 'error',
				code: ErrorCode.ParameterNotValid,
				msg: 'type必须不可为空',
			}
		}
		wps.OAAssist.ShellExecute(params.type, params.url)
		this.CloseWps()
		return { status: 'ok' }
	},

	CloseWps: function () {
		setTimeout(() => {
			wps.Quit()
		}, 2e3)
	},
}

var ErrorCode = {
	NoCommand: 90404,
	ParameterNotValid: 90405,
}

function command(info) {
	var func = extendCommand[info.name]
	if (func) return func.call(extendCommand, info.data)
	else return { status: 'error', code: ErrorCode.NoCommand, msg: '未知' }
}
