participateBid.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. package service
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "app.yhyue.com/moapp/jybase/date"
  5. "app.yhyue.com/moapp/jybase/encrypt"
  6. "encoding/json"
  7. "fmt"
  8. "github.com/gogf/gf/v2/container/gset"
  9. "jyBXCore/rpc/model/mysql"
  10. "jyBXCore/rpc/type/bxcore"
  11. "jyBXCore/rpc/util"
  12. "log"
  13. "strings"
  14. "time"
  15. )
  16. const (
  17. PositionTypeEnt = 1 // 职位类型企业
  18. PositionTypePersonal = 0 // 职位类型个人
  19. ButtonValueParticipate = 0 // 参标按钮 显示值 0-参标
  20. ButtonValueParticipated = 1 // 按钮显示值 列表页面 1-已参标
  21. RoleEntManager = 1 // 企业管理员角色
  22. RoleDepartManager = 2 // 部门管理员角色
  23. BidTypeDirect = 1 // 直接投标
  24. BidTypeChanel = 2 // 渠道投标
  25. RecordTypeBidStatus = 1 // 存储类型 1:投标状态更新
  26. )
  27. type ParticipateBid struct {
  28. EntId int64
  29. EntUserId int64
  30. PositionType int64
  31. PositionId int64
  32. EntRoleId int64 // 角色
  33. }
  34. func NewParticipateBid(entId, entUserId, positionType, positionId int64) ParticipateBid {
  35. return ParticipateBid{
  36. EntId: entId,
  37. EntUserId: entUserId,
  38. PositionType: positionType,
  39. PositionId: positionId,
  40. }
  41. }
  42. // PersonalExistProject 个人版要展示的参标按钮 查询出已经参标的项目信息 用于后边格式化数据
  43. func (p *ParticipateBid) PersonalExistProject(projectId []string) map[string]struct{} {
  44. rs := mysql.ParticipateProjectPersonal(p.PositionId, projectId)
  45. existProjectSet := map[string]struct{}{}
  46. if rs != nil && len(*rs) > 0 { // 如果查到了 说明已经参标 这部分应该显示已参标
  47. // 处理成map
  48. for i := 0; i < len(*rs); i++ {
  49. existId := common.ObjToString((*rs)[i]["project_id"])
  50. existProjectSet[existId] = struct{}{}
  51. }
  52. }
  53. return existProjectSet
  54. }
  55. // ListPersonalFormat 列表页个人版 参标按钮 格式化数据
  56. func (p *ParticipateBid) ListPersonalFormat(existProjectSet map[string]struct{}, infoM map[string]string) []*bxcore.ShowInfo {
  57. // 处理成 要返回的返回数据
  58. var formatList []*bxcore.ShowInfo
  59. for k, v := range infoM {
  60. buttonValue := ButtonValueParticipate // 不存在应该显示参标
  61. if _, ok := existProjectSet[v]; ok { // 存在说明应该显示已参标
  62. buttonValue = ButtonValueParticipated
  63. }
  64. formatList = append(formatList, &bxcore.ShowInfo{
  65. Id: encrypt.EncodeArticleId2ByCheck(k),
  66. Value: int64(buttonValue),
  67. })
  68. }
  69. return formatList
  70. }
  71. // EntExistProject 企业版 查出来企业下已经参标的这个项目的以及参标人信息 用于后边格式化数据判断有没有自己
  72. func (p *ParticipateBid) EntExistProject(projectId []string) map[string]string {
  73. rs := mysql.ParticipateProjectEnt(p.EntId, projectId)
  74. existProjectMap := map[string]string{}
  75. if rs != nil && len(*rs) > 0 { // 如果查到了 说明这个项目公司里面已经参标 处理一下信息用于后边判断是否是自己参标
  76. // 处理成map
  77. for i := 0; i < len(*rs); i++ {
  78. existId := common.ObjToString((*rs)[i]["project_id"])
  79. personIds := common.ObjToString((*rs)[i]["personIds"])
  80. existProjectMap[existId] = personIds
  81. }
  82. }
  83. return existProjectMap
  84. }
  85. // ListEntFormat 企业版 列表页数据格式化
  86. func (p *ParticipateBid) ListEntFormat(existProjectMap, infoM map[string]string, isAllow bool) []*bxcore.ShowInfo {
  87. // 处理成 要返回的返回数据
  88. var formatList []*bxcore.ShowInfo
  89. for k, v := range infoM {
  90. buttonValue := ButtonValueParticipate // 不存在时-显示参标
  91. if userIds, ok := existProjectMap[v]; ok { // 存在时 说明项目在企业下已经参标 需要进一步判断
  92. // 判断已经存在的参标人中是否包含自己 包含时 显示成已参标
  93. if ContainId(userIds, common.InterfaceToStr(p.EntUserId)) {
  94. buttonValue = ButtonValueParticipated
  95. } else if isAllow { // 不包含自己时需要 进一步判断公司设置是否允许多人参标
  96. // 允许时显示成 参标
  97. buttonValue = ButtonValueParticipate
  98. } else { // 不允许时 跳过该条信息
  99. continue
  100. }
  101. }
  102. formatList = append(formatList, &bxcore.ShowInfo{
  103. Id: encrypt.EncodeArticleId2ByCheck(k),
  104. Value: int64(buttonValue),
  105. })
  106. }
  107. return formatList
  108. }
  109. // DetailEntFormat 企业版 详情页数据格式化 返回数据 参标按钮 终止参标按钮 转给同事按钮 参标人姓名
  110. func (p *ParticipateBid) DetailEntFormat(existProjectMap map[string]string, isValid, isAllow bool, bidEndTime int64) (formatData *bxcore.ParticipateDetailInfo) {
  111. // 处理成 要返回的返回数据
  112. formatData = &bxcore.ParticipateDetailInfo{}
  113. if len(existProjectMap) == 0 && isValid {
  114. // 无参标人 展示参标按钮 其余按钮不显示
  115. formatData.ShowParticipate = true
  116. return
  117. }
  118. persons := ""
  119. for _, v := range existProjectMap { // 这是为了取参标人id信息 列表页是多条数据 详情页这里 map里面只会有一条数据
  120. persons = v
  121. break
  122. }
  123. // 参标人信息 处理成姓名
  124. nameRs := mysql.GetNameByUserIds(persons)
  125. if nameRs != nil && len(*nameRs) > 0 {
  126. formatData.UserName = common.ObjToString((*nameRs)[0]["name"])
  127. }
  128. if !isValid {
  129. return
  130. }
  131. formatData.CurrentTime = time.Now().Unix()
  132. formatData.BidEndTime = bidEndTime
  133. // 如果是管理员 显示 终止参标按钮、转给同事按钮
  134. if p.EntRoleId == RoleEntManager || p.EntRoleId == RoleDepartManager {
  135. formatData.ShowStopParticipate = true
  136. formatData.ShowTransfer = true
  137. }
  138. // 如果包含自己 显示终止参标按钮
  139. if ContainId(persons, common.InterfaceToStr(p.EntUserId)) {
  140. formatData.ShowStopParticipate = true
  141. formatData.ShowUpdate = true
  142. } else if isAllow { // 如果允许多人 显示参标按钮
  143. formatData.ShowParticipate = true
  144. }
  145. return
  146. }
  147. // DetailPersonalFormat 详情页个人版 按钮格式化数据
  148. func (p *ParticipateBid) DetailPersonalFormat(existProjectSet map[string]struct{}, isValid bool, bidEndTime int64) (formatData *bxcore.ParticipateDetailInfo) {
  149. // 处理成 要返回的返回数据
  150. formatData = &bxcore.ParticipateDetailInfo{}
  151. if !isValid {
  152. return
  153. }
  154. // 存在在说明已经参标 显示终止参标
  155. if len(existProjectSet) > 0 {
  156. formatData.CurrentTime = time.Now().Unix()
  157. formatData.BidEndTime = bidEndTime
  158. formatData.ShowStopParticipate = true
  159. formatData.ShowUpdate = true
  160. } else {
  161. // 不存在则说明 未参标 参标按钮展示
  162. formatData.ShowParticipate = true
  163. }
  164. return
  165. }
  166. // HandlerProjectId 返回信息的映射集合,项目id列表
  167. func HandlerProjectId(projectInfos []map[string]interface{}, infoIds map[string]struct{}) (map[string]string, []string) {
  168. result := map[string]string{}
  169. projectIdList := []string{}
  170. // 记录infoid 和项目id 对应关系 用于最后处理返回的数据
  171. for i := 0; i < len(projectInfos); i++ {
  172. _id := common.ObjToString(projectInfos[i]["_id"])
  173. projectIdList = append(projectIdList, _id)
  174. list, b := projectInfos[i]["list"].([]interface{})
  175. if !b {
  176. continue
  177. }
  178. for j := 0; j < len(list); j++ {
  179. infoidMap := common.ObjToMap(list[j])
  180. if infoidMap == nil {
  181. continue
  182. }
  183. infoid := common.ObjToString((*infoidMap)["infoid"])
  184. if _, ok := infoIds[infoid]; ok && infoid != "" {
  185. result[infoid] = _id
  186. }
  187. }
  188. }
  189. return result, projectIdList
  190. }
  191. // DecodeId 解密标讯id 返回一个信息id的列表 和 集合
  192. func DecodeId(ids string) (result []string, resultSet map[string]struct{}) {
  193. idList := strings.Split(ids, ",")
  194. resultSet = map[string]struct{}{}
  195. for i := 0; i < len(idList); i++ {
  196. decodeArray := encrypt.DecodeArticleId2ByCheck(idList[i])
  197. if len(decodeArray) == 1 && decodeArray[0] != "" {
  198. result = append(result, decodeArray[0])
  199. resultSet[decodeArray[0]] = struct{}{}
  200. }
  201. }
  202. return
  203. }
  204. // ContainId 用于判断给定的逗号分割的字符串中是否包含 目标的字符串
  205. func ContainId(ids string, objId string) bool {
  206. list := strings.Split(ids, ",")
  207. for i := 0; i < len(list); i++ {
  208. if list[i] == objId {
  209. return true
  210. }
  211. }
  212. return false
  213. }
  214. // CheckBidPower 查看记录 验证权限(参标人或者是该企业下的管理员)
  215. func (p *ParticipateBid) CheckBidPower(projectId string, valid bool) (b bool) {
  216. switch p.PositionType {
  217. case PositionTypePersonal:
  218. // 查个人id
  219. b = mysql.CheckParticipatePersonal(projectId, p.PositionId, valid)
  220. case PositionTypeEnt:
  221. // 查企业
  222. if p.EntRoleId == RoleEntManager || p.EntRoleId == RoleDepartManager {
  223. b = mysql.CheckParticipateManager(projectId, p.EntId, valid)
  224. } else {
  225. // 查参标人
  226. b = mysql.CheckParticipateEntUser(projectId, p.EntUserId, valid)
  227. }
  228. }
  229. return
  230. }
  231. // CheckUpdateBidPower 验证投标状态更新权限
  232. func (p *ParticipateBid) CheckUpdateBidPower(projectId string, valid bool) (b bool) {
  233. switch p.PositionType {
  234. case PositionTypePersonal:
  235. // 查个人id
  236. b = mysql.CheckParticipatePersonal(projectId, p.PositionId, valid)
  237. case PositionTypeEnt:
  238. // 查参标人
  239. b = mysql.CheckParticipateEntUser(projectId, p.EntUserId, valid)
  240. }
  241. return
  242. }
  243. // UpdateBidStatus 更新投标状态
  244. func (p *ParticipateBid) UpdateBidStatus(in *bxcore.UpdateBidStatusReq, projectId string) error {
  245. if p.PositionType == PositionTypeEnt {
  246. pLock := util.GetParticipateLock(fmt.Sprintf("%d_%s", p.EntId, projectId))
  247. pLock.Lock()
  248. defer pLock.Unlock()
  249. }
  250. // 如果查出来旧的 那么就需要做新旧对比
  251. oldMap, _ := p.GetLastBidStatus(projectId) // 查询出最新的招标状态信息
  252. // 新的
  253. if in.BidStage == nil {
  254. in.BidStage = []string{}
  255. }
  256. newMap := map[string]interface{}{
  257. "bidType": in.BidType,
  258. "bidStage": in.BidStage,
  259. "isWin": in.IsWin,
  260. "channelName": in.ChannelName,
  261. "channelPerson": in.ChannelPerson,
  262. "channelPhone": in.ChannelPhone,
  263. "winner": in.Winner,
  264. }
  265. // 新旧对比 处理成要保存的字段
  266. recordContent, err := processRecordStr(oldMap, newMap)
  267. if err != nil {
  268. return err
  269. }
  270. // 保存
  271. recordData := map[string]interface{}{
  272. "ent_id": p.EntId,
  273. "ent_user_id": p.EntUserId,
  274. "position_id": p.PositionId,
  275. "project_id": projectId,
  276. "record_content": recordContent,
  277. "record_type": RecordTypeBidStatus,
  278. "create_date": date.NowFormat(date.Date_Full_Layout),
  279. }
  280. if flag := mysql.InsertBidContent(recordData); !flag {
  281. return fmt.Errorf("更新失败")
  282. }
  283. return nil
  284. }
  285. // GetLastBidStatus 获取投标状态信息
  286. func (p *ParticipateBid) GetLastBidStatus(projectId string) (map[string]interface{}, error) {
  287. var (
  288. rs = map[string]interface{}{}
  289. // 查询项目投标信息 区分企业和个人
  290. result *[]map[string]interface{}
  291. )
  292. switch p.PositionType {
  293. case PositionTypeEnt:
  294. result = mysql.GetBidContentEnt(projectId, p.EntId)
  295. case PositionTypePersonal:
  296. result = mysql.GetBidContentPersonal(projectId, p.PositionId)
  297. }
  298. if rs != nil && len(*result) > 0 {
  299. content := common.ObjToMap((*result)[0]["record_content"])
  300. if content != nil {
  301. bidStatus := common.ObjToMap((*content)["after"])
  302. if bidStatus != nil {
  303. rs = *bidStatus
  304. }
  305. }
  306. }
  307. return rs, nil
  308. }
  309. func (p ParticipateBid) ParticipateContentFormat(data map[string]interface{}) (rs bxcore.ParticipateContentData) {
  310. if len(data) == 0 {
  311. return
  312. }
  313. rs.BidType = common.Int64All(data["bidType"])
  314. rs.ChannelPhone = common.ObjToString(data["channelPhone"])
  315. rs.ChannelPerson = common.ObjToString(data["channelPerson"])
  316. rs.ChannelName = common.ObjToString(data["channelName"])
  317. rs.IsWin = common.Int64All(data["isWin"])
  318. rs.Winner = common.ObjToString(data["winner"])
  319. tmp := data["bidStage"].([]interface{})
  320. rs.BidStage = common.ObjArrToStringArr(tmp)
  321. return rs
  322. }
  323. // GetBidRecords 获取操作记录
  324. func (p *ParticipateBid) GetBidRecords(projectId string, page, pageSize int64) *bxcore.ParticipateRecordsData {
  325. data := bxcore.ParticipateRecordsData{}
  326. var rs *[]map[string]interface{}
  327. var total int64
  328. switch p.PositionType {
  329. case PositionTypeEnt:
  330. // 1. 查询出操作记录
  331. rs, total = mysql.GetBidRecordsEnt(projectId, p.EntId, page, pageSize)
  332. case PositionTypePersonal:
  333. // 个人版不展示姓名
  334. rs, total = mysql.GetBidRecordsPersonal(projectId, p.PositionId, page, pageSize)
  335. }
  336. if rs == nil || len(*rs) == 0 {
  337. return &data
  338. }
  339. data.Total = total
  340. data.List = p.BidRecordsFormat(*rs)
  341. return &data
  342. }
  343. // BidRecordsFormat 获取操作记录格式化
  344. func (p ParticipateBid) BidRecordsFormat(data []map[string]interface{}) []*bxcore.ParticipateRecords {
  345. records := []*bxcore.ParticipateRecords{}
  346. switch p.PositionType {
  347. case PositionTypeEnt:
  348. // 用户id
  349. // 拿到所有的用户id
  350. userIdArr := []string{}
  351. userIdMap := map[int64]string{}
  352. for i := 0; i < len(data); i++ {
  353. userId := common.Int64All(data[i]["ent_user_id"])
  354. if _, ok := userIdMap[userId]; !ok {
  355. userIdMap[userId] = ""
  356. userIdArr = append(userIdArr, fmt.Sprint(userId))
  357. }
  358. }
  359. // 根据id查询出姓名{id:name}
  360. userIdMap = getUserIdName(userIdArr)
  361. // 遍历数据 换成姓名
  362. for i := 0; i < len(data); i++ {
  363. id := common.Int64All(data[i]["ent_user_id"])
  364. person := ""
  365. if name, ok := userIdMap[id]; ok {
  366. person = name
  367. }
  368. tmp := bxcore.ParticipateRecords{
  369. RecordsData: common.ObjToString(data[i]["record_content"]),
  370. UpdateDate: common.ObjToString(data[i]["create_date"]),
  371. UpdatePerson: person,
  372. RecordType: common.Int64All(data[i]["record_type"]),
  373. }
  374. records = append(records, &tmp)
  375. }
  376. case PositionTypePersonal:
  377. // 遍历数据
  378. for i := 0; i < len(data); i++ {
  379. tmp := bxcore.ParticipateRecords{
  380. RecordsData: common.ObjToString(data[i]["record_content"]),
  381. UpdateDate: common.ObjToString(data[i]["create_date"]),
  382. RecordType: common.Int64All(data[i]["record_type"]),
  383. }
  384. records = append(records, &tmp)
  385. }
  386. }
  387. return records
  388. }
  389. // 获取id和姓名的对应关系
  390. func getUserIdName(userIdArr []string) map[int64]string {
  391. rs := map[int64]string{}
  392. if len(userIdArr) > 0 {
  393. userIdStr := strings.Join(userIdArr, ",")
  394. userRs := mysql.GetUserMap(userIdStr)
  395. if userRs == nil || len(*userRs) == 0 {
  396. return rs
  397. }
  398. for i := 0; i < len(*userRs); i++ {
  399. user := (*userRs)[i]
  400. id := common.Int64All(user["id"])
  401. name := common.ObjToString(user["name"])
  402. rs[id] = name
  403. }
  404. }
  405. return rs
  406. }
  407. // 处理操作动作
  408. var (
  409. ParticipateBidContentKey = map[string]string{
  410. "bidType": "投标类型",
  411. "bidStage": "投标项目阶段",
  412. "isWin": "是否中标",
  413. "channelName": "渠道名称",
  414. "channelPerson": "联系人",
  415. "channelPhone": "联系电话",
  416. "winner": "中标单位",
  417. }
  418. BidTypeMap = map[int]string{
  419. BidTypeDirect: "直接投标",
  420. BidTypeChanel: "渠道投标",
  421. }
  422. WinMap = map[int]string{
  423. 1: "是",
  424. 2: "否",
  425. 0: "未选择",
  426. }
  427. )
  428. // 处理操作记录
  429. func processRecordStr(oldMap, newMap map[string]interface{}) (recordContent string, err error) {
  430. var (
  431. actonStr = "%s%s%s"
  432. changeField = []string{}
  433. result = []string{}
  434. afterMap = map[string]interface{}{}
  435. )
  436. for k, fieldName := range ParticipateBidContentKey {
  437. var (
  438. value interface{}
  439. status, changeStr string
  440. )
  441. switch k {
  442. case "bidType":
  443. oldv := common.IntAll(oldMap[k])
  444. newv := common.IntAll(newMap[k])
  445. newBidType := BidTypeMap[newv]
  446. if newBidType == "" {
  447. newBidType = "未选择"
  448. }
  449. value = newBidType
  450. if oldv == newv { // 没有改变
  451. afterMap[k] = map[string]interface{}{
  452. "status": status,
  453. "value": value,
  454. }
  455. continue
  456. }
  457. value = newBidType
  458. if oldv == 0 && newv != 0 { // 说明是新增
  459. status = "新增"
  460. changeStr = fmt.Sprintf(actonStr, fieldName, ": (新增)", newBidType)
  461. } else { // 调整
  462. status = "调整"
  463. changeStr = fmt.Sprintf(actonStr, fieldName, "(调整):", newBidType)
  464. }
  465. case "isWin":
  466. oldV := common.IntAll(oldMap[k])
  467. newV := common.IntAll(newMap[k])
  468. value = WinMap[newV]
  469. if oldV == newV { // 没有改变
  470. afterMap[k] = map[string]interface{}{
  471. "status": status,
  472. "value": value,
  473. }
  474. continue
  475. }
  476. status = "调整"
  477. //fieldName := fieldName
  478. if common.IntAll(newMap["bidType"]) == BidTypeChanel {
  479. fieldName = fmt.Sprintf("%s%s", "渠道", fieldName)
  480. }
  481. changeStr = fmt.Sprintf(actonStr, fieldName, "(调整) 为", WinMap[newV])
  482. case "bidStage":
  483. bidAction := "%s%s"
  484. bidChangeArr := []string{}
  485. oldSet := gset.NewFrom(oldMap[k])
  486. newSet := gset.NewFrom(newMap[k])
  487. value = newMap[k]
  488. // 判断相等
  489. if oldSet.Equal(newSet) {
  490. afterMap[k] = map[string]interface{}{
  491. "status": status,
  492. "value": value,
  493. }
  494. continue
  495. }
  496. status = "调整"
  497. // 差集计算
  498. // 取消勾选的
  499. cancleSet := oldSet.Diff(newSet)
  500. cancleSet.Iterator(func(v interface{}) bool {
  501. bidChangeArr = append(bidChangeArr, fmt.Sprintf(bidAction, "(取消勾选)", v))
  502. return true
  503. })
  504. // 新增的
  505. addSet := newSet.Diff(oldSet)
  506. addSet.Iterator(func(v interface{}) bool {
  507. bidChangeArr = append(bidChangeArr, fmt.Sprintf(bidAction, "(新增)", v))
  508. return true
  509. })
  510. tmpStr := strings.Join(bidChangeArr, " ")
  511. changeStr = fmt.Sprintf(actonStr, fieldName, " :", tmpStr)
  512. default:
  513. oldV := common.ObjToString(oldMap[k])
  514. newV := common.ObjToString(newMap[k])
  515. value = newV
  516. if oldV == newV { // 没有变化
  517. afterMap[k] = map[string]interface{}{
  518. "status": status,
  519. "value": value,
  520. }
  521. continue
  522. }
  523. changeStr = fmt.Sprintf(actonStr, fieldName, "(调整)为", fmt.Sprintf("\"%s\"", newV))
  524. status = "调整"
  525. }
  526. result = append(result, changeStr)
  527. changeField = append(changeField, k)
  528. afterMap[k] = map[string]interface{}{
  529. "status": status,
  530. "value": value,
  531. }
  532. }
  533. b, _ := json.Marshal(afterMap)
  534. recordMap := map[string]interface{}{
  535. "content": strings.Join(result, ";"), // 变更内容 文字描述
  536. "before": oldMap, // 变更前
  537. "after": newMap, // 变更后
  538. "changeField": changeField, // 涉及变更的字段
  539. "afterMap": string(b), // 涉及变更内容
  540. }
  541. tmp, err := json.Marshal(recordMap)
  542. if err != nil {
  543. log.Println("序列化操作记录失败:", err)
  544. return "", err
  545. }
  546. if len(result) == 0 {
  547. log.Println("没有更新的内容:", recordContent)
  548. err = fmt.Errorf("没有变更的内容,不用更新")
  549. }
  550. return string(tmp), err
  551. }