participateBid.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXCore/rpc/model/mysql"
  10. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXCore/rpc/type/bxcore"
  11. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/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. mysql.UpdateParticipateUserTable(projectId, p.PositionId)
  284. return nil
  285. }
  286. // GetLastBidStatus 获取投标状态信息
  287. func (p *ParticipateBid) GetLastBidStatus(projectId string) (map[string]interface{}, error) {
  288. var (
  289. rs = map[string]interface{}{}
  290. // 查询项目投标信息 区分企业和个人
  291. result *[]map[string]interface{}
  292. )
  293. switch p.PositionType {
  294. case PositionTypeEnt:
  295. result = mysql.GetBidContentEnt(projectId, p.EntId)
  296. case PositionTypePersonal:
  297. result = mysql.GetBidContentPersonal(projectId, p.PositionId)
  298. }
  299. if rs != nil && len(*result) > 0 {
  300. content := common.ObjToMap((*result)[0]["record_content"])
  301. if content != nil {
  302. bidStatus := common.ObjToMap((*content)["after"])
  303. if bidStatus != nil {
  304. rs = *bidStatus
  305. }
  306. }
  307. }
  308. return rs, nil
  309. }
  310. func (p ParticipateBid) ParticipateContentFormat(data map[string]interface{}) (rs bxcore.ParticipateContentData) {
  311. if len(data) == 0 {
  312. return
  313. }
  314. rs.BidType = common.Int64All(data["bidType"])
  315. rs.ChannelPhone = common.ObjToString(data["channelPhone"])
  316. rs.ChannelPerson = common.ObjToString(data["channelPerson"])
  317. rs.ChannelName = common.ObjToString(data["channelName"])
  318. rs.IsWin = common.Int64All(data["isWin"])
  319. rs.Winner = common.ObjToString(data["winner"])
  320. tmp := data["bidStage"].([]interface{})
  321. rs.BidStage = common.ObjArrToStringArr(tmp)
  322. return rs
  323. }
  324. // GetBidRecords 获取操作记录
  325. func (p *ParticipateBid) GetBidRecords(projectId string, page, pageSize int64) *bxcore.ParticipateRecordsData {
  326. data := bxcore.ParticipateRecordsData{}
  327. var rs *[]map[string]interface{}
  328. var total int64
  329. switch p.PositionType {
  330. case PositionTypeEnt:
  331. // 1. 查询出操作记录
  332. rs, total = mysql.GetBidRecordsEnt(projectId, p.EntId, page, pageSize)
  333. case PositionTypePersonal:
  334. // 个人版不展示姓名
  335. rs, total = mysql.GetBidRecordsPersonal(projectId, p.PositionId, page, pageSize)
  336. }
  337. if rs == nil || len(*rs) == 0 {
  338. return &data
  339. }
  340. data.Total = total
  341. data.List = p.BidRecordsFormat(*rs)
  342. return &data
  343. }
  344. // BidRecordsFormat 获取操作记录格式化
  345. func (p ParticipateBid) BidRecordsFormat(data []map[string]interface{}) []*bxcore.ParticipateRecords {
  346. records := []*bxcore.ParticipateRecords{}
  347. switch p.PositionType {
  348. case PositionTypeEnt:
  349. // 用户id
  350. // 拿到所有的用户id
  351. userIdArr := []string{}
  352. userIdMap := map[int64]string{}
  353. for i := 0; i < len(data); i++ {
  354. userId := common.Int64All(data[i]["ent_user_id"])
  355. if _, ok := userIdMap[userId]; !ok {
  356. userIdMap[userId] = ""
  357. userIdArr = append(userIdArr, fmt.Sprint(userId))
  358. }
  359. }
  360. // 根据id查询出姓名{id:name}
  361. userIdMap = getUserIdName(userIdArr)
  362. // 遍历数据 换成姓名
  363. for i := 0; i < len(data); i++ {
  364. id := common.Int64All(data[i]["ent_user_id"])
  365. person := ""
  366. if name, ok := userIdMap[id]; ok {
  367. person = name
  368. }
  369. tmp := bxcore.ParticipateRecords{
  370. RecordsData: common.ObjToString(data[i]["record_content"]),
  371. UpdateDate: common.ObjToString(data[i]["create_date"]),
  372. UpdatePerson: person,
  373. RecordType: common.Int64All(data[i]["record_type"]),
  374. }
  375. records = append(records, &tmp)
  376. }
  377. case PositionTypePersonal:
  378. // 遍历数据
  379. for i := 0; i < len(data); i++ {
  380. tmp := bxcore.ParticipateRecords{
  381. RecordsData: common.ObjToString(data[i]["record_content"]),
  382. UpdateDate: common.ObjToString(data[i]["create_date"]),
  383. RecordType: common.Int64All(data[i]["record_type"]),
  384. }
  385. records = append(records, &tmp)
  386. }
  387. }
  388. return records
  389. }
  390. // 获取id和姓名的对应关系
  391. func getUserIdName(userIdArr []string) map[int64]string {
  392. rs := map[int64]string{}
  393. if len(userIdArr) > 0 {
  394. userIdStr := strings.Join(userIdArr, ",")
  395. userRs := mysql.GetUserMap(userIdStr)
  396. if userRs == nil || len(*userRs) == 0 {
  397. return rs
  398. }
  399. for i := 0; i < len(*userRs); i++ {
  400. user := (*userRs)[i]
  401. id := common.Int64All(user["id"])
  402. name := common.ObjToString(user["name"])
  403. rs[id] = name
  404. }
  405. }
  406. return rs
  407. }
  408. // 处理操作动作
  409. var (
  410. ParticipateBidContentKey = map[string]string{
  411. "bidType": "投标类型",
  412. "bidStage": "投标项目阶段",
  413. "isWin": "是否中标",
  414. "channelName": "渠道名称",
  415. "channelPerson": "联系人",
  416. "channelPhone": "联系电话",
  417. "winner": "中标单位",
  418. }
  419. BidTypeMap = map[int]string{
  420. BidTypeDirect: "直接投标",
  421. BidTypeChanel: "渠道投标",
  422. }
  423. WinMap = map[int]string{
  424. 1: "是",
  425. 2: "否",
  426. 0: "未选择",
  427. }
  428. )
  429. // 处理操作记录
  430. func processRecordStr(oldMap, newMap map[string]interface{}) (recordContent string, err error) {
  431. var (
  432. actonStr = "%s%s%s"
  433. changeField = []string{}
  434. result = []string{}
  435. afterMap = map[string]interface{}{}
  436. )
  437. for k, fieldName := range ParticipateBidContentKey {
  438. var (
  439. value interface{}
  440. status, changeStr string
  441. )
  442. switch k {
  443. case "bidType":
  444. oldv := common.IntAll(oldMap[k])
  445. newv := common.IntAll(newMap[k])
  446. newBidType := BidTypeMap[newv]
  447. if newBidType == "" {
  448. newBidType = "未选择"
  449. }
  450. value = newBidType
  451. if oldv == newv { // 没有改变
  452. afterMap[k] = map[string]interface{}{
  453. "status": status,
  454. "value": value,
  455. }
  456. continue
  457. }
  458. value = newBidType
  459. if oldv == 0 && newv != 0 { // 说明是新增
  460. status = "新增"
  461. changeStr = fmt.Sprintf(actonStr, fieldName, ": (新增)", newBidType)
  462. } else { // 调整
  463. status = "调整"
  464. changeStr = fmt.Sprintf(actonStr, fieldName, "(调整):", newBidType)
  465. }
  466. case "isWin":
  467. oldV := common.IntAll(oldMap[k])
  468. newV := common.IntAll(newMap[k])
  469. value = WinMap[newV]
  470. if oldV == newV { // 没有改变
  471. afterMap[k] = map[string]interface{}{
  472. "status": status,
  473. "value": value,
  474. }
  475. continue
  476. }
  477. status = "调整"
  478. //fieldName := fieldName
  479. if common.IntAll(newMap["bidType"]) == BidTypeChanel {
  480. fieldName = fmt.Sprintf("%s%s", "渠道", fieldName)
  481. }
  482. changeStr = fmt.Sprintf(actonStr, fieldName, "(调整) 为", WinMap[newV])
  483. case "bidStage":
  484. bidAction := "%s%s"
  485. bidChangeArr := []string{}
  486. oldSet := gset.NewFrom(oldMap[k])
  487. newSet := gset.NewFrom(newMap[k])
  488. value = newMap[k]
  489. // 判断相等
  490. if oldSet.Equal(newSet) {
  491. afterMap[k] = map[string]interface{}{
  492. "status": status,
  493. "value": value,
  494. }
  495. continue
  496. }
  497. status = "调整"
  498. // 差集计算
  499. // 取消勾选的
  500. cancleSet := oldSet.Diff(newSet)
  501. cancleSet.Iterator(func(v interface{}) bool {
  502. bidChangeArr = append(bidChangeArr, fmt.Sprintf(bidAction, "(取消勾选)", v))
  503. return true
  504. })
  505. // 新增的
  506. addSet := newSet.Diff(oldSet)
  507. addSet.Iterator(func(v interface{}) bool {
  508. bidChangeArr = append(bidChangeArr, fmt.Sprintf(bidAction, "(新增)", v))
  509. return true
  510. })
  511. tmpStr := strings.Join(bidChangeArr, " ")
  512. changeStr = fmt.Sprintf(actonStr, fieldName, " :", tmpStr)
  513. default:
  514. oldV := common.ObjToString(oldMap[k])
  515. newV := common.ObjToString(newMap[k])
  516. value = newV
  517. if oldV == newV { // 没有变化
  518. afterMap[k] = map[string]interface{}{
  519. "status": status,
  520. "value": value,
  521. }
  522. continue
  523. }
  524. changeStr = fmt.Sprintf(actonStr, fieldName, "(调整)为", fmt.Sprintf("\"%s\"", newV))
  525. status = "调整"
  526. }
  527. result = append(result, changeStr)
  528. changeField = append(changeField, k)
  529. afterMap[k] = map[string]interface{}{
  530. "status": status,
  531. "value": value,
  532. }
  533. }
  534. b, _ := json.Marshal(afterMap)
  535. recordMap := map[string]interface{}{
  536. "content": strings.Join(result, ";"), // 变更内容 文字描述
  537. "before": oldMap, // 变更前
  538. "after": newMap, // 变更后
  539. "changeField": changeField, // 涉及变更的字段
  540. "afterMap": string(b), // 涉及变更内容
  541. }
  542. tmp, err := json.Marshal(recordMap)
  543. if err != nil {
  544. log.Println("序列化操作记录失败:", err)
  545. return "", err
  546. }
  547. if len(result) == 0 {
  548. log.Println("没有更新的内容:", recordContent)
  549. err = fmt.Errorf("没有变更的内容,不用更新")
  550. }
  551. return string(tmp), err
  552. }