You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: service.go
    path of file: ./repos/bk-cmdb/src/web_server/service
    
    the code of the file until where you have to start completion: /*
 * Tencent is pleased to support the open source community by making 蓝鲸 available.
 * Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
 * Licensed under the MIT License (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * http://opensource.org/licenses/MIT
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Package service TODO
package service

import (
	"net/http"
	"net/http/httputil"
	"os"
	"runtime"

	"configcenter/src/common"
	"configcenter/src/common/backbone"
	"configcenter/src/common/blog"
	"configcenter/src/common/metadata"
	"configcenter/src/common/metric"
	"configcenter/src/common/types"
	"configcenter/src/common/webservice/ginservice"
	"configcenter/src/storage/dal/redis"
	"configcenter/src/thirdparty/logplatform/opentelemetry"
	"configcenter/src/web_server/app/options"
	"configcenter/src/web_server/capability"
	webCommon "configcenter/src/web_server/common"
	"configcenter/src/web_server/logics"
	"configcenter/src/web_server/middleware"
	"configcenter/src/web_server/service/excel"

	"github.com/gin-contrib/sessions"
	"github.com/gin-gonic/gin"
)

// Service TODO
type Service struct {
	*options.ServerOption
	Engine   *backbone.Engine
	CacheCli redis.Client
	*logics.Logics
	Config  *options.Config
	Session redis.RedisStore
}

// WebService TODO
func (s *Service) WebService() *gin.Engine {
	setGinMode()
	ws := gin.New()
	ws.Use(gin.Logger())

	ws.Use(middleware.RequestIDMiddleware)
	ws.Use(sessions.Sessions(s.Config.Session.Name, s.Session))
	ws.Use(middleware.ValidLogin(*s.Config, s.Discovery()))
	ws.Use(func(c *gin.Context) {
		defer func() {
			// suppresses logging of a stack when err is ErrAbortHandler, same as net/http
			if err := recover(); err != nil {
				if err != http.ErrAbortHandler {
					stack := make([]byte, 10000)
					nbytes := runtime.Stack(stack, false)
					if nbytes < len(stack) {
						stack = stack[:nbytes]
					}
					request, _ := httputil.DumpRequest(c.Request, false)
					blog.Errorf("[Recovery] recovered:\n%s\n%s\n%s", string(request), err, 
    
func (s *Service) WebService() *gin.Engine {
	setGinMode()
	ws := gin.New()
	ws.Use(gin.Logger())

	ws.Use(middleware.RequestIDMiddleware)
	ws.Use(sessions.Sessions(s.Config.Session.Name, s.Session))
	ws.Use(middleware.ValidLogin(*s.Config, s.Discovery()))
	ws.Use(func(c *gin.Context) {
		defer func() {
			// suppresses logging of a stack when err is ErrAbortHandler, same as net/http
			if err := recover(); err != nil {
				if err != http.ErrAbortHandler {
					stack := make([]byte, 10000)
					nbytes := runtime.Stack(stack, false)
					if nbytes < len(stack) {
						stack = stack[:nbytes]
					}
					request, _ := httputil.DumpRequest(c.Request, false)
					blog.Errorf("[Recovery] recovered:\n%s\n%s\n%s", string(request), err, string(stack))
				}
				c.AbortWithStatus(500)
			}
		}()
		c.Next()
	})

	opentelemetry.UseOtlpMiddleware(ws)

	middleware.Engine = s.Engine

	ws.Static("/static", s.Config.Site.HtmlRoot)
	ws.LoadHTMLFiles(s.Config.Site.HtmlRoot+"/index.html", s.Config.Site.HtmlRoot+"/login.html",
		s.Config.Site.HtmlRoot+"/"+webCommon.InaccessibleHtml)

	ws.GET("/hosts/:bk_host_id/listen_ip_options", s.ListenIPOptions)
	ws.POST("/logout", s.LogOutUser)
	ws.GET("/login", s.Login)
	ws.POST("/login", s.LoginUser)
	ws.POST("/object/exportmany", s.BatchExportObject)
	ws.POST("/object/importmany/analysis", s.BatchImportObjectAnalysis)
	ws.POST("/object/importmany", s.BatchImportObject)
	ws.GET("/user/list", s.GetUserList)
	// suggest move to  Organization
	ws.GET("/user/department", s.GetDepartment)
	ws.GET("/user/departmentprofile", s.GetDepartmentProfile)

	ws.GET("/organization/department", s.GetDepartment)
	ws.GET("/organization/departmentprofile", s.GetDepartmentProfile)

	ws.GET("/user/language/:language", s.UpdateUserLanguage)
	// get current login user info
	ws.GET("/userinfo", s.UserInfo)
	ws.PUT("/user/current/supplier/:id", s.UpdateSupplier)
	ws.POST("/biz/search/web", s.SearchBusiness)

	ws.GET("/", s.Index)

	ws.POST("/object/count", s.GetObjectInstanceCount)

	ws.POST("/regular/verify_regular_express", s.VerifyRegularExpress)
	ws.POST("/regular/verify_regular_content_batch", s.VerifyRegularContentBatch)

	ws.Any("/proxy/:method/:target/*target_url", s.ProxyRequest)

	// get changelog info
	ws.POST("findmany/changelog", s.GetVersionList)
	ws.POST("find/changelog/detail", s.GetVersionDetail)

	// common api
	ws.GET("/healthz", s.Healthz)
	ws.GET("/version", ginservice.Version)

	// table instance, only for ui, should be removed later
	s.initModelQuote(ws)

	// field template, only for ui
	s.initFieldTemplate(ws)

	c := &capability.Capability{
		Ws:     ws,
		Engine: s.Engine,
	}
	// init excel func
	excel.Init(c)

	// if no route, redirect to 404 page
	ws.NoRoute(func(c *gin.Context) {
		c.Redirect(302, "/#/404")
	})

	return ws
}