api/v1/assign.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
api/v1/index.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/docs.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/swagger.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/swagger.yaml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
model/request/assign.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
model/user.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
pkg/ecode/code.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
router/assign.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
router/index.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
service/assign.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
service/client.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
service/index.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
api/v1/assign.go
New file @@ -0,0 +1,49 @@ package v1 import ( "aps_crm/model/request" "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" ) type AssignApi struct{} // Assign // // @Tags Assign // @Summary 审核 // @Produce application/json // @Param object body request.Assign true "查询参数" // @Success 200 {object} contextx.Response{} // @Router /api/assign/assign [post] func (au *AssignApi) Assign(c *gin.Context) { var params request.Assign ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } if params.MemberId == 0 { ctx.Fail(ecode.AssignWrongMemberId) return } if params.Id == 0 { ctx.Fail(ecode.AssignWrongId) return } if params.Type == "" { ctx.Fail(ecode.AssignWrongModelType) return } errCode := assignService.Assign(params.MemberId, params.Id, params.Type) if errCode != ecode.OK { ctx.Fail(errCode) return } ctx.Ok() } api/v1/index.go
@@ -5,17 +5,17 @@ ) type Group struct { CurrencyApi QuotationStatusApi RepositoryApi SalesReturnStatusApi AccountIdApi IsInvoiceApi RefundMethodApi ServiceContractTypeApi ServiceContractStatusApi OrderTypeApi ReportSourceApi CurrencyApi QuotationStatusApi RepositoryApi SalesReturnStatusApi AccountIdApi IsInvoiceApi RefundMethodApi ServiceContractTypeApi ServiceContractStatusApi OrderTypeApi ReportSourceApi IsVisitApi SolveRateApi TimelyRateApi @@ -64,68 +64,70 @@ DepartmentApi VettingApi SatisfactionApi AssignApi } var ApiGroup = new(Group) var ( userService = service.ServiceGroup.UserService jwtService = service.ServiceGroup.JwtService countryService = service.ServiceGroup.CountryService provinceService = service.ServiceGroup.ProvinceService cityService = service.ServiceGroup.CityService regionService = service.ServiceGroup.RegionService contactService = service.ServiceGroup.ContactService clientService = service.ServiceGroup.ClientService clientStatusService = service.ServiceGroup.ClientStatusService clientTypeService = service.ServiceGroup.ClientTypeService clientOriginService = service.ServiceGroup.ClientOriginService clientLevelService = service.ServiceGroup.ClientLevelService industryService = service.ServiceGroup.IndustryService enterpriseNatureService = service.ServiceGroup.EnterpriseNatureService registeredCapitalService = service.ServiceGroup.RegisteredCapitalService enterpriseScaleService = service.ServiceGroup.EnterpriseScaleService salesLeadsService = service.ServiceGroup.SalesLeadsService salesSourcesService = service.ServiceGroup.SalesSourcesService followRecordService = service.ServiceGroup.FollowRecordService saleChanceService = service.ServiceGroup.SaleChanceService saleStageService = service.ServiceGroup.SaleStageService saleTypeService = service.ServiceGroup.SaleTypeService regularCustomersService = service.ServiceGroup.RegularCustomersService possibilityService = service.ServiceGroup.PossibilityService statusService = service.ServiceGroup.StatusService quotationService = service.ServiceGroup.QuotationService masterOrderService = service.ServiceGroup.MasterOrderService subOrderService = service.ServiceGroup.SubOrderService salesDetailsService = service.ServiceGroup.SalesDetailsService salesReturnService = service.ServiceGroup.SalesReturnService salesRefundService = service.ServiceGroup.SalesRefundService contractService = service.ServiceGroup.ContractService planService = service.ServiceGroup.PlanService serviceContractService = service.ServiceGroup.SContractService orderManageService = service.ServiceGroup.OrderManageService serviceFollowupService = service.ServiceGroup.FollowupService customerServiceSheetService = service.ServiceGroup.CustomerServiceSheetService serviceFeeManageService = service.ServiceGroup.FeeManageService casbinService = service.ServiceGroup.CasbinService authorityService = service.ServiceGroup.AuthorityService menuService = service.ServiceGroup.MenuService allDataServer = service.ServiceGroup.DataServer departmentService = service.ServiceGroup.DepartmentService vettingService = service.ServiceGroup.VettingService satisfactionService = service.ServiceGroup.SatisfactionService timelyRateService = service.ServiceGroup.TimelyRateService solveRateService = service.ServiceGroup.SolveRateService isVisitService = service.ServiceGroup.IsVisitService reportSourceService = service.ServiceGroup.ReportSourceService orderTypeService = service.ServiceGroup.OrderTypeService serviceContractStatusService = service.ServiceGroup.ServiceContractStatusService serviceContractTypeService = service.ServiceGroup.ServiceContractTypeService refundMethodService = service.ServiceGroup.RefundMethodService isInvoiceService = service.ServiceGroup.IsInvoiceService accountIdService = service.ServiceGroup.AccountIdService salesReturnStatusService = service.ServiceGroup.SalesReturnStatusService repositoryService = service.ServiceGroup.RepositoryService quotationStatusService = service.ServiceGroup.QuotationStatusService currencyService = service.ServiceGroup.CurrencyService ) userService = service.ServiceGroup.UserService jwtService = service.ServiceGroup.JwtService countryService = service.ServiceGroup.CountryService provinceService = service.ServiceGroup.ProvinceService cityService = service.ServiceGroup.CityService regionService = service.ServiceGroup.RegionService contactService = service.ServiceGroup.ContactService clientService = service.ServiceGroup.ClientService clientStatusService = service.ServiceGroup.ClientStatusService clientTypeService = service.ServiceGroup.ClientTypeService clientOriginService = service.ServiceGroup.ClientOriginService clientLevelService = service.ServiceGroup.ClientLevelService industryService = service.ServiceGroup.IndustryService enterpriseNatureService = service.ServiceGroup.EnterpriseNatureService registeredCapitalService = service.ServiceGroup.RegisteredCapitalService enterpriseScaleService = service.ServiceGroup.EnterpriseScaleService salesLeadsService = service.ServiceGroup.SalesLeadsService salesSourcesService = service.ServiceGroup.SalesSourcesService followRecordService = service.ServiceGroup.FollowRecordService saleChanceService = service.ServiceGroup.SaleChanceService saleStageService = service.ServiceGroup.SaleStageService saleTypeService = service.ServiceGroup.SaleTypeService regularCustomersService = service.ServiceGroup.RegularCustomersService possibilityService = service.ServiceGroup.PossibilityService statusService = service.ServiceGroup.StatusService quotationService = service.ServiceGroup.QuotationService masterOrderService = service.ServiceGroup.MasterOrderService subOrderService = service.ServiceGroup.SubOrderService salesDetailsService = service.ServiceGroup.SalesDetailsService salesReturnService = service.ServiceGroup.SalesReturnService salesRefundService = service.ServiceGroup.SalesRefundService contractService = service.ServiceGroup.ContractService planService = service.ServiceGroup.PlanService serviceContractService = service.ServiceGroup.SContractService orderManageService = service.ServiceGroup.OrderManageService serviceFollowupService = service.ServiceGroup.FollowupService customerServiceSheetService = service.ServiceGroup.CustomerServiceSheetService serviceFeeManageService = service.ServiceGroup.FeeManageService casbinService = service.ServiceGroup.CasbinService authorityService = service.ServiceGroup.AuthorityService menuService = service.ServiceGroup.MenuService allDataServer = service.ServiceGroup.DataServer departmentService = service.ServiceGroup.DepartmentService vettingService = service.ServiceGroup.VettingService satisfactionService = service.ServiceGroup.SatisfactionService timelyRateService = service.ServiceGroup.TimelyRateService solveRateService = service.ServiceGroup.SolveRateService isVisitService = service.ServiceGroup.IsVisitService reportSourceService = service.ServiceGroup.ReportSourceService orderTypeService = service.ServiceGroup.OrderTypeService serviceContractStatusService = service.ServiceGroup.ServiceContractStatusService serviceContractTypeService = service.ServiceGroup.ServiceContractTypeService refundMethodService = service.ServiceGroup.RefundMethodService isInvoiceService = service.ServiceGroup.IsInvoiceService accountIdService = service.ServiceGroup.AccountIdService salesReturnStatusService = service.ServiceGroup.SalesReturnStatusService repositoryService = service.ServiceGroup.RepositoryService quotationStatusService = service.ServiceGroup.QuotationStatusService currencyService = service.ServiceGroup.CurrencyService assignService = service.ServiceGroup.AssignService ) docs/docs.go
@@ -135,6 +135,36 @@ } } }, "/api/assign/assign": { "post": { "produces": [ "application/json" ], "tags": [ "Assign" ], "summary": "审核", "parameters": [ { "description": "查询参数", "name": "object", "in": "body", "required": true, "schema": { "$ref": "#/definitions/request.Assign" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/contextx.Response" } } } } }, "/api/authority/add": { "post": { "security": [ @@ -9754,6 +9784,20 @@ } } }, "request.Assign": { "type": "object", "properties": { "id": { "type": "integer" }, "member_id": { "type": "integer" }, "type": { "type": "string" } } }, "request.CasbinInfo": { "type": "object", "properties": { docs/swagger.json
@@ -123,6 +123,36 @@ } } }, "/api/assign/assign": { "post": { "produces": [ "application/json" ], "tags": [ "Assign" ], "summary": "审核", "parameters": [ { "description": "查询参数", "name": "object", "in": "body", "required": true, "schema": { "$ref": "#/definitions/request.Assign" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/contextx.Response" } } } } }, "/api/authority/add": { "post": { "security": [ @@ -9742,6 +9772,20 @@ } } }, "request.Assign": { "type": "object", "properties": { "id": { "type": "integer" }, "member_id": { "type": "integer" }, "type": { "type": "string" } } }, "request.CasbinInfo": { "type": "object", "properties": { docs/swagger.yaml
@@ -1801,6 +1801,15 @@ - vettingId - vettingType type: object request.Assign: properties: id: type: integer member_id: type: integer type: type: string type: object request.CasbinInfo: properties: method: @@ -4141,6 +4150,25 @@ summary: 更新账户 tags: - AccountId /api/assign/assign: post: parameters: - description: 查询参数 in: body name: object required: true schema: $ref: '#/definitions/request.Assign' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/contextx.Response' summary: 审核 tags: - Assign /api/authority/add: post: consumes: model/request/assign.go
New file @@ -0,0 +1,7 @@ package request type Assign struct { MemberId int `json:"member_id"` Type string `json:"type"` Id int `json:"id"` } model/user.go
@@ -70,6 +70,11 @@ return slf } func (slf *UserSearch) SetUserId(userId int) *UserSearch { slf.ID = userId return slf } func (slf *UserSearch) SetUserName(username string) *UserSearch { slf.Username = username return slf pkg/ecode/code.go
@@ -383,4 +383,9 @@ CurrencySetErr = 5600004 // 设置币种失败 CurrencyUpdateErr = 5600005 // 更新币种失败 AssignErr = 5700001 // 分配失败 AssignWrongMemberId = 5700002 // 分配失败,分配人为空 AssignWrongId = 5700003 // 分配失败,分配对象为空 AssignWrongModelType = 5700004 // 分配失败,分配对象类型为空 ) router/assign.go
New file @@ -0,0 +1,16 @@ package router import ( v1 "aps_crm/api/v1" "github.com/gin-gonic/gin" ) type AssignRouter struct{} func (a *AssignRouter) InitAssignRouter(router *gin.RouterGroup) { assignRouter := router.Group("assign") assignApi := v1.ApiGroup.AssignApi { assignRouter.POST("assign", assignApi.Assign) // 分配 } } router/index.go
@@ -11,17 +11,17 @@ ) type Group struct { CurrencyRouter QuotationStatusRouter RepositoryRouter SalesReturnStatusRouter AccountIdRouter IsInvoiceRouter RefundMethodRouter ServiceContractTypeRouter ServiceContractStatusRouter OrderTypeRouter ReportSourceRouter CurrencyRouter QuotationStatusRouter RepositoryRouter SalesReturnStatusRouter AccountIdRouter IsInvoiceRouter RefundMethodRouter ServiceContractTypeRouter ServiceContractStatusRouter OrderTypeRouter ReportSourceRouter IsVisitRouter SolveRateRouter TimelyRateRouter @@ -69,6 +69,7 @@ DataRouter DepartmentRouter SatisfactionRouter AssignRouter } func InitRouter() *gin.Engine { @@ -146,17 +147,18 @@ routerGroup.InitTimelyRateRouter(PrivateGroup) routerGroup.InitSolveRateRouter(PrivateGroup) routerGroup.InitIsVisitRouter(PrivateGroup) routerGroup.InitReportSourceRouter(PrivateGroup) routerGroup.InitOrderTypeRouter(PrivateGroup) routerGroup.InitServiceContractStatusRouter(PrivateGroup) routerGroup.InitServiceContractTypeRouter(PrivateGroup) routerGroup.InitRefundMethodRouter(PrivateGroup) routerGroup.InitIsInvoiceRouter(PrivateGroup) routerGroup.InitAccountIdRouter(PrivateGroup) routerGroup.InitSalesReturnStatusRouter(PrivateGroup) routerGroup.InitRepositoryRouter(PrivateGroup) routerGroup.InitQuotationStatusRouter(PrivateGroup) routerGroup.InitCurrencyRouter(PrivateGroup) routerGroup.InitReportSourceRouter(PrivateGroup) routerGroup.InitOrderTypeRouter(PrivateGroup) routerGroup.InitServiceContractStatusRouter(PrivateGroup) routerGroup.InitServiceContractTypeRouter(PrivateGroup) routerGroup.InitRefundMethodRouter(PrivateGroup) routerGroup.InitIsInvoiceRouter(PrivateGroup) routerGroup.InitAccountIdRouter(PrivateGroup) routerGroup.InitSalesReturnStatusRouter(PrivateGroup) routerGroup.InitRepositoryRouter(PrivateGroup) routerGroup.InitQuotationStatusRouter(PrivateGroup) routerGroup.InitCurrencyRouter(PrivateGroup) routerGroup.InitAssignRouter(PrivateGroup) } return Router } } service/assign.go
New file @@ -0,0 +1,25 @@ package service import "aps_crm/pkg/ecode" type AssignService struct{} type Assign interface { Assign(id int) error } func (AssignService) Assign(memberId, id int, modelType string) int { var errCode int switch modelType { case "client": errCode = ClientService{}.Assign(id, memberId) default: errCode = ecode.AssignWrongModelType } if errCode != ecode.OK { return errCode } return ecode.OK } service/client.go
@@ -64,3 +64,26 @@ } return contacts, total, ecode.OK } func (ClientService) Assign(id, memberId int) int { // check member exist _, err := model.NewUserSearch(nil).SetUserId(memberId).First() if err != nil { return ecode.UserNotExist } // check client exist errCode := CheckClientExist(id) if errCode != ecode.OK { return errCode } // assign client err = model.NewClientSearch(nil).SetId(id).UpdateByMap(map[string]interface{}{ "member_id": memberId, }) if err != nil { return ecode.AssignErr } return ecode.OK } service/index.go
@@ -49,17 +49,18 @@ TimelyRateService SolveRateService IsVisitService ReportSourceService OrderTypeService ServiceContractStatusService ServiceContractTypeService RefundMethodService IsInvoiceService AccountIdService SalesReturnStatusService RepositoryService QuotationStatusService CurrencyService ReportSourceService OrderTypeService ServiceContractStatusService ServiceContractTypeService RefundMethodService IsInvoiceService AccountIdService SalesReturnStatusService RepositoryService QuotationStatusService CurrencyService AssignService } var ServiceGroup = new(Group) var ServiceGroup = new(Group)