| | |
| | | package service |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type DataServer struct{} |
| | | |
| | | func (DataServer) GetAllData() (errCode int, data response.DataResponse) { |
| | | func (DataServer) GetAllData(c *gin.Context) (errCode int, data response.DataResponse) { |
| | | // get country list |
| | | countryList, _ := ServiceGroup.GetCountryList() |
| | | data.Country = countryList |
| | |
| | | data.RegularCustomers = regularCustomerList |
| | | |
| | | // get Member list |
| | | memberList, _ := ServiceGroup.GetUserList() |
| | | |
| | | var memberIds []int |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | | memberIds = userInfo.SubUserIds |
| | | } |
| | | |
| | | memberList, _ := ServiceGroup.GetUserList(memberIds) |
| | | data.Member = memberList |
| | | |
| | | // get Department list |
| | |
| | | reportSourceList, _ := ServiceGroup.GetReportSourceList() |
| | | data.ReportSource = reportSourceList |
| | | |
| | | |
| | | // get OrderType list |
| | | orderTypeList, _ := ServiceGroup.GetOrderTypeList() |
| | | data.OrderType = orderTypeList |
| | | |
| | | |
| | | // get ServiceContractStatus list |
| | | serviceContractStatusList, _ := ServiceGroup.GetServiceContractStatusList() |
| | | serviceContractStatusList, _, _ := ServiceGroup.GetServiceContractStatusList() |
| | | data.ServiceContractStatus = serviceContractStatusList |
| | | |
| | | |
| | | // get ServiceContractType list |
| | | serviceContractTypeList, _ := ServiceGroup.GetServiceContractTypeList() |
| | | data.ServiceContractType = serviceContractTypeList |
| | | |
| | | // get RefundMethod list |
| | | refundMethodList, _ := ServiceGroup.GetRefundMethodList() |
| | | data.RefundMethod = refundMethodList |
| | | |
| | | // get IsInvoice list |
| | | isInvoiceList, _ := ServiceGroup.GetIsInvoiceList() |
| | | data.IsInvoice = isInvoiceList |
| | | |
| | | // get AccountId list |
| | | accountIdList, _ := ServiceGroup.GetAccountIdList() |
| | | data.AccountId = accountIdList |
| | | |
| | | // get SalesReturnStatus list |
| | | salesReturnStatusList, _ := ServiceGroup.GetSalesReturnStatusList() |
| | | data.SalesReturnStatus = salesReturnStatusList |
| | | |
| | | // get Repository list |
| | | repositoryList, _ := ServiceGroup.GetRepositoryList() |
| | | data.Repository = repositoryList |
| | | |
| | | // get QuotationStatus list |
| | | quotationStatusList, _ := ServiceGroup.GetQuotationStatusList() |
| | | data.QuotationStatus = quotationStatusList |
| | | |
| | | // get Possibility list |
| | | possibilityList, _ := ServiceGroup.GetPossibilityList() |
| | | data.Possibility = possibilityList |
| | | |
| | | // get Status list |
| | | statusList, _ := ServiceGroup.GetStatusList() |
| | | data.Status = statusList |
| | | |
| | | // get Currency list |
| | | currencyList, _ := ServiceGroup.GetCurrencyList() |
| | | data.Currency = currencyList |
| | | |
| | | errCode = ecode.OK |
| | | |
| | | return |
| | | } |
| | | } |