瀏覽代碼

bodycheck

胡轶钦 6 年之前
父節點
當前提交
464e012cd3
共有 2 個檔案被更改,包括 22 行新增22 行删除
  1. 21
    21
      controllers/bodycheck/bodycheck.go
  2. 1
    1
      models/model/ta_body_check.go

+ 21
- 21
controllers/bodycheck/bodycheck.go 查看文件

@@ -51,25 +51,25 @@ func (c *BodyCheckController) GetCheckByUser() {
51 51
 
52 52
 	bodyCheck, err := c.dao.GetBodyCheckByUser(user.CustomerId)
53 53
 	if err != nil {
54
-		c.ResponseJson(map[string]interface{}{
54
+		c.ResponseJSON(map[string]interface{}{
55 55
 			"Status":  false,
56 56
 			"Message": err.Error(),
57 57
 		})
58 58
 	}
59 59
 	if len(bodyCheck) == 0 {
60
-		c.ResponseJson(map[string]interface{}{
60
+		c.ResponseJSON(map[string]interface{}{
61 61
 			"Status":  false,
62 62
 			"Message": "没有查询到数据",
63 63
 		})
64 64
 	}
65 65
 	presentations, err := c.dao.GetPresentationByCheckID(bodyCheck[0].Id)
66 66
 	if err != nil {
67
-		c.ResponseJson(map[string]interface{}{
67
+		c.ResponseJSON(map[string]interface{}{
68 68
 			"Status":  false,
69 69
 			"Message": err.Error(),
70 70
 		})
71 71
 	}
72
-	c.ResponseJson(map[string]interface{}{
72
+	c.ResponseJSON(map[string]interface{}{
73 73
 		"Status":   true,
74 74
 		"Message":  presentations,
75 75
 		"Info":     bodyCheck,
@@ -87,7 +87,7 @@ func (c *BodyCheckController) PostCheckResult() {
87 87
 	err := json.Unmarshal(con, &formVal)
88 88
 	if err != nil {
89 89
 		beego.Error(err)
90
-		c.ResponseJson(map[string]interface{}{
90
+		c.ResponseJSON(map[string]interface{}{
91 91
 			"Status":  false,
92 92
 			"Message": err.Error(),
93 93
 		})
@@ -114,7 +114,7 @@ func (c *BodyCheckController) PostCheckResult() {
114 114
 	result.CheckType = int(formVal["CheckType"].(float64))
115 115
 	if err != nil {
116 116
 		beego.Error(err.Error())
117
-		c.ResponseJson(map[string]interface{}{
117
+		c.ResponseJSON(map[string]interface{}{
118 118
 			"Status":  false,
119 119
 			"Message": err.Error(),
120 120
 		})
@@ -123,7 +123,7 @@ func (c *BodyCheckController) PostCheckResult() {
123 123
 	result.CheckDate, err = time.ParseInLocation("2006-01-02 15:04:05", formVal["CheckDate"].(string), loc)
124 124
 	if err != nil {
125 125
 		beego.Error(err.Error())
126
-		c.ResponseJson(map[string]interface{}{
126
+		c.ResponseJSON(map[string]interface{}{
127 127
 			"Status":  false,
128 128
 			"Message": err.Error(),
129 129
 		})
@@ -132,25 +132,25 @@ func (c *BodyCheckController) PostCheckResult() {
132 132
 	user, err := c.dao.GetUserByOpenID(result.WechatAccount)
133 133
 	if err != nil {
134 134
 		beego.Error(err.Error())
135
-		c.ResponseJson(map[string]interface{}{
135
+		c.ResponseJSON(map[string]interface{}{
136 136
 			"Status":  false,
137 137
 			"Message": err.Error(),
138 138
 		})
139 139
 	}
140 140
 
141
-	if user == nil || user.Id < 1 {
141
+	if user == nil || user.CustomerId == "" {
142 142
 		beego.Error("没有当前用户信息!")
143
-		c.ResponseJson(map[string]interface{}{
143
+		c.ResponseJSON(map[string]interface{}{
144 144
 			"Status":  false,
145 145
 			"Message": "没有当前用户信息!",
146 146
 		})
147 147
 	}
148
-	userid := user.Id
148
+	userid := user.CustomerId
149 149
 
150 150
 	checkinfo, err := c.dao.GetCheckByUserAndEquipmentID(userid, result.EquipmentId)
151 151
 	if err != nil {
152 152
 		beego.Error(err.Error())
153
-		c.ResponseJson(map[string]interface{}{
153
+		c.ResponseJSON(map[string]interface{}{
154 154
 			"Status":  false,
155 155
 			"Message": err.Error(),
156 156
 		})
@@ -159,14 +159,14 @@ func (c *BodyCheckController) PostCheckResult() {
159 159
 		caseEquipment, err := c.dao.GetCaseEquipment(result.EquipmentId)
160 160
 		if err != nil {
161 161
 			beego.Error(err.Error())
162
-			c.ResponseJson(map[string]interface{}{
162
+			c.ResponseJSON(map[string]interface{}{
163 163
 				"Status":  false,
164 164
 				"Message": err.Error(),
165 165
 			})
166 166
 		}
167 167
 		if caseEquipment == nil || caseEquipment.Id < 1 {
168 168
 			beego.Error("设备未维护!")
169
-			c.ResponseJson(map[string]interface{}{
169
+			c.ResponseJSON(map[string]interface{}{
170 170
 				"Status":  false,
171 171
 				"Message": "设备未维护!",
172 172
 			})
@@ -201,7 +201,7 @@ func (c *BodyCheckController) PostCheckResult() {
201 201
 	presentation, err := c.dao.GetPresentation(checkinfo.Id, result.CheckType)
202 202
 	if err != nil {
203 203
 		beego.Error(err.Error())
204
-		c.ResponseJson(map[string]interface{}{
204
+		c.ResponseJSON(map[string]interface{}{
205 205
 			"Status":  false,
206 206
 			"Message": err.Error(),
207 207
 		})
@@ -217,7 +217,7 @@ func (c *BodyCheckController) PostCheckResult() {
217 217
 		presentation, err = c.dao.SavePresentation(preNew)
218 218
 		if err != nil {
219 219
 			beego.Error(err.Error())
220
-			c.ResponseJson(map[string]interface{}{
220
+			c.ResponseJSON(map[string]interface{}{
221 221
 				"Status":  false,
222 222
 				"Message": err.Error(),
223 223
 			})
@@ -230,7 +230,7 @@ func (c *BodyCheckController) PostCheckResult() {
230 230
 		err = c.dao.UpdatePresentation(presentation)
231 231
 		if err != nil {
232 232
 			beego.Error(err.Error())
233
-			c.ResponseJson(map[string]interface{}{
233
+			c.ResponseJSON(map[string]interface{}{
234 234
 				"Status":  false,
235 235
 				"Message": err.Error(),
236 236
 			})
@@ -239,7 +239,7 @@ func (c *BodyCheckController) PostCheckResult() {
239 239
 		err = c.dao.DeletePresentionDetail(presentation.Id)
240 240
 		if err != nil {
241 241
 			beego.Error(err.Error())
242
-			c.ResponseJson(map[string]interface{}{
242
+			c.ResponseJSON(map[string]interface{}{
243 243
 				"Status":  false,
244 244
 				"Message": err.Error(),
245 245
 			})
@@ -249,7 +249,7 @@ func (c *BodyCheckController) PostCheckResult() {
249 249
 	specs, err := c.dao.GetCheckSpecs()
250 250
 	if err != nil {
251 251
 		beego.Error(err.Error())
252
-		c.ResponseJson(map[string]interface{}{
252
+		c.ResponseJSON(map[string]interface{}{
253 253
 			"Status":  false,
254 254
 			"Message": err.Error(),
255 255
 		})
@@ -284,14 +284,14 @@ func (c *BodyCheckController) PostCheckResult() {
284 284
 			err := c.dao.SavePresentationDetail(details)
285 285
 			if err != nil {
286 286
 				beego.Error(err.Error())
287
-				c.ResponseJson(map[string]interface{}{
287
+				c.ResponseJSON(map[string]interface{}{
288 288
 					"Status":  false,
289 289
 					"Message": err.Error(),
290 290
 				})
291 291
 			}
292 292
 		}
293 293
 	}
294
-	c.ResponseJson(map[string]interface{}{
294
+	c.ResponseJSON(map[string]interface{}{
295 295
 		"Status":  true,
296 296
 		"Message": "",
297 297
 	})

+ 1
- 1
models/model/ta_body_check.go 查看文件

@@ -6,7 +6,7 @@ import (
6 6
 
7 7
 type TaBodyCheck struct {
8 8
 	Id          int       `xorm:"not null pk autoincr INT(11)"`
9
-	UserId      int       `xorm:"not null INT(11)"`
9
+	UserId      string    `xorm:"not null INT(11)"`
10 10
 	EquipmentId string    `xorm:"not null VARCHAR(100)"`
11 11
 	CreateDate  time.Time `xorm:"not null DATETIME"`
12 12
 	Status      int       `xorm:"not null comment('1为正常') INT(11)"`