get_charts_logic.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. package dashboard
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/suyuan32/simple-admin-common/msg/errormsg"
  6. "strconv"
  7. "time"
  8. "wechat-api/ent/custom_types"
  9. "wechat-api/ent/label"
  10. "wechat-api/ent/predicate"
  11. "wechat-api/ent/usagedetail"
  12. "wechat-api/ent/usagestatisticday"
  13. "wechat-api/ent/usagestatistichour"
  14. "wechat-api/internal/svc"
  15. "wechat-api/internal/types"
  16. "github.com/zeromicro/go-zero/core/logx"
  17. )
  18. type GetChartsLogic struct {
  19. logx.Logger
  20. ctx context.Context
  21. svcCtx *svc.ServiceContext
  22. }
  23. func NewGetChartsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChartsLogic {
  24. return &GetChartsLogic{
  25. Logger: logx.WithContext(ctx),
  26. ctx: ctx,
  27. svcCtx: svcCtx}
  28. }
  29. type SumUint struct {
  30. Addtime uint64 `json:"addtime"`
  31. Value uint64 `json:"value"`
  32. }
  33. type SumInt struct {
  34. Addtime uint64 `json:"addtime"`
  35. Value int64 `json:"value"`
  36. }
  37. func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp, err error) {
  38. // 获取组织id
  39. var organizationId uint64 = 0
  40. isAdmin := l.ctx.Value("isAdmin").(bool)
  41. if isAdmin {
  42. if req.OrganizationId != nil && *req.OrganizationId != 0 {
  43. organizationId = *req.OrganizationId
  44. }
  45. } else {
  46. organizationId = l.ctx.Value("organizationId").(uint64)
  47. }
  48. // 解析起始和截止时间
  49. layouts := []string{
  50. "2006-01", // 对应 "2024-01"
  51. "2006-01-02", // 对应 "2024-01-01"
  52. }
  53. var layoutsType int
  54. var startTime time.Time
  55. for i, layout := range layouts {
  56. startTime, err = time.Parse(layout, *req.StartDate)
  57. layoutsType = i
  58. if err == nil {
  59. break
  60. }
  61. }
  62. if err != nil {
  63. fmt.Println("解析开始时间失败:", err)
  64. return
  65. }
  66. var endTime time.Time
  67. for _, layout := range layouts {
  68. endTime, err = time.Parse(layout, *req.EndDate)
  69. if err == nil {
  70. break
  71. }
  72. }
  73. if err != nil {
  74. fmt.Println("解析结束时间失败:", err)
  75. return
  76. }
  77. // 判断截止日期是否包含当前日
  78. var isCurrentDay bool
  79. now := time.Now()
  80. if layoutsType == 0 {
  81. isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month()
  82. } else {
  83. isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month() && endTime.Day() == now.Day()
  84. }
  85. aiResponseTip := "AI角色 + SOP 执行次数"
  86. sopRunTip := "SOP 节点或阶段的触发次数"
  87. totalFriendTip := "截止至各统计时点的好友数量"
  88. totalGroupTip := "截止至各统计时点的群数量"
  89. activeUserTip := "统计周期内回复sop 或触发了AI角色的微信用户"
  90. newUserTip := "统计周期内好友的增减数量"
  91. // 定义变量
  92. aiResponse := types.ChartsUint{}
  93. aiResponse.Tip = &aiResponseTip
  94. sopRun := types.ChartsUint{}
  95. sopRun.Tip = &sopRunTip
  96. totalFriend := types.ChartsUint{}
  97. totalFriend.Tip = &totalFriendTip
  98. totalGroup := types.ChartsUint{}
  99. totalGroup.Tip = &totalGroupTip
  100. accountBalance := types.ChartsUint{}
  101. accountBalance.LabelText = "积分"
  102. consumeToken := types.ChartsUint{}
  103. activeUser := types.ChartsUint{}
  104. activeUser.Tip = &activeUserTip
  105. newUser := types.ChartsInt{}
  106. newUser.Tip = &newUserTip
  107. var labelDists []custom_types.LabelDist
  108. if layoutsType == 1 && *req.StartDate == *req.EndDate {
  109. startAddTimeString := startTime.Format("2006010200")
  110. startAddTime, err := strconv.ParseUint(startAddTimeString, 10, 64)
  111. if err != nil {
  112. fmt.Println("转换开始时间失败:", err)
  113. return nil, err
  114. }
  115. nextDayMidnight := time.Date(startTime.Year(), startTime.Month(), startTime.Day()+1, 0, 0, 0, 0, startTime.Location())
  116. nextDayMidnightString := nextDayMidnight.Format("2006010200")
  117. nextDayAddTime, err := strconv.ParseUint(nextDayMidnightString, 10, 64)
  118. if err != nil {
  119. fmt.Println("转换次日0点时间失败:", err)
  120. return nil, err
  121. }
  122. var predicates []predicate.UsageStatisticHour
  123. if req.Wxid != nil {
  124. if organizationId != 0 {
  125. predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
  126. }
  127. predicates = append(predicates, usagestatistichour.BotID(*req.Wxid))
  128. } else {
  129. predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
  130. predicates = append(predicates, usagestatistichour.BotID(""))
  131. }
  132. predicates = append(predicates, usagestatistichour.AddtimeGTE(startAddTime))
  133. predicates = append(predicates, usagestatistichour.AddtimeLTE(nextDayAddTime))
  134. usageStatisticHour, err := l.svcCtx.DB.UsageStatisticHour.Query().Where(predicates...).All(l.ctx)
  135. if err != nil {
  136. return nil, err
  137. }
  138. for _, hourData := range usageStatisticHour {
  139. addtimeLastTwoDigits := hourData.Addtime % 100
  140. aiResponse.Count += hourData.AiResponse
  141. aiResponse.Val = append(aiResponse.Val, hourData.AiResponse)
  142. aiResponse.Label = append(aiResponse.Label, fmt.Sprintf("%02d-%02d点", addtimeLastTwoDigits, addtimeLastTwoDigits+1))
  143. aiResponse.LabelText = "次"
  144. sopRun.Count += hourData.SopRun
  145. sopRun.Val = append(sopRun.Val, hourData.SopRun)
  146. sopRun.Label = append(sopRun.Label, fmt.Sprintf("%02d-%02d点", addtimeLastTwoDigits, addtimeLastTwoDigits+1))
  147. sopRun.LabelText = "次"
  148. totalFriend.Count = hourData.TotalFriend
  149. totalFriend.Val = append(totalFriend.Val, hourData.TotalFriend)
  150. totalFriend.Label = append(totalFriend.Label, fmt.Sprintf("%02d点", addtimeLastTwoDigits+1))
  151. totalFriend.LabelText = "个"
  152. totalGroup.Count = hourData.TotalGroup
  153. totalGroup.Val = append(totalGroup.Val, hourData.TotalGroup)
  154. totalGroup.Label = append(totalGroup.Label, fmt.Sprintf("%02d点", addtimeLastTwoDigits+1))
  155. totalGroup.LabelText = "个"
  156. consumeToken.Count += hourData.ConsumeToken
  157. consumeToken.Val = append(consumeToken.Val, hourData.ConsumeToken)
  158. consumeToken.Label = append(consumeToken.Label, fmt.Sprintf("%02d-%02d点", addtimeLastTwoDigits, addtimeLastTwoDigits+1))
  159. consumeToken.LabelText = "token"
  160. //activeUser.Count = hourData.ActiveUser
  161. activeUser.Val = append(activeUser.Val, hourData.ActiveUser)
  162. activeUser.Label = append(activeUser.Label, fmt.Sprintf("%02d-%02d点", addtimeLastTwoDigits, addtimeLastTwoDigits+1))
  163. activeUser.LabelText = "个"
  164. newUser.Count += hourData.NewUser
  165. newUser.Val = append(newUser.Val, hourData.NewUser)
  166. newUser.Label = append(newUser.Label, fmt.Sprintf("%02d-%02d点", addtimeLastTwoDigits, addtimeLastTwoDigits+1))
  167. newUser.LabelText = "个"
  168. }
  169. // 活跃好友:usage_detail 表 type = 1
  170. var usageDetailPredicates []predicate.UsageDetail
  171. if organizationId != 0 {
  172. usageDetailPredicates = append(usageDetailPredicates, usagedetail.OrganizationID(organizationId))
  173. }
  174. if req.Wxid != nil {
  175. usageDetailPredicates = append(usageDetailPredicates, usagedetail.BotID(*req.Wxid))
  176. }
  177. usageDetailPredicates = append(usageDetailPredicates, usagedetail.Type(1))
  178. usageDetailPredicates = append(usageDetailPredicates, usagedetail.CreatedAtGTE(startTime))
  179. usageDetailPredicates = append(usageDetailPredicates, usagedetail.CreatedAtLT(nextDayMidnight))
  180. activeUsers, _ := l.svcCtx.DB.UsageDetail.Query().Where(usageDetailPredicates...).GroupBy(usagedetail.FieldReceiverID).Strings(l.ctx)
  181. activeUser.Count = uint64(len(activeUsers))
  182. hourLen := len(usageStatisticHour)
  183. if hourLen > 0 {
  184. if usageStatisticHour[0].TotalFriend > 0 {
  185. totalFriendRate := float32((float64(usageStatisticHour[hourLen-1].TotalFriend) - float64(usageStatisticHour[0].TotalFriend)) / float64(usageStatisticHour[0].TotalFriend))
  186. totalFriend.Rate = &totalFriendRate
  187. }
  188. if usageStatisticHour[0].TotalGroup > 0 {
  189. totalGroupRate := float32((float64(usageStatisticHour[hourLen-1].TotalGroup) - float64(usageStatisticHour[0].TotalGroup)) / float64(usageStatisticHour[0].TotalGroup))
  190. totalGroup.Rate = &totalGroupRate
  191. }
  192. if usageStatisticHour[0].ActiveUser > 0 {
  193. activeUserRate := float32((float64(usageStatisticHour[hourLen-1].ActiveUser) - float64(usageStatisticHour[0].ActiveUser)) / float64(usageStatisticHour[0].ActiveUser))
  194. activeUser.Rate = &activeUserRate
  195. }
  196. if usageStatisticHour[0].NewUser > 0 {
  197. newUserRate := float32((float64(usageStatisticHour[hourLen-1].NewUser) - float64(usageStatisticHour[0].NewUser)) / float64(usageStatisticHour[0].NewUser))
  198. newUser.Rate = &newUserRate
  199. }
  200. labelDists = usageStatisticHour[hourLen-1].LabelDist
  201. }
  202. } else {
  203. // 从天表统计数据
  204. startAddTimeString := startTime.Format("20060102")
  205. startAddTime, err := strconv.ParseUint(startAddTimeString, 10, 64)
  206. if err != nil {
  207. fmt.Println("转换开始时间失败:", err)
  208. return nil, err
  209. }
  210. endAddTimeString := endTime.Format("20060102")
  211. endAddTime, err := strconv.ParseUint(endAddTimeString, 10, 64)
  212. nextDayMidnight := time.Date(endTime.Year(), endTime.Month(), endTime.Day()+1, 0, 0, 0, 0, endTime.Location())
  213. if err != nil {
  214. fmt.Println("转换截止时间失败:", err)
  215. return nil, err
  216. }
  217. var predicatesDay []predicate.UsageStatisticDay
  218. if req.Wxid != nil {
  219. if organizationId != 0 {
  220. predicatesDay = append(predicatesDay, usagestatisticday.OrganizationID(organizationId))
  221. }
  222. predicatesDay = append(predicatesDay, usagestatisticday.BotID(*req.Wxid))
  223. } else {
  224. predicatesDay = append(predicatesDay, usagestatisticday.OrganizationID(organizationId))
  225. predicatesDay = append(predicatesDay, usagestatisticday.BotID(""))
  226. }
  227. predicatesDay = append(predicatesDay, usagestatisticday.AddtimeGTE(startAddTime))
  228. predicatesDay = append(predicatesDay, usagestatisticday.AddtimeLTE(endAddTime))
  229. usageStatisticDay, err := l.svcCtx.DB.UsageStatisticDay.Query().Where(predicatesDay...).All(l.ctx)
  230. if err != nil {
  231. return nil, err
  232. }
  233. for _, dayData := range usageStatisticDay {
  234. aiResponse.Count = aiResponse.Count + dayData.AiResponse
  235. aiResponse.Val = append(aiResponse.Val, dayData.AiResponse)
  236. aiResponse.Label = append(aiResponse.Label, fmt.Sprintf("%d", dayData.Addtime))
  237. aiResponse.LabelText = "次"
  238. sopRun.Count += dayData.SopRun
  239. sopRun.Val = append(sopRun.Val, dayData.SopRun)
  240. sopRun.Label = append(sopRun.Label, fmt.Sprintf("%d", dayData.Addtime))
  241. sopRun.LabelText = "次"
  242. totalFriend.Count = dayData.TotalFriend
  243. totalFriend.Val = append(totalFriend.Val, dayData.TotalFriend)
  244. totalFriend.Label = append(totalFriend.Label, fmt.Sprintf("%d", dayData.Addtime))
  245. totalFriend.LabelText = "个"
  246. totalGroup.Count = dayData.TotalGroup
  247. totalGroup.Val = append(totalGroup.Val, dayData.TotalGroup)
  248. totalGroup.Label = append(totalGroup.Label, fmt.Sprintf("%d", dayData.Addtime))
  249. totalGroup.LabelText = "个"
  250. consumeToken.Count += dayData.ConsumeToken
  251. consumeToken.Val = append(consumeToken.Val, dayData.ConsumeToken)
  252. consumeToken.Label = append(consumeToken.Label, fmt.Sprintf("%d", dayData.Addtime))
  253. consumeToken.LabelText = "token"
  254. //activeUser.Count = dayData.ActiveUser
  255. activeUser.Val = append(activeUser.Val, dayData.ActiveUser)
  256. activeUser.Label = append(activeUser.Label, fmt.Sprintf("%d", dayData.Addtime))
  257. activeUser.LabelText = "个"
  258. newUser.Count += dayData.NewUser
  259. newUser.Val = append(newUser.Val, dayData.NewUser)
  260. newUser.Label = append(newUser.Label, fmt.Sprintf("%d", dayData.Addtime))
  261. newUser.LabelText = "个"
  262. }
  263. dayLen := len(usageStatisticDay)
  264. if dayLen > 0 {
  265. if usageStatisticDay[0].TotalFriend > 0 {
  266. totalFriendRate := float32((float64(usageStatisticDay[dayLen-1].TotalFriend) - float64(usageStatisticDay[0].TotalFriend)) / float64(usageStatisticDay[0].TotalFriend))
  267. totalFriend.Rate = &totalFriendRate
  268. }
  269. if usageStatisticDay[0].TotalGroup > 0 {
  270. totalGroupRate := float32((float64(usageStatisticDay[dayLen-1].TotalGroup) - float64(usageStatisticDay[0].TotalGroup)) / float64(usageStatisticDay[0].TotalGroup))
  271. totalGroup.Rate = &totalGroupRate
  272. }
  273. if usageStatisticDay[0].ActiveUser > 0 {
  274. activeUserRate := float32((float64(usageStatisticDay[dayLen-1].ActiveUser) - float64(usageStatisticDay[0].ActiveUser)) / float64(usageStatisticDay[0].ActiveUser))
  275. activeUser.Rate = &activeUserRate
  276. }
  277. if usageStatisticDay[0].NewUser > 0 {
  278. newUserRate := float32((float64(usageStatisticDay[dayLen-1].NewUser) - float64(usageStatisticDay[0].NewUser)) / float64(usageStatisticDay[0].NewUser))
  279. newUser.Rate = &newUserRate
  280. }
  281. labelDists = usageStatisticDay[dayLen-1].LabelDist
  282. }
  283. if isCurrentDay {
  284. // 从小时表统计当天数据
  285. startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
  286. startOfDayAddTimeString := startOfDay.Format("2006010200")
  287. startOfDayAddTime, err := strconv.ParseUint(startOfDayAddTimeString, 10, 64)
  288. if err != nil {
  289. fmt.Println("转换开始时间失败:", err)
  290. return nil, err
  291. }
  292. var predicates []predicate.UsageStatisticHour
  293. if req.Wxid != nil {
  294. if organizationId != 0 {
  295. predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
  296. }
  297. predicates = append(predicates, usagestatistichour.BotID(*req.Wxid))
  298. } else {
  299. predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
  300. predicates = append(predicates, usagestatistichour.BotID(""))
  301. }
  302. predicates = append(predicates, usagestatistichour.AddtimeGTE(startOfDayAddTime))
  303. usageStatisticHour, err := l.svcCtx.DB.UsageStatisticHour.Query().Where(predicates...).All(l.ctx)
  304. if err != nil {
  305. return nil, err
  306. }
  307. hourLen := len(usageStatisticHour)
  308. if hourLen > 0 {
  309. var aiResponseOfDay uint64
  310. var sopRunOfDay uint64
  311. var totalFriendOfDay uint64
  312. var totalGroupOfDay uint64
  313. var consumeTokenOfDay uint64
  314. var activeUserOfDay uint64
  315. var newUserOfDay int64
  316. for _, hourData := range usageStatisticHour {
  317. aiResponseOfDay += hourData.AiResponse
  318. sopRunOfDay += hourData.SopRun
  319. consumeTokenOfDay += hourData.ConsumeToken
  320. }
  321. totalFriendOfDay = usageStatisticHour[hourLen-1].TotalFriend
  322. totalGroupOfDay = usageStatisticHour[hourLen-1].TotalGroup
  323. activeUserOfDay = usageStatisticHour[hourLen-1].ActiveUser
  324. newUserOfDay = usageStatisticHour[hourLen-1].NewUser
  325. aiResponse.Count = aiResponse.Count + aiResponseOfDay
  326. aiResponse.Val = append(aiResponse.Val, aiResponseOfDay)
  327. aiResponse.Label = append(aiResponse.Label, "今日")
  328. aiResponse.LabelText = "次"
  329. sopRun.Count = sopRun.Count + sopRunOfDay
  330. sopRun.Val = append(sopRun.Val, sopRunOfDay)
  331. sopRun.Label = append(sopRun.Label, "今日")
  332. sopRun.LabelText = "次"
  333. totalFriend.Count = totalFriendOfDay
  334. totalFriend.Val = append(totalFriend.Val, totalFriendOfDay)
  335. totalFriend.Label = append(totalFriend.Label, "今日")
  336. tfLen := len(totalFriend.Val)
  337. if tfLen > 0 && totalFriend.Val[0] > 0 {
  338. totalFriendRate := float32((float64(totalFriend.Val[tfLen-1]) - float64(totalFriend.Val[0])) / float64(totalFriend.Val[0]))
  339. totalFriend.Rate = &totalFriendRate
  340. }
  341. totalFriend.LabelText = "个"
  342. totalGroup.Count = totalGroupOfDay
  343. totalGroup.Val = append(totalGroup.Val, totalGroupOfDay)
  344. totalGroup.Label = append(totalGroup.Label, "今日")
  345. tgLen := len(totalGroup.Val)
  346. if tgLen > 0 && totalGroup.Val[0] > 0 {
  347. totalGroupRate := float32((float64(totalGroup.Val[tgLen-1]) - float64(totalGroup.Val[0])) / float64(totalGroup.Val[0]))
  348. totalGroup.Rate = &totalGroupRate
  349. }
  350. totalGroup.LabelText = "个"
  351. consumeToken.Count = consumeToken.Count + consumeTokenOfDay
  352. consumeToken.Val = append(consumeToken.Val, consumeTokenOfDay)
  353. consumeToken.Label = append(consumeToken.Label, "今日")
  354. consumeToken.LabelText = "token"
  355. //activeUser.Count = activeUserOfDay
  356. activeUser.Val = append(activeUser.Val, activeUserOfDay)
  357. activeUser.Label = append(activeUser.Label, "今日")
  358. auLen := len(activeUser.Val)
  359. if auLen > 0 && activeUser.Val[0] > 0 {
  360. activeUserRate := float32((float64(activeUser.Val[auLen-1]) - float64(activeUser.Val[0])) / float64(activeUser.Val[0]))
  361. activeUser.Rate = &activeUserRate
  362. }
  363. activeUser.LabelText = "个"
  364. newUser.Count = newUserOfDay
  365. newUser.Val = append(newUser.Val, newUserOfDay)
  366. newUser.Label = append(newUser.Label, "今日")
  367. nuLen := len(newUser.Val)
  368. if nuLen > 0 && newUser.Val[0] > 0 {
  369. newUserRate := float32((float64(newUser.Val[nuLen-1]) - float64(newUser.Val[0])) / float64(newUser.Val[0]))
  370. newUser.Rate = &newUserRate
  371. }
  372. newUser.LabelText = "个"
  373. labelDists = usageStatisticHour[hourLen-1].LabelDist
  374. }
  375. }
  376. // 活跃好友:usage_detail 表 type = 1
  377. var usageDetailPredicates []predicate.UsageDetail
  378. if organizationId != 0 {
  379. usageDetailPredicates = append(usageDetailPredicates, usagedetail.OrganizationID(organizationId))
  380. }
  381. if req.Wxid != nil {
  382. usageDetailPredicates = append(usageDetailPredicates, usagedetail.BotID(*req.Wxid))
  383. }
  384. usageDetailPredicates = append(usageDetailPredicates, usagedetail.Type(1))
  385. usageDetailPredicates = append(usageDetailPredicates, usagedetail.CreatedAtGTE(startTime))
  386. usageDetailPredicates = append(usageDetailPredicates, usagedetail.CreatedAtLT(nextDayMidnight))
  387. activeUsers, _ := l.svcCtx.DB.UsageDetail.Query().Where(usageDetailPredicates...).GroupBy(usagedetail.FieldReceiverID).Strings(l.ctx)
  388. activeUser.Count = uint64(len(activeUsers))
  389. }
  390. var labelIds []uint64
  391. var labelsData []types.LabelsData
  392. labelSet := make(map[uint64]uint64)
  393. for _, labelDist := range labelDists {
  394. if labelDist.Count != 0 {
  395. labelIds = append(labelIds, labelDist.LabelID)
  396. labelSet[labelDist.LabelID] = labelDist.Count
  397. }
  398. }
  399. labelInfos, err := l.svcCtx.DB.Label.Query().Where(label.IDIn(labelIds...)).All(l.ctx)
  400. for _, labelInfo := range labelInfos {
  401. labelsData = append(labelsData, types.LabelsData{
  402. Value: labelSet[labelInfo.ID],
  403. Name: labelInfo.Name,
  404. })
  405. }
  406. chartsData := types.ChartsData{
  407. AiResponse: &aiResponse,
  408. SopRun: &sopRun,
  409. TotalFriend: &totalFriend,
  410. TotalGroup: &totalGroup,
  411. AccountBalance: &accountBalance,
  412. ConsumeToken: &consumeToken,
  413. ActiveUser: &activeUser,
  414. NewUser: &newUser,
  415. LabelDist: labelsData,
  416. }
  417. return &types.ChartsResp{BaseDataInfo: types.BaseDataInfo{Msg: errormsg.UpdateSuccess}, Data: &chartsData}, nil
  418. }