|
@@ -14,16 +14,20 @@ type PlatformController struct { |
|
@@ -14,16 +14,20 @@ type PlatformController struct { |
14
|
|
14
|
|
15
|
//
|
15
|
//
|
16
|
func (c PlatformController) UpdateData() {
|
16
|
func (c PlatformController) UpdateData() {
|
17
|
- defer func() {
|
|
|
18
|
- c.Data["json"] = map[string]interface{}{
|
17
|
+ var respMsg = map[string]interface{}{
|
19
|
"code": 0,
|
18
|
"code": 0,
|
20
|
"msg": "ok",
|
19
|
"msg": "ok",
|
21
|
}
|
20
|
}
|
|
|
21
|
+ defer func() {
|
|
|
22
|
+ c.Data["json"] = respMsg
|
22
|
c.ServeJSON()
|
23
|
c.ServeJSON()
|
23
|
}()
|
24
|
}()
|
|
|
25
|
+
|
24
|
var param platform.CommonProtocol
|
26
|
var param platform.CommonProtocol
|
25
|
if err := json.Unmarshal(c.Ctx.Input.RequestBody, ¶m); err != nil {
|
27
|
if err := json.Unmarshal(c.Ctx.Input.RequestBody, ¶m); err != nil {
|
26
|
log.Error("json 解析失败 err:%s", err)
|
28
|
log.Error("json 解析失败 err:%s", err)
|
|
|
29
|
+ respMsg["code"] = -1
|
|
|
30
|
+ respMsg["msg"] = "json 解析失败 err:" + err.Error()
|
27
|
return
|
31
|
return
|
28
|
}
|
32
|
}
|
29
|
m, err := platform.NewPlatformAction(param.Module)
|
33
|
m, err := platform.NewPlatformAction(param.Module)
|
|
@@ -34,12 +38,17 @@ func (c PlatformController) UpdateData() { |
|
@@ -34,12 +38,17 @@ func (c PlatformController) UpdateData() { |
34
|
bt, err := json.Marshal(param.Data)
|
38
|
bt, err := json.Marshal(param.Data)
|
35
|
if err != nil {
|
39
|
if err != nil {
|
36
|
log.Error("解析param.data数据失败")
|
40
|
log.Error("解析param.data数据失败")
|
|
|
41
|
+ respMsg["code"] = -1
|
|
|
42
|
+ respMsg["msg"] = "json 解析失败 err:" + err.Error()
|
|
|
43
|
+ return
|
37
|
}
|
44
|
}
|
38
|
err = m.DoAction(param.Action, bt)
|
45
|
err = m.DoAction(param.Action, bt)
|
39
|
if err != nil {
|
46
|
if err != nil {
|
40
|
log.Error("同步数据发生错误,module=%s,action=%s,err:%s", param.Module, param.Action, err)
|
47
|
log.Error("同步数据发生错误,module=%s,action=%s,err:%s", param.Module, param.Action, err)
|
41
|
- }
|
48
|
+ respMsg["code"] = -1
|
|
|
49
|
+ respMsg["msg"] = fmt.Sprintf("同步数据发生错误,module=%s,action=%s,err:%s", param.Module, param.Action, err)
|
42
|
return
|
50
|
return
|
|
|
51
|
+ }
|
43
|
}
|
52
|
}
|
44
|
|
53
|
|
45
|
func (c PlatformController) CompanyAdminChance() {
|
54
|
func (c PlatformController) CompanyAdminChance() {
|