From c4cc5a54d61b05d98d28b21710b3c1531bc05302 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 21 七月 2023 10:52:44 +0800
Subject: [PATCH] add
---
api/v1/index.go | 2
model/request/isVisit.go | 15 +
service/dataServer.go | 5
api/v1/isVisit.go | 113 ++++++++
pkg/ecode/code.go | 7
service/isVisit.go | 69 ++++
docs/swagger.yaml | 120 ++++++++
docs/docs.go | 190 +++++++++++++
docs/swagger.json | 190 +++++++++++++
model/response/response.go | 8
model/serviceFollowup.go | 2
service/index.go | 1
model/index.go | 4
model/isVisit.go | 85 ++++++
router/index.go | 2
router/isVisit.go | 20 +
api/v1/serviceFollowup.go | 2
17 files changed, 828 insertions(+), 7 deletions(-)
diff --git a/api/v1/index.go b/api/v1/index.go
index dc8b10b..0378ded 100644
--- a/api/v1/index.go
+++ b/api/v1/index.go
@@ -5,6 +5,7 @@
)
type Group struct {
+ IsVisitApi
SolveRateApi
TimelyRateApi
BaseApi
@@ -104,4 +105,5 @@
satisfactionService = service.ServiceGroup.SatisfactionService
timelyRateService = service.ServiceGroup.TimelyRateService
solveRateService = service.ServiceGroup.SolveRateService
+ isVisitService = service.ServiceGroup.IsVisitService
)
diff --git a/api/v1/isVisit.go b/api/v1/isVisit.go
new file mode 100644
index 0000000..57f2759
--- /dev/null
+++ b/api/v1/isVisit.go
@@ -0,0 +1,113 @@
+
+package v1
+
+import (
+ "aps_crm/model"
+ "aps_crm/model/request"
+ "aps_crm/model/response"
+ "aps_crm/pkg/contextx"
+ "aps_crm/pkg/ecode"
+ "github.com/gin-gonic/gin"
+ "strconv"
+)
+
+type IsVisitApi struct{}
+
+// Add
+//
+// @Tags IsVisit
+// @Summary 娣诲姞鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+// @Produce application/json
+// @Param object body request.AddIsVisit true "鏌ヨ鍙傛暟"
+// @Success 200 {object} contextx.Response{}
+// @Router /api/isVisit/add [post]
+func (s *IsVisitApi) Add(c *gin.Context) {
+ var params request.AddIsVisit
+ ctx, ok := contextx.NewContext(c, ¶ms)
+ if !ok {
+ return
+ }
+
+ isVisit := new(model.IsVisit)
+ isVisit.Name = params.Name
+
+ errCode := isVisitService.AddIsVisit(isVisit)
+ if errCode != ecode.OK {
+ ctx.Fail(errCode)
+ return
+ }
+
+ ctx.Ok()
+}
+
+// Delete
+//
+// @Tags IsVisit
+// @Summary 鍒犻櫎鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+// @Produce application/json
+// @Param id path int true "鏌ヨ鍙傛暟"
+// @Success 200 {object} contextx.Response{}
+// @Router /api/isVisit/delete/{id} [delete]
+func (s *IsVisitApi) Delete(c *gin.Context) {
+ ctx, ok := contextx.NewContext(c, nil)
+ if !ok {
+ return
+ }
+
+ id, _ := strconv.Atoi(c.Param("id"))
+ errCode := isVisitService.DeleteIsVisit(id)
+ if errCode != ecode.OK {
+ ctx.Fail(errCode)
+ return
+ }
+
+ ctx.Ok()
+}
+
+// Update
+//
+// @Tags IsVisit
+// @Summary 鏇存柊鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+// @Produce application/json
+// @Param object body request.UpdateIsVisits true "鏌ヨ鍙傛暟"
+// @Success 200 {object} contextx.Response{}
+// @Router /api/isVisit/update [put]
+func (s *IsVisitApi) Update(c *gin.Context) {
+ var params request.UpdateIsVisits
+ ctx, ok := contextx.NewContext(c, ¶ms)
+ if !ok {
+ return
+ }
+
+ errCode := isVisitService.UpdateIsVisit(params.IsVisits)
+ if errCode != ecode.OK {
+ ctx.Fail(errCode)
+ return
+ }
+
+ ctx.Ok()
+}
+
+// List
+//
+// @Tags IsVisit
+// @Summary 鑾峰彇鏈嶅姟浜哄憳鏄惁鏉ヨ繃鍒楄〃
+// @Produce application/json
+// @Success 200 {object} contextx.Response{data=response.IsVisitResponse}
+// @Router /api/isVisit/list [get]
+func (s *IsVisitApi) List(c *gin.Context) {
+ ctx, ok := contextx.NewContext(c, nil)
+ if !ok {
+ return
+ }
+
+ isVisits, errCode := isVisitService.GetIsVisitList()
+ if errCode != ecode.OK {
+ ctx.Fail(errCode)
+ return
+ }
+
+ ctx.OkWithDetailed(response.IsVisitResponse{
+ List: isVisits,
+ })
+}
diff --git a/api/v1/serviceFollowup.go b/api/v1/serviceFollowup.go
index e124cc7..9e97657 100644
--- a/api/v1/serviceFollowup.go
+++ b/api/v1/serviceFollowup.go
@@ -142,7 +142,7 @@
SatisfactionId: serviceFollowup.Satisfaction,
TimelyRateId: serviceFollowup.TimelyRate,
SolveRateId: serviceFollowup.SolveRate,
- IsVisit: serviceFollowup.IsVisit,
+ IsVisitId: serviceFollowup.IsVisit,
OldMemberId: serviceFollowup.OldMemberId,
Remark: serviceFollowup.Remark,
File: serviceFollowup.File,
diff --git a/docs/docs.go b/docs/docs.go
index 75ba54b..0cb0f32 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -2040,6 +2040,125 @@
}
}
},
+ "/api/isVisit/add": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "娣诲姞鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.AddIsVisit"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/contextx.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/isVisit/delete/{id}": {
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "鍒犻櫎鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "鏌ヨ鍙傛暟",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/contextx.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/isVisit/list": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "鑾峰彇鏈嶅姟浜哄憳鏄惁鏉ヨ繃鍒楄〃",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/contextx.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.IsVisitResponse"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/api/isVisit/update": {
+ "put": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "鏇存柊鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.UpdateIsVisits"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/contextx.Response"
+ }
+ }
+ }
+ }
+ },
"/api/masterOrder/add": {
"post": {
"produces": [
@@ -5984,6 +6103,17 @@
}
}
},
+ "model.IsVisit": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ },
"model.MasterOrder": {
"type": "object",
"properties": {
@@ -6681,7 +6811,7 @@
"id": {
"type": "integer"
},
- "isVisit": {
+ "isVisitId": {
"type": "integer"
},
"memberId": {
@@ -7134,6 +7264,17 @@
}
},
"request.AddIndustry": {
+ "type": "object",
+ "required": [
+ "name"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "request.AddIsVisit": {
"type": "object",
"required": [
"name"
@@ -8769,6 +8910,35 @@
}
}
},
+ "request.UpdateIsVisit": {
+ "type": "object",
+ "required": [
+ "id",
+ "name"
+ ],
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "request.UpdateIsVisits": {
+ "type": "object",
+ "required": [
+ "is_visit"
+ ],
+ "properties": {
+ "is_visit": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/request.UpdateIsVisit"
+ }
+ }
+ }
+ },
"request.UpdateMasterOrder": {
"type": "object",
"properties": {
@@ -9812,6 +9982,13 @@
"$ref": "#/definitions/model.Industry"
}
},
+ "isVisit": {
+ "description": "鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/model.IsVisit"
+ }
+ },
"member": {
"description": "Member",
"type": "array",
@@ -9946,6 +10123,17 @@
}
}
},
+ "response.IsVisitResponse": {
+ "type": "object",
+ "properties": {
+ "list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/model.IsVisit"
+ }
+ }
+ }
+ },
"response.LoginResponse": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 4d1423a..92f5a6d 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -2028,6 +2028,125 @@
}
}
},
+ "/api/isVisit/add": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "娣诲姞鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.AddIsVisit"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/contextx.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/isVisit/delete/{id}": {
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "鍒犻櫎鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "鏌ヨ鍙傛暟",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/contextx.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/isVisit/list": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "鑾峰彇鏈嶅姟浜哄憳鏄惁鏉ヨ繃鍒楄〃",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/contextx.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/response.IsVisitResponse"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/api/isVisit/update": {
+ "put": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "IsVisit"
+ ],
+ "summary": "鏇存柊鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.UpdateIsVisits"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/contextx.Response"
+ }
+ }
+ }
+ }
+ },
"/api/masterOrder/add": {
"post": {
"produces": [
@@ -5972,6 +6091,17 @@
}
}
},
+ "model.IsVisit": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ },
"model.MasterOrder": {
"type": "object",
"properties": {
@@ -6669,7 +6799,7 @@
"id": {
"type": "integer"
},
- "isVisit": {
+ "isVisitId": {
"type": "integer"
},
"memberId": {
@@ -7122,6 +7252,17 @@
}
},
"request.AddIndustry": {
+ "type": "object",
+ "required": [
+ "name"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "request.AddIsVisit": {
"type": "object",
"required": [
"name"
@@ -8757,6 +8898,35 @@
}
}
},
+ "request.UpdateIsVisit": {
+ "type": "object",
+ "required": [
+ "id",
+ "name"
+ ],
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "request.UpdateIsVisits": {
+ "type": "object",
+ "required": [
+ "is_visit"
+ ],
+ "properties": {
+ "is_visit": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/request.UpdateIsVisit"
+ }
+ }
+ }
+ },
"request.UpdateMasterOrder": {
"type": "object",
"properties": {
@@ -9800,6 +9970,13 @@
"$ref": "#/definitions/model.Industry"
}
},
+ "isVisit": {
+ "description": "鏈嶅姟浜哄憳鏄惁鏉ヨ繃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/model.IsVisit"
+ }
+ },
"member": {
"description": "Member",
"type": "array",
@@ -9934,6 +10111,17 @@
}
}
},
+ "response.IsVisitResponse": {
+ "type": "object",
+ "properties": {
+ "list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/model.IsVisit"
+ }
+ }
+ }
+ },
"response.LoginResponse": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index cb0cbb2..34747d8 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -402,6 +402,13 @@
name:
type: string
type: object
+ model.IsVisit:
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
+ type: object
model.MasterOrder:
properties:
client:
@@ -860,7 +867,7 @@
type: string
id:
type: integer
- isVisit:
+ isVisitId:
type: integer
memberId:
type: integer
@@ -1169,6 +1176,13 @@
- follow_record
type: object
request.AddIndustry:
+ properties:
+ name:
+ type: string
+ required:
+ - name
+ type: object
+ request.AddIsVisit:
properties:
name:
type: string
@@ -2277,6 +2291,25 @@
- id
- name
type: object
+ request.UpdateIsVisit:
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
+ required:
+ - id
+ - name
+ type: object
+ request.UpdateIsVisits:
+ properties:
+ is_visit:
+ items:
+ $ref: '#/definitions/request.UpdateIsVisit'
+ type: array
+ required:
+ - is_visit
+ type: object
request.UpdateMasterOrder:
properties:
client_id:
@@ -2974,6 +3007,11 @@
items:
$ref: '#/definitions/model.Industry'
type: array
+ isVisit:
+ description: 鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+ items:
+ $ref: '#/definitions/model.IsVisit'
+ type: array
member:
description: Member
items:
@@ -3063,6 +3101,13 @@
list:
items:
$ref: '#/definitions/model.Industry'
+ type: array
+ type: object
+ response.IsVisitResponse:
+ properties:
+ list:
+ items:
+ $ref: '#/definitions/model.IsVisit'
type: array
type: object
response.LoginResponse:
@@ -4489,6 +4534,79 @@
summary: 鏇存柊琛屼笟
tags:
- Industry
+ /api/isVisit/add:
+ post:
+ parameters:
+ - description: 鏌ヨ鍙傛暟
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.AddIsVisit'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/contextx.Response'
+ summary: 娣诲姞鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+ tags:
+ - IsVisit
+ /api/isVisit/delete/{id}:
+ delete:
+ parameters:
+ - description: 鏌ヨ鍙傛暟
+ in: path
+ name: id
+ required: true
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/contextx.Response'
+ summary: 鍒犻櫎鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+ tags:
+ - IsVisit
+ /api/isVisit/list:
+ get:
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/contextx.Response'
+ - properties:
+ data:
+ $ref: '#/definitions/response.IsVisitResponse'
+ type: object
+ summary: 鑾峰彇鏈嶅姟浜哄憳鏄惁鏉ヨ繃鍒楄〃
+ tags:
+ - IsVisit
+ /api/isVisit/update:
+ put:
+ parameters:
+ - description: 鏌ヨ鍙傛暟
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.UpdateIsVisits'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/contextx.Response'
+ summary: 鏇存柊鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+ tags:
+ - IsVisit
/api/masterOrder/add:
post:
parameters:
diff --git a/model/index.go b/model/index.go
index 2ded31e..c955be5 100644
--- a/model/index.go
+++ b/model/index.go
@@ -66,6 +66,8 @@
Satisfaction{},
TimelyRate{},
SolveRate{},
+ IsVisit{},
+ IsVisit{},
)
return err
-}
+}
\ No newline at end of file
diff --git a/model/isVisit.go b/model/isVisit.go
new file mode 100644
index 0000000..f6c4af9
--- /dev/null
+++ b/model/isVisit.go
@@ -0,0 +1,85 @@
+package model
+
+import (
+ "aps_crm/pkg/mysqlx"
+ "gorm.io/gorm"
+)
+
+type (
+ // IsVisit 鍟嗘満闃舵
+ IsVisit struct {
+ Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+ Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
+ }
+
+ IsVisitSearch struct {
+ IsVisit
+ Orm *gorm.DB
+ }
+)
+
+func (IsVisit) TableName() string {
+ return "is_visit"
+}
+
+func NewIsVisitSearch() *IsVisitSearch {
+ return &IsVisitSearch{
+ Orm: mysqlx.GetDB(),
+ }
+}
+
+func (slf *IsVisitSearch) build() *gorm.DB {
+ var db = slf.Orm.Model(&IsVisit{})
+ if slf.Id != 0 {
+ db = db.Where("id = ?", slf.Id)
+ }
+ if slf.Name != "" {
+ db = db.Where("name = ?", slf.Name)
+ }
+
+ return db
+}
+
+func (slf *IsVisitSearch) Create(record *IsVisit) error {
+ var db = slf.build()
+ return db.Create(record).Error
+}
+
+func (slf *IsVisitSearch) Delete() error {
+ var db = slf.build()
+ return db.Delete(&IsVisit{}).Error
+}
+
+func (slf *IsVisitSearch) Update(record *IsVisit) error {
+ var db = slf.build()
+ return db.Updates(record).Error
+}
+
+func (slf *IsVisitSearch) Find() (*IsVisit, error) {
+ var db = slf.build()
+ var record = new(IsVisit)
+ err := db.First(record).Error
+ return record, err
+}
+
+func (slf *IsVisitSearch) FindAll() ([]*IsVisit, error) {
+ var db = slf.build()
+ var records = make([]*IsVisit, 0)
+ err := db.Find(&records).Error
+ return records, err
+}
+
+func (slf *IsVisitSearch) SetId(id int) *IsVisitSearch {
+ slf.Id = id
+ return slf
+}
+
+func (slf *IsVisitSearch) SetName(name string) *IsVisitSearch {
+ slf.Name = name
+ return slf
+}
+
+func (slf *IsVisitSearch) Updates(data map[string]interface{}) error {
+ var db = slf.build()
+ return db.Updates(data).Error
+}
diff --git a/model/request/isVisit.go b/model/request/isVisit.go
new file mode 100644
index 0000000..61ce9ef
--- /dev/null
+++ b/model/request/isVisit.go
@@ -0,0 +1,15 @@
+
+package request
+
+type AddIsVisit struct {
+ Name string ` json:"name" binding:"required"`
+}
+
+type UpdateIsVisit struct {
+ Id int `json:"id" binding:"required"`
+ Name string `json:"name" binding:"required"`
+}
+
+type UpdateIsVisits struct {
+ IsVisits []*UpdateIsVisit `json:"is_visit" binding:"required"`
+}
diff --git a/model/response/response.go b/model/response/response.go
index 2bb073b..138e921 100644
--- a/model/response/response.go
+++ b/model/response/response.go
@@ -179,6 +179,10 @@
}
DataResponse struct {
+
+ // 鏈嶅姟浜哄憳鏄惁鏉ヨ繃
+ IsVisit []*model.IsVisit `json:"isVisit"`
+
// 鍥藉鏁版嵁
Country []*model.Country `json:"country"`
// 鐪佷唤鏁版嵁
@@ -238,4 +242,8 @@
SolveRateResponse struct {
List []*model.SolveRate `json:"list"`
}
+
+ IsVisitResponse struct {
+ List []*model.IsVisit `json:"list"`
+ }
)
diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go
index 4557eff..c534dcf 100644
--- a/model/serviceFollowup.go
+++ b/model/serviceFollowup.go
@@ -18,7 +18,7 @@
SatisfactionId int `json:"satisfactionId" gorm:"column:satisfaction_id;type:int;comment:婊℃剰搴d"`
TimelyRateId int `json:"timelyRateId" gorm:"column:timely_rate_id;type:int;comment:鍙婃椂鐜噄d"`
SolveRateId int `json:"solveRateId" gorm:"column:solve_rate_id;type:int;comment:瑙e喅鐜噄d"`
- IsVisit int `json:"isVisit" gorm:"column:is_visit;type:int;comment:鏈嶅姟浜哄憳鏄惁鏉ヨ繃"`
+ IsVisitId int `json:"isVisitId" gorm:"column:is_visit_id;type:int;comment:鏈嶅姟浜哄憳鏄惁鏉ヨ繃id"`
OldMemberId int `json:"oldMemberId" gorm:"column:old_member_id;type:int;comment:鍘熸湇鍔′汉鍛�"`
Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"`
File string `json:"file" gorm:"column:file;type:varchar(255);comment:闄勪欢"`
diff --git a/pkg/ecode/code.go b/pkg/ecode/code.go
index 2b7b61e..b6c7fc9 100644
--- a/pkg/ecode/code.go
+++ b/pkg/ecode/code.go
@@ -309,4 +309,11 @@
SolveRateListErr = 4400003 // 鑾峰彇瑙e喅鐜囧垪琛ㄥけ璐�
SolveRateSetErr = 4400004 // 璁剧疆瑙e喅鐜囧け璐�
SolveRateUpdateErr = 4400005 // 鏇存柊瑙e喅鐜囧け璐�
+
+ IsVisitExist = 4500001 // 鏈嶅姟浜哄憳鏄惁鏉ヨ繃宸插瓨鍦�
+ IsVisitNotExist = 4500002 // 鏈嶅姟浜哄憳鏄惁鏉ヨ繃涓嶅瓨鍦�
+ IsVisitListErr = 4500003 // 鑾峰彇鏈嶅姟浜哄憳鏄惁鏉ヨ繃鍒楄〃澶辫触
+ IsVisitSetErr = 4500004 // 璁剧疆鏈嶅姟浜哄憳鏄惁鏉ヨ繃澶辫触
+ IsVisitUpdateErr = 4500005 // 鏇存柊鏈嶅姟浜哄憳鏄惁鏉ヨ繃澶辫触
+
)
diff --git a/router/index.go b/router/index.go
index 21f46de..8a603b8 100644
--- a/router/index.go
+++ b/router/index.go
@@ -11,6 +11,7 @@
)
type Group struct {
+ IsVisitRouter
SolveRateRouter
TimelyRateRouter
BaseRouter
@@ -133,6 +134,7 @@
routerGroup.InitSatisfactionRouter(PrivateGroup) // 娉ㄥ唽satisfaction璺敱
routerGroup.InitTimelyRateRouter(PrivateGroup)
routerGroup.InitSolveRateRouter(PrivateGroup)
+ routerGroup.InitIsVisitRouter(PrivateGroup)
}
return Router
}
diff --git a/router/isVisit.go b/router/isVisit.go
new file mode 100644
index 0000000..c3928d0
--- /dev/null
+++ b/router/isVisit.go
@@ -0,0 +1,20 @@
+
+package router
+
+import (
+ v1 "aps_crm/api/v1"
+ "github.com/gin-gonic/gin"
+)
+
+type IsVisitRouter struct{}
+
+func (s *IsVisitRouter) InitIsVisitRouter(router *gin.RouterGroup) {
+ isVisitRouter := router.Group("isVisit")
+ isVisitApi := v1.ApiGroup.IsVisitApi
+ {
+ isVisitRouter.POST("add", isVisitApi.Add) // 娣诲姞$CName$
+ isVisitRouter.DELETE("delete/:id", isVisitApi.Delete) // 鍒犻櫎$CName$
+ isVisitRouter.PUT("update", isVisitApi.Update) // 鏇存柊$CName$
+ isVisitRouter.GET("list", isVisitApi.List) // 鑾峰彇$CName$鍒楄〃
+ }
+}
\ No newline at end of file
diff --git a/service/dataServer.go b/service/dataServer.go
index 8af4b8c..d9af969 100644
--- a/service/dataServer.go
+++ b/service/dataServer.go
@@ -92,8 +92,11 @@
solveRateList, _ := ServiceGroup.GetSolveRateList()
data.SolveRate = solveRateList
+ // get IsVisit list
+ isVisitList, _ := ServiceGroup.GetIsVisitList()
+ data.IsVisit = isVisitList
errCode = ecode.OK
return
-}
\ No newline at end of file
+}
diff --git a/service/index.go b/service/index.go
index cd34420..e8c2d4f 100644
--- a/service/index.go
+++ b/service/index.go
@@ -48,6 +48,7 @@
SatisfactionService
TimelyRateService
SolveRateService
+ IsVisitService
}
var ServiceGroup = new(Group)
diff --git a/service/isVisit.go b/service/isVisit.go
new file mode 100644
index 0000000..c62f2d3
--- /dev/null
+++ b/service/isVisit.go
@@ -0,0 +1,69 @@
+
+package service
+
+import (
+ "aps_crm/model"
+ "aps_crm/model/request"
+ "aps_crm/pkg/ecode"
+)
+
+type IsVisitService struct{}
+
+func (IsVisitService) AddIsVisit(isVisit *model.IsVisit) int {
+ err := model.NewIsVisitSearch().Create(isVisit)
+ if err != nil {
+ return ecode.IsVisitExist
+ }
+
+ return ecode.OK
+}
+
+func (IsVisitService) DeleteIsVisit(id int) int {
+ _, err := model.NewIsVisitSearch().SetId(id).Find()
+ if err != nil {
+ return ecode.IsVisitNotExist
+ }
+
+ err = model.NewIsVisitSearch().SetId(id).Delete()
+ if err != nil {
+ return ecode.IsVisitNotExist
+ }
+ return ecode.OK
+}
+
+func (IsVisitService) GetIsVisitList() ([]*model.IsVisit, int) {
+ list, err := model.NewIsVisitSearch().FindAll()
+ if err != nil {
+ return nil, ecode.IsVisitListErr
+ }
+
+ return list, ecode.OK
+}
+
+func (IsVisitService) UpdateIsVisit(isVisits []*request.UpdateIsVisit) int {
+ for _, v := range isVisits {
+ // check isVisit exist
+ _, err := model.NewIsVisitSearch().SetId(v.Id).Find()
+ if err != nil {
+ return ecode.IsVisitNotExist
+ }
+
+ err = model.NewIsVisitSearch().SetId(v.Id).Updates(map[string]interface{}{
+ "name": v.Name,
+ })
+ if err != nil {
+ return ecode.IsVisitSetErr
+ }
+ }
+
+ return ecode.OK
+}
+
+func (IsVisitService) GetIsVisitDetail(id int) (*model.IsVisit, int) {
+ isVisit, err := model.NewIsVisitSearch().SetId(id).Find()
+ if err != nil {
+ return nil, ecode.IsVisitNotExist
+ }
+
+ return isVisit, ecode.OK
+}
--
Gitblit v1.8.0