public_api_controller.go 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. package controllers
  2. import (
  3. "XT_New/enums"
  4. "XT_New/models"
  5. "XT_New/service"
  6. "encoding/json"
  7. "fmt"
  8. "os"
  9. "path"
  10. "runtime"
  11. "strings"
  12. "time"
  13. "github.com/astaxie/beego"
  14. )
  15. type PublicApiController struct {
  16. BaseAPIController
  17. }
  18. func PublicApiRegistRouters() {
  19. beego.Router("/api/public/getadviceconfig", &PublicApiController{}, "Get:GetDoctorAdviceConfig")
  20. beego.Router("/api/public/servertime", &PublicApiController{}, "Get:GetServerTime")
  21. beego.Router("/api/app/release", &PublicApiController{}, "Get:AppRelease")
  22. beego.Router("/api/get", &PublicApiController{}, "Get:GetJson")
  23. beego.Router("/api/public/handledata", &PublicApiController{}, "get:HandleData")
  24. }
  25. func (c *PublicApiController) GetDoctorAdviceConfig() {
  26. drugs, _, _ := service.GetPublicDrugDics()
  27. drugways, _, _ := service.GetPublicDrugWayDics()
  28. efs, _, _ := service.GetPublicExecutionFrequencyDics()
  29. c.ServeSuccessJSON(map[string]interface{}{
  30. "drugs": drugs,
  31. "drugways": drugways,
  32. "efs": efs,
  33. })
  34. }
  35. func (c *PublicApiController) GetServerTime() {
  36. timeNow := time.Now()
  37. timeNowStamp := timeNow.Unix()
  38. timeNowStr := timeNow.Format("2006-01-02 15:04:05")
  39. c.ServeSuccessJSON(map[string]interface{}{
  40. "time": timeNowStr,
  41. "timestamp": timeNowStamp,
  42. })
  43. }
  44. func (c *PublicApiController) AppRelease() {
  45. // appId := c.GetString("appid")
  46. version := c.GetString("version")
  47. appType, _ := c.GetInt64("app_type", 0)
  48. appVersion, err := service.GetAppVersionByAppType(appType)
  49. if err != nil {
  50. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  51. return
  52. }
  53. if appVersion == nil {
  54. c.ServeSuccessJSON(map[string]interface{}{
  55. "version": nil,
  56. "state": 2,
  57. })
  58. return
  59. }
  60. state := strings.Compare(version, appVersion.Version)
  61. // state := 1
  62. if state < 0 {
  63. c.ServeSuccessJSON(map[string]interface{}{
  64. "version": appVersion,
  65. "state": appVersion.Status,
  66. })
  67. return
  68. }
  69. c.ServeSuccessJSON(map[string]interface{}{
  70. "version": nil,
  71. "state": 2,
  72. })
  73. return
  74. }
  75. func (this *PublicApiController) GetJson() {
  76. type Global struct {
  77. DeviceSN string
  78. Version string
  79. Timestamp string
  80. InterfaceSource string
  81. }
  82. type RBPResultModel struct {
  83. Sys string
  84. Dia string
  85. HR string
  86. MeasureTime string
  87. }
  88. type ScannerResultModel struct {
  89. Code string
  90. }
  91. type IDCardResultModel struct {
  92. IDCardNo string
  93. UserName string
  94. Age string
  95. Female string
  96. Male string
  97. SocialSecurityNo string
  98. }
  99. type JsonTemp struct {
  100. Global Global
  101. RBPResultModel RBPResultModel
  102. ScannerResultModel ScannerResultModel
  103. IDCardResultModel IDCardResultModel
  104. }
  105. var person JsonTemp
  106. err3 := json.Unmarshal([]byte(this.GetString("params")), &person)
  107. fmt.Println(err3)
  108. fmt.Println(person.Global)
  109. //temp := JsonTemp{
  110. // Global:Global{
  111. // DeviceSN:"1122",
  112. // Version:"1122",
  113. // Timestamp:"1222",
  114. // InterfaceSource:"1233",
  115. // },
  116. // RBPResultModel: RBPResultModel{
  117. // Sys:"12",
  118. // Dia:"22",
  119. // HR:"23",
  120. // MeasureTime:"123",
  121. // },
  122. // ScannerResultModel:ScannerResultModel{
  123. // Code:"1233",
  124. // },
  125. // IDCardResultModel:IDCardResultModel{
  126. // IDCardNo:"123",
  127. // UserName:"123",
  128. // Age:"123",
  129. // Female:"123",
  130. // Male:"123",
  131. // SocialSecurityNo:"123",
  132. // },
  133. //}
  134. //
  135. //jsonBytes, err := json.Marshal(temp)
  136. //if err != nil {
  137. // fmt.Println(err)
  138. //}
  139. //fmt.Println(string(jsonBytes))
  140. }
  141. func (c *PublicApiController) HandleData() {
  142. //service.HandleData()
  143. org_app, _ := service.GetAllAppOrg()
  144. //org_role, _ := service.GetAllRole()
  145. //
  146. //var org_ids []int64
  147. for _, apps := range org_app {
  148. xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
  149. //org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
  150. //org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
  151. //org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
  152. //org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
  153. //org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
  154. //org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
  155. //org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
  156. //org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
  157. //org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
  158. //org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
  159. org_app_16, _ := service.GetAppByType(int64(apps.OrgId), 16)
  160. org_app_17, _ := service.GetAppByType(int64(apps.OrgId), 17)
  161. var xt_temp_org_app *models.OrgApp
  162. //var mall_temp_org_app *models.OrgApp
  163. if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  164. app, _ := service.GetOrgAppA(0, 3)
  165. org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  166. if org == nil || org.Id == 0 {
  167. continue
  168. }
  169. app.Id = 0
  170. app.OrgId = apps.OrgId
  171. app.Creator = int(org.Creator)
  172. app.Number = 0
  173. app.Status = 1
  174. app.ModifyTime = time.Now().Unix()
  175. app.CreateTime = time.Now().Unix()
  176. service.CreateOrgApp(app)
  177. xt_temp_org_app = app
  178. } else {
  179. xt_temp_org_app = xt_org_app
  180. }
  181. //if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  182. //
  183. // app, _ := service.GetOrgAppA(0, 1)
  184. // //org, _ := service.GetOrgById(int64(12))
  185. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  186. // if org == nil || org.Id == 0 {
  187. // continue
  188. // }
  189. //
  190. //
  191. // app.OrgId = apps.OrgId
  192. // app.Id = 0
  193. //
  194. // app.Creator = int(org.Creator)
  195. // app.Number = 0
  196. // app.Status = 1
  197. // app.ModifyTime = time.Now().Unix()
  198. // app.CreateTime = time.Now().Unix()
  199. // service.CreateOrgApp(app)
  200. //
  201. //}
  202. //
  203. //if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  204. // app, _ := service.GetOrgAppA(0, 4)
  205. // //org, _ := service.GetOrgById(int64(12))
  206. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  207. // if org == nil || org.Id == 0 {
  208. // continue
  209. // }
  210. //
  211. //
  212. // app.OrgId = apps.OrgId
  213. // app.Creator = int(org.Creator)
  214. // app.Number = 0
  215. // app.Id = 0
  216. //
  217. // app.Status = 1
  218. // app.ModifyTime = time.Now().Unix()
  219. // app.CreateTime = time.Now().Unix()
  220. // service.CreateOrgApp(app)
  221. //}
  222. //
  223. //if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  224. // app, _ := service.GetOrgAppA(0, 5)
  225. // //org, _ := service.GetOrgById(int64(12))
  226. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  227. //
  228. // if org == nil || org.Id == 0 {
  229. // continue
  230. // }
  231. //
  232. // app.OrgId = apps.OrgId
  233. // app.Creator = int(org.Creator)
  234. // app.Number = 0
  235. // app.Id = 0
  236. //
  237. // app.Status = 1
  238. // app.ModifyTime = time.Now().Unix()
  239. // app.CreateTime = time.Now().Unix()
  240. // service.CreateOrgApp(app)
  241. // mall_temp_org_app = app
  242. //} else {
  243. // mall_temp_org_app = mall_org_app
  244. //}
  245. //
  246. if org_app_16 == nil || org_app_16.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  247. app, _ := service.GetOrgAppA(0, 16)
  248. //org, _ := service.GetOrgById(int64(12))
  249. org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  250. if org == nil || org.Id == 0 {
  251. continue
  252. }
  253. app.OrgId = apps.OrgId
  254. app.Creator = int(org.Creator)
  255. app.Number = 11
  256. app.Id = 0
  257. app.Status = 1
  258. app.ModifyTime = time.Now().Unix()
  259. app.CreateTime = time.Now().Unix()
  260. app.Pid = xt_temp_org_app.Id
  261. service.CreateOrgApp(app)
  262. }
  263. if org_app_17 == nil || org_app_17.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  264. app, _ := service.GetOrgAppA(0, 17)
  265. //org, _ := service.GetOrgById(int64(12))
  266. org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  267. if org == nil || org.Id == 0 {
  268. continue
  269. }
  270. app.OrgId = apps.OrgId
  271. app.Creator = int(org.Creator)
  272. app.Number = 12
  273. app.Id = 0
  274. app.Status = 1
  275. app.ModifyTime = time.Now().Unix()
  276. app.CreateTime = time.Now().Unix()
  277. app.Pid = xt_temp_org_app.Id
  278. service.CreateOrgApp(app)
  279. }
  280. //if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  281. // app, _ := service.GetOrgAppA(0, 7)
  282. // //org, _ := service.GetOrgById(int64(12))
  283. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  284. // if org == nil || org.Id == 0 {
  285. // continue
  286. // }
  287. //
  288. //
  289. // app.OrgId = apps.OrgId
  290. // app.Creator = int(org.Creator)
  291. // app.Number = 2
  292. // app.Status = 2
  293. // app.Id = 0
  294. //
  295. // app.ModifyTime = time.Now().Unix()
  296. // app.CreateTime = time.Now().Unix()
  297. // app.Pid = xt_temp_org_app.Id
  298. //
  299. // service.CreateOrgApp(app)
  300. //}
  301. //if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  302. // app, _ := service.GetOrgAppA(0, 8)
  303. // //org, _ := service.GetOrgById(int64(12))
  304. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  305. // if org == nil || org.Id == 0 {
  306. // continue
  307. // }
  308. //
  309. //
  310. // app.OrgId = apps.OrgId
  311. // app.Creator = int(org.Creator)
  312. // app.Number = 3
  313. // app.Id = 0
  314. //
  315. // app.Pid = mall_temp_org_app.Id
  316. //
  317. // app.Status = 1
  318. // app.ModifyTime = time.Now().Unix()
  319. // app.CreateTime = time.Now().Unix()
  320. // service.CreateOrgApp(app)
  321. //}
  322. //if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  323. // app, _ := service.GetOrgAppA(0, 9)
  324. // //org, _ := service.GetOrgById(int64(12))
  325. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  326. // if org == nil || org.Id == 0 {
  327. // continue
  328. // }
  329. //
  330. //
  331. // app.OrgId = apps.OrgId
  332. // app.Pid = xt_temp_org_app.Id
  333. //
  334. // app.Creator = int(org.Creator)
  335. // app.Number = 4
  336. // app.Id = 0
  337. //
  338. // app.Status = 1
  339. // app.ModifyTime = time.Now().Unix()
  340. // app.CreateTime = time.Now().Unix()
  341. // service.CreateOrgApp(app)
  342. //
  343. //}
  344. //if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  345. // app, _ := service.GetOrgAppA(0, 10)
  346. // //org, _ := service.GetOrgById(int64(12))
  347. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  348. // if org == nil || org.Id == 0 {
  349. // continue
  350. // }
  351. //
  352. //
  353. // app.OrgId = apps.OrgId
  354. // app.Creator = int(org.Creator)
  355. // app.Pid = xt_temp_org_app.Id
  356. //
  357. // app.Number = 5
  358. // app.Id = 0
  359. //
  360. // app.Status = 1
  361. // app.ModifyTime = time.Now().Unix()
  362. // app.CreateTime = time.Now().Unix()
  363. // service.CreateOrgApp(app)
  364. //}
  365. //if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  366. // app, _ := service.GetOrgAppA(0, 11)
  367. // //org, _ := service.GetOrgById(int64(12))
  368. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  369. // if org == nil || org.Id == 0 {
  370. // continue
  371. // }
  372. //
  373. //
  374. // app.OrgId = apps.OrgId
  375. // app.Creator = int(org.Creator)
  376. // app.Pid = xt_temp_org_app.Id
  377. // app.Id = 0
  378. //
  379. // app.Number = 6
  380. // app.Status = 1
  381. // app.ModifyTime = time.Now().Unix()
  382. // app.CreateTime = time.Now().Unix()
  383. // service.CreateOrgApp(app)
  384. //}
  385. //if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  386. // app, _ := service.GetOrgAppA(0, 12)
  387. // //org, _ := service.GetOrgById(int64(12))
  388. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  389. // if org == nil || org.Id == 0 {
  390. // continue
  391. // }
  392. //
  393. //
  394. // app.OrgId = apps.OrgId
  395. // app.Creator = int(org.Creator)
  396. // app.Pid = xt_temp_org_app.Id
  397. // app.Number = 7
  398. // app.Status = 1
  399. // app.Id = 0
  400. //
  401. // app.ModifyTime = time.Now().Unix()
  402. // app.CreateTime = time.Now().Unix()
  403. // service.CreateOrgApp(app)
  404. //}
  405. //if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  406. // app, _ := service.GetOrgAppA(0, 13)
  407. // //org, _ := service.GetOrgById(int64(12))
  408. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  409. // if org == nil || org.Id == 0 {
  410. // continue
  411. // }
  412. //
  413. //
  414. // app.OrgId = apps.OrgId
  415. // app.Creator = int(org.Creator)
  416. // app.Pid = xt_temp_org_app.Id
  417. // app.Number = 8
  418. // app.Id = 0
  419. // app.Status = 1
  420. // app.ModifyTime = time.Now().Unix()
  421. // app.CreateTime = time.Now().Unix()
  422. // service.CreateOrgApp(app)
  423. //}
  424. //if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  425. // app, _ := service.GetOrgAppA(0, 14)
  426. // //org, _ := service.GetOrgById(int64(12))
  427. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  428. // if org == nil || org.Id == 0 {
  429. // continue
  430. // }
  431. //
  432. //
  433. // app.OrgId = apps.OrgId
  434. // app.Creator = int(org.Creator)
  435. // app.Pid = xt_temp_org_app.Id
  436. // app.Id = 0
  437. // app.Number = 9
  438. // app.Status = 1
  439. // app.ModifyTime = time.Now().Unix()
  440. // app.CreateTime = time.Now().Unix()
  441. // service.CreateOrgApp(app)
  442. //}
  443. //if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  444. // app, _ := service.GetOrgAppA(0, 15)
  445. // //org, _ := service.GetOrgById(int64(12))
  446. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  447. // if org == nil || org.Id == 0 {
  448. // continue
  449. // }
  450. //
  451. // app.OrgId = apps.OrgId
  452. // app.Creator = int(org.Creator)
  453. // app.Pid = xt_temp_org_app.Id
  454. // app.Number = 10
  455. // app.Status = 1
  456. // app.Id = 0
  457. // app.ModifyTime = time.Now().Unix()
  458. // app.CreateTime = time.Now().Unix()
  459. // service.CreateOrgApp(app)
  460. //}
  461. }
  462. //for _, role := range org_role {
  463. // org_ids = append(org_ids, role.OrgId)
  464. //}
  465. //
  466. //
  467. ////创建内置角色
  468. //InitRoleAndPurviews(org_ids)
  469. //var org_id int = 0
  470. //管理员
  471. //app_roles := service.GetAllUserRoleByUserTypeOne(org_id)
  472. //for _, item := range app_roles{
  473. // var ids string
  474. // if len(item.RoleIds) == 0{
  475. // ids = strconv.FormatInt( item.RoleId,10)
  476. // }else{
  477. // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
  478. // }
  479. // service.UpdateRoleIds(item.Id, ids)
  480. //}
  481. //护士医生
  482. //app_roles2 := service.GetAllUserRoleByUserTypeOther()
  483. // for _, item := range app_roles2{
  484. // var ids string
  485. // if len(item.RoleIds) == 0{
  486. // ids = strconv.FormatInt( item.RoleId,10)
  487. // }else{
  488. // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
  489. // }
  490. // if item.UserType == 2{
  491. // role := service.FindRoleByUserTypeOne(item.OrgId)
  492. // ids = ids +"," + strconv.FormatInt(role.Id,10)
  493. //
  494. // } else if item.UserType == 3{
  495. // role := service.FindRoleByUserTypeTwo(item.OrgId)
  496. // ids = ids +"," + strconv.FormatInt(role.Id,10)
  497. // }
  498. // service.UpdateRoleIds(item.Id, ids)
  499. // }
  500. //c.ServeSuccessJSON(map[string]interface{}{
  501. // "msg": "ok",
  502. //})
  503. }
  504. func InitRoleAndPurviews(org_ids []int64) {
  505. roles := LoadRoleConfig("./role.json").Roles
  506. for _, org_id := range org_ids {
  507. app, _ := service.GetOrgAppB(org_id, 3)
  508. role, _ := service.GetSystemRole(org_id)
  509. if app == nil || app.Id == 0 {
  510. continue
  511. }
  512. if len(role) == 0 {
  513. for _, item := range roles {
  514. role := &models.Role{
  515. RoleName: item.RoleName,
  516. RoleIntro: item.RoleIntroduction,
  517. Creator: 0,
  518. OrgId: org_id,
  519. AppId: app.Id,
  520. IsSuperAdmin: false,
  521. Status: 1,
  522. CreateTime: time.Now().Unix(),
  523. ModifyTime: time.Now().Unix(),
  524. Number: item.Number,
  525. IsSystem: item.IsSystem,
  526. }
  527. err := service.CreateOrgRoleB(role)
  528. if err == nil {
  529. purview := &models.RolePurview{
  530. RoleId: role.Id,
  531. OrgId: org_id,
  532. AppId: role.AppId,
  533. PurviewIds: item.PurviewIds,
  534. Status: 1,
  535. CreateTime: time.Now().Unix(),
  536. ModifyTime: time.Now().Unix(),
  537. }
  538. func_purview := &models.SgjUserRoleFuncPurview{
  539. RoleId: role.Id,
  540. OrgId: org_id,
  541. AppId: role.AppId,
  542. PurviewIds: item.FuncIds,
  543. Status: 1,
  544. Ctime: time.Now().Unix(),
  545. Mtime: time.Now().Unix(),
  546. }
  547. service.CreateRolePurviewB(purview)
  548. service.CreateFuncRolePurviewB(func_purview)
  549. }
  550. }
  551. }
  552. }
  553. }
  554. type RoleConfig struct {
  555. Roles []*models.VMUserRoleAndPurview "json:roles"
  556. }
  557. func LoadRoleConfig(dataFile string) *RoleConfig {
  558. var config RoleConfig
  559. _, filename, _, _ := runtime.Caller(1)
  560. datapath := path.Join(path.Dir(filename), dataFile)
  561. config_file, err := os.Open(datapath)
  562. if err != nil {
  563. emit("Failed to open config file '%s': %s\n", datapath, err)
  564. return &config
  565. }
  566. fi, _ := config_file.Stat()
  567. buffer := make([]byte, fi.Size())
  568. _, err = config_file.Read(buffer)
  569. buffer, err = StripComments(buffer) //去掉注释
  570. if err != nil {
  571. emit("Failed to strip comments from json: %s\n", err)
  572. return &config
  573. }
  574. buffer = []byte(os.ExpandEnv(string(buffer))) //特殊
  575. err = json.Unmarshal(buffer, &config) //解析json格式数据
  576. if err != nil {
  577. emit("Failed unmarshalling json: %s\n", err)
  578. return &config
  579. }
  580. return &config
  581. }