jimmyyem 3 місяців тому
батько
коміт
5a55b8ca95
62 змінених файлів з 23375 додано та 361 видалено
  1. 428 0
      crontask/compute_statistic.go
  2. 5 0
      crontask/init.go
  3. 3 1
      desc/all.api
  4. 96 0
      desc/wechat/dashboard.api
  5. 31 0
      desc/wechat/xiaoice.api
  6. 507 76
      ent/client.go
  7. 5 0
      ent/custom_types/types.go
  8. 0 12
      ent/employee/employee.go
  9. 0 30
      ent/employee_create.go
  10. 0 60
      ent/employee_update.go
  11. 37 31
      ent/ent.go
  12. 36 0
      ent/hook/hook.go
  13. 90 0
      ent/intercept/intercept.go
  14. 136 7
      ent/migrate/schema.go
  15. 5113 31
      ent/mutation.go
  16. 246 0
      ent/pagination.go
  17. 9 0
      ent/predicate/predicate.go
  18. 78 16
      ent/runtime/runtime.go
  19. 7 7
      ent/schema/employee.go
  20. 63 0
      ent/schema/usage_statistic_day.go
  21. 63 0
      ent/schema/usage_statistic_hour.go
  22. 63 0
      ent/schema/usage_statistic_month.go
  23. 1152 0
      ent/set_not_nil.go
  24. 9 0
      ent/tx.go
  25. 288 0
      ent/usagestatisticday.go
  26. 191 0
      ent/usagestatisticday/usagestatisticday.go
  27. 855 0
      ent/usagestatisticday/where.go
  28. 1683 0
      ent/usagestatisticday_create.go
  29. 88 0
      ent/usagestatisticday_delete.go
  30. 526 0
      ent/usagestatisticday_query.go
  31. 1054 0
      ent/usagestatisticday_update.go
  32. 288 0
      ent/usagestatistichour.go
  33. 191 0
      ent/usagestatistichour/usagestatistichour.go
  34. 855 0
      ent/usagestatistichour/where.go
  35. 1683 0
      ent/usagestatistichour_create.go
  36. 88 0
      ent/usagestatistichour_delete.go
  37. 526 0
      ent/usagestatistichour_query.go
  38. 1054 0
      ent/usagestatistichour_update.go
  39. 288 0
      ent/usagestatisticmonth.go
  40. 191 0
      ent/usagestatisticmonth/usagestatisticmonth.go
  41. 855 0
      ent/usagestatisticmonth/where.go
  42. 1683 0
      ent/usagestatisticmonth_create.go
  43. 88 0
      ent/usagestatisticmonth_delete.go
  44. 526 0
      ent/usagestatisticmonth_query.go
  45. 1054 0
      ent/usagestatisticmonth_update.go
  46. 0 83
      etc/wechat-docker.yaml
  47. 2 1
      go.mod
  48. 2 0
      go.sum
  49. 1 0
      internal/config/config.go
  50. 44 0
      internal/handler/dashboard/get_charts_handler.go
  51. 44 0
      internal/handler/dashboard/get_wxs_handler.go
  52. 36 0
      internal/handler/routes.go
  53. 44 0
      internal/handler/xiaoice/gptbots_message_handler.go
  54. 31 0
      internal/handler/xiaoice/signature_gen_handler.go
  55. 6 0
      internal/logic/Wx/create_wx_logic.go
  56. 1 6
      internal/logic/chatrecords/gpts_submit_api_chat_logic.go
  57. 354 0
      internal/logic/dashboard/get_charts_logic.go
  58. 176 0
      internal/logic/dashboard/get_wxs_logic.go
  59. 195 0
      internal/logic/xiaoice/gptbots_message_logic.go
  60. 86 0
      internal/logic/xiaoice/signature_gen_logic.go
  61. 90 0
      internal/types/types.go
  62. 31 0
      internal/types/xiaoice.go

+ 428 - 0
crontask/compute_statistic.go

@@ -0,0 +1,428 @@
+package crontask
+
+import (
+	"strconv"
+	"time"
+	"wechat-api/ent"
+	"wechat-api/ent/contact"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/labelrelationship"
+	"wechat-api/ent/messagerecords"
+	"wechat-api/ent/usagedetail"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/usagestatisticmonth"
+	"wechat-api/ent/wx"
+)
+
+func (l *CronTask) computeStatistic() {
+	startTime := time.Now()
+
+	// 获取所有机器人信息
+	wxbots, err := l.svcCtx.DB.Wx.Query().Select(wx.FieldWxid, wx.FieldID, wx.FieldOrganizationID).All(l.ctx)
+	if err != nil {
+		l.Errorf("fetch wxids error:%v\n", err)
+		return
+	}
+
+	wxbotsSet := make(map[uint64][]*ent.Wx)
+	for _, bot := range wxbots {
+		wxbotsSet[bot.OrganizationID] = append(wxbotsSet[bot.OrganizationID], bot)
+	}
+	LabelsCountSet := make(map[uint64][]custom_types.LabelDist)
+
+	/*
+		计算本小时的数据
+		1. 查询出上小时里所有 usagedetail 内容
+		2. 挨个遍历他的 bot_id ,再查询他的 bot_id 相关的参数
+		3. 遍历的时候可能有重复,所以要先检查是否生成了数据,如果有就忽略,没有再生成
+		----------------------------------------------------------------------------------------------------------
+	*/
+
+	// 获取当前时间
+	now := time.Now()
+
+	// 获取本小时的第一分钟
+	currentHour := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location())
+	currentHourInt, _ := strconv.Atoi(currentHour.Format("2006010215"))
+
+	// 上一个小时的起始时间
+	lastHour := currentHour.Add(-time.Hour * 1)
+	lastHourInt, _ := strconv.Atoi(lastHour.Format("2006010215"))
+
+	for orgID, wxinfos := range wxbotsSet {
+		var orgAiResponseInt, orgSopRunInt, orgFriendCountInt, orgGroupCountInt, orgAccountBalanceInt, orgConsumeTokenInt, orgActiveUserInt, orgNewUserInt int
+		for _, wxinfo := range wxinfos {
+			l.Logger.Infof("开始计算小时数据:%d\n", currentHourInt)
+
+			// 先判断该账号是否已经统计了小时数据,如果已经统计了,就不需要再统计了
+			var aiResponseInt, sopRunInt, friendCountInt, groupCountInt, accountBalanceInt, consumeTokenInt, activeUserInt, newUserInt int
+			hourDataCount, _ := l.svcCtx.DB.UsageStatisticHour.Query().Where(
+				usagestatistichour.Type(1),
+				usagestatistichour.BotID(wxinfo.Wxid),
+				usagestatistichour.Addtime(uint64(currentHourInt)),
+			).Count(l.ctx)
+			if hourDataCount > 0 {
+				continue
+			}
+
+			// AI回复包括:SOP次数+AI次数
+			// SOP次数:content 非空,source_type = 3 或 4,sub_source_id = 0
+			// AI次数:app = 1 或 3
+			sopresp, _ := l.svcCtx.DB.MessageRecords.Query().Where(
+				messagerecords.SubSourceID(0),
+				messagerecords.SourceTypeIn(3, 4),
+				messagerecords.BotWxid(wxinfo.Wxid),
+				messagerecords.CreatedAtGTE(lastHour),
+				messagerecords.CreatedAtLT(currentHour),
+			).Count(l.ctx)
+			airesp, _ := l.svcCtx.DB.UsageDetail.Query().Where(
+				usagedetail.AppIn(1, 3),
+				usagedetail.BotID(wxinfo.Wxid),
+				usagedetail.CreatedAtGTE(lastHour),
+				usagedetail.CreatedAtLT(currentHour),
+			).Count(l.ctx)
+			aiResponseInt = sopresp + airesp
+			orgAiResponseInt += aiResponseInt
+
+			// SOP执行次数:SOP阶段和节点的执行次数。
+			sopRunInt, _ = l.svcCtx.DB.MessageRecords.Query().Where(
+				messagerecords.BotWxid(wxinfo.Wxid),
+				messagerecords.SubSourceIDEQ(0),
+				messagerecords.SourceTypeIn(3, 4),
+				messagerecords.BotWxid(wxinfo.Wxid),
+				messagerecords.CreatedAtGTE(lastHour),
+				messagerecords.CreatedAtLT(currentHour),
+			).Count(l.ctx)
+			orgSopRunInt += sopRunInt
+
+			// 好友总数:contact 表中 type=1
+			friendCountInt, _ = l.svcCtx.DB.Contact.Query().Where(
+				contact.Type(1),
+				contact.WxWxid(wxinfo.Wxid),
+			).Count(l.ctx)
+			orgFriendCountInt += friendCountInt
+
+			// 群总数:contact 表中 type=2
+			groupCountInt, _ = l.svcCtx.DB.Contact.Query().Where(
+				contact.Type(2),
+				contact.WxWxid(wxinfo.Wxid),
+			).Count(l.ctx)
+			orgGroupCountInt += groupCountInt
+
+			// 消耗Token数:usage_detail 表
+			consumeTokenInt, _ = l.svcCtx.DB.UsageDetail.Query().Where(
+				usagedetail.TypeEQ(1),
+				usagedetail.BotID(wxinfo.Wxid),
+				usagedetail.CreatedAtGTE(lastHour),
+				usagedetail.CreatedAtLT(currentHour),
+			).Aggregate(ent.Sum("total_tokens")).Int(l.ctx)
+			orgConsumeTokenInt += consumeTokenInt
+
+			// 账户余额
+			accountBalanceInt = 0
+			orgAccountBalanceInt = 0
+
+			// 活跃好友:usage_detail 表 type = 1
+			activeUserInt, _ = l.svcCtx.DB.UsageDetail.Query().Where(
+				usagedetail.Type(1),
+				usagedetail.BotID(wxinfo.Wxid),
+				usagedetail.CreatedAtGTE(lastHour),
+				usagedetail.CreatedAtLT(currentHour),
+			).GroupBy(usagedetail.FieldReceiverID).Int(l.ctx)
+			orgActiveUserInt += activeUserInt
+
+			lastHourData, _ := l.svcCtx.DB.UsageStatisticHour.Query().Where(
+				usagestatistichour.AddtimeEQ(uint64(lastHourInt)),
+				usagestatistichour.Type(1),
+				usagestatistichour.BotID(wxinfo.Wxid),
+			).First(l.ctx)
+
+			if lastHourData == nil {
+				newUserInt = friendCountInt
+			} else {
+				newUserInt = int(lastHourData.TotalFriend) - friendCountInt
+			}
+			orgNewUserInt += newUserInt
+
+			_, err := l.svcCtx.DB.UsageStatisticHour.Create().
+				SetType(1).
+				SetBotID(wxinfo.Wxid).
+				SetOrganizationID(wxinfo.OrganizationID).
+				SetAiResponse(uint64(aiResponseInt)).
+				SetSopRun(uint64(sopRunInt)).
+				SetTotalFriend(uint64(friendCountInt)).
+				SetTotalGroup(uint64(groupCountInt)).
+				SetAccountBalance(uint64(accountBalanceInt)).
+				SetConsumeToken(uint64(consumeTokenInt)).
+				SetActiveUser(uint64(activeUserInt)).
+				SetNewUser(int64(newUserInt)).
+				SetAddtime(uint64(currentHourInt)).
+				Save(l.ctx)
+			l.Errorf("save hour data error:%v \n", err)
+		}
+		// 先判断该租户是否已经统计了小时数据,如果已经统计了,就不需要再统计了
+		hourDataCount, _ := l.svcCtx.DB.UsageStatisticHour.Query().Where(
+			usagestatistichour.Type(1),
+			usagestatistichour.OrganizationID(orgID),
+			usagestatistichour.BotIDIsNil(),
+			usagestatistichour.Addtime(uint64(currentHourInt)),
+		).Count(l.ctx)
+		if hourDataCount > 0 {
+			continue
+		}
+
+		var LabelsCount []custom_types.LabelDist
+		err := l.svcCtx.DB.LabelRelationship.Query().Where(labelrelationship.OrganizationIDEQ(orgID), labelrelationship.DeletedAtIsNil()).GroupBy(labelrelationship.FieldLabelID).Aggregate(ent.Count()).Scan(l.ctx, &LabelsCount)
+		l.Errorf("save hour data error:%v \n", err)
+		LabelsCountSet[orgID] = LabelsCount
+
+		_, err = l.svcCtx.DB.UsageStatisticHour.Create().
+			SetType(1).
+			SetOrganizationID(orgID).
+			SetAiResponse(uint64(orgAiResponseInt)).
+			SetSopRun(uint64(orgSopRunInt)).
+			SetTotalFriend(uint64(orgFriendCountInt)).
+			SetTotalGroup(uint64(orgGroupCountInt)).
+			SetAccountBalance(uint64(orgAccountBalanceInt)).
+			SetConsumeToken(uint64(orgConsumeTokenInt)).
+			SetActiveUser(uint64(orgActiveUserInt)).
+			SetNewUser(int64(orgNewUserInt)).
+			SetAddtime(uint64(currentHourInt)).
+			SetNotNilLabelDist(LabelsCount).
+			Save(l.ctx)
+		l.Errorf("save hour data error:%v \n", err)
+	}
+
+	/*
+		计算日数据
+		----------------------------------------------------------------------------------------------------------
+	*/
+	dayStr := time.Now().Format("20060102")
+	day, _ := strconv.Atoi(dayStr)
+
+	// 获取昨天的第一小时
+	yesterday := now.AddDate(0, 0, -1)
+	yesterdayFirstHour := time.Date(yesterday.Year(), yesterday.Month(), now.Day(), 0, 0, 0, 0, now.Location())
+	yesterdayFirstHourInt, _ := strconv.Atoi(yesterdayFirstHour.Format("20060102"))
+
+	// 获取昨天的最后一小时
+	yesterdayLastHour := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
+	yesterdayLastHourInt, _ := strconv.Atoi(yesterdayLastHour.Format("20060102"))
+
+	for orgID, wxinfos := range wxbotsSet {
+		var orgAiResponseInt, orgSopRunInt, orgFriendCountInt, orgGroupCountInt, orgAccountBalanceInt, orgConsumeTokenInt, orgActiveUserInt uint64
+		var orgNewUserInt int64
+		for _, wxinfo := range wxinfos {
+			l.Logger.Infof("开始计算日数据:%d\n", day)
+			// 先判断该账号是否已经统计了日数据,如果已经统计了,就不需要再统计了
+			dayDataCount, _ := l.svcCtx.DB.UsageStatisticDay.Query().Where(
+				usagestatisticday.Type(1),
+				usagestatisticday.BotID(wxinfo.Wxid),
+				usagestatisticday.Addtime(uint64(day)),
+			).Count(l.ctx)
+
+			// 如果添加过了就略过
+			if dayDataCount > 0 {
+				continue
+			}
+
+			hourDataBatch, _ := l.svcCtx.DB.UsageStatisticHour.Query().Where(
+				usagestatistichour.Type(1),
+				usagestatistichour.BotID(wxinfo.Wxid),
+				usagestatistichour.AddtimeGTE(uint64(yesterdayFirstHourInt)),
+				usagestatistichour.AddtimeLT(uint64(yesterdayLastHourInt)),
+			).All(l.ctx)
+
+			var aiResponse, sopRun, totalFriend, totalGroup, accountBalance, consumeToken, activeUser uint64
+			var newUser int64
+			for _, hourData := range hourDataBatch {
+				aiResponse += hourData.AiResponse
+				sopRun += hourData.SopRun
+				totalFriend += hourData.TotalFriend
+				totalGroup += hourData.TotalGroup
+				accountBalance += hourData.AccountBalance
+				consumeToken += hourData.ConsumeToken
+				activeUser += hourData.ActiveUser
+				newUser += hourData.NewUser
+			}
+			orgAiResponseInt += aiResponse
+			orgSopRunInt += sopRun
+			orgFriendCountInt += totalFriend
+			orgGroupCountInt += totalGroup
+			orgAccountBalanceInt += accountBalance
+			orgConsumeTokenInt += consumeToken
+			orgActiveUserInt += activeUser
+			orgNewUserInt += newUser
+
+			_, err := l.svcCtx.DB.UsageStatisticDay.Create().
+				SetAddtime(uint64(day)).
+				SetType(1).
+				SetBotID(wxinfo.Wxid).
+				SetOrganizationID(wxinfo.OrganizationID).
+				SetAiResponse(aiResponse).
+				SetSopRun(sopRun).
+				SetTotalFriend(totalFriend).
+				SetTotalGroup(totalGroup).
+				SetAccountBalance(accountBalance).
+				SetConsumeToken(consumeToken).
+				SetActiveUser(activeUser).
+				SetNewUser(newUser).
+				Save(l.ctx)
+			if err != nil {
+				l.Errorf("create day data error:%v \n", err)
+				continue
+			}
+		}
+		// 先判断该租户是否已经统计了日数据,如果已经统计了,就不需要再统计了
+		dayDataCount, _ := l.svcCtx.DB.UsageStatisticDay.Query().Where(
+			usagestatisticday.Type(1),
+			usagestatisticday.OrganizationID(orgID),
+			usagestatisticday.BotIDIsNil(),
+			usagestatisticday.Addtime(uint64(day)),
+		).Count(l.ctx)
+
+		// 如果添加过了就略过
+		if dayDataCount > 0 {
+			continue
+		}
+
+		_, err := l.svcCtx.DB.UsageStatisticDay.Create().
+			SetAddtime(uint64(day)).
+			SetType(1).
+			SetOrganizationID(orgID).
+			SetAiResponse(orgAiResponseInt).
+			SetSopRun(orgSopRunInt).
+			SetTotalFriend(orgFriendCountInt).
+			SetTotalGroup(orgGroupCountInt).
+			SetAccountBalance(orgAccountBalanceInt).
+			SetConsumeToken(orgConsumeTokenInt).
+			SetActiveUser(orgActiveUserInt).
+			SetNewUser(orgNewUserInt).
+			SetNotNilLabelDist(LabelsCountSet[orgID]).
+			Save(l.ctx)
+		if err != nil {
+			l.Errorf("create day data error:%v \n", err)
+			continue
+		}
+	}
+
+	/*
+		查看月表数据是否已经完成
+		1. 查询出上月里所有 usagedetail 内容
+		2. 挨个遍历他的 bot_id ,再查询他的 bot_id 相关的参数
+		----------------------------------------------------------------------------------------------------------
+	*/
+	monthStr := time.Now().Format("200601")
+	month, _ := strconv.Atoi(monthStr)
+
+	for orgID, wxinfos := range wxbotsSet {
+		var orgAiResponseInt, orgSopRunInt, orgFriendCountInt, orgGroupCountInt, orgAccountBalanceInt, orgConsumeTokenInt, orgActiveUserInt uint64
+		var orgNewUserInt int64
+		for _, wxinfo := range wxinfos {
+			l.Logger.Infof("开始计算月数据:%d\n", month)
+
+			// 获取上月的第一天
+			monthFirstDay := time.Date(now.Year(), now.Month()-1, 1, 0, 0, 0, 0, now.Location())
+			monthFirstDayInt, _ := strconv.Atoi(monthFirstDay.Format("20060102"))
+
+			// 获取上月的最后一天
+			monthLastDay := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location())
+			monthLastDayInt, _ := strconv.Atoi(monthLastDay.Format("20060102"))
+
+			// 先判断该账号是否已经统计了月数据,如果已经统计了,就不需要再统计了
+			monthDataCount, _ := l.svcCtx.DB.UsageStatisticMonth.Query().Where(
+				usagestatisticmonth.Type(1),
+				usagestatisticmonth.BotID(wxinfo.Wxid),
+				usagestatisticmonth.Addtime(uint64(month)),
+			).Count(l.ctx)
+
+			// 如果添加过了就略过
+			if monthDataCount > 0 {
+				continue
+			}
+
+			dayDataBatch, _ := l.svcCtx.DB.UsageStatisticDay.Query().Where(
+				usagestatisticday.Type(1),
+				usagestatisticday.BotID(wxinfo.Wxid),
+				usagestatisticday.AddtimeGTE(uint64(monthFirstDayInt)),
+				usagestatisticday.AddtimeLT(uint64(monthLastDayInt)),
+			).All(l.ctx)
+
+			var aiResponse, sopRun, totalFriend, totalGroup, accountBalance, consumeToken, activeUser uint64
+			var newUser int64
+			for _, dayData := range dayDataBatch {
+				aiResponse += dayData.AiResponse
+				sopRun += dayData.SopRun
+				totalFriend += dayData.TotalFriend
+				totalGroup += dayData.TotalGroup
+				accountBalance += dayData.AccountBalance
+				consumeToken += dayData.ConsumeToken
+				activeUser += dayData.ActiveUser
+				newUser += dayData.NewUser
+			}
+			orgAiResponseInt += aiResponse
+			orgSopRunInt += sopRun
+			orgFriendCountInt += totalFriend
+			orgGroupCountInt += totalGroup
+			orgAccountBalanceInt += accountBalance
+			orgConsumeTokenInt += consumeToken
+			orgActiveUserInt += activeUser
+			orgNewUserInt += newUser
+
+			_, err := l.svcCtx.DB.UsageStatisticMonth.Create().
+				SetAddtime(uint64(month)).
+				SetType(1).
+				SetBotID(wxinfo.Wxid).
+				SetOrganizationID(wxinfo.OrganizationID).
+				SetAiResponse(aiResponse).
+				SetSopRun(sopRun).
+				SetTotalFriend(totalFriend).
+				SetTotalGroup(totalGroup).
+				SetAccountBalance(accountBalance).
+				SetConsumeToken(consumeToken).
+				SetActiveUser(activeUser).
+				SetNewUser(newUser).
+				Save(l.ctx)
+			if err != nil {
+				l.Errorf("create month data error:%v \n", err)
+				continue
+			}
+		}
+		// 先判断该租户是否已经统计了月数据,如果已经统计了,就不需要再统计了
+		monthDataCount, _ := l.svcCtx.DB.UsageStatisticMonth.Query().Where(
+			usagestatisticmonth.Type(1),
+			usagestatisticmonth.OrganizationID(orgID),
+			usagestatisticmonth.BotIDIsNil(),
+			usagestatisticmonth.Addtime(uint64(month)),
+		).Count(l.ctx)
+
+		// 如果添加过了就略过
+		if monthDataCount > 0 {
+			continue
+		}
+
+		_, err := l.svcCtx.DB.UsageStatisticMonth.Create().
+			SetAddtime(uint64(month)).
+			SetType(1).
+			SetOrganizationID(orgID).
+			SetAiResponse(orgAiResponseInt).
+			SetSopRun(orgSopRunInt).
+			SetTotalFriend(orgFriendCountInt).
+			SetTotalGroup(orgGroupCountInt).
+			SetAccountBalance(orgAccountBalanceInt).
+			SetConsumeToken(orgConsumeTokenInt).
+			SetActiveUser(orgActiveUserInt).
+			SetNewUser(orgNewUserInt).
+			SetNotNilLabelDist(LabelsCountSet[orgID]).
+			Save(l.ctx)
+		if err != nil {
+			l.Errorf("create month data error:%v \n", err)
+			continue
+		}
+	}
+
+	finishTime := time.Now()
+	l.Logger.Infof("This process cost %v", finishTime.Sub(startTime).String())
+	return
+}

+ 5 - 0
crontask/init.go

@@ -37,4 +37,9 @@ func ScheduleRun(c *cron.Cron, serverCtx *svc.ServiceContext) {
 	c.AddFunc("* * * * *", func() {
 		sendWxOnTimeout.sendWxOnTimeout()
 	})
+
+	computeStatistic := NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("0 * * * *", func() {
+		computeStatistic.computeStatistic()
+	})
 }

+ 3 - 1
desc/all.api

@@ -33,4 +33,6 @@ import "./wechat/aliyun_avatar.api"
 import "./wechat/workphone.api"
 import "./wechat/usage_detail.api"
 import "./wechat/usage_total.api"
-import "./wechat/alloc_agent.api"
+import "./wechat/alloc_agent.api"
+import "./wechat/xiaoice.api"
+import "./wechat/dashboard.api"

+ 96 - 0
desc/wechat/dashboard.api

@@ -0,0 +1,96 @@
+import "../base.api"
+
+type (
+    DashboardInfo {
+        BaseIDInfo
+    }
+
+    ChartsReq {
+        StartDate *string `json:"start_date"`
+
+        EndDate *string `json:"end_date"`
+
+        // 租户id
+        OrganizationId  *uint64 `json:"organizationId,optional"`
+    }
+    ChartsResp {
+        BaseDataInfo
+
+        Data *ChartsData `json:"data"`
+    }
+
+    ChartsData {
+        AiResponse *ChartsUint `json:"ai_response"`
+        SopRun *ChartsUint `json:"sop_run"`
+        TotalFriend *ChartsUint `json:"total_friend"`
+        TotalGroup *ChartsUint `json:"total_group"`
+        AccountBalance *ChartsUint `json:"account_balance"`
+        ConsumeToken *ChartsUint `json:"consume_token"`
+        ActiveUser *ChartsUint `json:"active_user"`
+        NewUser *ChartsInt `json:"new_user"`
+        LabelDist []LabelsData `json:"label_dist"`
+    }
+
+    ChartsUint {
+        Count uint64 `json:"count"`
+        Rate float32 `json:"rate"`
+        Label []string `json:"label"`
+        Val []uint64 `json:"val"`
+    }
+
+    ChartsInt {
+        Count int64 `json:"count"`
+        Rate float32 `json:"rate"`
+        Label []string `json:"label"`
+        Val []int64 `json:"val"`
+    }
+
+    LabelsData {
+        Value uint64 `json:"value"`
+        Name string `json:"name"`
+    }
+
+    WxReq {
+        PageInfo
+
+        EndDate *string `json:"end_date"`
+
+        // 租户id
+        OrganizationId  *uint64 `json:"organizationId,optional"`
+    }
+
+    WxResp {
+        BaseDataInfo
+
+        Data WxList `json:"data"`
+    }
+
+    WxList {
+        BaseListInfo
+
+        Data  []WxData  `json:"data"`
+    }
+
+    WxData {
+        Nickname string `json:"nickname"`
+        TotalFriend uint64 `json:"total_friend"`
+        TotalGroup uint64 `json:"total_group"`
+        InteractionRate float32 `json:"interaction_rate"`
+    }
+)
+
+@server(
+	jwt: Auth
+    group: dashboard
+    middleware: Authority
+)
+
+service Wechat {
+    // get charts | 获取图表数据
+    @handler getCharts
+    post /dashboard/charts (ChartsReq) returns (ChartsResp)
+
+    // get wxs | 获取图表数据
+    @handler getWxs
+    post /dashboard/wx (WxReq) returns (WxResp)
+}

+ 31 - 0
desc/wechat/xiaoice.api

@@ -0,0 +1,31 @@
+import "../base.api"
+
+type (
+    SignatureResp {
+        BaseDataInfo
+
+        // 临时签名
+        Data *string `json:"data"`
+    }
+
+    MessageReq {
+        // 大模型生成内容
+        UserId *uint64 `json:"user_id"`
+
+        Text *string `json:"text"`
+    }
+)
+
+@server(
+	group: xiaoice
+)
+
+service Wechat {
+	// get xiaoice signature | 获取小冰签名
+    @handler signatureGen
+    get /api/xiaoice/signature () returns (SignatureResp)
+
+    // gen gptbots | 调用gptbots
+    @handler gptbotsMessage
+    post /api/xiaoice/message (MessageReq) returns (BaseDataInfo)
+}

+ 507 - 76
ent/client.go

@@ -34,6 +34,9 @@ import (
 	"wechat-api/ent/token"
 	"wechat-api/ent/tutorial"
 	"wechat-api/ent/usagedetail"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/usagestatisticmonth"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
 	"wechat-api/ent/wpchatroom"
@@ -102,6 +105,12 @@ type Client struct {
 	Tutorial *TutorialClient
 	// UsageDetail is the client for interacting with the UsageDetail builders.
 	UsageDetail *UsageDetailClient
+	// UsageStatisticDay is the client for interacting with the UsageStatisticDay builders.
+	UsageStatisticDay *UsageStatisticDayClient
+	// UsageStatisticHour is the client for interacting with the UsageStatisticHour builders.
+	UsageStatisticHour *UsageStatisticHourClient
+	// UsageStatisticMonth is the client for interacting with the UsageStatisticMonth builders.
+	UsageStatisticMonth *UsageStatisticMonthClient
 	// UsageTotal is the client for interacting with the UsageTotal builders.
 	UsageTotal *UsageTotalClient
 	// WorkExperience is the client for interacting with the WorkExperience builders.
@@ -152,6 +161,9 @@ func (c *Client) init() {
 	c.Token = NewTokenClient(c.config)
 	c.Tutorial = NewTutorialClient(c.config)
 	c.UsageDetail = NewUsageDetailClient(c.config)
+	c.UsageStatisticDay = NewUsageStatisticDayClient(c.config)
+	c.UsageStatisticHour = NewUsageStatisticHourClient(c.config)
+	c.UsageStatisticMonth = NewUsageStatisticMonthClient(c.config)
 	c.UsageTotal = NewUsageTotalClient(c.config)
 	c.WorkExperience = NewWorkExperienceClient(c.config)
 	c.WpChatroom = NewWpChatroomClient(c.config)
@@ -250,39 +262,42 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
 	cfg := c.config
 	cfg.driver = tx
 	return &Tx{
-		ctx:               ctx,
-		config:            cfg,
-		Agent:             NewAgentClient(cfg),
-		AgentBase:         NewAgentBaseClient(cfg),
-		AliyunAvatar:      NewAliyunAvatarClient(cfg),
-		AllocAgent:        NewAllocAgentClient(cfg),
-		BatchMsg:          NewBatchMsgClient(cfg),
-		Category:          NewCategoryClient(cfg),
-		ChatRecords:       NewChatRecordsClient(cfg),
-		ChatSession:       NewChatSessionClient(cfg),
-		Contact:           NewContactClient(cfg),
-		Employee:          NewEmployeeClient(cfg),
-		EmployeeConfig:    NewEmployeeConfigClient(cfg),
-		Label:             NewLabelClient(cfg),
-		LabelRelationship: NewLabelRelationshipClient(cfg),
-		Message:           NewMessageClient(cfg),
-		MessageRecords:    NewMessageRecordsClient(cfg),
-		Msg:               NewMsgClient(cfg),
-		Server:            NewServerClient(cfg),
-		SopNode:           NewSopNodeClient(cfg),
-		SopStage:          NewSopStageClient(cfg),
-		SopTask:           NewSopTaskClient(cfg),
-		Token:             NewTokenClient(cfg),
-		Tutorial:          NewTutorialClient(cfg),
-		UsageDetail:       NewUsageDetailClient(cfg),
-		UsageTotal:        NewUsageTotalClient(cfg),
-		WorkExperience:    NewWorkExperienceClient(cfg),
-		WpChatroom:        NewWpChatroomClient(cfg),
-		WpChatroomMember:  NewWpChatroomMemberClient(cfg),
-		Wx:                NewWxClient(cfg),
-		WxCard:            NewWxCardClient(cfg),
-		WxCardUser:        NewWxCardUserClient(cfg),
-		WxCardVisit:       NewWxCardVisitClient(cfg),
+		ctx:                 ctx,
+		config:              cfg,
+		Agent:               NewAgentClient(cfg),
+		AgentBase:           NewAgentBaseClient(cfg),
+		AliyunAvatar:        NewAliyunAvatarClient(cfg),
+		AllocAgent:          NewAllocAgentClient(cfg),
+		BatchMsg:            NewBatchMsgClient(cfg),
+		Category:            NewCategoryClient(cfg),
+		ChatRecords:         NewChatRecordsClient(cfg),
+		ChatSession:         NewChatSessionClient(cfg),
+		Contact:             NewContactClient(cfg),
+		Employee:            NewEmployeeClient(cfg),
+		EmployeeConfig:      NewEmployeeConfigClient(cfg),
+		Label:               NewLabelClient(cfg),
+		LabelRelationship:   NewLabelRelationshipClient(cfg),
+		Message:             NewMessageClient(cfg),
+		MessageRecords:      NewMessageRecordsClient(cfg),
+		Msg:                 NewMsgClient(cfg),
+		Server:              NewServerClient(cfg),
+		SopNode:             NewSopNodeClient(cfg),
+		SopStage:            NewSopStageClient(cfg),
+		SopTask:             NewSopTaskClient(cfg),
+		Token:               NewTokenClient(cfg),
+		Tutorial:            NewTutorialClient(cfg),
+		UsageDetail:         NewUsageDetailClient(cfg),
+		UsageStatisticDay:   NewUsageStatisticDayClient(cfg),
+		UsageStatisticHour:  NewUsageStatisticHourClient(cfg),
+		UsageStatisticMonth: NewUsageStatisticMonthClient(cfg),
+		UsageTotal:          NewUsageTotalClient(cfg),
+		WorkExperience:      NewWorkExperienceClient(cfg),
+		WpChatroom:          NewWpChatroomClient(cfg),
+		WpChatroomMember:    NewWpChatroomMemberClient(cfg),
+		Wx:                  NewWxClient(cfg),
+		WxCard:              NewWxCardClient(cfg),
+		WxCardUser:          NewWxCardUserClient(cfg),
+		WxCardVisit:         NewWxCardVisitClient(cfg),
 	}, nil
 }
 
@@ -300,39 +315,42 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
 	cfg := c.config
 	cfg.driver = &txDriver{tx: tx, drv: c.driver}
 	return &Tx{
-		ctx:               ctx,
-		config:            cfg,
-		Agent:             NewAgentClient(cfg),
-		AgentBase:         NewAgentBaseClient(cfg),
-		AliyunAvatar:      NewAliyunAvatarClient(cfg),
-		AllocAgent:        NewAllocAgentClient(cfg),
-		BatchMsg:          NewBatchMsgClient(cfg),
-		Category:          NewCategoryClient(cfg),
-		ChatRecords:       NewChatRecordsClient(cfg),
-		ChatSession:       NewChatSessionClient(cfg),
-		Contact:           NewContactClient(cfg),
-		Employee:          NewEmployeeClient(cfg),
-		EmployeeConfig:    NewEmployeeConfigClient(cfg),
-		Label:             NewLabelClient(cfg),
-		LabelRelationship: NewLabelRelationshipClient(cfg),
-		Message:           NewMessageClient(cfg),
-		MessageRecords:    NewMessageRecordsClient(cfg),
-		Msg:               NewMsgClient(cfg),
-		Server:            NewServerClient(cfg),
-		SopNode:           NewSopNodeClient(cfg),
-		SopStage:          NewSopStageClient(cfg),
-		SopTask:           NewSopTaskClient(cfg),
-		Token:             NewTokenClient(cfg),
-		Tutorial:          NewTutorialClient(cfg),
-		UsageDetail:       NewUsageDetailClient(cfg),
-		UsageTotal:        NewUsageTotalClient(cfg),
-		WorkExperience:    NewWorkExperienceClient(cfg),
-		WpChatroom:        NewWpChatroomClient(cfg),
-		WpChatroomMember:  NewWpChatroomMemberClient(cfg),
-		Wx:                NewWxClient(cfg),
-		WxCard:            NewWxCardClient(cfg),
-		WxCardUser:        NewWxCardUserClient(cfg),
-		WxCardVisit:       NewWxCardVisitClient(cfg),
+		ctx:                 ctx,
+		config:              cfg,
+		Agent:               NewAgentClient(cfg),
+		AgentBase:           NewAgentBaseClient(cfg),
+		AliyunAvatar:        NewAliyunAvatarClient(cfg),
+		AllocAgent:          NewAllocAgentClient(cfg),
+		BatchMsg:            NewBatchMsgClient(cfg),
+		Category:            NewCategoryClient(cfg),
+		ChatRecords:         NewChatRecordsClient(cfg),
+		ChatSession:         NewChatSessionClient(cfg),
+		Contact:             NewContactClient(cfg),
+		Employee:            NewEmployeeClient(cfg),
+		EmployeeConfig:      NewEmployeeConfigClient(cfg),
+		Label:               NewLabelClient(cfg),
+		LabelRelationship:   NewLabelRelationshipClient(cfg),
+		Message:             NewMessageClient(cfg),
+		MessageRecords:      NewMessageRecordsClient(cfg),
+		Msg:                 NewMsgClient(cfg),
+		Server:              NewServerClient(cfg),
+		SopNode:             NewSopNodeClient(cfg),
+		SopStage:            NewSopStageClient(cfg),
+		SopTask:             NewSopTaskClient(cfg),
+		Token:               NewTokenClient(cfg),
+		Tutorial:            NewTutorialClient(cfg),
+		UsageDetail:         NewUsageDetailClient(cfg),
+		UsageStatisticDay:   NewUsageStatisticDayClient(cfg),
+		UsageStatisticHour:  NewUsageStatisticHourClient(cfg),
+		UsageStatisticMonth: NewUsageStatisticMonthClient(cfg),
+		UsageTotal:          NewUsageTotalClient(cfg),
+		WorkExperience:      NewWorkExperienceClient(cfg),
+		WpChatroom:          NewWpChatroomClient(cfg),
+		WpChatroomMember:    NewWpChatroomMemberClient(cfg),
+		Wx:                  NewWxClient(cfg),
+		WxCard:              NewWxCardClient(cfg),
+		WxCardUser:          NewWxCardUserClient(cfg),
+		WxCardVisit:         NewWxCardVisitClient(cfg),
 	}, nil
 }
 
@@ -365,9 +383,9 @@ func (c *Client) Use(hooks ...Hook) {
 		c.Agent, c.AgentBase, c.AliyunAvatar, c.AllocAgent, c.BatchMsg, c.Category,
 		c.ChatRecords, c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
 		c.LabelRelationship, c.Message, c.MessageRecords, c.Msg, c.Server, c.SopNode,
-		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageTotal,
-		c.WorkExperience, c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard,
-		c.WxCardUser, c.WxCardVisit,
+		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageStatisticDay,
+		c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal, c.WorkExperience,
+		c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Use(hooks...)
 	}
@@ -380,9 +398,9 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
 		c.Agent, c.AgentBase, c.AliyunAvatar, c.AllocAgent, c.BatchMsg, c.Category,
 		c.ChatRecords, c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
 		c.LabelRelationship, c.Message, c.MessageRecords, c.Msg, c.Server, c.SopNode,
-		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageTotal,
-		c.WorkExperience, c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard,
-		c.WxCardUser, c.WxCardVisit,
+		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageStatisticDay,
+		c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal, c.WorkExperience,
+		c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Intercept(interceptors...)
 	}
@@ -437,6 +455,12 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
 		return c.Tutorial.mutate(ctx, m)
 	case *UsageDetailMutation:
 		return c.UsageDetail.mutate(ctx, m)
+	case *UsageStatisticDayMutation:
+		return c.UsageStatisticDay.mutate(ctx, m)
+	case *UsageStatisticHourMutation:
+		return c.UsageStatisticHour.mutate(ctx, m)
+	case *UsageStatisticMonthMutation:
+		return c.UsageStatisticMonth.mutate(ctx, m)
 	case *UsageTotalMutation:
 		return c.UsageTotal.mutate(ctx, m)
 	case *WorkExperienceMutation:
@@ -3905,6 +3929,411 @@ func (c *UsageDetailClient) mutate(ctx context.Context, m *UsageDetailMutation)
 	}
 }
 
+// UsageStatisticDayClient is a client for the UsageStatisticDay schema.
+type UsageStatisticDayClient struct {
+	config
+}
+
+// NewUsageStatisticDayClient returns a client for the UsageStatisticDay from the given config.
+func NewUsageStatisticDayClient(c config) *UsageStatisticDayClient {
+	return &UsageStatisticDayClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `usagestatisticday.Hooks(f(g(h())))`.
+func (c *UsageStatisticDayClient) Use(hooks ...Hook) {
+	c.hooks.UsageStatisticDay = append(c.hooks.UsageStatisticDay, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `usagestatisticday.Intercept(f(g(h())))`.
+func (c *UsageStatisticDayClient) Intercept(interceptors ...Interceptor) {
+	c.inters.UsageStatisticDay = append(c.inters.UsageStatisticDay, interceptors...)
+}
+
+// Create returns a builder for creating a UsageStatisticDay entity.
+func (c *UsageStatisticDayClient) Create() *UsageStatisticDayCreate {
+	mutation := newUsageStatisticDayMutation(c.config, OpCreate)
+	return &UsageStatisticDayCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of UsageStatisticDay entities.
+func (c *UsageStatisticDayClient) CreateBulk(builders ...*UsageStatisticDayCreate) *UsageStatisticDayCreateBulk {
+	return &UsageStatisticDayCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *UsageStatisticDayClient) MapCreateBulk(slice any, setFunc func(*UsageStatisticDayCreate, int)) *UsageStatisticDayCreateBulk {
+	rv := reflect.ValueOf(slice)
+	if rv.Kind() != reflect.Slice {
+		return &UsageStatisticDayCreateBulk{err: fmt.Errorf("calling to UsageStatisticDayClient.MapCreateBulk with wrong type %T, need slice", slice)}
+	}
+	builders := make([]*UsageStatisticDayCreate, rv.Len())
+	for i := 0; i < rv.Len(); i++ {
+		builders[i] = c.Create()
+		setFunc(builders[i], i)
+	}
+	return &UsageStatisticDayCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for UsageStatisticDay.
+func (c *UsageStatisticDayClient) Update() *UsageStatisticDayUpdate {
+	mutation := newUsageStatisticDayMutation(c.config, OpUpdate)
+	return &UsageStatisticDayUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *UsageStatisticDayClient) UpdateOne(usd *UsageStatisticDay) *UsageStatisticDayUpdateOne {
+	mutation := newUsageStatisticDayMutation(c.config, OpUpdateOne, withUsageStatisticDay(usd))
+	return &UsageStatisticDayUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *UsageStatisticDayClient) UpdateOneID(id uint64) *UsageStatisticDayUpdateOne {
+	mutation := newUsageStatisticDayMutation(c.config, OpUpdateOne, withUsageStatisticDayID(id))
+	return &UsageStatisticDayUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for UsageStatisticDay.
+func (c *UsageStatisticDayClient) Delete() *UsageStatisticDayDelete {
+	mutation := newUsageStatisticDayMutation(c.config, OpDelete)
+	return &UsageStatisticDayDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *UsageStatisticDayClient) DeleteOne(usd *UsageStatisticDay) *UsageStatisticDayDeleteOne {
+	return c.DeleteOneID(usd.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *UsageStatisticDayClient) DeleteOneID(id uint64) *UsageStatisticDayDeleteOne {
+	builder := c.Delete().Where(usagestatisticday.ID(id))
+	builder.mutation.id = &id
+	builder.mutation.op = OpDeleteOne
+	return &UsageStatisticDayDeleteOne{builder}
+}
+
+// Query returns a query builder for UsageStatisticDay.
+func (c *UsageStatisticDayClient) Query() *UsageStatisticDayQuery {
+	return &UsageStatisticDayQuery{
+		config: c.config,
+		ctx:    &QueryContext{Type: TypeUsageStatisticDay},
+		inters: c.Interceptors(),
+	}
+}
+
+// Get returns a UsageStatisticDay entity by its id.
+func (c *UsageStatisticDayClient) Get(ctx context.Context, id uint64) (*UsageStatisticDay, error) {
+	return c.Query().Where(usagestatisticday.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *UsageStatisticDayClient) GetX(ctx context.Context, id uint64) *UsageStatisticDay {
+	obj, err := c.Get(ctx, id)
+	if err != nil {
+		panic(err)
+	}
+	return obj
+}
+
+// Hooks returns the client hooks.
+func (c *UsageStatisticDayClient) Hooks() []Hook {
+	hooks := c.hooks.UsageStatisticDay
+	return append(hooks[:len(hooks):len(hooks)], usagestatisticday.Hooks[:]...)
+}
+
+// Interceptors returns the client interceptors.
+func (c *UsageStatisticDayClient) Interceptors() []Interceptor {
+	inters := c.inters.UsageStatisticDay
+	return append(inters[:len(inters):len(inters)], usagestatisticday.Interceptors[:]...)
+}
+
+func (c *UsageStatisticDayClient) mutate(ctx context.Context, m *UsageStatisticDayMutation) (Value, error) {
+	switch m.Op() {
+	case OpCreate:
+		return (&UsageStatisticDayCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdate:
+		return (&UsageStatisticDayUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdateOne:
+		return (&UsageStatisticDayUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpDelete, OpDeleteOne:
+		return (&UsageStatisticDayDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+	default:
+		return nil, fmt.Errorf("ent: unknown UsageStatisticDay mutation op: %q", m.Op())
+	}
+}
+
+// UsageStatisticHourClient is a client for the UsageStatisticHour schema.
+type UsageStatisticHourClient struct {
+	config
+}
+
+// NewUsageStatisticHourClient returns a client for the UsageStatisticHour from the given config.
+func NewUsageStatisticHourClient(c config) *UsageStatisticHourClient {
+	return &UsageStatisticHourClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `usagestatistichour.Hooks(f(g(h())))`.
+func (c *UsageStatisticHourClient) Use(hooks ...Hook) {
+	c.hooks.UsageStatisticHour = append(c.hooks.UsageStatisticHour, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `usagestatistichour.Intercept(f(g(h())))`.
+func (c *UsageStatisticHourClient) Intercept(interceptors ...Interceptor) {
+	c.inters.UsageStatisticHour = append(c.inters.UsageStatisticHour, interceptors...)
+}
+
+// Create returns a builder for creating a UsageStatisticHour entity.
+func (c *UsageStatisticHourClient) Create() *UsageStatisticHourCreate {
+	mutation := newUsageStatisticHourMutation(c.config, OpCreate)
+	return &UsageStatisticHourCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of UsageStatisticHour entities.
+func (c *UsageStatisticHourClient) CreateBulk(builders ...*UsageStatisticHourCreate) *UsageStatisticHourCreateBulk {
+	return &UsageStatisticHourCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *UsageStatisticHourClient) MapCreateBulk(slice any, setFunc func(*UsageStatisticHourCreate, int)) *UsageStatisticHourCreateBulk {
+	rv := reflect.ValueOf(slice)
+	if rv.Kind() != reflect.Slice {
+		return &UsageStatisticHourCreateBulk{err: fmt.Errorf("calling to UsageStatisticHourClient.MapCreateBulk with wrong type %T, need slice", slice)}
+	}
+	builders := make([]*UsageStatisticHourCreate, rv.Len())
+	for i := 0; i < rv.Len(); i++ {
+		builders[i] = c.Create()
+		setFunc(builders[i], i)
+	}
+	return &UsageStatisticHourCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for UsageStatisticHour.
+func (c *UsageStatisticHourClient) Update() *UsageStatisticHourUpdate {
+	mutation := newUsageStatisticHourMutation(c.config, OpUpdate)
+	return &UsageStatisticHourUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *UsageStatisticHourClient) UpdateOne(ush *UsageStatisticHour) *UsageStatisticHourUpdateOne {
+	mutation := newUsageStatisticHourMutation(c.config, OpUpdateOne, withUsageStatisticHour(ush))
+	return &UsageStatisticHourUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *UsageStatisticHourClient) UpdateOneID(id uint64) *UsageStatisticHourUpdateOne {
+	mutation := newUsageStatisticHourMutation(c.config, OpUpdateOne, withUsageStatisticHourID(id))
+	return &UsageStatisticHourUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for UsageStatisticHour.
+func (c *UsageStatisticHourClient) Delete() *UsageStatisticHourDelete {
+	mutation := newUsageStatisticHourMutation(c.config, OpDelete)
+	return &UsageStatisticHourDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *UsageStatisticHourClient) DeleteOne(ush *UsageStatisticHour) *UsageStatisticHourDeleteOne {
+	return c.DeleteOneID(ush.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *UsageStatisticHourClient) DeleteOneID(id uint64) *UsageStatisticHourDeleteOne {
+	builder := c.Delete().Where(usagestatistichour.ID(id))
+	builder.mutation.id = &id
+	builder.mutation.op = OpDeleteOne
+	return &UsageStatisticHourDeleteOne{builder}
+}
+
+// Query returns a query builder for UsageStatisticHour.
+func (c *UsageStatisticHourClient) Query() *UsageStatisticHourQuery {
+	return &UsageStatisticHourQuery{
+		config: c.config,
+		ctx:    &QueryContext{Type: TypeUsageStatisticHour},
+		inters: c.Interceptors(),
+	}
+}
+
+// Get returns a UsageStatisticHour entity by its id.
+func (c *UsageStatisticHourClient) Get(ctx context.Context, id uint64) (*UsageStatisticHour, error) {
+	return c.Query().Where(usagestatistichour.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *UsageStatisticHourClient) GetX(ctx context.Context, id uint64) *UsageStatisticHour {
+	obj, err := c.Get(ctx, id)
+	if err != nil {
+		panic(err)
+	}
+	return obj
+}
+
+// Hooks returns the client hooks.
+func (c *UsageStatisticHourClient) Hooks() []Hook {
+	hooks := c.hooks.UsageStatisticHour
+	return append(hooks[:len(hooks):len(hooks)], usagestatistichour.Hooks[:]...)
+}
+
+// Interceptors returns the client interceptors.
+func (c *UsageStatisticHourClient) Interceptors() []Interceptor {
+	inters := c.inters.UsageStatisticHour
+	return append(inters[:len(inters):len(inters)], usagestatistichour.Interceptors[:]...)
+}
+
+func (c *UsageStatisticHourClient) mutate(ctx context.Context, m *UsageStatisticHourMutation) (Value, error) {
+	switch m.Op() {
+	case OpCreate:
+		return (&UsageStatisticHourCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdate:
+		return (&UsageStatisticHourUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdateOne:
+		return (&UsageStatisticHourUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpDelete, OpDeleteOne:
+		return (&UsageStatisticHourDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+	default:
+		return nil, fmt.Errorf("ent: unknown UsageStatisticHour mutation op: %q", m.Op())
+	}
+}
+
+// UsageStatisticMonthClient is a client for the UsageStatisticMonth schema.
+type UsageStatisticMonthClient struct {
+	config
+}
+
+// NewUsageStatisticMonthClient returns a client for the UsageStatisticMonth from the given config.
+func NewUsageStatisticMonthClient(c config) *UsageStatisticMonthClient {
+	return &UsageStatisticMonthClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `usagestatisticmonth.Hooks(f(g(h())))`.
+func (c *UsageStatisticMonthClient) Use(hooks ...Hook) {
+	c.hooks.UsageStatisticMonth = append(c.hooks.UsageStatisticMonth, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `usagestatisticmonth.Intercept(f(g(h())))`.
+func (c *UsageStatisticMonthClient) Intercept(interceptors ...Interceptor) {
+	c.inters.UsageStatisticMonth = append(c.inters.UsageStatisticMonth, interceptors...)
+}
+
+// Create returns a builder for creating a UsageStatisticMonth entity.
+func (c *UsageStatisticMonthClient) Create() *UsageStatisticMonthCreate {
+	mutation := newUsageStatisticMonthMutation(c.config, OpCreate)
+	return &UsageStatisticMonthCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of UsageStatisticMonth entities.
+func (c *UsageStatisticMonthClient) CreateBulk(builders ...*UsageStatisticMonthCreate) *UsageStatisticMonthCreateBulk {
+	return &UsageStatisticMonthCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *UsageStatisticMonthClient) MapCreateBulk(slice any, setFunc func(*UsageStatisticMonthCreate, int)) *UsageStatisticMonthCreateBulk {
+	rv := reflect.ValueOf(slice)
+	if rv.Kind() != reflect.Slice {
+		return &UsageStatisticMonthCreateBulk{err: fmt.Errorf("calling to UsageStatisticMonthClient.MapCreateBulk with wrong type %T, need slice", slice)}
+	}
+	builders := make([]*UsageStatisticMonthCreate, rv.Len())
+	for i := 0; i < rv.Len(); i++ {
+		builders[i] = c.Create()
+		setFunc(builders[i], i)
+	}
+	return &UsageStatisticMonthCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for UsageStatisticMonth.
+func (c *UsageStatisticMonthClient) Update() *UsageStatisticMonthUpdate {
+	mutation := newUsageStatisticMonthMutation(c.config, OpUpdate)
+	return &UsageStatisticMonthUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *UsageStatisticMonthClient) UpdateOne(usm *UsageStatisticMonth) *UsageStatisticMonthUpdateOne {
+	mutation := newUsageStatisticMonthMutation(c.config, OpUpdateOne, withUsageStatisticMonth(usm))
+	return &UsageStatisticMonthUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *UsageStatisticMonthClient) UpdateOneID(id uint64) *UsageStatisticMonthUpdateOne {
+	mutation := newUsageStatisticMonthMutation(c.config, OpUpdateOne, withUsageStatisticMonthID(id))
+	return &UsageStatisticMonthUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for UsageStatisticMonth.
+func (c *UsageStatisticMonthClient) Delete() *UsageStatisticMonthDelete {
+	mutation := newUsageStatisticMonthMutation(c.config, OpDelete)
+	return &UsageStatisticMonthDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *UsageStatisticMonthClient) DeleteOne(usm *UsageStatisticMonth) *UsageStatisticMonthDeleteOne {
+	return c.DeleteOneID(usm.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *UsageStatisticMonthClient) DeleteOneID(id uint64) *UsageStatisticMonthDeleteOne {
+	builder := c.Delete().Where(usagestatisticmonth.ID(id))
+	builder.mutation.id = &id
+	builder.mutation.op = OpDeleteOne
+	return &UsageStatisticMonthDeleteOne{builder}
+}
+
+// Query returns a query builder for UsageStatisticMonth.
+func (c *UsageStatisticMonthClient) Query() *UsageStatisticMonthQuery {
+	return &UsageStatisticMonthQuery{
+		config: c.config,
+		ctx:    &QueryContext{Type: TypeUsageStatisticMonth},
+		inters: c.Interceptors(),
+	}
+}
+
+// Get returns a UsageStatisticMonth entity by its id.
+func (c *UsageStatisticMonthClient) Get(ctx context.Context, id uint64) (*UsageStatisticMonth, error) {
+	return c.Query().Where(usagestatisticmonth.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *UsageStatisticMonthClient) GetX(ctx context.Context, id uint64) *UsageStatisticMonth {
+	obj, err := c.Get(ctx, id)
+	if err != nil {
+		panic(err)
+	}
+	return obj
+}
+
+// Hooks returns the client hooks.
+func (c *UsageStatisticMonthClient) Hooks() []Hook {
+	hooks := c.hooks.UsageStatisticMonth
+	return append(hooks[:len(hooks):len(hooks)], usagestatisticmonth.Hooks[:]...)
+}
+
+// Interceptors returns the client interceptors.
+func (c *UsageStatisticMonthClient) Interceptors() []Interceptor {
+	inters := c.inters.UsageStatisticMonth
+	return append(inters[:len(inters):len(inters)], usagestatisticmonth.Interceptors[:]...)
+}
+
+func (c *UsageStatisticMonthClient) mutate(ctx context.Context, m *UsageStatisticMonthMutation) (Value, error) {
+	switch m.Op() {
+	case OpCreate:
+		return (&UsageStatisticMonthCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdate:
+		return (&UsageStatisticMonthUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdateOne:
+		return (&UsageStatisticMonthUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpDelete, OpDeleteOne:
+		return (&UsageStatisticMonthDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+	default:
+		return nil, fmt.Errorf("ent: unknown UsageStatisticMonth mutation op: %q", m.Op())
+	}
+}
+
 // UsageTotalClient is a client for the UsageTotal schema.
 type UsageTotalClient struct {
 	config
@@ -5033,15 +5462,17 @@ type (
 		Agent, AgentBase, AliyunAvatar, AllocAgent, BatchMsg, Category, ChatRecords,
 		ChatSession, Contact, Employee, EmployeeConfig, Label, LabelRelationship,
 		Message, MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token,
-		Tutorial, UsageDetail, UsageTotal, WorkExperience, WpChatroom,
-		WpChatroomMember, Wx, WxCard, WxCardUser, WxCardVisit []ent.Hook
+		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour,
+		UsageStatisticMonth, UsageTotal, WorkExperience, WpChatroom, WpChatroomMember,
+		Wx, WxCard, WxCardUser, WxCardVisit []ent.Hook
 	}
 	inters struct {
 		Agent, AgentBase, AliyunAvatar, AllocAgent, BatchMsg, Category, ChatRecords,
 		ChatSession, Contact, Employee, EmployeeConfig, Label, LabelRelationship,
 		Message, MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token,
-		Tutorial, UsageDetail, UsageTotal, WorkExperience, WpChatroom,
-		WpChatroomMember, Wx, WxCard, WxCardUser, WxCardVisit []ent.Interceptor
+		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour,
+		UsageStatisticMonth, UsageTotal, WorkExperience, WpChatroom, WpChatroomMember,
+		Wx, WxCard, WxCardUser, WxCardVisit []ent.Interceptor
 	}
 )
 

+ 5 - 0
ent/custom_types/types.go

@@ -19,3 +19,8 @@ type ActionForward struct {
 	Wxid   string   `json:"wxid"`
 	Action []Action `json:"action"`
 }
+
+type LabelDist struct {
+	LabelID uint64 `json:"label_id"`
+	Count   uint64 `json:"count"`
+}

+ 0 - 12
ent/employee/employee.go

@@ -137,10 +137,6 @@ var (
 	UpdateDefaultUpdatedAt func() time.Time
 	// TitleValidator is a validator for the "title" field. It is called by the builders before save.
 	TitleValidator func(string) error
-	// AvatarValidator is a validator for the "avatar" field. It is called by the builders before save.
-	AvatarValidator func(string) error
-	// TagsValidator is a validator for the "tags" field. It is called by the builders before save.
-	TagsValidator func(string) error
 	// DefaultHireCount holds the default value on creation for the "hire_count" field.
 	DefaultHireCount int
 	// HireCountValidator is a validator for the "hire_count" field. It is called by the builders before save.
@@ -155,16 +151,10 @@ var (
 	AchievementCountValidator func(int) error
 	// DefaultIntro holds the default value on creation for the "intro" field.
 	DefaultIntro string
-	// IntroValidator is a validator for the "intro" field. It is called by the builders before save.
-	IntroValidator func(string) error
 	// DefaultEstimate holds the default value on creation for the "estimate" field.
 	DefaultEstimate string
-	// EstimateValidator is a validator for the "estimate" field. It is called by the builders before save.
-	EstimateValidator func(string) error
 	// DefaultSkill holds the default value on creation for the "skill" field.
 	DefaultSkill string
-	// SkillValidator is a validator for the "skill" field. It is called by the builders before save.
-	SkillValidator func(string) error
 	// DefaultAbilityType holds the default value on creation for the "ability_type" field.
 	DefaultAbilityType string
 	// DefaultScene holds the default value on creation for the "scene" field.
@@ -173,8 +163,6 @@ var (
 	DefaultSwitchIn string
 	// DefaultVideoURL holds the default value on creation for the "video_url" field.
 	DefaultVideoURL string
-	// VideoURLValidator is a validator for the "video_url" field. It is called by the builders before save.
-	VideoURLValidator func(string) error
 	// OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
 	OrganizationIDValidator func(uint64) error
 	// CategoryIDValidator is a validator for the "category_id" field. It is called by the builders before save.

+ 0 - 30
ent/employee_create.go

@@ -459,19 +459,9 @@ func (ec *EmployeeCreate) check() error {
 	if _, ok := ec.mutation.Avatar(); !ok {
 		return &ValidationError{Name: "avatar", err: errors.New(`ent: missing required field "Employee.avatar"`)}
 	}
-	if v, ok := ec.mutation.Avatar(); ok {
-		if err := employee.AvatarValidator(v); err != nil {
-			return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "Employee.avatar": %w`, err)}
-		}
-	}
 	if _, ok := ec.mutation.Tags(); !ok {
 		return &ValidationError{Name: "tags", err: errors.New(`ent: missing required field "Employee.tags"`)}
 	}
-	if v, ok := ec.mutation.Tags(); ok {
-		if err := employee.TagsValidator(v); err != nil {
-			return &ValidationError{Name: "tags", err: fmt.Errorf(`ent: validator failed for field "Employee.tags": %w`, err)}
-		}
-	}
 	if _, ok := ec.mutation.HireCount(); !ok {
 		return &ValidationError{Name: "hire_count", err: errors.New(`ent: missing required field "Employee.hire_count"`)}
 	}
@@ -499,27 +489,12 @@ func (ec *EmployeeCreate) check() error {
 	if _, ok := ec.mutation.Intro(); !ok {
 		return &ValidationError{Name: "intro", err: errors.New(`ent: missing required field "Employee.intro"`)}
 	}
-	if v, ok := ec.mutation.Intro(); ok {
-		if err := employee.IntroValidator(v); err != nil {
-			return &ValidationError{Name: "intro", err: fmt.Errorf(`ent: validator failed for field "Employee.intro": %w`, err)}
-		}
-	}
 	if _, ok := ec.mutation.Estimate(); !ok {
 		return &ValidationError{Name: "estimate", err: errors.New(`ent: missing required field "Employee.estimate"`)}
 	}
-	if v, ok := ec.mutation.Estimate(); ok {
-		if err := employee.EstimateValidator(v); err != nil {
-			return &ValidationError{Name: "estimate", err: fmt.Errorf(`ent: validator failed for field "Employee.estimate": %w`, err)}
-		}
-	}
 	if _, ok := ec.mutation.Skill(); !ok {
 		return &ValidationError{Name: "skill", err: errors.New(`ent: missing required field "Employee.skill"`)}
 	}
-	if v, ok := ec.mutation.Skill(); ok {
-		if err := employee.SkillValidator(v); err != nil {
-			return &ValidationError{Name: "skill", err: fmt.Errorf(`ent: validator failed for field "Employee.skill": %w`, err)}
-		}
-	}
 	if _, ok := ec.mutation.AbilityType(); !ok {
 		return &ValidationError{Name: "ability_type", err: errors.New(`ent: missing required field "Employee.ability_type"`)}
 	}
@@ -532,11 +507,6 @@ func (ec *EmployeeCreate) check() error {
 	if _, ok := ec.mutation.VideoURL(); !ok {
 		return &ValidationError{Name: "video_url", err: errors.New(`ent: missing required field "Employee.video_url"`)}
 	}
-	if v, ok := ec.mutation.VideoURL(); ok {
-		if err := employee.VideoURLValidator(v); err != nil {
-			return &ValidationError{Name: "video_url", err: fmt.Errorf(`ent: validator failed for field "Employee.video_url": %w`, err)}
-		}
-	}
 	if _, ok := ec.mutation.OrganizationID(); !ok {
 		return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "Employee.organization_id"`)}
 	}

+ 0 - 60
ent/employee_update.go

@@ -510,16 +510,6 @@ func (eu *EmployeeUpdate) check() error {
 			return &ValidationError{Name: "title", err: fmt.Errorf(`ent: validator failed for field "Employee.title": %w`, err)}
 		}
 	}
-	if v, ok := eu.mutation.Avatar(); ok {
-		if err := employee.AvatarValidator(v); err != nil {
-			return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "Employee.avatar": %w`, err)}
-		}
-	}
-	if v, ok := eu.mutation.Tags(); ok {
-		if err := employee.TagsValidator(v); err != nil {
-			return &ValidationError{Name: "tags", err: fmt.Errorf(`ent: validator failed for field "Employee.tags": %w`, err)}
-		}
-	}
 	if v, ok := eu.mutation.HireCount(); ok {
 		if err := employee.HireCountValidator(v); err != nil {
 			return &ValidationError{Name: "hire_count", err: fmt.Errorf(`ent: validator failed for field "Employee.hire_count": %w`, err)}
@@ -535,26 +525,6 @@ func (eu *EmployeeUpdate) check() error {
 			return &ValidationError{Name: "achievement_count", err: fmt.Errorf(`ent: validator failed for field "Employee.achievement_count": %w`, err)}
 		}
 	}
-	if v, ok := eu.mutation.Intro(); ok {
-		if err := employee.IntroValidator(v); err != nil {
-			return &ValidationError{Name: "intro", err: fmt.Errorf(`ent: validator failed for field "Employee.intro": %w`, err)}
-		}
-	}
-	if v, ok := eu.mutation.Estimate(); ok {
-		if err := employee.EstimateValidator(v); err != nil {
-			return &ValidationError{Name: "estimate", err: fmt.Errorf(`ent: validator failed for field "Employee.estimate": %w`, err)}
-		}
-	}
-	if v, ok := eu.mutation.Skill(); ok {
-		if err := employee.SkillValidator(v); err != nil {
-			return &ValidationError{Name: "skill", err: fmt.Errorf(`ent: validator failed for field "Employee.skill": %w`, err)}
-		}
-	}
-	if v, ok := eu.mutation.VideoURL(); ok {
-		if err := employee.VideoURLValidator(v); err != nil {
-			return &ValidationError{Name: "video_url", err: fmt.Errorf(`ent: validator failed for field "Employee.video_url": %w`, err)}
-		}
-	}
 	if v, ok := eu.mutation.OrganizationID(); ok {
 		if err := employee.OrganizationIDValidator(v); err != nil {
 			return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "Employee.organization_id": %w`, err)}
@@ -1273,16 +1243,6 @@ func (euo *EmployeeUpdateOne) check() error {
 			return &ValidationError{Name: "title", err: fmt.Errorf(`ent: validator failed for field "Employee.title": %w`, err)}
 		}
 	}
-	if v, ok := euo.mutation.Avatar(); ok {
-		if err := employee.AvatarValidator(v); err != nil {
-			return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "Employee.avatar": %w`, err)}
-		}
-	}
-	if v, ok := euo.mutation.Tags(); ok {
-		if err := employee.TagsValidator(v); err != nil {
-			return &ValidationError{Name: "tags", err: fmt.Errorf(`ent: validator failed for field "Employee.tags": %w`, err)}
-		}
-	}
 	if v, ok := euo.mutation.HireCount(); ok {
 		if err := employee.HireCountValidator(v); err != nil {
 			return &ValidationError{Name: "hire_count", err: fmt.Errorf(`ent: validator failed for field "Employee.hire_count": %w`, err)}
@@ -1298,26 +1258,6 @@ func (euo *EmployeeUpdateOne) check() error {
 			return &ValidationError{Name: "achievement_count", err: fmt.Errorf(`ent: validator failed for field "Employee.achievement_count": %w`, err)}
 		}
 	}
-	if v, ok := euo.mutation.Intro(); ok {
-		if err := employee.IntroValidator(v); err != nil {
-			return &ValidationError{Name: "intro", err: fmt.Errorf(`ent: validator failed for field "Employee.intro": %w`, err)}
-		}
-	}
-	if v, ok := euo.mutation.Estimate(); ok {
-		if err := employee.EstimateValidator(v); err != nil {
-			return &ValidationError{Name: "estimate", err: fmt.Errorf(`ent: validator failed for field "Employee.estimate": %w`, err)}
-		}
-	}
-	if v, ok := euo.mutation.Skill(); ok {
-		if err := employee.SkillValidator(v); err != nil {
-			return &ValidationError{Name: "skill", err: fmt.Errorf(`ent: validator failed for field "Employee.skill": %w`, err)}
-		}
-	}
-	if v, ok := euo.mutation.VideoURL(); ok {
-		if err := employee.VideoURLValidator(v); err != nil {
-			return &ValidationError{Name: "video_url", err: fmt.Errorf(`ent: validator failed for field "Employee.video_url": %w`, err)}
-		}
-	}
 	if v, ok := euo.mutation.OrganizationID(); ok {
 		if err := employee.OrganizationIDValidator(v); err != nil {
 			return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "Employee.organization_id": %w`, err)}

+ 37 - 31
ent/ent.go

@@ -31,6 +31,9 @@ import (
 	"wechat-api/ent/token"
 	"wechat-api/ent/tutorial"
 	"wechat-api/ent/usagedetail"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/usagestatisticmonth"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
 	"wechat-api/ent/wpchatroom"
@@ -103,37 +106,40 @@ var (
 func checkColumn(table, column string) error {
 	initCheck.Do(func() {
 		columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
-			agent.Table:             agent.ValidColumn,
-			agentbase.Table:         agentbase.ValidColumn,
-			aliyunavatar.Table:      aliyunavatar.ValidColumn,
-			allocagent.Table:        allocagent.ValidColumn,
-			batchmsg.Table:          batchmsg.ValidColumn,
-			category.Table:          category.ValidColumn,
-			chatrecords.Table:       chatrecords.ValidColumn,
-			chatsession.Table:       chatsession.ValidColumn,
-			contact.Table:           contact.ValidColumn,
-			employee.Table:          employee.ValidColumn,
-			employeeconfig.Table:    employeeconfig.ValidColumn,
-			label.Table:             label.ValidColumn,
-			labelrelationship.Table: labelrelationship.ValidColumn,
-			message.Table:           message.ValidColumn,
-			messagerecords.Table:    messagerecords.ValidColumn,
-			msg.Table:               msg.ValidColumn,
-			server.Table:            server.ValidColumn,
-			sopnode.Table:           sopnode.ValidColumn,
-			sopstage.Table:          sopstage.ValidColumn,
-			soptask.Table:           soptask.ValidColumn,
-			token.Table:             token.ValidColumn,
-			tutorial.Table:          tutorial.ValidColumn,
-			usagedetail.Table:       usagedetail.ValidColumn,
-			usagetotal.Table:        usagetotal.ValidColumn,
-			workexperience.Table:    workexperience.ValidColumn,
-			wpchatroom.Table:        wpchatroom.ValidColumn,
-			wpchatroommember.Table:  wpchatroommember.ValidColumn,
-			wx.Table:                wx.ValidColumn,
-			wxcard.Table:            wxcard.ValidColumn,
-			wxcarduser.Table:        wxcarduser.ValidColumn,
-			wxcardvisit.Table:       wxcardvisit.ValidColumn,
+			agent.Table:               agent.ValidColumn,
+			agentbase.Table:           agentbase.ValidColumn,
+			aliyunavatar.Table:        aliyunavatar.ValidColumn,
+			allocagent.Table:          allocagent.ValidColumn,
+			batchmsg.Table:            batchmsg.ValidColumn,
+			category.Table:            category.ValidColumn,
+			chatrecords.Table:         chatrecords.ValidColumn,
+			chatsession.Table:         chatsession.ValidColumn,
+			contact.Table:             contact.ValidColumn,
+			employee.Table:            employee.ValidColumn,
+			employeeconfig.Table:      employeeconfig.ValidColumn,
+			label.Table:               label.ValidColumn,
+			labelrelationship.Table:   labelrelationship.ValidColumn,
+			message.Table:             message.ValidColumn,
+			messagerecords.Table:      messagerecords.ValidColumn,
+			msg.Table:                 msg.ValidColumn,
+			server.Table:              server.ValidColumn,
+			sopnode.Table:             sopnode.ValidColumn,
+			sopstage.Table:            sopstage.ValidColumn,
+			soptask.Table:             soptask.ValidColumn,
+			token.Table:               token.ValidColumn,
+			tutorial.Table:            tutorial.ValidColumn,
+			usagedetail.Table:         usagedetail.ValidColumn,
+			usagestatisticday.Table:   usagestatisticday.ValidColumn,
+			usagestatistichour.Table:  usagestatistichour.ValidColumn,
+			usagestatisticmonth.Table: usagestatisticmonth.ValidColumn,
+			usagetotal.Table:          usagetotal.ValidColumn,
+			workexperience.Table:      workexperience.ValidColumn,
+			wpchatroom.Table:          wpchatroom.ValidColumn,
+			wpchatroommember.Table:    wpchatroommember.ValidColumn,
+			wx.Table:                  wx.ValidColumn,
+			wxcard.Table:              wxcard.ValidColumn,
+			wxcarduser.Table:          wxcarduser.ValidColumn,
+			wxcardvisit.Table:         wxcardvisit.ValidColumn,
 		})
 	})
 	return columnCheck(table, column)

+ 36 - 0
ent/hook/hook.go

@@ -284,6 +284,42 @@ func (f UsageDetailFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value,
 	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.UsageDetailMutation", m)
 }
 
+// The UsageStatisticDayFunc type is an adapter to allow the use of ordinary
+// function as UsageStatisticDay mutator.
+type UsageStatisticDayFunc func(context.Context, *ent.UsageStatisticDayMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f UsageStatisticDayFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+	if mv, ok := m.(*ent.UsageStatisticDayMutation); ok {
+		return f(ctx, mv)
+	}
+	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.UsageStatisticDayMutation", m)
+}
+
+// The UsageStatisticHourFunc type is an adapter to allow the use of ordinary
+// function as UsageStatisticHour mutator.
+type UsageStatisticHourFunc func(context.Context, *ent.UsageStatisticHourMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f UsageStatisticHourFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+	if mv, ok := m.(*ent.UsageStatisticHourMutation); ok {
+		return f(ctx, mv)
+	}
+	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.UsageStatisticHourMutation", m)
+}
+
+// The UsageStatisticMonthFunc type is an adapter to allow the use of ordinary
+// function as UsageStatisticMonth mutator.
+type UsageStatisticMonthFunc func(context.Context, *ent.UsageStatisticMonthMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f UsageStatisticMonthFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+	if mv, ok := m.(*ent.UsageStatisticMonthMutation); ok {
+		return f(ctx, mv)
+	}
+	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.UsageStatisticMonthMutation", m)
+}
+
 // The UsageTotalFunc type is an adapter to allow the use of ordinary
 // function as UsageTotal mutator.
 type UsageTotalFunc func(context.Context, *ent.UsageTotalMutation) (ent.Value, error)

+ 90 - 0
ent/intercept/intercept.go

@@ -30,6 +30,9 @@ import (
 	"wechat-api/ent/token"
 	"wechat-api/ent/tutorial"
 	"wechat-api/ent/usagedetail"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/usagestatisticmonth"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
 	"wechat-api/ent/wpchatroom"
@@ -719,6 +722,87 @@ func (f TraverseUsageDetail) Traverse(ctx context.Context, q ent.Query) error {
 	return fmt.Errorf("unexpected query type %T. expect *ent.UsageDetailQuery", q)
 }
 
+// The UsageStatisticDayFunc type is an adapter to allow the use of ordinary function as a Querier.
+type UsageStatisticDayFunc func(context.Context, *ent.UsageStatisticDayQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f UsageStatisticDayFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+	if q, ok := q.(*ent.UsageStatisticDayQuery); ok {
+		return f(ctx, q)
+	}
+	return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticDayQuery", q)
+}
+
+// The TraverseUsageStatisticDay type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseUsageStatisticDay func(context.Context, *ent.UsageStatisticDayQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseUsageStatisticDay) Intercept(next ent.Querier) ent.Querier {
+	return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseUsageStatisticDay) Traverse(ctx context.Context, q ent.Query) error {
+	if q, ok := q.(*ent.UsageStatisticDayQuery); ok {
+		return f(ctx, q)
+	}
+	return fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticDayQuery", q)
+}
+
+// The UsageStatisticHourFunc type is an adapter to allow the use of ordinary function as a Querier.
+type UsageStatisticHourFunc func(context.Context, *ent.UsageStatisticHourQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f UsageStatisticHourFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+	if q, ok := q.(*ent.UsageStatisticHourQuery); ok {
+		return f(ctx, q)
+	}
+	return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticHourQuery", q)
+}
+
+// The TraverseUsageStatisticHour type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseUsageStatisticHour func(context.Context, *ent.UsageStatisticHourQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseUsageStatisticHour) Intercept(next ent.Querier) ent.Querier {
+	return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseUsageStatisticHour) Traverse(ctx context.Context, q ent.Query) error {
+	if q, ok := q.(*ent.UsageStatisticHourQuery); ok {
+		return f(ctx, q)
+	}
+	return fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticHourQuery", q)
+}
+
+// The UsageStatisticMonthFunc type is an adapter to allow the use of ordinary function as a Querier.
+type UsageStatisticMonthFunc func(context.Context, *ent.UsageStatisticMonthQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f UsageStatisticMonthFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+	if q, ok := q.(*ent.UsageStatisticMonthQuery); ok {
+		return f(ctx, q)
+	}
+	return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticMonthQuery", q)
+}
+
+// The TraverseUsageStatisticMonth type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseUsageStatisticMonth func(context.Context, *ent.UsageStatisticMonthQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseUsageStatisticMonth) Intercept(next ent.Querier) ent.Querier {
+	return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseUsageStatisticMonth) Traverse(ctx context.Context, q ent.Query) error {
+	if q, ok := q.(*ent.UsageStatisticMonthQuery); ok {
+		return f(ctx, q)
+	}
+	return fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticMonthQuery", q)
+}
+
 // The UsageTotalFunc type is an adapter to allow the use of ordinary function as a Querier.
 type UsageTotalFunc func(context.Context, *ent.UsageTotalQuery) (ent.Value, error)
 
@@ -984,6 +1068,12 @@ func NewQuery(q ent.Query) (Query, error) {
 		return &query[*ent.TutorialQuery, predicate.Tutorial, tutorial.OrderOption]{typ: ent.TypeTutorial, tq: q}, nil
 	case *ent.UsageDetailQuery:
 		return &query[*ent.UsageDetailQuery, predicate.UsageDetail, usagedetail.OrderOption]{typ: ent.TypeUsageDetail, tq: q}, nil
+	case *ent.UsageStatisticDayQuery:
+		return &query[*ent.UsageStatisticDayQuery, predicate.UsageStatisticDay, usagestatisticday.OrderOption]{typ: ent.TypeUsageStatisticDay, tq: q}, nil
+	case *ent.UsageStatisticHourQuery:
+		return &query[*ent.UsageStatisticHourQuery, predicate.UsageStatisticHour, usagestatistichour.OrderOption]{typ: ent.TypeUsageStatisticHour, tq: q}, nil
+	case *ent.UsageStatisticMonthQuery:
+		return &query[*ent.UsageStatisticMonthQuery, predicate.UsageStatisticMonth, usagestatisticmonth.OrderOption]{typ: ent.TypeUsageStatisticMonth, tq: q}, nil
 	case *ent.UsageTotalQuery:
 		return &query[*ent.UsageTotalQuery, predicate.UsageTotal, usagetotal.OrderOption]{typ: ent.TypeUsageTotal, tq: q}, nil
 	case *ent.WorkExperienceQuery:

+ 136 - 7
ent/migrate/schema.go

@@ -289,19 +289,19 @@ var (
 		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
 		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
 		{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
-		{Name: "title", Type: field.TypeString, Size: 255, Comment: "title | 标题"},
-		{Name: "avatar", Type: field.TypeString, Size: 1000, Comment: "avatar | 头像"},
-		{Name: "tags", Type: field.TypeString, Size: 255, Comment: "tags | 个人标签"},
+		{Name: "title", Type: field.TypeString, Size: 1000, Comment: "title | 标题"},
+		{Name: "avatar", Type: field.TypeString, Comment: "avatar | 头像"},
+		{Name: "tags", Type: field.TypeString, Comment: "tags | 个人标签"},
 		{Name: "hire_count", Type: field.TypeInt, Comment: "hire_count | 被雇佣次数", Default: 0},
 		{Name: "service_count", Type: field.TypeInt, Comment: "service_count | 已服务次数", Default: 0},
 		{Name: "achievement_count", Type: field.TypeInt, Comment: "achievement_count | 业绩单数", Default: 0},
-		{Name: "intro", Type: field.TypeString, Size: 1000, Comment: "intro | 个人介绍", Default: ""},
-		{Name: "estimate", Type: field.TypeString, Size: 1000, Comment: "estimate | 自我评价", Default: ""},
-		{Name: "skill", Type: field.TypeString, Size: 1000, Comment: "skill | 技能卡", Default: ""},
+		{Name: "intro", Type: field.TypeString, Comment: "intro | 个人介绍", Default: ""},
+		{Name: "estimate", Type: field.TypeString, Comment: "estimate | 自我评价", Default: ""},
+		{Name: "skill", Type: field.TypeString, Comment: "skill | 技能卡", Default: ""},
 		{Name: "ability_type", Type: field.TypeString, Comment: "ability_type | 能力类型", Default: ""},
 		{Name: "scene", Type: field.TypeString, Comment: "scene | 使用场景", Default: ""},
 		{Name: "switch_in", Type: field.TypeString, Comment: "switch_in | 支持介入", Default: ""},
-		{Name: "video_url", Type: field.TypeString, Size: 1000, Comment: "video_url | 视频地址", Default: ""},
+		{Name: "video_url", Type: field.TypeString, Comment: "video_url | 视频地址", Default: ""},
 		{Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
 		{Name: "category_id", Type: field.TypeUint64, Comment: "category_id | 分类ID"},
 		{Name: "api_base", Type: field.TypeString, Comment: "api_base", Default: ""},
@@ -772,6 +772,123 @@ var (
 			},
 		},
 	}
+	// UsageStatisticDayColumns holds the columns for the "usage_statistic_day" table.
+	UsageStatisticDayColumns = []*schema.Column{
+		{Name: "id", Type: field.TypeUint64, Increment: true},
+		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
+		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
+		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
+		{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
+		{Name: "addtime", Type: field.TypeUint64, Comment: "写入年月日"},
+		{Name: "type", Type: field.TypeInt, Comment: "1-微信 2-名片"},
+		{Name: "bot_id", Type: field.TypeString, Nullable: true, Comment: "微信或名片id"},
+		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构ID"},
+		{Name: "ai_response", Type: field.TypeUint64, Comment: "AI回复次数"},
+		{Name: "sop_run", Type: field.TypeUint64, Comment: "SOP运行次数"},
+		{Name: "total_friend", Type: field.TypeUint64, Comment: "好友总数"},
+		{Name: "total_group", Type: field.TypeUint64, Comment: "群总数"},
+		{Name: "account_balance", Type: field.TypeUint64, Comment: "账户余额(单位:分)"},
+		{Name: "consume_token", Type: field.TypeUint64, Comment: "消耗token数"},
+		{Name: "active_user", Type: field.TypeUint64, Comment: "活跃用户数"},
+		{Name: "new_user", Type: field.TypeInt64, Comment: "新增用户数"},
+		{Name: "label_dist", Type: field.TypeJSON, Comment: "标签分布"},
+	}
+	// UsageStatisticDayTable holds the schema information for the "usage_statistic_day" table.
+	UsageStatisticDayTable = &schema.Table{
+		Name:       "usage_statistic_day",
+		Columns:    UsageStatisticDayColumns,
+		PrimaryKey: []*schema.Column{UsageStatisticDayColumns[0]},
+		Indexes: []*schema.Index{
+			{
+				Name:    "usagestatisticday_addtime",
+				Unique:  false,
+				Columns: []*schema.Column{UsageStatisticDayColumns[5]},
+			},
+			{
+				Name:    "usagestatisticday_bot_id",
+				Unique:  false,
+				Columns: []*schema.Column{UsageStatisticDayColumns[7]},
+			},
+		},
+	}
+	// UsageStatisticHourColumns holds the columns for the "usage_statistic_hour" table.
+	UsageStatisticHourColumns = []*schema.Column{
+		{Name: "id", Type: field.TypeUint64, Increment: true},
+		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
+		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
+		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
+		{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
+		{Name: "addtime", Type: field.TypeUint64, Comment: "写入小时"},
+		{Name: "type", Type: field.TypeInt, Comment: "1-微信 2-名片"},
+		{Name: "bot_id", Type: field.TypeString, Nullable: true, Comment: "微信或名片id"},
+		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构ID"},
+		{Name: "ai_response", Type: field.TypeUint64, Comment: "AI回复次数"},
+		{Name: "sop_run", Type: field.TypeUint64, Comment: "SOP运行次数"},
+		{Name: "total_friend", Type: field.TypeUint64, Comment: "好友总数"},
+		{Name: "total_group", Type: field.TypeUint64, Comment: "群总数"},
+		{Name: "account_balance", Type: field.TypeUint64, Comment: "账户余额(单位:分)"},
+		{Name: "consume_token", Type: field.TypeUint64, Comment: "消耗token数"},
+		{Name: "active_user", Type: field.TypeUint64, Comment: "活跃用户数"},
+		{Name: "new_user", Type: field.TypeInt64, Comment: "新增用户数"},
+		{Name: "label_dist", Type: field.TypeJSON, Comment: "标签分布"},
+	}
+	// UsageStatisticHourTable holds the schema information for the "usage_statistic_hour" table.
+	UsageStatisticHourTable = &schema.Table{
+		Name:       "usage_statistic_hour",
+		Columns:    UsageStatisticHourColumns,
+		PrimaryKey: []*schema.Column{UsageStatisticHourColumns[0]},
+		Indexes: []*schema.Index{
+			{
+				Name:    "usagestatistichour_addtime",
+				Unique:  false,
+				Columns: []*schema.Column{UsageStatisticHourColumns[5]},
+			},
+			{
+				Name:    "usagestatistichour_bot_id",
+				Unique:  false,
+				Columns: []*schema.Column{UsageStatisticHourColumns[7]},
+			},
+		},
+	}
+	// UsageStatisticMonthColumns holds the columns for the "usage_statistic_month" table.
+	UsageStatisticMonthColumns = []*schema.Column{
+		{Name: "id", Type: field.TypeUint64, Increment: true},
+		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
+		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
+		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
+		{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
+		{Name: "addtime", Type: field.TypeUint64, Comment: "写入年月"},
+		{Name: "type", Type: field.TypeInt, Comment: "1-微信 2-名片"},
+		{Name: "bot_id", Type: field.TypeString, Nullable: true, Comment: "微信或名片id"},
+		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构ID"},
+		{Name: "ai_response", Type: field.TypeUint64, Comment: "AI回复次数"},
+		{Name: "sop_run", Type: field.TypeUint64, Comment: "SOP运行次数"},
+		{Name: "total_friend", Type: field.TypeUint64, Comment: "好友总数"},
+		{Name: "total_group", Type: field.TypeUint64, Comment: "群总数"},
+		{Name: "account_balance", Type: field.TypeUint64, Comment: "账户余额(单位:分)"},
+		{Name: "consume_token", Type: field.TypeUint64, Comment: "消耗token数"},
+		{Name: "active_user", Type: field.TypeUint64, Comment: "活跃用户数"},
+		{Name: "new_user", Type: field.TypeInt64, Comment: "新增用户数"},
+		{Name: "label_dist", Type: field.TypeJSON, Comment: "标签分布"},
+	}
+	// UsageStatisticMonthTable holds the schema information for the "usage_statistic_month" table.
+	UsageStatisticMonthTable = &schema.Table{
+		Name:       "usage_statistic_month",
+		Columns:    UsageStatisticMonthColumns,
+		PrimaryKey: []*schema.Column{UsageStatisticMonthColumns[0]},
+		Indexes: []*schema.Index{
+			{
+				Name:    "usagestatisticmonth_addtime",
+				Unique:  false,
+				Columns: []*schema.Column{UsageStatisticMonthColumns[5]},
+			},
+			{
+				Name:    "usagestatisticmonth_bot_id",
+				Unique:  false,
+				Columns: []*schema.Column{UsageStatisticMonthColumns[7]},
+			},
+		},
+	}
 	// UsageTotalColumns holds the columns for the "usage_total" table.
 	UsageTotalColumns = []*schema.Column{
 		{Name: "id", Type: field.TypeUint64, Increment: true},
@@ -1089,6 +1206,9 @@ var (
 		TokenTable,
 		TutorialTable,
 		UsageDetailTable,
+		UsageStatisticDayTable,
+		UsageStatisticHourTable,
+		UsageStatisticMonthTable,
 		UsageTotalTable,
 		WorkExperienceTable,
 		WpChatroomTable,
@@ -1179,6 +1299,15 @@ func init() {
 	UsageDetailTable.Annotation = &entsql.Annotation{
 		Table: "usage_detail",
 	}
+	UsageStatisticDayTable.Annotation = &entsql.Annotation{
+		Table: "usage_statistic_day",
+	}
+	UsageStatisticHourTable.Annotation = &entsql.Annotation{
+		Table: "usage_statistic_hour",
+	}
+	UsageStatisticMonthTable.Annotation = &entsql.Annotation{
+		Table: "usage_statistic_month",
+	}
 	UsageTotalTable.Annotation = &entsql.Annotation{
 		Table: "usage_total",
 	}

+ 5113 - 31
ent/mutation.go

@@ -33,6 +33,9 @@ import (
 	"wechat-api/ent/token"
 	"wechat-api/ent/tutorial"
 	"wechat-api/ent/usagedetail"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/usagestatisticmonth"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
 	"wechat-api/ent/wpchatroom"
@@ -55,37 +58,40 @@ const (
 	OpUpdateOne = ent.OpUpdateOne
 
 	// Node types.
-	TypeAgent             = "Agent"
-	TypeAgentBase         = "AgentBase"
-	TypeAliyunAvatar      = "AliyunAvatar"
-	TypeAllocAgent        = "AllocAgent"
-	TypeBatchMsg          = "BatchMsg"
-	TypeCategory          = "Category"
-	TypeChatRecords       = "ChatRecords"
-	TypeChatSession       = "ChatSession"
-	TypeContact           = "Contact"
-	TypeEmployee          = "Employee"
-	TypeEmployeeConfig    = "EmployeeConfig"
-	TypeLabel             = "Label"
-	TypeLabelRelationship = "LabelRelationship"
-	TypeMessage           = "Message"
-	TypeMessageRecords    = "MessageRecords"
-	TypeMsg               = "Msg"
-	TypeServer            = "Server"
-	TypeSopNode           = "SopNode"
-	TypeSopStage          = "SopStage"
-	TypeSopTask           = "SopTask"
-	TypeToken             = "Token"
-	TypeTutorial          = "Tutorial"
-	TypeUsageDetail       = "UsageDetail"
-	TypeUsageTotal        = "UsageTotal"
-	TypeWorkExperience    = "WorkExperience"
-	TypeWpChatroom        = "WpChatroom"
-	TypeWpChatroomMember  = "WpChatroomMember"
-	TypeWx                = "Wx"
-	TypeWxCard            = "WxCard"
-	TypeWxCardUser        = "WxCardUser"
-	TypeWxCardVisit       = "WxCardVisit"
+	TypeAgent               = "Agent"
+	TypeAgentBase           = "AgentBase"
+	TypeAliyunAvatar        = "AliyunAvatar"
+	TypeAllocAgent          = "AllocAgent"
+	TypeBatchMsg            = "BatchMsg"
+	TypeCategory            = "Category"
+	TypeChatRecords         = "ChatRecords"
+	TypeChatSession         = "ChatSession"
+	TypeContact             = "Contact"
+	TypeEmployee            = "Employee"
+	TypeEmployeeConfig      = "EmployeeConfig"
+	TypeLabel               = "Label"
+	TypeLabelRelationship   = "LabelRelationship"
+	TypeMessage             = "Message"
+	TypeMessageRecords      = "MessageRecords"
+	TypeMsg                 = "Msg"
+	TypeServer              = "Server"
+	TypeSopNode             = "SopNode"
+	TypeSopStage            = "SopStage"
+	TypeSopTask             = "SopTask"
+	TypeToken               = "Token"
+	TypeTutorial            = "Tutorial"
+	TypeUsageDetail         = "UsageDetail"
+	TypeUsageStatisticDay   = "UsageStatisticDay"
+	TypeUsageStatisticHour  = "UsageStatisticHour"
+	TypeUsageStatisticMonth = "UsageStatisticMonth"
+	TypeUsageTotal          = "UsageTotal"
+	TypeWorkExperience      = "WorkExperience"
+	TypeWpChatroom          = "WpChatroom"
+	TypeWpChatroomMember    = "WpChatroomMember"
+	TypeWx                  = "Wx"
+	TypeWxCard              = "WxCard"
+	TypeWxCardUser          = "WxCardUser"
+	TypeWxCardVisit         = "WxCardVisit"
 )
 
 // AgentMutation represents an operation that mutates the Agent nodes in the graph.
@@ -26747,6 +26753,5082 @@ func (m *UsageDetailMutation) ResetEdge(name string) error {
 	return fmt.Errorf("unknown UsageDetail edge %s", name)
 }
 
+// UsageStatisticDayMutation represents an operation that mutates the UsageStatisticDay nodes in the graph.
+type UsageStatisticDayMutation struct {
+	config
+	op                 Op
+	typ                string
+	id                 *uint64
+	created_at         *time.Time
+	updated_at         *time.Time
+	status             *uint8
+	addstatus          *int8
+	deleted_at         *time.Time
+	addtime            *uint64
+	addaddtime         *int64
+	_type              *int
+	add_type           *int
+	bot_id             *string
+	organization_id    *uint64
+	addorganization_id *int64
+	ai_response        *uint64
+	addai_response     *int64
+	sop_run            *uint64
+	addsop_run         *int64
+	total_friend       *uint64
+	addtotal_friend    *int64
+	total_group        *uint64
+	addtotal_group     *int64
+	account_balance    *uint64
+	addaccount_balance *int64
+	consume_token      *uint64
+	addconsume_token   *int64
+	active_user        *uint64
+	addactive_user     *int64
+	new_user           *int64
+	addnew_user        *int64
+	label_dist         *[]custom_types.LabelDist
+	appendlabel_dist   []custom_types.LabelDist
+	clearedFields      map[string]struct{}
+	done               bool
+	oldValue           func(context.Context) (*UsageStatisticDay, error)
+	predicates         []predicate.UsageStatisticDay
+}
+
+var _ ent.Mutation = (*UsageStatisticDayMutation)(nil)
+
+// usagestatisticdayOption allows management of the mutation configuration using functional options.
+type usagestatisticdayOption func(*UsageStatisticDayMutation)
+
+// newUsageStatisticDayMutation creates new mutation for the UsageStatisticDay entity.
+func newUsageStatisticDayMutation(c config, op Op, opts ...usagestatisticdayOption) *UsageStatisticDayMutation {
+	m := &UsageStatisticDayMutation{
+		config:        c,
+		op:            op,
+		typ:           TypeUsageStatisticDay,
+		clearedFields: make(map[string]struct{}),
+	}
+	for _, opt := range opts {
+		opt(m)
+	}
+	return m
+}
+
+// withUsageStatisticDayID sets the ID field of the mutation.
+func withUsageStatisticDayID(id uint64) usagestatisticdayOption {
+	return func(m *UsageStatisticDayMutation) {
+		var (
+			err   error
+			once  sync.Once
+			value *UsageStatisticDay
+		)
+		m.oldValue = func(ctx context.Context) (*UsageStatisticDay, error) {
+			once.Do(func() {
+				if m.done {
+					err = errors.New("querying old values post mutation is not allowed")
+				} else {
+					value, err = m.Client().UsageStatisticDay.Get(ctx, id)
+				}
+			})
+			return value, err
+		}
+		m.id = &id
+	}
+}
+
+// withUsageStatisticDay sets the old UsageStatisticDay of the mutation.
+func withUsageStatisticDay(node *UsageStatisticDay) usagestatisticdayOption {
+	return func(m *UsageStatisticDayMutation) {
+		m.oldValue = func(context.Context) (*UsageStatisticDay, error) {
+			return node, nil
+		}
+		m.id = &node.ID
+	}
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m UsageStatisticDayMutation) Client() *Client {
+	client := &Client{config: m.config}
+	client.init()
+	return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m UsageStatisticDayMutation) Tx() (*Tx, error) {
+	if _, ok := m.driver.(*txDriver); !ok {
+		return nil, errors.New("ent: mutation is not running in a transaction")
+	}
+	tx := &Tx{config: m.config}
+	tx.init()
+	return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of UsageStatisticDay entities.
+func (m *UsageStatisticDayMutation) SetID(id uint64) {
+	m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *UsageStatisticDayMutation) ID() (id uint64, exists bool) {
+	if m.id == nil {
+		return
+	}
+	return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *UsageStatisticDayMutation) IDs(ctx context.Context) ([]uint64, error) {
+	switch {
+	case m.op.Is(OpUpdateOne | OpDeleteOne):
+		id, exists := m.ID()
+		if exists {
+			return []uint64{id}, nil
+		}
+		fallthrough
+	case m.op.Is(OpUpdate | OpDelete):
+		return m.Client().UsageStatisticDay.Query().Where(m.predicates...).IDs(ctx)
+	default:
+		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+	}
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *UsageStatisticDayMutation) SetCreatedAt(t time.Time) {
+	m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *UsageStatisticDayMutation) CreatedAt() (r time.Time, exists bool) {
+	v := m.created_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+	}
+	return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *UsageStatisticDayMutation) ResetCreatedAt() {
+	m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *UsageStatisticDayMutation) SetUpdatedAt(t time.Time) {
+	m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *UsageStatisticDayMutation) UpdatedAt() (r time.Time, exists bool) {
+	v := m.updated_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+	}
+	return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *UsageStatisticDayMutation) ResetUpdatedAt() {
+	m.updated_at = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *UsageStatisticDayMutation) SetStatus(u uint8) {
+	m.status = &u
+	m.addstatus = nil
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *UsageStatisticDayMutation) Status() (r uint8, exists bool) {
+	v := m.status
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldStatus(ctx context.Context) (v uint8, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldStatus requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+	}
+	return oldValue.Status, nil
+}
+
+// AddStatus adds u to the "status" field.
+func (m *UsageStatisticDayMutation) AddStatus(u int8) {
+	if m.addstatus != nil {
+		*m.addstatus += u
+	} else {
+		m.addstatus = &u
+	}
+}
+
+// AddedStatus returns the value that was added to the "status" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedStatus() (r int8, exists bool) {
+	v := m.addstatus
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearStatus clears the value of the "status" field.
+func (m *UsageStatisticDayMutation) ClearStatus() {
+	m.status = nil
+	m.addstatus = nil
+	m.clearedFields[usagestatisticday.FieldStatus] = struct{}{}
+}
+
+// StatusCleared returns if the "status" field was cleared in this mutation.
+func (m *UsageStatisticDayMutation) StatusCleared() bool {
+	_, ok := m.clearedFields[usagestatisticday.FieldStatus]
+	return ok
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *UsageStatisticDayMutation) ResetStatus() {
+	m.status = nil
+	m.addstatus = nil
+	delete(m.clearedFields, usagestatisticday.FieldStatus)
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (m *UsageStatisticDayMutation) SetDeletedAt(t time.Time) {
+	m.deleted_at = &t
+}
+
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
+func (m *UsageStatisticDayMutation) DeletedAt() (r time.Time, exists bool) {
+	v := m.deleted_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldDeletedAt returns the old "deleted_at" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldDeletedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
+	}
+	return oldValue.DeletedAt, nil
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (m *UsageStatisticDayMutation) ClearDeletedAt() {
+	m.deleted_at = nil
+	m.clearedFields[usagestatisticday.FieldDeletedAt] = struct{}{}
+}
+
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
+func (m *UsageStatisticDayMutation) DeletedAtCleared() bool {
+	_, ok := m.clearedFields[usagestatisticday.FieldDeletedAt]
+	return ok
+}
+
+// ResetDeletedAt resets all changes to the "deleted_at" field.
+func (m *UsageStatisticDayMutation) ResetDeletedAt() {
+	m.deleted_at = nil
+	delete(m.clearedFields, usagestatisticday.FieldDeletedAt)
+}
+
+// SetAddtime sets the "addtime" field.
+func (m *UsageStatisticDayMutation) SetAddtime(u uint64) {
+	m.addtime = &u
+	m.addaddtime = nil
+}
+
+// Addtime returns the value of the "addtime" field in the mutation.
+func (m *UsageStatisticDayMutation) Addtime() (r uint64, exists bool) {
+	v := m.addtime
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAddtime returns the old "addtime" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldAddtime(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAddtime is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAddtime requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAddtime: %w", err)
+	}
+	return oldValue.Addtime, nil
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (m *UsageStatisticDayMutation) AddAddtime(u int64) {
+	if m.addaddtime != nil {
+		*m.addaddtime += u
+	} else {
+		m.addaddtime = &u
+	}
+}
+
+// AddedAddtime returns the value that was added to the "addtime" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedAddtime() (r int64, exists bool) {
+	v := m.addaddtime
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAddtime resets all changes to the "addtime" field.
+func (m *UsageStatisticDayMutation) ResetAddtime() {
+	m.addtime = nil
+	m.addaddtime = nil
+}
+
+// SetType sets the "type" field.
+func (m *UsageStatisticDayMutation) SetType(i int) {
+	m._type = &i
+	m.add_type = nil
+}
+
+// GetType returns the value of the "type" field in the mutation.
+func (m *UsageStatisticDayMutation) GetType() (r int, exists bool) {
+	v := m._type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldType returns the old "type" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldType(ctx context.Context) (v int, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldType is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldType requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldType: %w", err)
+	}
+	return oldValue.Type, nil
+}
+
+// AddType adds i to the "type" field.
+func (m *UsageStatisticDayMutation) AddType(i int) {
+	if m.add_type != nil {
+		*m.add_type += i
+	} else {
+		m.add_type = &i
+	}
+}
+
+// AddedType returns the value that was added to the "type" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedType() (r int, exists bool) {
+	v := m.add_type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetType resets all changes to the "type" field.
+func (m *UsageStatisticDayMutation) ResetType() {
+	m._type = nil
+	m.add_type = nil
+}
+
+// SetBotID sets the "bot_id" field.
+func (m *UsageStatisticDayMutation) SetBotID(s string) {
+	m.bot_id = &s
+}
+
+// BotID returns the value of the "bot_id" field in the mutation.
+func (m *UsageStatisticDayMutation) BotID() (r string, exists bool) {
+	v := m.bot_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldBotID returns the old "bot_id" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldBotID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldBotID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldBotID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldBotID: %w", err)
+	}
+	return oldValue.BotID, nil
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (m *UsageStatisticDayMutation) ClearBotID() {
+	m.bot_id = nil
+	m.clearedFields[usagestatisticday.FieldBotID] = struct{}{}
+}
+
+// BotIDCleared returns if the "bot_id" field was cleared in this mutation.
+func (m *UsageStatisticDayMutation) BotIDCleared() bool {
+	_, ok := m.clearedFields[usagestatisticday.FieldBotID]
+	return ok
+}
+
+// ResetBotID resets all changes to the "bot_id" field.
+func (m *UsageStatisticDayMutation) ResetBotID() {
+	m.bot_id = nil
+	delete(m.clearedFields, usagestatisticday.FieldBotID)
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (m *UsageStatisticDayMutation) SetOrganizationID(u uint64) {
+	m.organization_id = &u
+	m.addorganization_id = nil
+}
+
+// OrganizationID returns the value of the "organization_id" field in the mutation.
+func (m *UsageStatisticDayMutation) OrganizationID() (r uint64, exists bool) {
+	v := m.organization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldOrganizationID returns the old "organization_id" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldOrganizationID(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldOrganizationID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldOrganizationID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldOrganizationID: %w", err)
+	}
+	return oldValue.OrganizationID, nil
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (m *UsageStatisticDayMutation) AddOrganizationID(u int64) {
+	if m.addorganization_id != nil {
+		*m.addorganization_id += u
+	} else {
+		m.addorganization_id = &u
+	}
+}
+
+// AddedOrganizationID returns the value that was added to the "organization_id" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedOrganizationID() (r int64, exists bool) {
+	v := m.addorganization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (m *UsageStatisticDayMutation) ClearOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+	m.clearedFields[usagestatisticday.FieldOrganizationID] = struct{}{}
+}
+
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
+func (m *UsageStatisticDayMutation) OrganizationIDCleared() bool {
+	_, ok := m.clearedFields[usagestatisticday.FieldOrganizationID]
+	return ok
+}
+
+// ResetOrganizationID resets all changes to the "organization_id" field.
+func (m *UsageStatisticDayMutation) ResetOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+	delete(m.clearedFields, usagestatisticday.FieldOrganizationID)
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (m *UsageStatisticDayMutation) SetAiResponse(u uint64) {
+	m.ai_response = &u
+	m.addai_response = nil
+}
+
+// AiResponse returns the value of the "ai_response" field in the mutation.
+func (m *UsageStatisticDayMutation) AiResponse() (r uint64, exists bool) {
+	v := m.ai_response
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAiResponse returns the old "ai_response" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldAiResponse(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAiResponse is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAiResponse requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAiResponse: %w", err)
+	}
+	return oldValue.AiResponse, nil
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (m *UsageStatisticDayMutation) AddAiResponse(u int64) {
+	if m.addai_response != nil {
+		*m.addai_response += u
+	} else {
+		m.addai_response = &u
+	}
+}
+
+// AddedAiResponse returns the value that was added to the "ai_response" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedAiResponse() (r int64, exists bool) {
+	v := m.addai_response
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAiResponse resets all changes to the "ai_response" field.
+func (m *UsageStatisticDayMutation) ResetAiResponse() {
+	m.ai_response = nil
+	m.addai_response = nil
+}
+
+// SetSopRun sets the "sop_run" field.
+func (m *UsageStatisticDayMutation) SetSopRun(u uint64) {
+	m.sop_run = &u
+	m.addsop_run = nil
+}
+
+// SopRun returns the value of the "sop_run" field in the mutation.
+func (m *UsageStatisticDayMutation) SopRun() (r uint64, exists bool) {
+	v := m.sop_run
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldSopRun returns the old "sop_run" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldSopRun(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldSopRun is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldSopRun requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldSopRun: %w", err)
+	}
+	return oldValue.SopRun, nil
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (m *UsageStatisticDayMutation) AddSopRun(u int64) {
+	if m.addsop_run != nil {
+		*m.addsop_run += u
+	} else {
+		m.addsop_run = &u
+	}
+}
+
+// AddedSopRun returns the value that was added to the "sop_run" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedSopRun() (r int64, exists bool) {
+	v := m.addsop_run
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetSopRun resets all changes to the "sop_run" field.
+func (m *UsageStatisticDayMutation) ResetSopRun() {
+	m.sop_run = nil
+	m.addsop_run = nil
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (m *UsageStatisticDayMutation) SetTotalFriend(u uint64) {
+	m.total_friend = &u
+	m.addtotal_friend = nil
+}
+
+// TotalFriend returns the value of the "total_friend" field in the mutation.
+func (m *UsageStatisticDayMutation) TotalFriend() (r uint64, exists bool) {
+	v := m.total_friend
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldTotalFriend returns the old "total_friend" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldTotalFriend(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldTotalFriend is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldTotalFriend requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldTotalFriend: %w", err)
+	}
+	return oldValue.TotalFriend, nil
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (m *UsageStatisticDayMutation) AddTotalFriend(u int64) {
+	if m.addtotal_friend != nil {
+		*m.addtotal_friend += u
+	} else {
+		m.addtotal_friend = &u
+	}
+}
+
+// AddedTotalFriend returns the value that was added to the "total_friend" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedTotalFriend() (r int64, exists bool) {
+	v := m.addtotal_friend
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetTotalFriend resets all changes to the "total_friend" field.
+func (m *UsageStatisticDayMutation) ResetTotalFriend() {
+	m.total_friend = nil
+	m.addtotal_friend = nil
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (m *UsageStatisticDayMutation) SetTotalGroup(u uint64) {
+	m.total_group = &u
+	m.addtotal_group = nil
+}
+
+// TotalGroup returns the value of the "total_group" field in the mutation.
+func (m *UsageStatisticDayMutation) TotalGroup() (r uint64, exists bool) {
+	v := m.total_group
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldTotalGroup returns the old "total_group" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldTotalGroup(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldTotalGroup is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldTotalGroup requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldTotalGroup: %w", err)
+	}
+	return oldValue.TotalGroup, nil
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (m *UsageStatisticDayMutation) AddTotalGroup(u int64) {
+	if m.addtotal_group != nil {
+		*m.addtotal_group += u
+	} else {
+		m.addtotal_group = &u
+	}
+}
+
+// AddedTotalGroup returns the value that was added to the "total_group" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedTotalGroup() (r int64, exists bool) {
+	v := m.addtotal_group
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetTotalGroup resets all changes to the "total_group" field.
+func (m *UsageStatisticDayMutation) ResetTotalGroup() {
+	m.total_group = nil
+	m.addtotal_group = nil
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (m *UsageStatisticDayMutation) SetAccountBalance(u uint64) {
+	m.account_balance = &u
+	m.addaccount_balance = nil
+}
+
+// AccountBalance returns the value of the "account_balance" field in the mutation.
+func (m *UsageStatisticDayMutation) AccountBalance() (r uint64, exists bool) {
+	v := m.account_balance
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAccountBalance returns the old "account_balance" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldAccountBalance(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAccountBalance is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAccountBalance requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAccountBalance: %w", err)
+	}
+	return oldValue.AccountBalance, nil
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (m *UsageStatisticDayMutation) AddAccountBalance(u int64) {
+	if m.addaccount_balance != nil {
+		*m.addaccount_balance += u
+	} else {
+		m.addaccount_balance = &u
+	}
+}
+
+// AddedAccountBalance returns the value that was added to the "account_balance" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedAccountBalance() (r int64, exists bool) {
+	v := m.addaccount_balance
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAccountBalance resets all changes to the "account_balance" field.
+func (m *UsageStatisticDayMutation) ResetAccountBalance() {
+	m.account_balance = nil
+	m.addaccount_balance = nil
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (m *UsageStatisticDayMutation) SetConsumeToken(u uint64) {
+	m.consume_token = &u
+	m.addconsume_token = nil
+}
+
+// ConsumeToken returns the value of the "consume_token" field in the mutation.
+func (m *UsageStatisticDayMutation) ConsumeToken() (r uint64, exists bool) {
+	v := m.consume_token
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldConsumeToken returns the old "consume_token" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldConsumeToken(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldConsumeToken is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldConsumeToken requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldConsumeToken: %w", err)
+	}
+	return oldValue.ConsumeToken, nil
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (m *UsageStatisticDayMutation) AddConsumeToken(u int64) {
+	if m.addconsume_token != nil {
+		*m.addconsume_token += u
+	} else {
+		m.addconsume_token = &u
+	}
+}
+
+// AddedConsumeToken returns the value that was added to the "consume_token" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedConsumeToken() (r int64, exists bool) {
+	v := m.addconsume_token
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetConsumeToken resets all changes to the "consume_token" field.
+func (m *UsageStatisticDayMutation) ResetConsumeToken() {
+	m.consume_token = nil
+	m.addconsume_token = nil
+}
+
+// SetActiveUser sets the "active_user" field.
+func (m *UsageStatisticDayMutation) SetActiveUser(u uint64) {
+	m.active_user = &u
+	m.addactive_user = nil
+}
+
+// ActiveUser returns the value of the "active_user" field in the mutation.
+func (m *UsageStatisticDayMutation) ActiveUser() (r uint64, exists bool) {
+	v := m.active_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldActiveUser returns the old "active_user" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldActiveUser(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldActiveUser is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldActiveUser requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldActiveUser: %w", err)
+	}
+	return oldValue.ActiveUser, nil
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (m *UsageStatisticDayMutation) AddActiveUser(u int64) {
+	if m.addactive_user != nil {
+		*m.addactive_user += u
+	} else {
+		m.addactive_user = &u
+	}
+}
+
+// AddedActiveUser returns the value that was added to the "active_user" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedActiveUser() (r int64, exists bool) {
+	v := m.addactive_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetActiveUser resets all changes to the "active_user" field.
+func (m *UsageStatisticDayMutation) ResetActiveUser() {
+	m.active_user = nil
+	m.addactive_user = nil
+}
+
+// SetNewUser sets the "new_user" field.
+func (m *UsageStatisticDayMutation) SetNewUser(i int64) {
+	m.new_user = &i
+	m.addnew_user = nil
+}
+
+// NewUser returns the value of the "new_user" field in the mutation.
+func (m *UsageStatisticDayMutation) NewUser() (r int64, exists bool) {
+	v := m.new_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldNewUser returns the old "new_user" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldNewUser(ctx context.Context) (v int64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldNewUser is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldNewUser requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldNewUser: %w", err)
+	}
+	return oldValue.NewUser, nil
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (m *UsageStatisticDayMutation) AddNewUser(i int64) {
+	if m.addnew_user != nil {
+		*m.addnew_user += i
+	} else {
+		m.addnew_user = &i
+	}
+}
+
+// AddedNewUser returns the value that was added to the "new_user" field in this mutation.
+func (m *UsageStatisticDayMutation) AddedNewUser() (r int64, exists bool) {
+	v := m.addnew_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetNewUser resets all changes to the "new_user" field.
+func (m *UsageStatisticDayMutation) ResetNewUser() {
+	m.new_user = nil
+	m.addnew_user = nil
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (m *UsageStatisticDayMutation) SetLabelDist(ctd []custom_types.LabelDist) {
+	m.label_dist = &ctd
+	m.appendlabel_dist = nil
+}
+
+// LabelDist returns the value of the "label_dist" field in the mutation.
+func (m *UsageStatisticDayMutation) LabelDist() (r []custom_types.LabelDist, exists bool) {
+	v := m.label_dist
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldLabelDist returns the old "label_dist" field's value of the UsageStatisticDay entity.
+// If the UsageStatisticDay object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticDayMutation) OldLabelDist(ctx context.Context) (v []custom_types.LabelDist, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldLabelDist is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldLabelDist requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldLabelDist: %w", err)
+	}
+	return oldValue.LabelDist, nil
+}
+
+// AppendLabelDist adds ctd to the "label_dist" field.
+func (m *UsageStatisticDayMutation) AppendLabelDist(ctd []custom_types.LabelDist) {
+	m.appendlabel_dist = append(m.appendlabel_dist, ctd...)
+}
+
+// AppendedLabelDist returns the list of values that were appended to the "label_dist" field in this mutation.
+func (m *UsageStatisticDayMutation) AppendedLabelDist() ([]custom_types.LabelDist, bool) {
+	if len(m.appendlabel_dist) == 0 {
+		return nil, false
+	}
+	return m.appendlabel_dist, true
+}
+
+// ResetLabelDist resets all changes to the "label_dist" field.
+func (m *UsageStatisticDayMutation) ResetLabelDist() {
+	m.label_dist = nil
+	m.appendlabel_dist = nil
+}
+
+// Where appends a list predicates to the UsageStatisticDayMutation builder.
+func (m *UsageStatisticDayMutation) Where(ps ...predicate.UsageStatisticDay) {
+	m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the UsageStatisticDayMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *UsageStatisticDayMutation) WhereP(ps ...func(*sql.Selector)) {
+	p := make([]predicate.UsageStatisticDay, len(ps))
+	for i := range ps {
+		p[i] = ps[i]
+	}
+	m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *UsageStatisticDayMutation) Op() Op {
+	return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *UsageStatisticDayMutation) SetOp(op Op) {
+	m.op = op
+}
+
+// Type returns the node type of this mutation (UsageStatisticDay).
+func (m *UsageStatisticDayMutation) Type() string {
+	return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *UsageStatisticDayMutation) Fields() []string {
+	fields := make([]string, 0, 17)
+	if m.created_at != nil {
+		fields = append(fields, usagestatisticday.FieldCreatedAt)
+	}
+	if m.updated_at != nil {
+		fields = append(fields, usagestatisticday.FieldUpdatedAt)
+	}
+	if m.status != nil {
+		fields = append(fields, usagestatisticday.FieldStatus)
+	}
+	if m.deleted_at != nil {
+		fields = append(fields, usagestatisticday.FieldDeletedAt)
+	}
+	if m.addtime != nil {
+		fields = append(fields, usagestatisticday.FieldAddtime)
+	}
+	if m._type != nil {
+		fields = append(fields, usagestatisticday.FieldType)
+	}
+	if m.bot_id != nil {
+		fields = append(fields, usagestatisticday.FieldBotID)
+	}
+	if m.organization_id != nil {
+		fields = append(fields, usagestatisticday.FieldOrganizationID)
+	}
+	if m.ai_response != nil {
+		fields = append(fields, usagestatisticday.FieldAiResponse)
+	}
+	if m.sop_run != nil {
+		fields = append(fields, usagestatisticday.FieldSopRun)
+	}
+	if m.total_friend != nil {
+		fields = append(fields, usagestatisticday.FieldTotalFriend)
+	}
+	if m.total_group != nil {
+		fields = append(fields, usagestatisticday.FieldTotalGroup)
+	}
+	if m.account_balance != nil {
+		fields = append(fields, usagestatisticday.FieldAccountBalance)
+	}
+	if m.consume_token != nil {
+		fields = append(fields, usagestatisticday.FieldConsumeToken)
+	}
+	if m.active_user != nil {
+		fields = append(fields, usagestatisticday.FieldActiveUser)
+	}
+	if m.new_user != nil {
+		fields = append(fields, usagestatisticday.FieldNewUser)
+	}
+	if m.label_dist != nil {
+		fields = append(fields, usagestatisticday.FieldLabelDist)
+	}
+	return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *UsageStatisticDayMutation) Field(name string) (ent.Value, bool) {
+	switch name {
+	case usagestatisticday.FieldCreatedAt:
+		return m.CreatedAt()
+	case usagestatisticday.FieldUpdatedAt:
+		return m.UpdatedAt()
+	case usagestatisticday.FieldStatus:
+		return m.Status()
+	case usagestatisticday.FieldDeletedAt:
+		return m.DeletedAt()
+	case usagestatisticday.FieldAddtime:
+		return m.Addtime()
+	case usagestatisticday.FieldType:
+		return m.GetType()
+	case usagestatisticday.FieldBotID:
+		return m.BotID()
+	case usagestatisticday.FieldOrganizationID:
+		return m.OrganizationID()
+	case usagestatisticday.FieldAiResponse:
+		return m.AiResponse()
+	case usagestatisticday.FieldSopRun:
+		return m.SopRun()
+	case usagestatisticday.FieldTotalFriend:
+		return m.TotalFriend()
+	case usagestatisticday.FieldTotalGroup:
+		return m.TotalGroup()
+	case usagestatisticday.FieldAccountBalance:
+		return m.AccountBalance()
+	case usagestatisticday.FieldConsumeToken:
+		return m.ConsumeToken()
+	case usagestatisticday.FieldActiveUser:
+		return m.ActiveUser()
+	case usagestatisticday.FieldNewUser:
+		return m.NewUser()
+	case usagestatisticday.FieldLabelDist:
+		return m.LabelDist()
+	}
+	return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *UsageStatisticDayMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+	switch name {
+	case usagestatisticday.FieldCreatedAt:
+		return m.OldCreatedAt(ctx)
+	case usagestatisticday.FieldUpdatedAt:
+		return m.OldUpdatedAt(ctx)
+	case usagestatisticday.FieldStatus:
+		return m.OldStatus(ctx)
+	case usagestatisticday.FieldDeletedAt:
+		return m.OldDeletedAt(ctx)
+	case usagestatisticday.FieldAddtime:
+		return m.OldAddtime(ctx)
+	case usagestatisticday.FieldType:
+		return m.OldType(ctx)
+	case usagestatisticday.FieldBotID:
+		return m.OldBotID(ctx)
+	case usagestatisticday.FieldOrganizationID:
+		return m.OldOrganizationID(ctx)
+	case usagestatisticday.FieldAiResponse:
+		return m.OldAiResponse(ctx)
+	case usagestatisticday.FieldSopRun:
+		return m.OldSopRun(ctx)
+	case usagestatisticday.FieldTotalFriend:
+		return m.OldTotalFriend(ctx)
+	case usagestatisticday.FieldTotalGroup:
+		return m.OldTotalGroup(ctx)
+	case usagestatisticday.FieldAccountBalance:
+		return m.OldAccountBalance(ctx)
+	case usagestatisticday.FieldConsumeToken:
+		return m.OldConsumeToken(ctx)
+	case usagestatisticday.FieldActiveUser:
+		return m.OldActiveUser(ctx)
+	case usagestatisticday.FieldNewUser:
+		return m.OldNewUser(ctx)
+	case usagestatisticday.FieldLabelDist:
+		return m.OldLabelDist(ctx)
+	}
+	return nil, fmt.Errorf("unknown UsageStatisticDay field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *UsageStatisticDayMutation) SetField(name string, value ent.Value) error {
+	switch name {
+	case usagestatisticday.FieldCreatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetCreatedAt(v)
+		return nil
+	case usagestatisticday.FieldUpdatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetUpdatedAt(v)
+		return nil
+	case usagestatisticday.FieldStatus:
+		v, ok := value.(uint8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetStatus(v)
+		return nil
+	case usagestatisticday.FieldDeletedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetDeletedAt(v)
+		return nil
+	case usagestatisticday.FieldAddtime:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAddtime(v)
+		return nil
+	case usagestatisticday.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetType(v)
+		return nil
+	case usagestatisticday.FieldBotID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetBotID(v)
+		return nil
+	case usagestatisticday.FieldOrganizationID:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetOrganizationID(v)
+		return nil
+	case usagestatisticday.FieldAiResponse:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAiResponse(v)
+		return nil
+	case usagestatisticday.FieldSopRun:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetSopRun(v)
+		return nil
+	case usagestatisticday.FieldTotalFriend:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetTotalFriend(v)
+		return nil
+	case usagestatisticday.FieldTotalGroup:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetTotalGroup(v)
+		return nil
+	case usagestatisticday.FieldAccountBalance:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAccountBalance(v)
+		return nil
+	case usagestatisticday.FieldConsumeToken:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetConsumeToken(v)
+		return nil
+	case usagestatisticday.FieldActiveUser:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetActiveUser(v)
+		return nil
+	case usagestatisticday.FieldNewUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetNewUser(v)
+		return nil
+	case usagestatisticday.FieldLabelDist:
+		v, ok := value.([]custom_types.LabelDist)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetLabelDist(v)
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticDay field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *UsageStatisticDayMutation) AddedFields() []string {
+	var fields []string
+	if m.addstatus != nil {
+		fields = append(fields, usagestatisticday.FieldStatus)
+	}
+	if m.addaddtime != nil {
+		fields = append(fields, usagestatisticday.FieldAddtime)
+	}
+	if m.add_type != nil {
+		fields = append(fields, usagestatisticday.FieldType)
+	}
+	if m.addorganization_id != nil {
+		fields = append(fields, usagestatisticday.FieldOrganizationID)
+	}
+	if m.addai_response != nil {
+		fields = append(fields, usagestatisticday.FieldAiResponse)
+	}
+	if m.addsop_run != nil {
+		fields = append(fields, usagestatisticday.FieldSopRun)
+	}
+	if m.addtotal_friend != nil {
+		fields = append(fields, usagestatisticday.FieldTotalFriend)
+	}
+	if m.addtotal_group != nil {
+		fields = append(fields, usagestatisticday.FieldTotalGroup)
+	}
+	if m.addaccount_balance != nil {
+		fields = append(fields, usagestatisticday.FieldAccountBalance)
+	}
+	if m.addconsume_token != nil {
+		fields = append(fields, usagestatisticday.FieldConsumeToken)
+	}
+	if m.addactive_user != nil {
+		fields = append(fields, usagestatisticday.FieldActiveUser)
+	}
+	if m.addnew_user != nil {
+		fields = append(fields, usagestatisticday.FieldNewUser)
+	}
+	return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *UsageStatisticDayMutation) AddedField(name string) (ent.Value, bool) {
+	switch name {
+	case usagestatisticday.FieldStatus:
+		return m.AddedStatus()
+	case usagestatisticday.FieldAddtime:
+		return m.AddedAddtime()
+	case usagestatisticday.FieldType:
+		return m.AddedType()
+	case usagestatisticday.FieldOrganizationID:
+		return m.AddedOrganizationID()
+	case usagestatisticday.FieldAiResponse:
+		return m.AddedAiResponse()
+	case usagestatisticday.FieldSopRun:
+		return m.AddedSopRun()
+	case usagestatisticday.FieldTotalFriend:
+		return m.AddedTotalFriend()
+	case usagestatisticday.FieldTotalGroup:
+		return m.AddedTotalGroup()
+	case usagestatisticday.FieldAccountBalance:
+		return m.AddedAccountBalance()
+	case usagestatisticday.FieldConsumeToken:
+		return m.AddedConsumeToken()
+	case usagestatisticday.FieldActiveUser:
+		return m.AddedActiveUser()
+	case usagestatisticday.FieldNewUser:
+		return m.AddedNewUser()
+	}
+	return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *UsageStatisticDayMutation) AddField(name string, value ent.Value) error {
+	switch name {
+	case usagestatisticday.FieldStatus:
+		v, ok := value.(int8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddStatus(v)
+		return nil
+	case usagestatisticday.FieldAddtime:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAddtime(v)
+		return nil
+	case usagestatisticday.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddType(v)
+		return nil
+	case usagestatisticday.FieldOrganizationID:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddOrganizationID(v)
+		return nil
+	case usagestatisticday.FieldAiResponse:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAiResponse(v)
+		return nil
+	case usagestatisticday.FieldSopRun:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddSopRun(v)
+		return nil
+	case usagestatisticday.FieldTotalFriend:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddTotalFriend(v)
+		return nil
+	case usagestatisticday.FieldTotalGroup:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddTotalGroup(v)
+		return nil
+	case usagestatisticday.FieldAccountBalance:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAccountBalance(v)
+		return nil
+	case usagestatisticday.FieldConsumeToken:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddConsumeToken(v)
+		return nil
+	case usagestatisticday.FieldActiveUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddActiveUser(v)
+		return nil
+	case usagestatisticday.FieldNewUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddNewUser(v)
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticDay numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *UsageStatisticDayMutation) ClearedFields() []string {
+	var fields []string
+	if m.FieldCleared(usagestatisticday.FieldStatus) {
+		fields = append(fields, usagestatisticday.FieldStatus)
+	}
+	if m.FieldCleared(usagestatisticday.FieldDeletedAt) {
+		fields = append(fields, usagestatisticday.FieldDeletedAt)
+	}
+	if m.FieldCleared(usagestatisticday.FieldBotID) {
+		fields = append(fields, usagestatisticday.FieldBotID)
+	}
+	if m.FieldCleared(usagestatisticday.FieldOrganizationID) {
+		fields = append(fields, usagestatisticday.FieldOrganizationID)
+	}
+	return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *UsageStatisticDayMutation) FieldCleared(name string) bool {
+	_, ok := m.clearedFields[name]
+	return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *UsageStatisticDayMutation) ClearField(name string) error {
+	switch name {
+	case usagestatisticday.FieldStatus:
+		m.ClearStatus()
+		return nil
+	case usagestatisticday.FieldDeletedAt:
+		m.ClearDeletedAt()
+		return nil
+	case usagestatisticday.FieldBotID:
+		m.ClearBotID()
+		return nil
+	case usagestatisticday.FieldOrganizationID:
+		m.ClearOrganizationID()
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticDay nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *UsageStatisticDayMutation) ResetField(name string) error {
+	switch name {
+	case usagestatisticday.FieldCreatedAt:
+		m.ResetCreatedAt()
+		return nil
+	case usagestatisticday.FieldUpdatedAt:
+		m.ResetUpdatedAt()
+		return nil
+	case usagestatisticday.FieldStatus:
+		m.ResetStatus()
+		return nil
+	case usagestatisticday.FieldDeletedAt:
+		m.ResetDeletedAt()
+		return nil
+	case usagestatisticday.FieldAddtime:
+		m.ResetAddtime()
+		return nil
+	case usagestatisticday.FieldType:
+		m.ResetType()
+		return nil
+	case usagestatisticday.FieldBotID:
+		m.ResetBotID()
+		return nil
+	case usagestatisticday.FieldOrganizationID:
+		m.ResetOrganizationID()
+		return nil
+	case usagestatisticday.FieldAiResponse:
+		m.ResetAiResponse()
+		return nil
+	case usagestatisticday.FieldSopRun:
+		m.ResetSopRun()
+		return nil
+	case usagestatisticday.FieldTotalFriend:
+		m.ResetTotalFriend()
+		return nil
+	case usagestatisticday.FieldTotalGroup:
+		m.ResetTotalGroup()
+		return nil
+	case usagestatisticday.FieldAccountBalance:
+		m.ResetAccountBalance()
+		return nil
+	case usagestatisticday.FieldConsumeToken:
+		m.ResetConsumeToken()
+		return nil
+	case usagestatisticday.FieldActiveUser:
+		m.ResetActiveUser()
+		return nil
+	case usagestatisticday.FieldNewUser:
+		m.ResetNewUser()
+		return nil
+	case usagestatisticday.FieldLabelDist:
+		m.ResetLabelDist()
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticDay field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *UsageStatisticDayMutation) AddedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *UsageStatisticDayMutation) AddedIDs(name string) []ent.Value {
+	return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *UsageStatisticDayMutation) RemovedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *UsageStatisticDayMutation) RemovedIDs(name string) []ent.Value {
+	return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *UsageStatisticDayMutation) ClearedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *UsageStatisticDayMutation) EdgeCleared(name string) bool {
+	return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *UsageStatisticDayMutation) ClearEdge(name string) error {
+	return fmt.Errorf("unknown UsageStatisticDay unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *UsageStatisticDayMutation) ResetEdge(name string) error {
+	return fmt.Errorf("unknown UsageStatisticDay edge %s", name)
+}
+
+// UsageStatisticHourMutation represents an operation that mutates the UsageStatisticHour nodes in the graph.
+type UsageStatisticHourMutation struct {
+	config
+	op                 Op
+	typ                string
+	id                 *uint64
+	created_at         *time.Time
+	updated_at         *time.Time
+	status             *uint8
+	addstatus          *int8
+	deleted_at         *time.Time
+	addtime            *uint64
+	addaddtime         *int64
+	_type              *int
+	add_type           *int
+	bot_id             *string
+	organization_id    *uint64
+	addorganization_id *int64
+	ai_response        *uint64
+	addai_response     *int64
+	sop_run            *uint64
+	addsop_run         *int64
+	total_friend       *uint64
+	addtotal_friend    *int64
+	total_group        *uint64
+	addtotal_group     *int64
+	account_balance    *uint64
+	addaccount_balance *int64
+	consume_token      *uint64
+	addconsume_token   *int64
+	active_user        *uint64
+	addactive_user     *int64
+	new_user           *int64
+	addnew_user        *int64
+	label_dist         *[]custom_types.LabelDist
+	appendlabel_dist   []custom_types.LabelDist
+	clearedFields      map[string]struct{}
+	done               bool
+	oldValue           func(context.Context) (*UsageStatisticHour, error)
+	predicates         []predicate.UsageStatisticHour
+}
+
+var _ ent.Mutation = (*UsageStatisticHourMutation)(nil)
+
+// usagestatistichourOption allows management of the mutation configuration using functional options.
+type usagestatistichourOption func(*UsageStatisticHourMutation)
+
+// newUsageStatisticHourMutation creates new mutation for the UsageStatisticHour entity.
+func newUsageStatisticHourMutation(c config, op Op, opts ...usagestatistichourOption) *UsageStatisticHourMutation {
+	m := &UsageStatisticHourMutation{
+		config:        c,
+		op:            op,
+		typ:           TypeUsageStatisticHour,
+		clearedFields: make(map[string]struct{}),
+	}
+	for _, opt := range opts {
+		opt(m)
+	}
+	return m
+}
+
+// withUsageStatisticHourID sets the ID field of the mutation.
+func withUsageStatisticHourID(id uint64) usagestatistichourOption {
+	return func(m *UsageStatisticHourMutation) {
+		var (
+			err   error
+			once  sync.Once
+			value *UsageStatisticHour
+		)
+		m.oldValue = func(ctx context.Context) (*UsageStatisticHour, error) {
+			once.Do(func() {
+				if m.done {
+					err = errors.New("querying old values post mutation is not allowed")
+				} else {
+					value, err = m.Client().UsageStatisticHour.Get(ctx, id)
+				}
+			})
+			return value, err
+		}
+		m.id = &id
+	}
+}
+
+// withUsageStatisticHour sets the old UsageStatisticHour of the mutation.
+func withUsageStatisticHour(node *UsageStatisticHour) usagestatistichourOption {
+	return func(m *UsageStatisticHourMutation) {
+		m.oldValue = func(context.Context) (*UsageStatisticHour, error) {
+			return node, nil
+		}
+		m.id = &node.ID
+	}
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m UsageStatisticHourMutation) Client() *Client {
+	client := &Client{config: m.config}
+	client.init()
+	return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m UsageStatisticHourMutation) Tx() (*Tx, error) {
+	if _, ok := m.driver.(*txDriver); !ok {
+		return nil, errors.New("ent: mutation is not running in a transaction")
+	}
+	tx := &Tx{config: m.config}
+	tx.init()
+	return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of UsageStatisticHour entities.
+func (m *UsageStatisticHourMutation) SetID(id uint64) {
+	m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *UsageStatisticHourMutation) ID() (id uint64, exists bool) {
+	if m.id == nil {
+		return
+	}
+	return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *UsageStatisticHourMutation) IDs(ctx context.Context) ([]uint64, error) {
+	switch {
+	case m.op.Is(OpUpdateOne | OpDeleteOne):
+		id, exists := m.ID()
+		if exists {
+			return []uint64{id}, nil
+		}
+		fallthrough
+	case m.op.Is(OpUpdate | OpDelete):
+		return m.Client().UsageStatisticHour.Query().Where(m.predicates...).IDs(ctx)
+	default:
+		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+	}
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *UsageStatisticHourMutation) SetCreatedAt(t time.Time) {
+	m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *UsageStatisticHourMutation) CreatedAt() (r time.Time, exists bool) {
+	v := m.created_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+	}
+	return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *UsageStatisticHourMutation) ResetCreatedAt() {
+	m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *UsageStatisticHourMutation) SetUpdatedAt(t time.Time) {
+	m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *UsageStatisticHourMutation) UpdatedAt() (r time.Time, exists bool) {
+	v := m.updated_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+	}
+	return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *UsageStatisticHourMutation) ResetUpdatedAt() {
+	m.updated_at = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *UsageStatisticHourMutation) SetStatus(u uint8) {
+	m.status = &u
+	m.addstatus = nil
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *UsageStatisticHourMutation) Status() (r uint8, exists bool) {
+	v := m.status
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldStatus(ctx context.Context) (v uint8, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldStatus requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+	}
+	return oldValue.Status, nil
+}
+
+// AddStatus adds u to the "status" field.
+func (m *UsageStatisticHourMutation) AddStatus(u int8) {
+	if m.addstatus != nil {
+		*m.addstatus += u
+	} else {
+		m.addstatus = &u
+	}
+}
+
+// AddedStatus returns the value that was added to the "status" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedStatus() (r int8, exists bool) {
+	v := m.addstatus
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearStatus clears the value of the "status" field.
+func (m *UsageStatisticHourMutation) ClearStatus() {
+	m.status = nil
+	m.addstatus = nil
+	m.clearedFields[usagestatistichour.FieldStatus] = struct{}{}
+}
+
+// StatusCleared returns if the "status" field was cleared in this mutation.
+func (m *UsageStatisticHourMutation) StatusCleared() bool {
+	_, ok := m.clearedFields[usagestatistichour.FieldStatus]
+	return ok
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *UsageStatisticHourMutation) ResetStatus() {
+	m.status = nil
+	m.addstatus = nil
+	delete(m.clearedFields, usagestatistichour.FieldStatus)
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (m *UsageStatisticHourMutation) SetDeletedAt(t time.Time) {
+	m.deleted_at = &t
+}
+
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
+func (m *UsageStatisticHourMutation) DeletedAt() (r time.Time, exists bool) {
+	v := m.deleted_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldDeletedAt returns the old "deleted_at" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldDeletedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
+	}
+	return oldValue.DeletedAt, nil
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (m *UsageStatisticHourMutation) ClearDeletedAt() {
+	m.deleted_at = nil
+	m.clearedFields[usagestatistichour.FieldDeletedAt] = struct{}{}
+}
+
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
+func (m *UsageStatisticHourMutation) DeletedAtCleared() bool {
+	_, ok := m.clearedFields[usagestatistichour.FieldDeletedAt]
+	return ok
+}
+
+// ResetDeletedAt resets all changes to the "deleted_at" field.
+func (m *UsageStatisticHourMutation) ResetDeletedAt() {
+	m.deleted_at = nil
+	delete(m.clearedFields, usagestatistichour.FieldDeletedAt)
+}
+
+// SetAddtime sets the "addtime" field.
+func (m *UsageStatisticHourMutation) SetAddtime(u uint64) {
+	m.addtime = &u
+	m.addaddtime = nil
+}
+
+// Addtime returns the value of the "addtime" field in the mutation.
+func (m *UsageStatisticHourMutation) Addtime() (r uint64, exists bool) {
+	v := m.addtime
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAddtime returns the old "addtime" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldAddtime(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAddtime is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAddtime requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAddtime: %w", err)
+	}
+	return oldValue.Addtime, nil
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (m *UsageStatisticHourMutation) AddAddtime(u int64) {
+	if m.addaddtime != nil {
+		*m.addaddtime += u
+	} else {
+		m.addaddtime = &u
+	}
+}
+
+// AddedAddtime returns the value that was added to the "addtime" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedAddtime() (r int64, exists bool) {
+	v := m.addaddtime
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAddtime resets all changes to the "addtime" field.
+func (m *UsageStatisticHourMutation) ResetAddtime() {
+	m.addtime = nil
+	m.addaddtime = nil
+}
+
+// SetType sets the "type" field.
+func (m *UsageStatisticHourMutation) SetType(i int) {
+	m._type = &i
+	m.add_type = nil
+}
+
+// GetType returns the value of the "type" field in the mutation.
+func (m *UsageStatisticHourMutation) GetType() (r int, exists bool) {
+	v := m._type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldType returns the old "type" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldType(ctx context.Context) (v int, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldType is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldType requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldType: %w", err)
+	}
+	return oldValue.Type, nil
+}
+
+// AddType adds i to the "type" field.
+func (m *UsageStatisticHourMutation) AddType(i int) {
+	if m.add_type != nil {
+		*m.add_type += i
+	} else {
+		m.add_type = &i
+	}
+}
+
+// AddedType returns the value that was added to the "type" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedType() (r int, exists bool) {
+	v := m.add_type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetType resets all changes to the "type" field.
+func (m *UsageStatisticHourMutation) ResetType() {
+	m._type = nil
+	m.add_type = nil
+}
+
+// SetBotID sets the "bot_id" field.
+func (m *UsageStatisticHourMutation) SetBotID(s string) {
+	m.bot_id = &s
+}
+
+// BotID returns the value of the "bot_id" field in the mutation.
+func (m *UsageStatisticHourMutation) BotID() (r string, exists bool) {
+	v := m.bot_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldBotID returns the old "bot_id" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldBotID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldBotID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldBotID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldBotID: %w", err)
+	}
+	return oldValue.BotID, nil
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (m *UsageStatisticHourMutation) ClearBotID() {
+	m.bot_id = nil
+	m.clearedFields[usagestatistichour.FieldBotID] = struct{}{}
+}
+
+// BotIDCleared returns if the "bot_id" field was cleared in this mutation.
+func (m *UsageStatisticHourMutation) BotIDCleared() bool {
+	_, ok := m.clearedFields[usagestatistichour.FieldBotID]
+	return ok
+}
+
+// ResetBotID resets all changes to the "bot_id" field.
+func (m *UsageStatisticHourMutation) ResetBotID() {
+	m.bot_id = nil
+	delete(m.clearedFields, usagestatistichour.FieldBotID)
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (m *UsageStatisticHourMutation) SetOrganizationID(u uint64) {
+	m.organization_id = &u
+	m.addorganization_id = nil
+}
+
+// OrganizationID returns the value of the "organization_id" field in the mutation.
+func (m *UsageStatisticHourMutation) OrganizationID() (r uint64, exists bool) {
+	v := m.organization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldOrganizationID returns the old "organization_id" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldOrganizationID(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldOrganizationID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldOrganizationID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldOrganizationID: %w", err)
+	}
+	return oldValue.OrganizationID, nil
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (m *UsageStatisticHourMutation) AddOrganizationID(u int64) {
+	if m.addorganization_id != nil {
+		*m.addorganization_id += u
+	} else {
+		m.addorganization_id = &u
+	}
+}
+
+// AddedOrganizationID returns the value that was added to the "organization_id" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedOrganizationID() (r int64, exists bool) {
+	v := m.addorganization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (m *UsageStatisticHourMutation) ClearOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+	m.clearedFields[usagestatistichour.FieldOrganizationID] = struct{}{}
+}
+
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
+func (m *UsageStatisticHourMutation) OrganizationIDCleared() bool {
+	_, ok := m.clearedFields[usagestatistichour.FieldOrganizationID]
+	return ok
+}
+
+// ResetOrganizationID resets all changes to the "organization_id" field.
+func (m *UsageStatisticHourMutation) ResetOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+	delete(m.clearedFields, usagestatistichour.FieldOrganizationID)
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (m *UsageStatisticHourMutation) SetAiResponse(u uint64) {
+	m.ai_response = &u
+	m.addai_response = nil
+}
+
+// AiResponse returns the value of the "ai_response" field in the mutation.
+func (m *UsageStatisticHourMutation) AiResponse() (r uint64, exists bool) {
+	v := m.ai_response
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAiResponse returns the old "ai_response" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldAiResponse(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAiResponse is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAiResponse requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAiResponse: %w", err)
+	}
+	return oldValue.AiResponse, nil
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (m *UsageStatisticHourMutation) AddAiResponse(u int64) {
+	if m.addai_response != nil {
+		*m.addai_response += u
+	} else {
+		m.addai_response = &u
+	}
+}
+
+// AddedAiResponse returns the value that was added to the "ai_response" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedAiResponse() (r int64, exists bool) {
+	v := m.addai_response
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAiResponse resets all changes to the "ai_response" field.
+func (m *UsageStatisticHourMutation) ResetAiResponse() {
+	m.ai_response = nil
+	m.addai_response = nil
+}
+
+// SetSopRun sets the "sop_run" field.
+func (m *UsageStatisticHourMutation) SetSopRun(u uint64) {
+	m.sop_run = &u
+	m.addsop_run = nil
+}
+
+// SopRun returns the value of the "sop_run" field in the mutation.
+func (m *UsageStatisticHourMutation) SopRun() (r uint64, exists bool) {
+	v := m.sop_run
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldSopRun returns the old "sop_run" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldSopRun(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldSopRun is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldSopRun requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldSopRun: %w", err)
+	}
+	return oldValue.SopRun, nil
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (m *UsageStatisticHourMutation) AddSopRun(u int64) {
+	if m.addsop_run != nil {
+		*m.addsop_run += u
+	} else {
+		m.addsop_run = &u
+	}
+}
+
+// AddedSopRun returns the value that was added to the "sop_run" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedSopRun() (r int64, exists bool) {
+	v := m.addsop_run
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetSopRun resets all changes to the "sop_run" field.
+func (m *UsageStatisticHourMutation) ResetSopRun() {
+	m.sop_run = nil
+	m.addsop_run = nil
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (m *UsageStatisticHourMutation) SetTotalFriend(u uint64) {
+	m.total_friend = &u
+	m.addtotal_friend = nil
+}
+
+// TotalFriend returns the value of the "total_friend" field in the mutation.
+func (m *UsageStatisticHourMutation) TotalFriend() (r uint64, exists bool) {
+	v := m.total_friend
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldTotalFriend returns the old "total_friend" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldTotalFriend(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldTotalFriend is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldTotalFriend requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldTotalFriend: %w", err)
+	}
+	return oldValue.TotalFriend, nil
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (m *UsageStatisticHourMutation) AddTotalFriend(u int64) {
+	if m.addtotal_friend != nil {
+		*m.addtotal_friend += u
+	} else {
+		m.addtotal_friend = &u
+	}
+}
+
+// AddedTotalFriend returns the value that was added to the "total_friend" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedTotalFriend() (r int64, exists bool) {
+	v := m.addtotal_friend
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetTotalFriend resets all changes to the "total_friend" field.
+func (m *UsageStatisticHourMutation) ResetTotalFriend() {
+	m.total_friend = nil
+	m.addtotal_friend = nil
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (m *UsageStatisticHourMutation) SetTotalGroup(u uint64) {
+	m.total_group = &u
+	m.addtotal_group = nil
+}
+
+// TotalGroup returns the value of the "total_group" field in the mutation.
+func (m *UsageStatisticHourMutation) TotalGroup() (r uint64, exists bool) {
+	v := m.total_group
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldTotalGroup returns the old "total_group" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldTotalGroup(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldTotalGroup is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldTotalGroup requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldTotalGroup: %w", err)
+	}
+	return oldValue.TotalGroup, nil
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (m *UsageStatisticHourMutation) AddTotalGroup(u int64) {
+	if m.addtotal_group != nil {
+		*m.addtotal_group += u
+	} else {
+		m.addtotal_group = &u
+	}
+}
+
+// AddedTotalGroup returns the value that was added to the "total_group" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedTotalGroup() (r int64, exists bool) {
+	v := m.addtotal_group
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetTotalGroup resets all changes to the "total_group" field.
+func (m *UsageStatisticHourMutation) ResetTotalGroup() {
+	m.total_group = nil
+	m.addtotal_group = nil
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (m *UsageStatisticHourMutation) SetAccountBalance(u uint64) {
+	m.account_balance = &u
+	m.addaccount_balance = nil
+}
+
+// AccountBalance returns the value of the "account_balance" field in the mutation.
+func (m *UsageStatisticHourMutation) AccountBalance() (r uint64, exists bool) {
+	v := m.account_balance
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAccountBalance returns the old "account_balance" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldAccountBalance(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAccountBalance is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAccountBalance requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAccountBalance: %w", err)
+	}
+	return oldValue.AccountBalance, nil
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (m *UsageStatisticHourMutation) AddAccountBalance(u int64) {
+	if m.addaccount_balance != nil {
+		*m.addaccount_balance += u
+	} else {
+		m.addaccount_balance = &u
+	}
+}
+
+// AddedAccountBalance returns the value that was added to the "account_balance" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedAccountBalance() (r int64, exists bool) {
+	v := m.addaccount_balance
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAccountBalance resets all changes to the "account_balance" field.
+func (m *UsageStatisticHourMutation) ResetAccountBalance() {
+	m.account_balance = nil
+	m.addaccount_balance = nil
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (m *UsageStatisticHourMutation) SetConsumeToken(u uint64) {
+	m.consume_token = &u
+	m.addconsume_token = nil
+}
+
+// ConsumeToken returns the value of the "consume_token" field in the mutation.
+func (m *UsageStatisticHourMutation) ConsumeToken() (r uint64, exists bool) {
+	v := m.consume_token
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldConsumeToken returns the old "consume_token" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldConsumeToken(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldConsumeToken is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldConsumeToken requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldConsumeToken: %w", err)
+	}
+	return oldValue.ConsumeToken, nil
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (m *UsageStatisticHourMutation) AddConsumeToken(u int64) {
+	if m.addconsume_token != nil {
+		*m.addconsume_token += u
+	} else {
+		m.addconsume_token = &u
+	}
+}
+
+// AddedConsumeToken returns the value that was added to the "consume_token" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedConsumeToken() (r int64, exists bool) {
+	v := m.addconsume_token
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetConsumeToken resets all changes to the "consume_token" field.
+func (m *UsageStatisticHourMutation) ResetConsumeToken() {
+	m.consume_token = nil
+	m.addconsume_token = nil
+}
+
+// SetActiveUser sets the "active_user" field.
+func (m *UsageStatisticHourMutation) SetActiveUser(u uint64) {
+	m.active_user = &u
+	m.addactive_user = nil
+}
+
+// ActiveUser returns the value of the "active_user" field in the mutation.
+func (m *UsageStatisticHourMutation) ActiveUser() (r uint64, exists bool) {
+	v := m.active_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldActiveUser returns the old "active_user" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldActiveUser(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldActiveUser is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldActiveUser requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldActiveUser: %w", err)
+	}
+	return oldValue.ActiveUser, nil
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (m *UsageStatisticHourMutation) AddActiveUser(u int64) {
+	if m.addactive_user != nil {
+		*m.addactive_user += u
+	} else {
+		m.addactive_user = &u
+	}
+}
+
+// AddedActiveUser returns the value that was added to the "active_user" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedActiveUser() (r int64, exists bool) {
+	v := m.addactive_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetActiveUser resets all changes to the "active_user" field.
+func (m *UsageStatisticHourMutation) ResetActiveUser() {
+	m.active_user = nil
+	m.addactive_user = nil
+}
+
+// SetNewUser sets the "new_user" field.
+func (m *UsageStatisticHourMutation) SetNewUser(i int64) {
+	m.new_user = &i
+	m.addnew_user = nil
+}
+
+// NewUser returns the value of the "new_user" field in the mutation.
+func (m *UsageStatisticHourMutation) NewUser() (r int64, exists bool) {
+	v := m.new_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldNewUser returns the old "new_user" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldNewUser(ctx context.Context) (v int64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldNewUser is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldNewUser requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldNewUser: %w", err)
+	}
+	return oldValue.NewUser, nil
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (m *UsageStatisticHourMutation) AddNewUser(i int64) {
+	if m.addnew_user != nil {
+		*m.addnew_user += i
+	} else {
+		m.addnew_user = &i
+	}
+}
+
+// AddedNewUser returns the value that was added to the "new_user" field in this mutation.
+func (m *UsageStatisticHourMutation) AddedNewUser() (r int64, exists bool) {
+	v := m.addnew_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetNewUser resets all changes to the "new_user" field.
+func (m *UsageStatisticHourMutation) ResetNewUser() {
+	m.new_user = nil
+	m.addnew_user = nil
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (m *UsageStatisticHourMutation) SetLabelDist(ctd []custom_types.LabelDist) {
+	m.label_dist = &ctd
+	m.appendlabel_dist = nil
+}
+
+// LabelDist returns the value of the "label_dist" field in the mutation.
+func (m *UsageStatisticHourMutation) LabelDist() (r []custom_types.LabelDist, exists bool) {
+	v := m.label_dist
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldLabelDist returns the old "label_dist" field's value of the UsageStatisticHour entity.
+// If the UsageStatisticHour object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticHourMutation) OldLabelDist(ctx context.Context) (v []custom_types.LabelDist, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldLabelDist is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldLabelDist requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldLabelDist: %w", err)
+	}
+	return oldValue.LabelDist, nil
+}
+
+// AppendLabelDist adds ctd to the "label_dist" field.
+func (m *UsageStatisticHourMutation) AppendLabelDist(ctd []custom_types.LabelDist) {
+	m.appendlabel_dist = append(m.appendlabel_dist, ctd...)
+}
+
+// AppendedLabelDist returns the list of values that were appended to the "label_dist" field in this mutation.
+func (m *UsageStatisticHourMutation) AppendedLabelDist() ([]custom_types.LabelDist, bool) {
+	if len(m.appendlabel_dist) == 0 {
+		return nil, false
+	}
+	return m.appendlabel_dist, true
+}
+
+// ResetLabelDist resets all changes to the "label_dist" field.
+func (m *UsageStatisticHourMutation) ResetLabelDist() {
+	m.label_dist = nil
+	m.appendlabel_dist = nil
+}
+
+// Where appends a list predicates to the UsageStatisticHourMutation builder.
+func (m *UsageStatisticHourMutation) Where(ps ...predicate.UsageStatisticHour) {
+	m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the UsageStatisticHourMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *UsageStatisticHourMutation) WhereP(ps ...func(*sql.Selector)) {
+	p := make([]predicate.UsageStatisticHour, len(ps))
+	for i := range ps {
+		p[i] = ps[i]
+	}
+	m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *UsageStatisticHourMutation) Op() Op {
+	return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *UsageStatisticHourMutation) SetOp(op Op) {
+	m.op = op
+}
+
+// Type returns the node type of this mutation (UsageStatisticHour).
+func (m *UsageStatisticHourMutation) Type() string {
+	return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *UsageStatisticHourMutation) Fields() []string {
+	fields := make([]string, 0, 17)
+	if m.created_at != nil {
+		fields = append(fields, usagestatistichour.FieldCreatedAt)
+	}
+	if m.updated_at != nil {
+		fields = append(fields, usagestatistichour.FieldUpdatedAt)
+	}
+	if m.status != nil {
+		fields = append(fields, usagestatistichour.FieldStatus)
+	}
+	if m.deleted_at != nil {
+		fields = append(fields, usagestatistichour.FieldDeletedAt)
+	}
+	if m.addtime != nil {
+		fields = append(fields, usagestatistichour.FieldAddtime)
+	}
+	if m._type != nil {
+		fields = append(fields, usagestatistichour.FieldType)
+	}
+	if m.bot_id != nil {
+		fields = append(fields, usagestatistichour.FieldBotID)
+	}
+	if m.organization_id != nil {
+		fields = append(fields, usagestatistichour.FieldOrganizationID)
+	}
+	if m.ai_response != nil {
+		fields = append(fields, usagestatistichour.FieldAiResponse)
+	}
+	if m.sop_run != nil {
+		fields = append(fields, usagestatistichour.FieldSopRun)
+	}
+	if m.total_friend != nil {
+		fields = append(fields, usagestatistichour.FieldTotalFriend)
+	}
+	if m.total_group != nil {
+		fields = append(fields, usagestatistichour.FieldTotalGroup)
+	}
+	if m.account_balance != nil {
+		fields = append(fields, usagestatistichour.FieldAccountBalance)
+	}
+	if m.consume_token != nil {
+		fields = append(fields, usagestatistichour.FieldConsumeToken)
+	}
+	if m.active_user != nil {
+		fields = append(fields, usagestatistichour.FieldActiveUser)
+	}
+	if m.new_user != nil {
+		fields = append(fields, usagestatistichour.FieldNewUser)
+	}
+	if m.label_dist != nil {
+		fields = append(fields, usagestatistichour.FieldLabelDist)
+	}
+	return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *UsageStatisticHourMutation) Field(name string) (ent.Value, bool) {
+	switch name {
+	case usagestatistichour.FieldCreatedAt:
+		return m.CreatedAt()
+	case usagestatistichour.FieldUpdatedAt:
+		return m.UpdatedAt()
+	case usagestatistichour.FieldStatus:
+		return m.Status()
+	case usagestatistichour.FieldDeletedAt:
+		return m.DeletedAt()
+	case usagestatistichour.FieldAddtime:
+		return m.Addtime()
+	case usagestatistichour.FieldType:
+		return m.GetType()
+	case usagestatistichour.FieldBotID:
+		return m.BotID()
+	case usagestatistichour.FieldOrganizationID:
+		return m.OrganizationID()
+	case usagestatistichour.FieldAiResponse:
+		return m.AiResponse()
+	case usagestatistichour.FieldSopRun:
+		return m.SopRun()
+	case usagestatistichour.FieldTotalFriend:
+		return m.TotalFriend()
+	case usagestatistichour.FieldTotalGroup:
+		return m.TotalGroup()
+	case usagestatistichour.FieldAccountBalance:
+		return m.AccountBalance()
+	case usagestatistichour.FieldConsumeToken:
+		return m.ConsumeToken()
+	case usagestatistichour.FieldActiveUser:
+		return m.ActiveUser()
+	case usagestatistichour.FieldNewUser:
+		return m.NewUser()
+	case usagestatistichour.FieldLabelDist:
+		return m.LabelDist()
+	}
+	return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *UsageStatisticHourMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+	switch name {
+	case usagestatistichour.FieldCreatedAt:
+		return m.OldCreatedAt(ctx)
+	case usagestatistichour.FieldUpdatedAt:
+		return m.OldUpdatedAt(ctx)
+	case usagestatistichour.FieldStatus:
+		return m.OldStatus(ctx)
+	case usagestatistichour.FieldDeletedAt:
+		return m.OldDeletedAt(ctx)
+	case usagestatistichour.FieldAddtime:
+		return m.OldAddtime(ctx)
+	case usagestatistichour.FieldType:
+		return m.OldType(ctx)
+	case usagestatistichour.FieldBotID:
+		return m.OldBotID(ctx)
+	case usagestatistichour.FieldOrganizationID:
+		return m.OldOrganizationID(ctx)
+	case usagestatistichour.FieldAiResponse:
+		return m.OldAiResponse(ctx)
+	case usagestatistichour.FieldSopRun:
+		return m.OldSopRun(ctx)
+	case usagestatistichour.FieldTotalFriend:
+		return m.OldTotalFriend(ctx)
+	case usagestatistichour.FieldTotalGroup:
+		return m.OldTotalGroup(ctx)
+	case usagestatistichour.FieldAccountBalance:
+		return m.OldAccountBalance(ctx)
+	case usagestatistichour.FieldConsumeToken:
+		return m.OldConsumeToken(ctx)
+	case usagestatistichour.FieldActiveUser:
+		return m.OldActiveUser(ctx)
+	case usagestatistichour.FieldNewUser:
+		return m.OldNewUser(ctx)
+	case usagestatistichour.FieldLabelDist:
+		return m.OldLabelDist(ctx)
+	}
+	return nil, fmt.Errorf("unknown UsageStatisticHour field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *UsageStatisticHourMutation) SetField(name string, value ent.Value) error {
+	switch name {
+	case usagestatistichour.FieldCreatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetCreatedAt(v)
+		return nil
+	case usagestatistichour.FieldUpdatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetUpdatedAt(v)
+		return nil
+	case usagestatistichour.FieldStatus:
+		v, ok := value.(uint8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetStatus(v)
+		return nil
+	case usagestatistichour.FieldDeletedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetDeletedAt(v)
+		return nil
+	case usagestatistichour.FieldAddtime:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAddtime(v)
+		return nil
+	case usagestatistichour.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetType(v)
+		return nil
+	case usagestatistichour.FieldBotID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetBotID(v)
+		return nil
+	case usagestatistichour.FieldOrganizationID:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetOrganizationID(v)
+		return nil
+	case usagestatistichour.FieldAiResponse:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAiResponse(v)
+		return nil
+	case usagestatistichour.FieldSopRun:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetSopRun(v)
+		return nil
+	case usagestatistichour.FieldTotalFriend:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetTotalFriend(v)
+		return nil
+	case usagestatistichour.FieldTotalGroup:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetTotalGroup(v)
+		return nil
+	case usagestatistichour.FieldAccountBalance:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAccountBalance(v)
+		return nil
+	case usagestatistichour.FieldConsumeToken:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetConsumeToken(v)
+		return nil
+	case usagestatistichour.FieldActiveUser:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetActiveUser(v)
+		return nil
+	case usagestatistichour.FieldNewUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetNewUser(v)
+		return nil
+	case usagestatistichour.FieldLabelDist:
+		v, ok := value.([]custom_types.LabelDist)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetLabelDist(v)
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticHour field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *UsageStatisticHourMutation) AddedFields() []string {
+	var fields []string
+	if m.addstatus != nil {
+		fields = append(fields, usagestatistichour.FieldStatus)
+	}
+	if m.addaddtime != nil {
+		fields = append(fields, usagestatistichour.FieldAddtime)
+	}
+	if m.add_type != nil {
+		fields = append(fields, usagestatistichour.FieldType)
+	}
+	if m.addorganization_id != nil {
+		fields = append(fields, usagestatistichour.FieldOrganizationID)
+	}
+	if m.addai_response != nil {
+		fields = append(fields, usagestatistichour.FieldAiResponse)
+	}
+	if m.addsop_run != nil {
+		fields = append(fields, usagestatistichour.FieldSopRun)
+	}
+	if m.addtotal_friend != nil {
+		fields = append(fields, usagestatistichour.FieldTotalFriend)
+	}
+	if m.addtotal_group != nil {
+		fields = append(fields, usagestatistichour.FieldTotalGroup)
+	}
+	if m.addaccount_balance != nil {
+		fields = append(fields, usagestatistichour.FieldAccountBalance)
+	}
+	if m.addconsume_token != nil {
+		fields = append(fields, usagestatistichour.FieldConsumeToken)
+	}
+	if m.addactive_user != nil {
+		fields = append(fields, usagestatistichour.FieldActiveUser)
+	}
+	if m.addnew_user != nil {
+		fields = append(fields, usagestatistichour.FieldNewUser)
+	}
+	return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *UsageStatisticHourMutation) AddedField(name string) (ent.Value, bool) {
+	switch name {
+	case usagestatistichour.FieldStatus:
+		return m.AddedStatus()
+	case usagestatistichour.FieldAddtime:
+		return m.AddedAddtime()
+	case usagestatistichour.FieldType:
+		return m.AddedType()
+	case usagestatistichour.FieldOrganizationID:
+		return m.AddedOrganizationID()
+	case usagestatistichour.FieldAiResponse:
+		return m.AddedAiResponse()
+	case usagestatistichour.FieldSopRun:
+		return m.AddedSopRun()
+	case usagestatistichour.FieldTotalFriend:
+		return m.AddedTotalFriend()
+	case usagestatistichour.FieldTotalGroup:
+		return m.AddedTotalGroup()
+	case usagestatistichour.FieldAccountBalance:
+		return m.AddedAccountBalance()
+	case usagestatistichour.FieldConsumeToken:
+		return m.AddedConsumeToken()
+	case usagestatistichour.FieldActiveUser:
+		return m.AddedActiveUser()
+	case usagestatistichour.FieldNewUser:
+		return m.AddedNewUser()
+	}
+	return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *UsageStatisticHourMutation) AddField(name string, value ent.Value) error {
+	switch name {
+	case usagestatistichour.FieldStatus:
+		v, ok := value.(int8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddStatus(v)
+		return nil
+	case usagestatistichour.FieldAddtime:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAddtime(v)
+		return nil
+	case usagestatistichour.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddType(v)
+		return nil
+	case usagestatistichour.FieldOrganizationID:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddOrganizationID(v)
+		return nil
+	case usagestatistichour.FieldAiResponse:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAiResponse(v)
+		return nil
+	case usagestatistichour.FieldSopRun:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddSopRun(v)
+		return nil
+	case usagestatistichour.FieldTotalFriend:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddTotalFriend(v)
+		return nil
+	case usagestatistichour.FieldTotalGroup:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddTotalGroup(v)
+		return nil
+	case usagestatistichour.FieldAccountBalance:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAccountBalance(v)
+		return nil
+	case usagestatistichour.FieldConsumeToken:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddConsumeToken(v)
+		return nil
+	case usagestatistichour.FieldActiveUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddActiveUser(v)
+		return nil
+	case usagestatistichour.FieldNewUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddNewUser(v)
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticHour numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *UsageStatisticHourMutation) ClearedFields() []string {
+	var fields []string
+	if m.FieldCleared(usagestatistichour.FieldStatus) {
+		fields = append(fields, usagestatistichour.FieldStatus)
+	}
+	if m.FieldCleared(usagestatistichour.FieldDeletedAt) {
+		fields = append(fields, usagestatistichour.FieldDeletedAt)
+	}
+	if m.FieldCleared(usagestatistichour.FieldBotID) {
+		fields = append(fields, usagestatistichour.FieldBotID)
+	}
+	if m.FieldCleared(usagestatistichour.FieldOrganizationID) {
+		fields = append(fields, usagestatistichour.FieldOrganizationID)
+	}
+	return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *UsageStatisticHourMutation) FieldCleared(name string) bool {
+	_, ok := m.clearedFields[name]
+	return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *UsageStatisticHourMutation) ClearField(name string) error {
+	switch name {
+	case usagestatistichour.FieldStatus:
+		m.ClearStatus()
+		return nil
+	case usagestatistichour.FieldDeletedAt:
+		m.ClearDeletedAt()
+		return nil
+	case usagestatistichour.FieldBotID:
+		m.ClearBotID()
+		return nil
+	case usagestatistichour.FieldOrganizationID:
+		m.ClearOrganizationID()
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticHour nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *UsageStatisticHourMutation) ResetField(name string) error {
+	switch name {
+	case usagestatistichour.FieldCreatedAt:
+		m.ResetCreatedAt()
+		return nil
+	case usagestatistichour.FieldUpdatedAt:
+		m.ResetUpdatedAt()
+		return nil
+	case usagestatistichour.FieldStatus:
+		m.ResetStatus()
+		return nil
+	case usagestatistichour.FieldDeletedAt:
+		m.ResetDeletedAt()
+		return nil
+	case usagestatistichour.FieldAddtime:
+		m.ResetAddtime()
+		return nil
+	case usagestatistichour.FieldType:
+		m.ResetType()
+		return nil
+	case usagestatistichour.FieldBotID:
+		m.ResetBotID()
+		return nil
+	case usagestatistichour.FieldOrganizationID:
+		m.ResetOrganizationID()
+		return nil
+	case usagestatistichour.FieldAiResponse:
+		m.ResetAiResponse()
+		return nil
+	case usagestatistichour.FieldSopRun:
+		m.ResetSopRun()
+		return nil
+	case usagestatistichour.FieldTotalFriend:
+		m.ResetTotalFriend()
+		return nil
+	case usagestatistichour.FieldTotalGroup:
+		m.ResetTotalGroup()
+		return nil
+	case usagestatistichour.FieldAccountBalance:
+		m.ResetAccountBalance()
+		return nil
+	case usagestatistichour.FieldConsumeToken:
+		m.ResetConsumeToken()
+		return nil
+	case usagestatistichour.FieldActiveUser:
+		m.ResetActiveUser()
+		return nil
+	case usagestatistichour.FieldNewUser:
+		m.ResetNewUser()
+		return nil
+	case usagestatistichour.FieldLabelDist:
+		m.ResetLabelDist()
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticHour field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *UsageStatisticHourMutation) AddedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *UsageStatisticHourMutation) AddedIDs(name string) []ent.Value {
+	return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *UsageStatisticHourMutation) RemovedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *UsageStatisticHourMutation) RemovedIDs(name string) []ent.Value {
+	return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *UsageStatisticHourMutation) ClearedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *UsageStatisticHourMutation) EdgeCleared(name string) bool {
+	return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *UsageStatisticHourMutation) ClearEdge(name string) error {
+	return fmt.Errorf("unknown UsageStatisticHour unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *UsageStatisticHourMutation) ResetEdge(name string) error {
+	return fmt.Errorf("unknown UsageStatisticHour edge %s", name)
+}
+
+// UsageStatisticMonthMutation represents an operation that mutates the UsageStatisticMonth nodes in the graph.
+type UsageStatisticMonthMutation struct {
+	config
+	op                 Op
+	typ                string
+	id                 *uint64
+	created_at         *time.Time
+	updated_at         *time.Time
+	status             *uint8
+	addstatus          *int8
+	deleted_at         *time.Time
+	addtime            *uint64
+	addaddtime         *int64
+	_type              *int
+	add_type           *int
+	bot_id             *string
+	organization_id    *uint64
+	addorganization_id *int64
+	ai_response        *uint64
+	addai_response     *int64
+	sop_run            *uint64
+	addsop_run         *int64
+	total_friend       *uint64
+	addtotal_friend    *int64
+	total_group        *uint64
+	addtotal_group     *int64
+	account_balance    *uint64
+	addaccount_balance *int64
+	consume_token      *uint64
+	addconsume_token   *int64
+	active_user        *uint64
+	addactive_user     *int64
+	new_user           *int64
+	addnew_user        *int64
+	label_dist         *[]custom_types.LabelDist
+	appendlabel_dist   []custom_types.LabelDist
+	clearedFields      map[string]struct{}
+	done               bool
+	oldValue           func(context.Context) (*UsageStatisticMonth, error)
+	predicates         []predicate.UsageStatisticMonth
+}
+
+var _ ent.Mutation = (*UsageStatisticMonthMutation)(nil)
+
+// usagestatisticmonthOption allows management of the mutation configuration using functional options.
+type usagestatisticmonthOption func(*UsageStatisticMonthMutation)
+
+// newUsageStatisticMonthMutation creates new mutation for the UsageStatisticMonth entity.
+func newUsageStatisticMonthMutation(c config, op Op, opts ...usagestatisticmonthOption) *UsageStatisticMonthMutation {
+	m := &UsageStatisticMonthMutation{
+		config:        c,
+		op:            op,
+		typ:           TypeUsageStatisticMonth,
+		clearedFields: make(map[string]struct{}),
+	}
+	for _, opt := range opts {
+		opt(m)
+	}
+	return m
+}
+
+// withUsageStatisticMonthID sets the ID field of the mutation.
+func withUsageStatisticMonthID(id uint64) usagestatisticmonthOption {
+	return func(m *UsageStatisticMonthMutation) {
+		var (
+			err   error
+			once  sync.Once
+			value *UsageStatisticMonth
+		)
+		m.oldValue = func(ctx context.Context) (*UsageStatisticMonth, error) {
+			once.Do(func() {
+				if m.done {
+					err = errors.New("querying old values post mutation is not allowed")
+				} else {
+					value, err = m.Client().UsageStatisticMonth.Get(ctx, id)
+				}
+			})
+			return value, err
+		}
+		m.id = &id
+	}
+}
+
+// withUsageStatisticMonth sets the old UsageStatisticMonth of the mutation.
+func withUsageStatisticMonth(node *UsageStatisticMonth) usagestatisticmonthOption {
+	return func(m *UsageStatisticMonthMutation) {
+		m.oldValue = func(context.Context) (*UsageStatisticMonth, error) {
+			return node, nil
+		}
+		m.id = &node.ID
+	}
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m UsageStatisticMonthMutation) Client() *Client {
+	client := &Client{config: m.config}
+	client.init()
+	return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m UsageStatisticMonthMutation) Tx() (*Tx, error) {
+	if _, ok := m.driver.(*txDriver); !ok {
+		return nil, errors.New("ent: mutation is not running in a transaction")
+	}
+	tx := &Tx{config: m.config}
+	tx.init()
+	return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of UsageStatisticMonth entities.
+func (m *UsageStatisticMonthMutation) SetID(id uint64) {
+	m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *UsageStatisticMonthMutation) ID() (id uint64, exists bool) {
+	if m.id == nil {
+		return
+	}
+	return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *UsageStatisticMonthMutation) IDs(ctx context.Context) ([]uint64, error) {
+	switch {
+	case m.op.Is(OpUpdateOne | OpDeleteOne):
+		id, exists := m.ID()
+		if exists {
+			return []uint64{id}, nil
+		}
+		fallthrough
+	case m.op.Is(OpUpdate | OpDelete):
+		return m.Client().UsageStatisticMonth.Query().Where(m.predicates...).IDs(ctx)
+	default:
+		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+	}
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *UsageStatisticMonthMutation) SetCreatedAt(t time.Time) {
+	m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *UsageStatisticMonthMutation) CreatedAt() (r time.Time, exists bool) {
+	v := m.created_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+	}
+	return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *UsageStatisticMonthMutation) ResetCreatedAt() {
+	m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *UsageStatisticMonthMutation) SetUpdatedAt(t time.Time) {
+	m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *UsageStatisticMonthMutation) UpdatedAt() (r time.Time, exists bool) {
+	v := m.updated_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+	}
+	return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *UsageStatisticMonthMutation) ResetUpdatedAt() {
+	m.updated_at = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *UsageStatisticMonthMutation) SetStatus(u uint8) {
+	m.status = &u
+	m.addstatus = nil
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *UsageStatisticMonthMutation) Status() (r uint8, exists bool) {
+	v := m.status
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldStatus(ctx context.Context) (v uint8, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldStatus requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+	}
+	return oldValue.Status, nil
+}
+
+// AddStatus adds u to the "status" field.
+func (m *UsageStatisticMonthMutation) AddStatus(u int8) {
+	if m.addstatus != nil {
+		*m.addstatus += u
+	} else {
+		m.addstatus = &u
+	}
+}
+
+// AddedStatus returns the value that was added to the "status" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedStatus() (r int8, exists bool) {
+	v := m.addstatus
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearStatus clears the value of the "status" field.
+func (m *UsageStatisticMonthMutation) ClearStatus() {
+	m.status = nil
+	m.addstatus = nil
+	m.clearedFields[usagestatisticmonth.FieldStatus] = struct{}{}
+}
+
+// StatusCleared returns if the "status" field was cleared in this mutation.
+func (m *UsageStatisticMonthMutation) StatusCleared() bool {
+	_, ok := m.clearedFields[usagestatisticmonth.FieldStatus]
+	return ok
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *UsageStatisticMonthMutation) ResetStatus() {
+	m.status = nil
+	m.addstatus = nil
+	delete(m.clearedFields, usagestatisticmonth.FieldStatus)
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (m *UsageStatisticMonthMutation) SetDeletedAt(t time.Time) {
+	m.deleted_at = &t
+}
+
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
+func (m *UsageStatisticMonthMutation) DeletedAt() (r time.Time, exists bool) {
+	v := m.deleted_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldDeletedAt returns the old "deleted_at" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldDeletedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
+	}
+	return oldValue.DeletedAt, nil
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (m *UsageStatisticMonthMutation) ClearDeletedAt() {
+	m.deleted_at = nil
+	m.clearedFields[usagestatisticmonth.FieldDeletedAt] = struct{}{}
+}
+
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
+func (m *UsageStatisticMonthMutation) DeletedAtCleared() bool {
+	_, ok := m.clearedFields[usagestatisticmonth.FieldDeletedAt]
+	return ok
+}
+
+// ResetDeletedAt resets all changes to the "deleted_at" field.
+func (m *UsageStatisticMonthMutation) ResetDeletedAt() {
+	m.deleted_at = nil
+	delete(m.clearedFields, usagestatisticmonth.FieldDeletedAt)
+}
+
+// SetAddtime sets the "addtime" field.
+func (m *UsageStatisticMonthMutation) SetAddtime(u uint64) {
+	m.addtime = &u
+	m.addaddtime = nil
+}
+
+// Addtime returns the value of the "addtime" field in the mutation.
+func (m *UsageStatisticMonthMutation) Addtime() (r uint64, exists bool) {
+	v := m.addtime
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAddtime returns the old "addtime" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldAddtime(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAddtime is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAddtime requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAddtime: %w", err)
+	}
+	return oldValue.Addtime, nil
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (m *UsageStatisticMonthMutation) AddAddtime(u int64) {
+	if m.addaddtime != nil {
+		*m.addaddtime += u
+	} else {
+		m.addaddtime = &u
+	}
+}
+
+// AddedAddtime returns the value that was added to the "addtime" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedAddtime() (r int64, exists bool) {
+	v := m.addaddtime
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAddtime resets all changes to the "addtime" field.
+func (m *UsageStatisticMonthMutation) ResetAddtime() {
+	m.addtime = nil
+	m.addaddtime = nil
+}
+
+// SetType sets the "type" field.
+func (m *UsageStatisticMonthMutation) SetType(i int) {
+	m._type = &i
+	m.add_type = nil
+}
+
+// GetType returns the value of the "type" field in the mutation.
+func (m *UsageStatisticMonthMutation) GetType() (r int, exists bool) {
+	v := m._type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldType returns the old "type" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldType(ctx context.Context) (v int, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldType is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldType requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldType: %w", err)
+	}
+	return oldValue.Type, nil
+}
+
+// AddType adds i to the "type" field.
+func (m *UsageStatisticMonthMutation) AddType(i int) {
+	if m.add_type != nil {
+		*m.add_type += i
+	} else {
+		m.add_type = &i
+	}
+}
+
+// AddedType returns the value that was added to the "type" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedType() (r int, exists bool) {
+	v := m.add_type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetType resets all changes to the "type" field.
+func (m *UsageStatisticMonthMutation) ResetType() {
+	m._type = nil
+	m.add_type = nil
+}
+
+// SetBotID sets the "bot_id" field.
+func (m *UsageStatisticMonthMutation) SetBotID(s string) {
+	m.bot_id = &s
+}
+
+// BotID returns the value of the "bot_id" field in the mutation.
+func (m *UsageStatisticMonthMutation) BotID() (r string, exists bool) {
+	v := m.bot_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldBotID returns the old "bot_id" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldBotID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldBotID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldBotID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldBotID: %w", err)
+	}
+	return oldValue.BotID, nil
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (m *UsageStatisticMonthMutation) ClearBotID() {
+	m.bot_id = nil
+	m.clearedFields[usagestatisticmonth.FieldBotID] = struct{}{}
+}
+
+// BotIDCleared returns if the "bot_id" field was cleared in this mutation.
+func (m *UsageStatisticMonthMutation) BotIDCleared() bool {
+	_, ok := m.clearedFields[usagestatisticmonth.FieldBotID]
+	return ok
+}
+
+// ResetBotID resets all changes to the "bot_id" field.
+func (m *UsageStatisticMonthMutation) ResetBotID() {
+	m.bot_id = nil
+	delete(m.clearedFields, usagestatisticmonth.FieldBotID)
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (m *UsageStatisticMonthMutation) SetOrganizationID(u uint64) {
+	m.organization_id = &u
+	m.addorganization_id = nil
+}
+
+// OrganizationID returns the value of the "organization_id" field in the mutation.
+func (m *UsageStatisticMonthMutation) OrganizationID() (r uint64, exists bool) {
+	v := m.organization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldOrganizationID returns the old "organization_id" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldOrganizationID(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldOrganizationID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldOrganizationID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldOrganizationID: %w", err)
+	}
+	return oldValue.OrganizationID, nil
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (m *UsageStatisticMonthMutation) AddOrganizationID(u int64) {
+	if m.addorganization_id != nil {
+		*m.addorganization_id += u
+	} else {
+		m.addorganization_id = &u
+	}
+}
+
+// AddedOrganizationID returns the value that was added to the "organization_id" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedOrganizationID() (r int64, exists bool) {
+	v := m.addorganization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (m *UsageStatisticMonthMutation) ClearOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+	m.clearedFields[usagestatisticmonth.FieldOrganizationID] = struct{}{}
+}
+
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
+func (m *UsageStatisticMonthMutation) OrganizationIDCleared() bool {
+	_, ok := m.clearedFields[usagestatisticmonth.FieldOrganizationID]
+	return ok
+}
+
+// ResetOrganizationID resets all changes to the "organization_id" field.
+func (m *UsageStatisticMonthMutation) ResetOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+	delete(m.clearedFields, usagestatisticmonth.FieldOrganizationID)
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (m *UsageStatisticMonthMutation) SetAiResponse(u uint64) {
+	m.ai_response = &u
+	m.addai_response = nil
+}
+
+// AiResponse returns the value of the "ai_response" field in the mutation.
+func (m *UsageStatisticMonthMutation) AiResponse() (r uint64, exists bool) {
+	v := m.ai_response
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAiResponse returns the old "ai_response" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldAiResponse(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAiResponse is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAiResponse requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAiResponse: %w", err)
+	}
+	return oldValue.AiResponse, nil
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (m *UsageStatisticMonthMutation) AddAiResponse(u int64) {
+	if m.addai_response != nil {
+		*m.addai_response += u
+	} else {
+		m.addai_response = &u
+	}
+}
+
+// AddedAiResponse returns the value that was added to the "ai_response" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedAiResponse() (r int64, exists bool) {
+	v := m.addai_response
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAiResponse resets all changes to the "ai_response" field.
+func (m *UsageStatisticMonthMutation) ResetAiResponse() {
+	m.ai_response = nil
+	m.addai_response = nil
+}
+
+// SetSopRun sets the "sop_run" field.
+func (m *UsageStatisticMonthMutation) SetSopRun(u uint64) {
+	m.sop_run = &u
+	m.addsop_run = nil
+}
+
+// SopRun returns the value of the "sop_run" field in the mutation.
+func (m *UsageStatisticMonthMutation) SopRun() (r uint64, exists bool) {
+	v := m.sop_run
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldSopRun returns the old "sop_run" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldSopRun(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldSopRun is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldSopRun requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldSopRun: %w", err)
+	}
+	return oldValue.SopRun, nil
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (m *UsageStatisticMonthMutation) AddSopRun(u int64) {
+	if m.addsop_run != nil {
+		*m.addsop_run += u
+	} else {
+		m.addsop_run = &u
+	}
+}
+
+// AddedSopRun returns the value that was added to the "sop_run" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedSopRun() (r int64, exists bool) {
+	v := m.addsop_run
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetSopRun resets all changes to the "sop_run" field.
+func (m *UsageStatisticMonthMutation) ResetSopRun() {
+	m.sop_run = nil
+	m.addsop_run = nil
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (m *UsageStatisticMonthMutation) SetTotalFriend(u uint64) {
+	m.total_friend = &u
+	m.addtotal_friend = nil
+}
+
+// TotalFriend returns the value of the "total_friend" field in the mutation.
+func (m *UsageStatisticMonthMutation) TotalFriend() (r uint64, exists bool) {
+	v := m.total_friend
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldTotalFriend returns the old "total_friend" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldTotalFriend(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldTotalFriend is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldTotalFriend requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldTotalFriend: %w", err)
+	}
+	return oldValue.TotalFriend, nil
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (m *UsageStatisticMonthMutation) AddTotalFriend(u int64) {
+	if m.addtotal_friend != nil {
+		*m.addtotal_friend += u
+	} else {
+		m.addtotal_friend = &u
+	}
+}
+
+// AddedTotalFriend returns the value that was added to the "total_friend" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedTotalFriend() (r int64, exists bool) {
+	v := m.addtotal_friend
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetTotalFriend resets all changes to the "total_friend" field.
+func (m *UsageStatisticMonthMutation) ResetTotalFriend() {
+	m.total_friend = nil
+	m.addtotal_friend = nil
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (m *UsageStatisticMonthMutation) SetTotalGroup(u uint64) {
+	m.total_group = &u
+	m.addtotal_group = nil
+}
+
+// TotalGroup returns the value of the "total_group" field in the mutation.
+func (m *UsageStatisticMonthMutation) TotalGroup() (r uint64, exists bool) {
+	v := m.total_group
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldTotalGroup returns the old "total_group" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldTotalGroup(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldTotalGroup is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldTotalGroup requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldTotalGroup: %w", err)
+	}
+	return oldValue.TotalGroup, nil
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (m *UsageStatisticMonthMutation) AddTotalGroup(u int64) {
+	if m.addtotal_group != nil {
+		*m.addtotal_group += u
+	} else {
+		m.addtotal_group = &u
+	}
+}
+
+// AddedTotalGroup returns the value that was added to the "total_group" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedTotalGroup() (r int64, exists bool) {
+	v := m.addtotal_group
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetTotalGroup resets all changes to the "total_group" field.
+func (m *UsageStatisticMonthMutation) ResetTotalGroup() {
+	m.total_group = nil
+	m.addtotal_group = nil
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (m *UsageStatisticMonthMutation) SetAccountBalance(u uint64) {
+	m.account_balance = &u
+	m.addaccount_balance = nil
+}
+
+// AccountBalance returns the value of the "account_balance" field in the mutation.
+func (m *UsageStatisticMonthMutation) AccountBalance() (r uint64, exists bool) {
+	v := m.account_balance
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAccountBalance returns the old "account_balance" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldAccountBalance(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAccountBalance is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAccountBalance requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAccountBalance: %w", err)
+	}
+	return oldValue.AccountBalance, nil
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (m *UsageStatisticMonthMutation) AddAccountBalance(u int64) {
+	if m.addaccount_balance != nil {
+		*m.addaccount_balance += u
+	} else {
+		m.addaccount_balance = &u
+	}
+}
+
+// AddedAccountBalance returns the value that was added to the "account_balance" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedAccountBalance() (r int64, exists bool) {
+	v := m.addaccount_balance
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetAccountBalance resets all changes to the "account_balance" field.
+func (m *UsageStatisticMonthMutation) ResetAccountBalance() {
+	m.account_balance = nil
+	m.addaccount_balance = nil
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (m *UsageStatisticMonthMutation) SetConsumeToken(u uint64) {
+	m.consume_token = &u
+	m.addconsume_token = nil
+}
+
+// ConsumeToken returns the value of the "consume_token" field in the mutation.
+func (m *UsageStatisticMonthMutation) ConsumeToken() (r uint64, exists bool) {
+	v := m.consume_token
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldConsumeToken returns the old "consume_token" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldConsumeToken(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldConsumeToken is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldConsumeToken requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldConsumeToken: %w", err)
+	}
+	return oldValue.ConsumeToken, nil
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (m *UsageStatisticMonthMutation) AddConsumeToken(u int64) {
+	if m.addconsume_token != nil {
+		*m.addconsume_token += u
+	} else {
+		m.addconsume_token = &u
+	}
+}
+
+// AddedConsumeToken returns the value that was added to the "consume_token" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedConsumeToken() (r int64, exists bool) {
+	v := m.addconsume_token
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetConsumeToken resets all changes to the "consume_token" field.
+func (m *UsageStatisticMonthMutation) ResetConsumeToken() {
+	m.consume_token = nil
+	m.addconsume_token = nil
+}
+
+// SetActiveUser sets the "active_user" field.
+func (m *UsageStatisticMonthMutation) SetActiveUser(u uint64) {
+	m.active_user = &u
+	m.addactive_user = nil
+}
+
+// ActiveUser returns the value of the "active_user" field in the mutation.
+func (m *UsageStatisticMonthMutation) ActiveUser() (r uint64, exists bool) {
+	v := m.active_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldActiveUser returns the old "active_user" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldActiveUser(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldActiveUser is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldActiveUser requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldActiveUser: %w", err)
+	}
+	return oldValue.ActiveUser, nil
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (m *UsageStatisticMonthMutation) AddActiveUser(u int64) {
+	if m.addactive_user != nil {
+		*m.addactive_user += u
+	} else {
+		m.addactive_user = &u
+	}
+}
+
+// AddedActiveUser returns the value that was added to the "active_user" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedActiveUser() (r int64, exists bool) {
+	v := m.addactive_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetActiveUser resets all changes to the "active_user" field.
+func (m *UsageStatisticMonthMutation) ResetActiveUser() {
+	m.active_user = nil
+	m.addactive_user = nil
+}
+
+// SetNewUser sets the "new_user" field.
+func (m *UsageStatisticMonthMutation) SetNewUser(i int64) {
+	m.new_user = &i
+	m.addnew_user = nil
+}
+
+// NewUser returns the value of the "new_user" field in the mutation.
+func (m *UsageStatisticMonthMutation) NewUser() (r int64, exists bool) {
+	v := m.new_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldNewUser returns the old "new_user" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldNewUser(ctx context.Context) (v int64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldNewUser is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldNewUser requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldNewUser: %w", err)
+	}
+	return oldValue.NewUser, nil
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (m *UsageStatisticMonthMutation) AddNewUser(i int64) {
+	if m.addnew_user != nil {
+		*m.addnew_user += i
+	} else {
+		m.addnew_user = &i
+	}
+}
+
+// AddedNewUser returns the value that was added to the "new_user" field in this mutation.
+func (m *UsageStatisticMonthMutation) AddedNewUser() (r int64, exists bool) {
+	v := m.addnew_user
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetNewUser resets all changes to the "new_user" field.
+func (m *UsageStatisticMonthMutation) ResetNewUser() {
+	m.new_user = nil
+	m.addnew_user = nil
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (m *UsageStatisticMonthMutation) SetLabelDist(ctd []custom_types.LabelDist) {
+	m.label_dist = &ctd
+	m.appendlabel_dist = nil
+}
+
+// LabelDist returns the value of the "label_dist" field in the mutation.
+func (m *UsageStatisticMonthMutation) LabelDist() (r []custom_types.LabelDist, exists bool) {
+	v := m.label_dist
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldLabelDist returns the old "label_dist" field's value of the UsageStatisticMonth entity.
+// If the UsageStatisticMonth object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageStatisticMonthMutation) OldLabelDist(ctx context.Context) (v []custom_types.LabelDist, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldLabelDist is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldLabelDist requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldLabelDist: %w", err)
+	}
+	return oldValue.LabelDist, nil
+}
+
+// AppendLabelDist adds ctd to the "label_dist" field.
+func (m *UsageStatisticMonthMutation) AppendLabelDist(ctd []custom_types.LabelDist) {
+	m.appendlabel_dist = append(m.appendlabel_dist, ctd...)
+}
+
+// AppendedLabelDist returns the list of values that were appended to the "label_dist" field in this mutation.
+func (m *UsageStatisticMonthMutation) AppendedLabelDist() ([]custom_types.LabelDist, bool) {
+	if len(m.appendlabel_dist) == 0 {
+		return nil, false
+	}
+	return m.appendlabel_dist, true
+}
+
+// ResetLabelDist resets all changes to the "label_dist" field.
+func (m *UsageStatisticMonthMutation) ResetLabelDist() {
+	m.label_dist = nil
+	m.appendlabel_dist = nil
+}
+
+// Where appends a list predicates to the UsageStatisticMonthMutation builder.
+func (m *UsageStatisticMonthMutation) Where(ps ...predicate.UsageStatisticMonth) {
+	m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the UsageStatisticMonthMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *UsageStatisticMonthMutation) WhereP(ps ...func(*sql.Selector)) {
+	p := make([]predicate.UsageStatisticMonth, len(ps))
+	for i := range ps {
+		p[i] = ps[i]
+	}
+	m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *UsageStatisticMonthMutation) Op() Op {
+	return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *UsageStatisticMonthMutation) SetOp(op Op) {
+	m.op = op
+}
+
+// Type returns the node type of this mutation (UsageStatisticMonth).
+func (m *UsageStatisticMonthMutation) Type() string {
+	return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *UsageStatisticMonthMutation) Fields() []string {
+	fields := make([]string, 0, 17)
+	if m.created_at != nil {
+		fields = append(fields, usagestatisticmonth.FieldCreatedAt)
+	}
+	if m.updated_at != nil {
+		fields = append(fields, usagestatisticmonth.FieldUpdatedAt)
+	}
+	if m.status != nil {
+		fields = append(fields, usagestatisticmonth.FieldStatus)
+	}
+	if m.deleted_at != nil {
+		fields = append(fields, usagestatisticmonth.FieldDeletedAt)
+	}
+	if m.addtime != nil {
+		fields = append(fields, usagestatisticmonth.FieldAddtime)
+	}
+	if m._type != nil {
+		fields = append(fields, usagestatisticmonth.FieldType)
+	}
+	if m.bot_id != nil {
+		fields = append(fields, usagestatisticmonth.FieldBotID)
+	}
+	if m.organization_id != nil {
+		fields = append(fields, usagestatisticmonth.FieldOrganizationID)
+	}
+	if m.ai_response != nil {
+		fields = append(fields, usagestatisticmonth.FieldAiResponse)
+	}
+	if m.sop_run != nil {
+		fields = append(fields, usagestatisticmonth.FieldSopRun)
+	}
+	if m.total_friend != nil {
+		fields = append(fields, usagestatisticmonth.FieldTotalFriend)
+	}
+	if m.total_group != nil {
+		fields = append(fields, usagestatisticmonth.FieldTotalGroup)
+	}
+	if m.account_balance != nil {
+		fields = append(fields, usagestatisticmonth.FieldAccountBalance)
+	}
+	if m.consume_token != nil {
+		fields = append(fields, usagestatisticmonth.FieldConsumeToken)
+	}
+	if m.active_user != nil {
+		fields = append(fields, usagestatisticmonth.FieldActiveUser)
+	}
+	if m.new_user != nil {
+		fields = append(fields, usagestatisticmonth.FieldNewUser)
+	}
+	if m.label_dist != nil {
+		fields = append(fields, usagestatisticmonth.FieldLabelDist)
+	}
+	return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *UsageStatisticMonthMutation) Field(name string) (ent.Value, bool) {
+	switch name {
+	case usagestatisticmonth.FieldCreatedAt:
+		return m.CreatedAt()
+	case usagestatisticmonth.FieldUpdatedAt:
+		return m.UpdatedAt()
+	case usagestatisticmonth.FieldStatus:
+		return m.Status()
+	case usagestatisticmonth.FieldDeletedAt:
+		return m.DeletedAt()
+	case usagestatisticmonth.FieldAddtime:
+		return m.Addtime()
+	case usagestatisticmonth.FieldType:
+		return m.GetType()
+	case usagestatisticmonth.FieldBotID:
+		return m.BotID()
+	case usagestatisticmonth.FieldOrganizationID:
+		return m.OrganizationID()
+	case usagestatisticmonth.FieldAiResponse:
+		return m.AiResponse()
+	case usagestatisticmonth.FieldSopRun:
+		return m.SopRun()
+	case usagestatisticmonth.FieldTotalFriend:
+		return m.TotalFriend()
+	case usagestatisticmonth.FieldTotalGroup:
+		return m.TotalGroup()
+	case usagestatisticmonth.FieldAccountBalance:
+		return m.AccountBalance()
+	case usagestatisticmonth.FieldConsumeToken:
+		return m.ConsumeToken()
+	case usagestatisticmonth.FieldActiveUser:
+		return m.ActiveUser()
+	case usagestatisticmonth.FieldNewUser:
+		return m.NewUser()
+	case usagestatisticmonth.FieldLabelDist:
+		return m.LabelDist()
+	}
+	return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *UsageStatisticMonthMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+	switch name {
+	case usagestatisticmonth.FieldCreatedAt:
+		return m.OldCreatedAt(ctx)
+	case usagestatisticmonth.FieldUpdatedAt:
+		return m.OldUpdatedAt(ctx)
+	case usagestatisticmonth.FieldStatus:
+		return m.OldStatus(ctx)
+	case usagestatisticmonth.FieldDeletedAt:
+		return m.OldDeletedAt(ctx)
+	case usagestatisticmonth.FieldAddtime:
+		return m.OldAddtime(ctx)
+	case usagestatisticmonth.FieldType:
+		return m.OldType(ctx)
+	case usagestatisticmonth.FieldBotID:
+		return m.OldBotID(ctx)
+	case usagestatisticmonth.FieldOrganizationID:
+		return m.OldOrganizationID(ctx)
+	case usagestatisticmonth.FieldAiResponse:
+		return m.OldAiResponse(ctx)
+	case usagestatisticmonth.FieldSopRun:
+		return m.OldSopRun(ctx)
+	case usagestatisticmonth.FieldTotalFriend:
+		return m.OldTotalFriend(ctx)
+	case usagestatisticmonth.FieldTotalGroup:
+		return m.OldTotalGroup(ctx)
+	case usagestatisticmonth.FieldAccountBalance:
+		return m.OldAccountBalance(ctx)
+	case usagestatisticmonth.FieldConsumeToken:
+		return m.OldConsumeToken(ctx)
+	case usagestatisticmonth.FieldActiveUser:
+		return m.OldActiveUser(ctx)
+	case usagestatisticmonth.FieldNewUser:
+		return m.OldNewUser(ctx)
+	case usagestatisticmonth.FieldLabelDist:
+		return m.OldLabelDist(ctx)
+	}
+	return nil, fmt.Errorf("unknown UsageStatisticMonth field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *UsageStatisticMonthMutation) SetField(name string, value ent.Value) error {
+	switch name {
+	case usagestatisticmonth.FieldCreatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetCreatedAt(v)
+		return nil
+	case usagestatisticmonth.FieldUpdatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetUpdatedAt(v)
+		return nil
+	case usagestatisticmonth.FieldStatus:
+		v, ok := value.(uint8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetStatus(v)
+		return nil
+	case usagestatisticmonth.FieldDeletedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetDeletedAt(v)
+		return nil
+	case usagestatisticmonth.FieldAddtime:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAddtime(v)
+		return nil
+	case usagestatisticmonth.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetType(v)
+		return nil
+	case usagestatisticmonth.FieldBotID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetBotID(v)
+		return nil
+	case usagestatisticmonth.FieldOrganizationID:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetOrganizationID(v)
+		return nil
+	case usagestatisticmonth.FieldAiResponse:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAiResponse(v)
+		return nil
+	case usagestatisticmonth.FieldSopRun:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetSopRun(v)
+		return nil
+	case usagestatisticmonth.FieldTotalFriend:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetTotalFriend(v)
+		return nil
+	case usagestatisticmonth.FieldTotalGroup:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetTotalGroup(v)
+		return nil
+	case usagestatisticmonth.FieldAccountBalance:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAccountBalance(v)
+		return nil
+	case usagestatisticmonth.FieldConsumeToken:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetConsumeToken(v)
+		return nil
+	case usagestatisticmonth.FieldActiveUser:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetActiveUser(v)
+		return nil
+	case usagestatisticmonth.FieldNewUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetNewUser(v)
+		return nil
+	case usagestatisticmonth.FieldLabelDist:
+		v, ok := value.([]custom_types.LabelDist)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetLabelDist(v)
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticMonth field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *UsageStatisticMonthMutation) AddedFields() []string {
+	var fields []string
+	if m.addstatus != nil {
+		fields = append(fields, usagestatisticmonth.FieldStatus)
+	}
+	if m.addaddtime != nil {
+		fields = append(fields, usagestatisticmonth.FieldAddtime)
+	}
+	if m.add_type != nil {
+		fields = append(fields, usagestatisticmonth.FieldType)
+	}
+	if m.addorganization_id != nil {
+		fields = append(fields, usagestatisticmonth.FieldOrganizationID)
+	}
+	if m.addai_response != nil {
+		fields = append(fields, usagestatisticmonth.FieldAiResponse)
+	}
+	if m.addsop_run != nil {
+		fields = append(fields, usagestatisticmonth.FieldSopRun)
+	}
+	if m.addtotal_friend != nil {
+		fields = append(fields, usagestatisticmonth.FieldTotalFriend)
+	}
+	if m.addtotal_group != nil {
+		fields = append(fields, usagestatisticmonth.FieldTotalGroup)
+	}
+	if m.addaccount_balance != nil {
+		fields = append(fields, usagestatisticmonth.FieldAccountBalance)
+	}
+	if m.addconsume_token != nil {
+		fields = append(fields, usagestatisticmonth.FieldConsumeToken)
+	}
+	if m.addactive_user != nil {
+		fields = append(fields, usagestatisticmonth.FieldActiveUser)
+	}
+	if m.addnew_user != nil {
+		fields = append(fields, usagestatisticmonth.FieldNewUser)
+	}
+	return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *UsageStatisticMonthMutation) AddedField(name string) (ent.Value, bool) {
+	switch name {
+	case usagestatisticmonth.FieldStatus:
+		return m.AddedStatus()
+	case usagestatisticmonth.FieldAddtime:
+		return m.AddedAddtime()
+	case usagestatisticmonth.FieldType:
+		return m.AddedType()
+	case usagestatisticmonth.FieldOrganizationID:
+		return m.AddedOrganizationID()
+	case usagestatisticmonth.FieldAiResponse:
+		return m.AddedAiResponse()
+	case usagestatisticmonth.FieldSopRun:
+		return m.AddedSopRun()
+	case usagestatisticmonth.FieldTotalFriend:
+		return m.AddedTotalFriend()
+	case usagestatisticmonth.FieldTotalGroup:
+		return m.AddedTotalGroup()
+	case usagestatisticmonth.FieldAccountBalance:
+		return m.AddedAccountBalance()
+	case usagestatisticmonth.FieldConsumeToken:
+		return m.AddedConsumeToken()
+	case usagestatisticmonth.FieldActiveUser:
+		return m.AddedActiveUser()
+	case usagestatisticmonth.FieldNewUser:
+		return m.AddedNewUser()
+	}
+	return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *UsageStatisticMonthMutation) AddField(name string, value ent.Value) error {
+	switch name {
+	case usagestatisticmonth.FieldStatus:
+		v, ok := value.(int8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddStatus(v)
+		return nil
+	case usagestatisticmonth.FieldAddtime:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAddtime(v)
+		return nil
+	case usagestatisticmonth.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddType(v)
+		return nil
+	case usagestatisticmonth.FieldOrganizationID:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddOrganizationID(v)
+		return nil
+	case usagestatisticmonth.FieldAiResponse:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAiResponse(v)
+		return nil
+	case usagestatisticmonth.FieldSopRun:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddSopRun(v)
+		return nil
+	case usagestatisticmonth.FieldTotalFriend:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddTotalFriend(v)
+		return nil
+	case usagestatisticmonth.FieldTotalGroup:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddTotalGroup(v)
+		return nil
+	case usagestatisticmonth.FieldAccountBalance:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddAccountBalance(v)
+		return nil
+	case usagestatisticmonth.FieldConsumeToken:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddConsumeToken(v)
+		return nil
+	case usagestatisticmonth.FieldActiveUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddActiveUser(v)
+		return nil
+	case usagestatisticmonth.FieldNewUser:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddNewUser(v)
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticMonth numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *UsageStatisticMonthMutation) ClearedFields() []string {
+	var fields []string
+	if m.FieldCleared(usagestatisticmonth.FieldStatus) {
+		fields = append(fields, usagestatisticmonth.FieldStatus)
+	}
+	if m.FieldCleared(usagestatisticmonth.FieldDeletedAt) {
+		fields = append(fields, usagestatisticmonth.FieldDeletedAt)
+	}
+	if m.FieldCleared(usagestatisticmonth.FieldBotID) {
+		fields = append(fields, usagestatisticmonth.FieldBotID)
+	}
+	if m.FieldCleared(usagestatisticmonth.FieldOrganizationID) {
+		fields = append(fields, usagestatisticmonth.FieldOrganizationID)
+	}
+	return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *UsageStatisticMonthMutation) FieldCleared(name string) bool {
+	_, ok := m.clearedFields[name]
+	return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *UsageStatisticMonthMutation) ClearField(name string) error {
+	switch name {
+	case usagestatisticmonth.FieldStatus:
+		m.ClearStatus()
+		return nil
+	case usagestatisticmonth.FieldDeletedAt:
+		m.ClearDeletedAt()
+		return nil
+	case usagestatisticmonth.FieldBotID:
+		m.ClearBotID()
+		return nil
+	case usagestatisticmonth.FieldOrganizationID:
+		m.ClearOrganizationID()
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticMonth nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *UsageStatisticMonthMutation) ResetField(name string) error {
+	switch name {
+	case usagestatisticmonth.FieldCreatedAt:
+		m.ResetCreatedAt()
+		return nil
+	case usagestatisticmonth.FieldUpdatedAt:
+		m.ResetUpdatedAt()
+		return nil
+	case usagestatisticmonth.FieldStatus:
+		m.ResetStatus()
+		return nil
+	case usagestatisticmonth.FieldDeletedAt:
+		m.ResetDeletedAt()
+		return nil
+	case usagestatisticmonth.FieldAddtime:
+		m.ResetAddtime()
+		return nil
+	case usagestatisticmonth.FieldType:
+		m.ResetType()
+		return nil
+	case usagestatisticmonth.FieldBotID:
+		m.ResetBotID()
+		return nil
+	case usagestatisticmonth.FieldOrganizationID:
+		m.ResetOrganizationID()
+		return nil
+	case usagestatisticmonth.FieldAiResponse:
+		m.ResetAiResponse()
+		return nil
+	case usagestatisticmonth.FieldSopRun:
+		m.ResetSopRun()
+		return nil
+	case usagestatisticmonth.FieldTotalFriend:
+		m.ResetTotalFriend()
+		return nil
+	case usagestatisticmonth.FieldTotalGroup:
+		m.ResetTotalGroup()
+		return nil
+	case usagestatisticmonth.FieldAccountBalance:
+		m.ResetAccountBalance()
+		return nil
+	case usagestatisticmonth.FieldConsumeToken:
+		m.ResetConsumeToken()
+		return nil
+	case usagestatisticmonth.FieldActiveUser:
+		m.ResetActiveUser()
+		return nil
+	case usagestatisticmonth.FieldNewUser:
+		m.ResetNewUser()
+		return nil
+	case usagestatisticmonth.FieldLabelDist:
+		m.ResetLabelDist()
+		return nil
+	}
+	return fmt.Errorf("unknown UsageStatisticMonth field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *UsageStatisticMonthMutation) AddedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *UsageStatisticMonthMutation) AddedIDs(name string) []ent.Value {
+	return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *UsageStatisticMonthMutation) RemovedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *UsageStatisticMonthMutation) RemovedIDs(name string) []ent.Value {
+	return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *UsageStatisticMonthMutation) ClearedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *UsageStatisticMonthMutation) EdgeCleared(name string) bool {
+	return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *UsageStatisticMonthMutation) ClearEdge(name string) error {
+	return fmt.Errorf("unknown UsageStatisticMonth unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *UsageStatisticMonthMutation) ResetEdge(name string) error {
+	return fmt.Errorf("unknown UsageStatisticMonth edge %s", name)
+}
+
 // UsageTotalMutation represents an operation that mutates the UsageTotal nodes in the graph.
 type UsageTotalMutation struct {
 	config

+ 246 - 0
ent/pagination.go

@@ -28,6 +28,9 @@ import (
 	"wechat-api/ent/token"
 	"wechat-api/ent/tutorial"
 	"wechat-api/ent/usagedetail"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/usagestatisticmonth"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
 	"wechat-api/ent/wpchatroom"
@@ -1947,6 +1950,249 @@ func (ud *UsageDetailQuery) Page(
 	return ret, nil
 }
 
+type UsageStatisticDayPager struct {
+	Order  usagestatisticday.OrderOption
+	Filter func(*UsageStatisticDayQuery) (*UsageStatisticDayQuery, error)
+}
+
+// UsageStatisticDayPaginateOption enables pagination customization.
+type UsageStatisticDayPaginateOption func(*UsageStatisticDayPager)
+
+// DefaultUsageStatisticDayOrder is the default ordering of UsageStatisticDay.
+var DefaultUsageStatisticDayOrder = Desc(usagestatisticday.FieldID)
+
+func newUsageStatisticDayPager(opts []UsageStatisticDayPaginateOption) (*UsageStatisticDayPager, error) {
+	pager := &UsageStatisticDayPager{}
+	for _, opt := range opts {
+		opt(pager)
+	}
+	if pager.Order == nil {
+		pager.Order = DefaultUsageStatisticDayOrder
+	}
+	return pager, nil
+}
+
+func (p *UsageStatisticDayPager) ApplyFilter(query *UsageStatisticDayQuery) (*UsageStatisticDayQuery, error) {
+	if p.Filter != nil {
+		return p.Filter(query)
+	}
+	return query, nil
+}
+
+// UsageStatisticDayPageList is UsageStatisticDay PageList result.
+type UsageStatisticDayPageList struct {
+	List        []*UsageStatisticDay `json:"list"`
+	PageDetails *PageDetails         `json:"pageDetails"`
+}
+
+func (usd *UsageStatisticDayQuery) Page(
+	ctx context.Context, pageNum uint64, pageSize uint64, opts ...UsageStatisticDayPaginateOption,
+) (*UsageStatisticDayPageList, error) {
+
+	pager, err := newUsageStatisticDayPager(opts)
+	if err != nil {
+		return nil, err
+	}
+
+	if usd, err = pager.ApplyFilter(usd); err != nil {
+		return nil, err
+	}
+
+	ret := &UsageStatisticDayPageList{}
+
+	ret.PageDetails = &PageDetails{
+		Page: pageNum,
+		Size: pageSize,
+	}
+
+	query := usd.Clone()
+	query.ctx.Fields = nil
+	count, err := query.Count(ctx)
+
+	if err != nil {
+		return nil, err
+	}
+
+	ret.PageDetails.Total = uint64(count)
+
+	if pager.Order != nil {
+		usd = usd.Order(pager.Order)
+	} else {
+		usd = usd.Order(DefaultUsageStatisticDayOrder)
+	}
+
+	usd = usd.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
+	list, err := usd.All(ctx)
+	if err != nil {
+		return nil, err
+	}
+	ret.List = list
+
+	return ret, nil
+}
+
+type UsageStatisticHourPager struct {
+	Order  usagestatistichour.OrderOption
+	Filter func(*UsageStatisticHourQuery) (*UsageStatisticHourQuery, error)
+}
+
+// UsageStatisticHourPaginateOption enables pagination customization.
+type UsageStatisticHourPaginateOption func(*UsageStatisticHourPager)
+
+// DefaultUsageStatisticHourOrder is the default ordering of UsageStatisticHour.
+var DefaultUsageStatisticHourOrder = Desc(usagestatistichour.FieldID)
+
+func newUsageStatisticHourPager(opts []UsageStatisticHourPaginateOption) (*UsageStatisticHourPager, error) {
+	pager := &UsageStatisticHourPager{}
+	for _, opt := range opts {
+		opt(pager)
+	}
+	if pager.Order == nil {
+		pager.Order = DefaultUsageStatisticHourOrder
+	}
+	return pager, nil
+}
+
+func (p *UsageStatisticHourPager) ApplyFilter(query *UsageStatisticHourQuery) (*UsageStatisticHourQuery, error) {
+	if p.Filter != nil {
+		return p.Filter(query)
+	}
+	return query, nil
+}
+
+// UsageStatisticHourPageList is UsageStatisticHour PageList result.
+type UsageStatisticHourPageList struct {
+	List        []*UsageStatisticHour `json:"list"`
+	PageDetails *PageDetails          `json:"pageDetails"`
+}
+
+func (ush *UsageStatisticHourQuery) Page(
+	ctx context.Context, pageNum uint64, pageSize uint64, opts ...UsageStatisticHourPaginateOption,
+) (*UsageStatisticHourPageList, error) {
+
+	pager, err := newUsageStatisticHourPager(opts)
+	if err != nil {
+		return nil, err
+	}
+
+	if ush, err = pager.ApplyFilter(ush); err != nil {
+		return nil, err
+	}
+
+	ret := &UsageStatisticHourPageList{}
+
+	ret.PageDetails = &PageDetails{
+		Page: pageNum,
+		Size: pageSize,
+	}
+
+	query := ush.Clone()
+	query.ctx.Fields = nil
+	count, err := query.Count(ctx)
+
+	if err != nil {
+		return nil, err
+	}
+
+	ret.PageDetails.Total = uint64(count)
+
+	if pager.Order != nil {
+		ush = ush.Order(pager.Order)
+	} else {
+		ush = ush.Order(DefaultUsageStatisticHourOrder)
+	}
+
+	ush = ush.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
+	list, err := ush.All(ctx)
+	if err != nil {
+		return nil, err
+	}
+	ret.List = list
+
+	return ret, nil
+}
+
+type UsageStatisticMonthPager struct {
+	Order  usagestatisticmonth.OrderOption
+	Filter func(*UsageStatisticMonthQuery) (*UsageStatisticMonthQuery, error)
+}
+
+// UsageStatisticMonthPaginateOption enables pagination customization.
+type UsageStatisticMonthPaginateOption func(*UsageStatisticMonthPager)
+
+// DefaultUsageStatisticMonthOrder is the default ordering of UsageStatisticMonth.
+var DefaultUsageStatisticMonthOrder = Desc(usagestatisticmonth.FieldID)
+
+func newUsageStatisticMonthPager(opts []UsageStatisticMonthPaginateOption) (*UsageStatisticMonthPager, error) {
+	pager := &UsageStatisticMonthPager{}
+	for _, opt := range opts {
+		opt(pager)
+	}
+	if pager.Order == nil {
+		pager.Order = DefaultUsageStatisticMonthOrder
+	}
+	return pager, nil
+}
+
+func (p *UsageStatisticMonthPager) ApplyFilter(query *UsageStatisticMonthQuery) (*UsageStatisticMonthQuery, error) {
+	if p.Filter != nil {
+		return p.Filter(query)
+	}
+	return query, nil
+}
+
+// UsageStatisticMonthPageList is UsageStatisticMonth PageList result.
+type UsageStatisticMonthPageList struct {
+	List        []*UsageStatisticMonth `json:"list"`
+	PageDetails *PageDetails           `json:"pageDetails"`
+}
+
+func (usm *UsageStatisticMonthQuery) Page(
+	ctx context.Context, pageNum uint64, pageSize uint64, opts ...UsageStatisticMonthPaginateOption,
+) (*UsageStatisticMonthPageList, error) {
+
+	pager, err := newUsageStatisticMonthPager(opts)
+	if err != nil {
+		return nil, err
+	}
+
+	if usm, err = pager.ApplyFilter(usm); err != nil {
+		return nil, err
+	}
+
+	ret := &UsageStatisticMonthPageList{}
+
+	ret.PageDetails = &PageDetails{
+		Page: pageNum,
+		Size: pageSize,
+	}
+
+	query := usm.Clone()
+	query.ctx.Fields = nil
+	count, err := query.Count(ctx)
+
+	if err != nil {
+		return nil, err
+	}
+
+	ret.PageDetails.Total = uint64(count)
+
+	if pager.Order != nil {
+		usm = usm.Order(pager.Order)
+	} else {
+		usm = usm.Order(DefaultUsageStatisticMonthOrder)
+	}
+
+	usm = usm.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
+	list, err := usm.All(ctx)
+	if err != nil {
+		return nil, err
+	}
+	ret.List = list
+
+	return ret, nil
+}
+
 type UsageTotalPager struct {
 	Order  usagetotal.OrderOption
 	Filter func(*UsageTotalQuery) (*UsageTotalQuery, error)

+ 9 - 0
ent/predicate/predicate.go

@@ -75,6 +75,15 @@ type Tutorial func(*sql.Selector)
 // UsageDetail is the predicate function for usagedetail builders.
 type UsageDetail func(*sql.Selector)
 
+// UsageStatisticDay is the predicate function for usagestatisticday builders.
+type UsageStatisticDay func(*sql.Selector)
+
+// UsageStatisticHour is the predicate function for usagestatistichour builders.
+type UsageStatisticHour func(*sql.Selector)
+
+// UsageStatisticMonth is the predicate function for usagestatisticmonth builders.
+type UsageStatisticMonth func(*sql.Selector)
+
 // UsageTotal is the predicate function for usagetotal builders.
 type UsageTotal func(*sql.Selector)
 

+ 78 - 16
ent/runtime/runtime.go

@@ -28,6 +28,9 @@ import (
 	"wechat-api/ent/token"
 	"wechat-api/ent/tutorial"
 	"wechat-api/ent/usagedetail"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/usagestatisticmonth"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
 	"wechat-api/ent/wpchatroom"
@@ -425,14 +428,6 @@ func init() {
 	employeeDescTitle := employeeFields[0].Descriptor()
 	// employee.TitleValidator is a validator for the "title" field. It is called by the builders before save.
 	employee.TitleValidator = employeeDescTitle.Validators[0].(func(string) error)
-	// employeeDescAvatar is the schema descriptor for avatar field.
-	employeeDescAvatar := employeeFields[1].Descriptor()
-	// employee.AvatarValidator is a validator for the "avatar" field. It is called by the builders before save.
-	employee.AvatarValidator = employeeDescAvatar.Validators[0].(func(string) error)
-	// employeeDescTags is the schema descriptor for tags field.
-	employeeDescTags := employeeFields[2].Descriptor()
-	// employee.TagsValidator is a validator for the "tags" field. It is called by the builders before save.
-	employee.TagsValidator = employeeDescTags.Validators[0].(func(string) error)
 	// employeeDescHireCount is the schema descriptor for hire_count field.
 	employeeDescHireCount := employeeFields[3].Descriptor()
 	// employee.DefaultHireCount holds the default value on creation for the hire_count field.
@@ -455,20 +450,14 @@ func init() {
 	employeeDescIntro := employeeFields[6].Descriptor()
 	// employee.DefaultIntro holds the default value on creation for the intro field.
 	employee.DefaultIntro = employeeDescIntro.Default.(string)
-	// employee.IntroValidator is a validator for the "intro" field. It is called by the builders before save.
-	employee.IntroValidator = employeeDescIntro.Validators[0].(func(string) error)
 	// employeeDescEstimate is the schema descriptor for estimate field.
 	employeeDescEstimate := employeeFields[7].Descriptor()
 	// employee.DefaultEstimate holds the default value on creation for the estimate field.
 	employee.DefaultEstimate = employeeDescEstimate.Default.(string)
-	// employee.EstimateValidator is a validator for the "estimate" field. It is called by the builders before save.
-	employee.EstimateValidator = employeeDescEstimate.Validators[0].(func(string) error)
 	// employeeDescSkill is the schema descriptor for skill field.
 	employeeDescSkill := employeeFields[8].Descriptor()
 	// employee.DefaultSkill holds the default value on creation for the skill field.
 	employee.DefaultSkill = employeeDescSkill.Default.(string)
-	// employee.SkillValidator is a validator for the "skill" field. It is called by the builders before save.
-	employee.SkillValidator = employeeDescSkill.Validators[0].(func(string) error)
 	// employeeDescAbilityType is the schema descriptor for ability_type field.
 	employeeDescAbilityType := employeeFields[9].Descriptor()
 	// employee.DefaultAbilityType holds the default value on creation for the ability_type field.
@@ -485,8 +474,6 @@ func init() {
 	employeeDescVideoURL := employeeFields[12].Descriptor()
 	// employee.DefaultVideoURL holds the default value on creation for the video_url field.
 	employee.DefaultVideoURL = employeeDescVideoURL.Default.(string)
-	// employee.VideoURLValidator is a validator for the "video_url" field. It is called by the builders before save.
-	employee.VideoURLValidator = employeeDescVideoURL.Validators[0].(func(string) error)
 	// employeeDescOrganizationID is the schema descriptor for organization_id field.
 	employeeDescOrganizationID := employeeFields[13].Descriptor()
 	// employee.OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
@@ -1001,6 +988,81 @@ func init() {
 	usagedetailDescOrganizationID := usagedetailFields[10].Descriptor()
 	// usagedetail.DefaultOrganizationID holds the default value on creation for the organization_id field.
 	usagedetail.DefaultOrganizationID = usagedetailDescOrganizationID.Default.(uint64)
+	usagestatisticdayMixin := schema.UsageStatisticDay{}.Mixin()
+	usagestatisticdayMixinHooks2 := usagestatisticdayMixin[2].Hooks()
+	usagestatisticday.Hooks[0] = usagestatisticdayMixinHooks2[0]
+	usagestatisticdayMixinInters2 := usagestatisticdayMixin[2].Interceptors()
+	usagestatisticday.Interceptors[0] = usagestatisticdayMixinInters2[0]
+	usagestatisticdayMixinFields0 := usagestatisticdayMixin[0].Fields()
+	_ = usagestatisticdayMixinFields0
+	usagestatisticdayMixinFields1 := usagestatisticdayMixin[1].Fields()
+	_ = usagestatisticdayMixinFields1
+	usagestatisticdayFields := schema.UsageStatisticDay{}.Fields()
+	_ = usagestatisticdayFields
+	// usagestatisticdayDescCreatedAt is the schema descriptor for created_at field.
+	usagestatisticdayDescCreatedAt := usagestatisticdayMixinFields0[1].Descriptor()
+	// usagestatisticday.DefaultCreatedAt holds the default value on creation for the created_at field.
+	usagestatisticday.DefaultCreatedAt = usagestatisticdayDescCreatedAt.Default.(func() time.Time)
+	// usagestatisticdayDescUpdatedAt is the schema descriptor for updated_at field.
+	usagestatisticdayDescUpdatedAt := usagestatisticdayMixinFields0[2].Descriptor()
+	// usagestatisticday.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+	usagestatisticday.DefaultUpdatedAt = usagestatisticdayDescUpdatedAt.Default.(func() time.Time)
+	// usagestatisticday.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+	usagestatisticday.UpdateDefaultUpdatedAt = usagestatisticdayDescUpdatedAt.UpdateDefault.(func() time.Time)
+	// usagestatisticdayDescStatus is the schema descriptor for status field.
+	usagestatisticdayDescStatus := usagestatisticdayMixinFields1[0].Descriptor()
+	// usagestatisticday.DefaultStatus holds the default value on creation for the status field.
+	usagestatisticday.DefaultStatus = usagestatisticdayDescStatus.Default.(uint8)
+	usagestatistichourMixin := schema.UsageStatisticHour{}.Mixin()
+	usagestatistichourMixinHooks2 := usagestatistichourMixin[2].Hooks()
+	usagestatistichour.Hooks[0] = usagestatistichourMixinHooks2[0]
+	usagestatistichourMixinInters2 := usagestatistichourMixin[2].Interceptors()
+	usagestatistichour.Interceptors[0] = usagestatistichourMixinInters2[0]
+	usagestatistichourMixinFields0 := usagestatistichourMixin[0].Fields()
+	_ = usagestatistichourMixinFields0
+	usagestatistichourMixinFields1 := usagestatistichourMixin[1].Fields()
+	_ = usagestatistichourMixinFields1
+	usagestatistichourFields := schema.UsageStatisticHour{}.Fields()
+	_ = usagestatistichourFields
+	// usagestatistichourDescCreatedAt is the schema descriptor for created_at field.
+	usagestatistichourDescCreatedAt := usagestatistichourMixinFields0[1].Descriptor()
+	// usagestatistichour.DefaultCreatedAt holds the default value on creation for the created_at field.
+	usagestatistichour.DefaultCreatedAt = usagestatistichourDescCreatedAt.Default.(func() time.Time)
+	// usagestatistichourDescUpdatedAt is the schema descriptor for updated_at field.
+	usagestatistichourDescUpdatedAt := usagestatistichourMixinFields0[2].Descriptor()
+	// usagestatistichour.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+	usagestatistichour.DefaultUpdatedAt = usagestatistichourDescUpdatedAt.Default.(func() time.Time)
+	// usagestatistichour.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+	usagestatistichour.UpdateDefaultUpdatedAt = usagestatistichourDescUpdatedAt.UpdateDefault.(func() time.Time)
+	// usagestatistichourDescStatus is the schema descriptor for status field.
+	usagestatistichourDescStatus := usagestatistichourMixinFields1[0].Descriptor()
+	// usagestatistichour.DefaultStatus holds the default value on creation for the status field.
+	usagestatistichour.DefaultStatus = usagestatistichourDescStatus.Default.(uint8)
+	usagestatisticmonthMixin := schema.UsageStatisticMonth{}.Mixin()
+	usagestatisticmonthMixinHooks2 := usagestatisticmonthMixin[2].Hooks()
+	usagestatisticmonth.Hooks[0] = usagestatisticmonthMixinHooks2[0]
+	usagestatisticmonthMixinInters2 := usagestatisticmonthMixin[2].Interceptors()
+	usagestatisticmonth.Interceptors[0] = usagestatisticmonthMixinInters2[0]
+	usagestatisticmonthMixinFields0 := usagestatisticmonthMixin[0].Fields()
+	_ = usagestatisticmonthMixinFields0
+	usagestatisticmonthMixinFields1 := usagestatisticmonthMixin[1].Fields()
+	_ = usagestatisticmonthMixinFields1
+	usagestatisticmonthFields := schema.UsageStatisticMonth{}.Fields()
+	_ = usagestatisticmonthFields
+	// usagestatisticmonthDescCreatedAt is the schema descriptor for created_at field.
+	usagestatisticmonthDescCreatedAt := usagestatisticmonthMixinFields0[1].Descriptor()
+	// usagestatisticmonth.DefaultCreatedAt holds the default value on creation for the created_at field.
+	usagestatisticmonth.DefaultCreatedAt = usagestatisticmonthDescCreatedAt.Default.(func() time.Time)
+	// usagestatisticmonthDescUpdatedAt is the schema descriptor for updated_at field.
+	usagestatisticmonthDescUpdatedAt := usagestatisticmonthMixinFields0[2].Descriptor()
+	// usagestatisticmonth.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+	usagestatisticmonth.DefaultUpdatedAt = usagestatisticmonthDescUpdatedAt.Default.(func() time.Time)
+	// usagestatisticmonth.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+	usagestatisticmonth.UpdateDefaultUpdatedAt = usagestatisticmonthDescUpdatedAt.UpdateDefault.(func() time.Time)
+	// usagestatisticmonthDescStatus is the schema descriptor for status field.
+	usagestatisticmonthDescStatus := usagestatisticmonthMixinFields1[0].Descriptor()
+	// usagestatisticmonth.DefaultStatus holds the default value on creation for the status field.
+	usagestatisticmonth.DefaultStatus = usagestatisticmonthDescStatus.Default.(uint8)
 	usagetotalMixin := schema.UsageTotal{}.Mixin()
 	usagetotalMixinFields0 := usagetotalMixin[0].Fields()
 	_ = usagetotalMixinFields0

+ 7 - 7
ent/schema/employee.go

@@ -18,19 +18,19 @@ type Employee struct {
 
 func (Employee) Fields() []ent.Field {
 	return []ent.Field{
-		field.String("title").MaxLen(255).Comment("title | 标题"),
-		field.String("avatar").MaxLen(1000).Comment("avatar | 头像"),
-		field.String("tags").MaxLen(255).Comment("tags | 个人标签"),
+		field.String("title").MaxLen(1000).Comment("title | 标题"),
+		field.String("avatar").Comment("avatar | 头像"),
+		field.String("tags").Comment("tags | 个人标签"),
 		field.Int("hire_count").Positive().Default(0).Comment("hire_count | 被雇佣次数"),
 		field.Int("service_count").Positive().Default(0).Comment("service_count | 已服务次数"),
 		field.Int("achievement_count").Positive().Default(0).Comment("achievement_count | 业绩单数"),
-		field.String("intro").MaxLen(1000).Default("").Comment("intro | 个人介绍"),
-		field.String("estimate").MaxLen(1000).Default("").Comment("estimate | 自我评价"),
-		field.String("skill").MaxLen(1000).Default("").Comment("skill | 技能卡"),
+		field.String("intro").Default("").Comment("intro | 个人介绍"),
+		field.String("estimate").Default("").Comment("estimate | 自我评价"),
+		field.String("skill").Default("").Comment("skill | 技能卡"),
 		field.String("ability_type").Default("").Comment("ability_type | 能力类型"),
 		field.String("scene").Default("").Comment("scene | 使用场景"),
 		field.String("switch_in").Default("").Comment("switch_in | 支持介入"),
-		field.String("video_url").MaxLen(1000).Default("").Comment("video_url | 视频地址"),
+		field.String("video_url").Default("").Comment("video_url | 视频地址"),
 		field.Uint64("organization_id").Positive().Comment("organization_id | 租户ID"),
 		field.Uint64("category_id").Positive().Comment("category_id | 分类ID"),
 		field.String("api_base").Default("").Comment("api_base"),

+ 63 - 0
ent/schema/usage_statistic_day.go

@@ -0,0 +1,63 @@
+package schema
+
+import (
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/schema/localmixin"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/entsql"
+	"entgo.io/ent/schema"
+	"entgo.io/ent/schema/field"
+	"entgo.io/ent/schema/index"
+	"github.com/suyuan32/simple-admin-common/orm/ent/mixins"
+)
+
+type UsageStatisticDay struct {
+	ent.Schema
+}
+
+func (UsageStatisticDay) Fields() []ent.Field {
+	return []ent.Field{
+		field.Uint64("addtime").Comment("写入年月日"),
+		field.Int("type").Comment("1-微信 2-名片"),
+		field.String("bot_id").Optional().Comment("微信或名片id"),
+		field.Uint64("organization_id").Optional().Comment("机构ID"),
+		field.Uint64("ai_response").Comment("AI回复次数"),
+		field.Uint64("sop_run").Comment("SOP运行次数"),
+		field.Uint64("total_friend").Comment("好友总数"),
+		field.Uint64("total_group").Comment("群总数"),
+		field.Uint64("account_balance").Comment("账户余额(单位:分)"),
+		field.Uint64("consume_token").Comment("消耗token数"),
+		field.Uint64("active_user").Comment("活跃用户数"),
+		field.Int64("new_user").Comment("新增用户数"),
+		field.JSON("label_dist", []custom_types.LabelDist{}).
+			Annotations(entsql.WithComments(true)).
+			Comment("标签分布"),
+	}
+}
+
+func (UsageStatisticDay) Mixin() []ent.Mixin {
+	return []ent.Mixin{
+		mixins.IDMixin{},
+		mixins.StatusMixin{},
+		localmixin.SoftDeleteMixin{},
+	}
+}
+
+func (UsageStatisticDay) Indexes() []ent.Index {
+	return []ent.Index{
+		index.Fields("addtime"),
+		index.Fields("bot_id"),
+	}
+}
+
+func (UsageStatisticDay) Edges() []ent.Edge {
+	return nil
+}
+
+func (UsageStatisticDay) Annotations() []schema.Annotation {
+	return []schema.Annotation{
+		entsql.WithComments(true),
+		entsql.Annotation{Table: "usage_statistic_day"},
+	}
+}

+ 63 - 0
ent/schema/usage_statistic_hour.go

@@ -0,0 +1,63 @@
+package schema
+
+import (
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/schema/localmixin"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/entsql"
+	"entgo.io/ent/schema"
+	"entgo.io/ent/schema/field"
+	"entgo.io/ent/schema/index"
+	"github.com/suyuan32/simple-admin-common/orm/ent/mixins"
+)
+
+type UsageStatisticHour struct {
+	ent.Schema
+}
+
+func (UsageStatisticHour) Fields() []ent.Field {
+	return []ent.Field{
+		field.Uint64("addtime").Comment("写入小时"),
+		field.Int("type").Comment("1-微信 2-名片"),
+		field.String("bot_id").Optional().Comment("微信或名片id"),
+		field.Uint64("organization_id").Optional().Comment("机构ID"),
+		field.Uint64("ai_response").Comment("AI回复次数"),
+		field.Uint64("sop_run").Comment("SOP运行次数"),
+		field.Uint64("total_friend").Comment("好友总数"),
+		field.Uint64("total_group").Comment("群总数"),
+		field.Uint64("account_balance").Comment("账户余额(单位:分)"),
+		field.Uint64("consume_token").Comment("消耗token数"),
+		field.Uint64("active_user").Comment("活跃用户数"),
+		field.Int64("new_user").Comment("新增用户数"),
+		field.JSON("label_dist", []custom_types.LabelDist{}).
+			Annotations(entsql.WithComments(true)).
+			Comment("标签分布"),
+	}
+}
+
+func (UsageStatisticHour) Mixin() []ent.Mixin {
+	return []ent.Mixin{
+		mixins.IDMixin{},
+		mixins.StatusMixin{},
+		localmixin.SoftDeleteMixin{},
+	}
+}
+
+func (UsageStatisticHour) Indexes() []ent.Index {
+	return []ent.Index{
+		index.Fields("addtime"),
+		index.Fields("bot_id"),
+	}
+}
+
+func (UsageStatisticHour) Edges() []ent.Edge {
+	return nil
+}
+
+func (UsageStatisticHour) Annotations() []schema.Annotation {
+	return []schema.Annotation{
+		entsql.WithComments(true),
+		entsql.Annotation{Table: "usage_statistic_hour"},
+	}
+}

+ 63 - 0
ent/schema/usage_statistic_month.go

@@ -0,0 +1,63 @@
+package schema
+
+import (
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/schema/localmixin"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/entsql"
+	"entgo.io/ent/schema"
+	"entgo.io/ent/schema/field"
+	"entgo.io/ent/schema/index"
+	"github.com/suyuan32/simple-admin-common/orm/ent/mixins"
+)
+
+type UsageStatisticMonth struct {
+	ent.Schema
+}
+
+func (UsageStatisticMonth) Fields() []ent.Field {
+	return []ent.Field{
+		field.Uint64("addtime").Comment("写入年月"),
+		field.Int("type").Comment("1-微信 2-名片"),
+		field.String("bot_id").Optional().Comment("微信或名片id"),
+		field.Uint64("organization_id").Optional().Comment("机构ID"),
+		field.Uint64("ai_response").Comment("AI回复次数"),
+		field.Uint64("sop_run").Comment("SOP运行次数"),
+		field.Uint64("total_friend").Comment("好友总数"),
+		field.Uint64("total_group").Comment("群总数"),
+		field.Uint64("account_balance").Comment("账户余额(单位:分)"),
+		field.Uint64("consume_token").Comment("消耗token数"),
+		field.Uint64("active_user").Comment("活跃用户数"),
+		field.Int64("new_user").Comment("新增用户数"),
+		field.JSON("label_dist", []custom_types.LabelDist{}).
+			Annotations(entsql.WithComments(true)).
+			Comment("标签分布"),
+	}
+}
+
+func (UsageStatisticMonth) Mixin() []ent.Mixin {
+	return []ent.Mixin{
+		mixins.IDMixin{},
+		mixins.StatusMixin{},
+		localmixin.SoftDeleteMixin{},
+	}
+}
+
+func (UsageStatisticMonth) Indexes() []ent.Index {
+	return []ent.Index{
+		index.Fields("addtime"),
+		index.Fields("bot_id"),
+	}
+}
+
+func (UsageStatisticMonth) Edges() []ent.Edge {
+	return nil
+}
+
+func (UsageStatisticMonth) Annotations() []schema.Annotation {
+	return []schema.Annotation{
+		entsql.WithComments(true),
+		entsql.Annotation{Table: "usage_statistic_month"},
+	}
+}

+ 1152 - 0
ent/set_not_nil.go

@@ -5624,6 +5624,1158 @@ func (ud *UsageDetailCreate) SetNotNilOrganizationID(value *uint64) *UsageDetail
 }
 
 // set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetUpdatedAt(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetUpdatedAt(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetUpdatedAt(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilStatus(value *uint8) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetStatus(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilStatus(value *uint8) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetStatus(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilStatus(value *uint8) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetStatus(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilDeletedAt(value *time.Time) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetDeletedAt(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilDeletedAt(value *time.Time) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetDeletedAt(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilDeletedAt(value *time.Time) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetDeletedAt(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilAddtime(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetAddtime(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilAddtime(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetAddtime(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilAddtime(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetAddtime(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilType(value *int) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetType(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilType(value *int) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetType(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilType(value *int) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetType(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilBotID(value *string) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetBotID(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilBotID(value *string) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetBotID(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilBotID(value *string) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetBotID(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilOrganizationID(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetOrganizationID(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilOrganizationID(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetOrganizationID(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilOrganizationID(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetOrganizationID(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilAiResponse(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetAiResponse(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilAiResponse(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetAiResponse(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilAiResponse(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetAiResponse(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilSopRun(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetSopRun(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilSopRun(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetSopRun(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilSopRun(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetSopRun(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilTotalFriend(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetTotalFriend(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilTotalFriend(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetTotalFriend(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilTotalFriend(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetTotalFriend(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilTotalGroup(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetTotalGroup(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilTotalGroup(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetTotalGroup(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilTotalGroup(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetTotalGroup(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilAccountBalance(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetAccountBalance(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilAccountBalance(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetAccountBalance(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilAccountBalance(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetAccountBalance(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilConsumeToken(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetConsumeToken(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilConsumeToken(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetConsumeToken(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilConsumeToken(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetConsumeToken(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilActiveUser(value *uint64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetActiveUser(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilActiveUser(value *uint64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetActiveUser(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilActiveUser(value *uint64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetActiveUser(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilNewUser(value *int64) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetNewUser(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilNewUser(value *int64) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetNewUser(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilNewUser(value *int64) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetNewUser(*value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdate) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticDayUpdate {
+	if value != nil {
+		return usd.SetLabelDist(value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayUpdateOne) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticDayUpdateOne {
+	if value != nil {
+		return usd.SetLabelDist(value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (usd *UsageStatisticDayCreate) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticDayCreate {
+	if value != nil {
+		return usd.SetLabelDist(value)
+	}
+	return usd
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetUpdatedAt(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetUpdatedAt(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetUpdatedAt(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilStatus(value *uint8) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetStatus(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilStatus(value *uint8) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetStatus(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilStatus(value *uint8) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetStatus(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilDeletedAt(value *time.Time) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetDeletedAt(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilDeletedAt(value *time.Time) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetDeletedAt(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilDeletedAt(value *time.Time) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetDeletedAt(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilAddtime(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetAddtime(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilAddtime(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetAddtime(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilAddtime(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetAddtime(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilType(value *int) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetType(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilType(value *int) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetType(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilType(value *int) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetType(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilBotID(value *string) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetBotID(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilBotID(value *string) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetBotID(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilBotID(value *string) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetBotID(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilOrganizationID(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetOrganizationID(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilOrganizationID(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetOrganizationID(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilOrganizationID(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetOrganizationID(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilAiResponse(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetAiResponse(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilAiResponse(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetAiResponse(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilAiResponse(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetAiResponse(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilSopRun(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetSopRun(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilSopRun(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetSopRun(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilSopRun(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetSopRun(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilTotalFriend(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetTotalFriend(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilTotalFriend(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetTotalFriend(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilTotalFriend(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetTotalFriend(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilTotalGroup(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetTotalGroup(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilTotalGroup(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetTotalGroup(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilTotalGroup(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetTotalGroup(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilAccountBalance(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetAccountBalance(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilAccountBalance(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetAccountBalance(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilAccountBalance(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetAccountBalance(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilConsumeToken(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetConsumeToken(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilConsumeToken(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetConsumeToken(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilConsumeToken(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetConsumeToken(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilActiveUser(value *uint64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetActiveUser(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilActiveUser(value *uint64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetActiveUser(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilActiveUser(value *uint64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetActiveUser(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilNewUser(value *int64) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetNewUser(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilNewUser(value *int64) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetNewUser(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilNewUser(value *int64) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetNewUser(*value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdate) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticHourUpdate {
+	if value != nil {
+		return ush.SetLabelDist(value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourUpdateOne) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticHourUpdateOne {
+	if value != nil {
+		return ush.SetLabelDist(value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (ush *UsageStatisticHourCreate) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticHourCreate {
+	if value != nil {
+		return ush.SetLabelDist(value)
+	}
+	return ush
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetUpdatedAt(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetUpdatedAt(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilUpdatedAt(value *time.Time) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetUpdatedAt(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilStatus(value *uint8) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetStatus(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilStatus(value *uint8) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetStatus(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilStatus(value *uint8) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetStatus(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilDeletedAt(value *time.Time) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetDeletedAt(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilDeletedAt(value *time.Time) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetDeletedAt(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilDeletedAt(value *time.Time) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetDeletedAt(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilAddtime(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetAddtime(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilAddtime(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetAddtime(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilAddtime(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetAddtime(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilType(value *int) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetType(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilType(value *int) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetType(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilType(value *int) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetType(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilBotID(value *string) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetBotID(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilBotID(value *string) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetBotID(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilBotID(value *string) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetBotID(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilOrganizationID(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetOrganizationID(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilOrganizationID(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetOrganizationID(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilOrganizationID(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetOrganizationID(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilAiResponse(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetAiResponse(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilAiResponse(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetAiResponse(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilAiResponse(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetAiResponse(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilSopRun(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetSopRun(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilSopRun(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetSopRun(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilSopRun(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetSopRun(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilTotalFriend(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetTotalFriend(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilTotalFriend(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetTotalFriend(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilTotalFriend(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetTotalFriend(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilTotalGroup(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetTotalGroup(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilTotalGroup(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetTotalGroup(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilTotalGroup(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetTotalGroup(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilAccountBalance(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetAccountBalance(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilAccountBalance(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetAccountBalance(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilAccountBalance(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetAccountBalance(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilConsumeToken(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetConsumeToken(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilConsumeToken(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetConsumeToken(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilConsumeToken(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetConsumeToken(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilActiveUser(value *uint64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetActiveUser(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilActiveUser(value *uint64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetActiveUser(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilActiveUser(value *uint64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetActiveUser(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilNewUser(value *int64) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetNewUser(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilNewUser(value *int64) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetNewUser(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilNewUser(value *int64) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetNewUser(*value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdate) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticMonthUpdate {
+	if value != nil {
+		return usm.SetLabelDist(value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthUpdateOne) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticMonthUpdateOne {
+	if value != nil {
+		return usm.SetLabelDist(value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
+func (usm *UsageStatisticMonthCreate) SetNotNilLabelDist(value []custom_types.LabelDist) *UsageStatisticMonthCreate {
+	if value != nil {
+		return usm.SetLabelDist(value)
+	}
+	return usm
+}
+
+// set field if value's pointer is not nil.
 func (ut *UsageTotalUpdate) SetNotNilUpdatedAt(value *time.Time) *UsageTotalUpdate {
 	if value != nil {
 		return ut.SetUpdatedAt(*value)

+ 9 - 0
ent/tx.go

@@ -60,6 +60,12 @@ type Tx struct {
 	Tutorial *TutorialClient
 	// UsageDetail is the client for interacting with the UsageDetail builders.
 	UsageDetail *UsageDetailClient
+	// UsageStatisticDay is the client for interacting with the UsageStatisticDay builders.
+	UsageStatisticDay *UsageStatisticDayClient
+	// UsageStatisticHour is the client for interacting with the UsageStatisticHour builders.
+	UsageStatisticHour *UsageStatisticHourClient
+	// UsageStatisticMonth is the client for interacting with the UsageStatisticMonth builders.
+	UsageStatisticMonth *UsageStatisticMonthClient
 	// UsageTotal is the client for interacting with the UsageTotal builders.
 	UsageTotal *UsageTotalClient
 	// WorkExperience is the client for interacting with the WorkExperience builders.
@@ -230,6 +236,9 @@ func (tx *Tx) init() {
 	tx.Token = NewTokenClient(tx.config)
 	tx.Tutorial = NewTutorialClient(tx.config)
 	tx.UsageDetail = NewUsageDetailClient(tx.config)
+	tx.UsageStatisticDay = NewUsageStatisticDayClient(tx.config)
+	tx.UsageStatisticHour = NewUsageStatisticHourClient(tx.config)
+	tx.UsageStatisticMonth = NewUsageStatisticMonthClient(tx.config)
 	tx.UsageTotal = NewUsageTotalClient(tx.config)
 	tx.WorkExperience = NewWorkExperienceClient(tx.config)
 	tx.WpChatroom = NewWpChatroomClient(tx.config)

+ 288 - 0
ent/usagestatisticday.go

@@ -0,0 +1,288 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"encoding/json"
+	"fmt"
+	"strings"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/usagestatisticday"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+// UsageStatisticDay is the model entity for the UsageStatisticDay schema.
+type UsageStatisticDay struct {
+	config `json:"-"`
+	// ID of the ent.
+	ID uint64 `json:"id,omitempty"`
+	// Create Time | 创建日期
+	CreatedAt time.Time `json:"created_at,omitempty"`
+	// Update Time | 修改日期
+	UpdatedAt time.Time `json:"updated_at,omitempty"`
+	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
+	Status uint8 `json:"status,omitempty"`
+	// Delete Time | 删除日期
+	DeletedAt time.Time `json:"deleted_at,omitempty"`
+	// 写入年月日
+	Addtime uint64 `json:"addtime,omitempty"`
+	// 1-微信 2-名片
+	Type int `json:"type,omitempty"`
+	// 微信或名片id
+	BotID string `json:"bot_id,omitempty"`
+	// 机构ID
+	OrganizationID uint64 `json:"organization_id,omitempty"`
+	// AI回复次数
+	AiResponse uint64 `json:"ai_response,omitempty"`
+	// SOP运行次数
+	SopRun uint64 `json:"sop_run,omitempty"`
+	// 好友总数
+	TotalFriend uint64 `json:"total_friend,omitempty"`
+	// 群总数
+	TotalGroup uint64 `json:"total_group,omitempty"`
+	// 账户余额(单位:分)
+	AccountBalance uint64 `json:"account_balance,omitempty"`
+	// 消耗token数
+	ConsumeToken uint64 `json:"consume_token,omitempty"`
+	// 活跃用户数
+	ActiveUser uint64 `json:"active_user,omitempty"`
+	// 新增用户数
+	NewUser int64 `json:"new_user,omitempty"`
+	// 标签分布
+	LabelDist    []custom_types.LabelDist `json:"label_dist,omitempty"`
+	selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*UsageStatisticDay) scanValues(columns []string) ([]any, error) {
+	values := make([]any, len(columns))
+	for i := range columns {
+		switch columns[i] {
+		case usagestatisticday.FieldLabelDist:
+			values[i] = new([]byte)
+		case usagestatisticday.FieldID, usagestatisticday.FieldStatus, usagestatisticday.FieldAddtime, usagestatisticday.FieldType, usagestatisticday.FieldOrganizationID, usagestatisticday.FieldAiResponse, usagestatisticday.FieldSopRun, usagestatisticday.FieldTotalFriend, usagestatisticday.FieldTotalGroup, usagestatisticday.FieldAccountBalance, usagestatisticday.FieldConsumeToken, usagestatisticday.FieldActiveUser, usagestatisticday.FieldNewUser:
+			values[i] = new(sql.NullInt64)
+		case usagestatisticday.FieldBotID:
+			values[i] = new(sql.NullString)
+		case usagestatisticday.FieldCreatedAt, usagestatisticday.FieldUpdatedAt, usagestatisticday.FieldDeletedAt:
+			values[i] = new(sql.NullTime)
+		default:
+			values[i] = new(sql.UnknownType)
+		}
+	}
+	return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the UsageStatisticDay fields.
+func (usd *UsageStatisticDay) assignValues(columns []string, values []any) error {
+	if m, n := len(values), len(columns); m < n {
+		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+	}
+	for i := range columns {
+		switch columns[i] {
+		case usagestatisticday.FieldID:
+			value, ok := values[i].(*sql.NullInt64)
+			if !ok {
+				return fmt.Errorf("unexpected type %T for field id", value)
+			}
+			usd.ID = uint64(value.Int64)
+		case usagestatisticday.FieldCreatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field created_at", values[i])
+			} else if value.Valid {
+				usd.CreatedAt = value.Time
+			}
+		case usagestatisticday.FieldUpdatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+			} else if value.Valid {
+				usd.UpdatedAt = value.Time
+			}
+		case usagestatisticday.FieldStatus:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field status", values[i])
+			} else if value.Valid {
+				usd.Status = uint8(value.Int64)
+			}
+		case usagestatisticday.FieldDeletedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
+			} else if value.Valid {
+				usd.DeletedAt = value.Time
+			}
+		case usagestatisticday.FieldAddtime:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field addtime", values[i])
+			} else if value.Valid {
+				usd.Addtime = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldType:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field type", values[i])
+			} else if value.Valid {
+				usd.Type = int(value.Int64)
+			}
+		case usagestatisticday.FieldBotID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field bot_id", values[i])
+			} else if value.Valid {
+				usd.BotID = value.String
+			}
+		case usagestatisticday.FieldOrganizationID:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field organization_id", values[i])
+			} else if value.Valid {
+				usd.OrganizationID = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldAiResponse:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field ai_response", values[i])
+			} else if value.Valid {
+				usd.AiResponse = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldSopRun:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field sop_run", values[i])
+			} else if value.Valid {
+				usd.SopRun = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldTotalFriend:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field total_friend", values[i])
+			} else if value.Valid {
+				usd.TotalFriend = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldTotalGroup:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field total_group", values[i])
+			} else if value.Valid {
+				usd.TotalGroup = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldAccountBalance:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field account_balance", values[i])
+			} else if value.Valid {
+				usd.AccountBalance = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldConsumeToken:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field consume_token", values[i])
+			} else if value.Valid {
+				usd.ConsumeToken = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldActiveUser:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field active_user", values[i])
+			} else if value.Valid {
+				usd.ActiveUser = uint64(value.Int64)
+			}
+		case usagestatisticday.FieldNewUser:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field new_user", values[i])
+			} else if value.Valid {
+				usd.NewUser = value.Int64
+			}
+		case usagestatisticday.FieldLabelDist:
+			if value, ok := values[i].(*[]byte); !ok {
+				return fmt.Errorf("unexpected type %T for field label_dist", values[i])
+			} else if value != nil && len(*value) > 0 {
+				if err := json.Unmarshal(*value, &usd.LabelDist); err != nil {
+					return fmt.Errorf("unmarshal field label_dist: %w", err)
+				}
+			}
+		default:
+			usd.selectValues.Set(columns[i], values[i])
+		}
+	}
+	return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the UsageStatisticDay.
+// This includes values selected through modifiers, order, etc.
+func (usd *UsageStatisticDay) Value(name string) (ent.Value, error) {
+	return usd.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this UsageStatisticDay.
+// Note that you need to call UsageStatisticDay.Unwrap() before calling this method if this UsageStatisticDay
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (usd *UsageStatisticDay) Update() *UsageStatisticDayUpdateOne {
+	return NewUsageStatisticDayClient(usd.config).UpdateOne(usd)
+}
+
+// Unwrap unwraps the UsageStatisticDay entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (usd *UsageStatisticDay) Unwrap() *UsageStatisticDay {
+	_tx, ok := usd.config.driver.(*txDriver)
+	if !ok {
+		panic("ent: UsageStatisticDay is not a transactional entity")
+	}
+	usd.config.driver = _tx.drv
+	return usd
+}
+
+// String implements the fmt.Stringer.
+func (usd *UsageStatisticDay) String() string {
+	var builder strings.Builder
+	builder.WriteString("UsageStatisticDay(")
+	builder.WriteString(fmt.Sprintf("id=%v, ", usd.ID))
+	builder.WriteString("created_at=")
+	builder.WriteString(usd.CreatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("updated_at=")
+	builder.WriteString(usd.UpdatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("status=")
+	builder.WriteString(fmt.Sprintf("%v", usd.Status))
+	builder.WriteString(", ")
+	builder.WriteString("deleted_at=")
+	builder.WriteString(usd.DeletedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("addtime=")
+	builder.WriteString(fmt.Sprintf("%v", usd.Addtime))
+	builder.WriteString(", ")
+	builder.WriteString("type=")
+	builder.WriteString(fmt.Sprintf("%v", usd.Type))
+	builder.WriteString(", ")
+	builder.WriteString("bot_id=")
+	builder.WriteString(usd.BotID)
+	builder.WriteString(", ")
+	builder.WriteString("organization_id=")
+	builder.WriteString(fmt.Sprintf("%v", usd.OrganizationID))
+	builder.WriteString(", ")
+	builder.WriteString("ai_response=")
+	builder.WriteString(fmt.Sprintf("%v", usd.AiResponse))
+	builder.WriteString(", ")
+	builder.WriteString("sop_run=")
+	builder.WriteString(fmt.Sprintf("%v", usd.SopRun))
+	builder.WriteString(", ")
+	builder.WriteString("total_friend=")
+	builder.WriteString(fmt.Sprintf("%v", usd.TotalFriend))
+	builder.WriteString(", ")
+	builder.WriteString("total_group=")
+	builder.WriteString(fmt.Sprintf("%v", usd.TotalGroup))
+	builder.WriteString(", ")
+	builder.WriteString("account_balance=")
+	builder.WriteString(fmt.Sprintf("%v", usd.AccountBalance))
+	builder.WriteString(", ")
+	builder.WriteString("consume_token=")
+	builder.WriteString(fmt.Sprintf("%v", usd.ConsumeToken))
+	builder.WriteString(", ")
+	builder.WriteString("active_user=")
+	builder.WriteString(fmt.Sprintf("%v", usd.ActiveUser))
+	builder.WriteString(", ")
+	builder.WriteString("new_user=")
+	builder.WriteString(fmt.Sprintf("%v", usd.NewUser))
+	builder.WriteString(", ")
+	builder.WriteString("label_dist=")
+	builder.WriteString(fmt.Sprintf("%v", usd.LabelDist))
+	builder.WriteByte(')')
+	return builder.String()
+}
+
+// UsageStatisticDays is a parsable slice of UsageStatisticDay.
+type UsageStatisticDays []*UsageStatisticDay

+ 191 - 0
ent/usagestatisticday/usagestatisticday.go

@@ -0,0 +1,191 @@
+// Code generated by ent, DO NOT EDIT.
+
+package usagestatisticday
+
+import (
+	"time"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+const (
+	// Label holds the string label denoting the usagestatisticday type in the database.
+	Label = "usage_statistic_day"
+	// FieldID holds the string denoting the id field in the database.
+	FieldID = "id"
+	// FieldCreatedAt holds the string denoting the created_at field in the database.
+	FieldCreatedAt = "created_at"
+	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
+	FieldUpdatedAt = "updated_at"
+	// FieldStatus holds the string denoting the status field in the database.
+	FieldStatus = "status"
+	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
+	FieldDeletedAt = "deleted_at"
+	// FieldAddtime holds the string denoting the addtime field in the database.
+	FieldAddtime = "addtime"
+	// FieldType holds the string denoting the type field in the database.
+	FieldType = "type"
+	// FieldBotID holds the string denoting the bot_id field in the database.
+	FieldBotID = "bot_id"
+	// FieldOrganizationID holds the string denoting the organization_id field in the database.
+	FieldOrganizationID = "organization_id"
+	// FieldAiResponse holds the string denoting the ai_response field in the database.
+	FieldAiResponse = "ai_response"
+	// FieldSopRun holds the string denoting the sop_run field in the database.
+	FieldSopRun = "sop_run"
+	// FieldTotalFriend holds the string denoting the total_friend field in the database.
+	FieldTotalFriend = "total_friend"
+	// FieldTotalGroup holds the string denoting the total_group field in the database.
+	FieldTotalGroup = "total_group"
+	// FieldAccountBalance holds the string denoting the account_balance field in the database.
+	FieldAccountBalance = "account_balance"
+	// FieldConsumeToken holds the string denoting the consume_token field in the database.
+	FieldConsumeToken = "consume_token"
+	// FieldActiveUser holds the string denoting the active_user field in the database.
+	FieldActiveUser = "active_user"
+	// FieldNewUser holds the string denoting the new_user field in the database.
+	FieldNewUser = "new_user"
+	// FieldLabelDist holds the string denoting the label_dist field in the database.
+	FieldLabelDist = "label_dist"
+	// Table holds the table name of the usagestatisticday in the database.
+	Table = "usage_statistic_day"
+)
+
+// Columns holds all SQL columns for usagestatisticday fields.
+var Columns = []string{
+	FieldID,
+	FieldCreatedAt,
+	FieldUpdatedAt,
+	FieldStatus,
+	FieldDeletedAt,
+	FieldAddtime,
+	FieldType,
+	FieldBotID,
+	FieldOrganizationID,
+	FieldAiResponse,
+	FieldSopRun,
+	FieldTotalFriend,
+	FieldTotalGroup,
+	FieldAccountBalance,
+	FieldConsumeToken,
+	FieldActiveUser,
+	FieldNewUser,
+	FieldLabelDist,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+	for i := range Columns {
+		if column == Columns[i] {
+			return true
+		}
+	}
+	return false
+}
+
+// Note that the variables below are initialized by the runtime
+// package on the initialization of the application. Therefore,
+// it should be imported in the main as follows:
+//
+//	import _ "wechat-api/ent/runtime"
+var (
+	Hooks        [1]ent.Hook
+	Interceptors [1]ent.Interceptor
+	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
+	DefaultCreatedAt func() time.Time
+	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+	DefaultUpdatedAt func() time.Time
+	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+	UpdateDefaultUpdatedAt func() time.Time
+	// DefaultStatus holds the default value on creation for the "status" field.
+	DefaultStatus uint8
+)
+
+// OrderOption defines the ordering options for the UsageStatisticDay queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByDeletedAt orders the results by the deleted_at field.
+func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
+}
+
+// ByAddtime orders the results by the addtime field.
+func ByAddtime(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAddtime, opts...).ToFunc()
+}
+
+// ByType orders the results by the type field.
+func ByType(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldType, opts...).ToFunc()
+}
+
+// ByBotID orders the results by the bot_id field.
+func ByBotID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldBotID, opts...).ToFunc()
+}
+
+// ByOrganizationID orders the results by the organization_id field.
+func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
+}
+
+// ByAiResponse orders the results by the ai_response field.
+func ByAiResponse(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAiResponse, opts...).ToFunc()
+}
+
+// BySopRun orders the results by the sop_run field.
+func BySopRun(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldSopRun, opts...).ToFunc()
+}
+
+// ByTotalFriend orders the results by the total_friend field.
+func ByTotalFriend(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldTotalFriend, opts...).ToFunc()
+}
+
+// ByTotalGroup orders the results by the total_group field.
+func ByTotalGroup(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldTotalGroup, opts...).ToFunc()
+}
+
+// ByAccountBalance orders the results by the account_balance field.
+func ByAccountBalance(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAccountBalance, opts...).ToFunc()
+}
+
+// ByConsumeToken orders the results by the consume_token field.
+func ByConsumeToken(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldConsumeToken, opts...).ToFunc()
+}
+
+// ByActiveUser orders the results by the active_user field.
+func ByActiveUser(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldActiveUser, opts...).ToFunc()
+}
+
+// ByNewUser orders the results by the new_user field.
+func ByNewUser(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldNewUser, opts...).ToFunc()
+}

+ 855 - 0
ent/usagestatisticday/where.go

@@ -0,0 +1,855 @@
+// Code generated by ent, DO NOT EDIT.
+
+package usagestatisticday
+
+import (
+	"time"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldStatus, v))
+}
+
+// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
+func DeletedAt(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// Addtime applies equality check predicate on the "addtime" field. It's identical to AddtimeEQ.
+func Addtime(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldAddtime, v))
+}
+
+// Type applies equality check predicate on the "type" field. It's identical to TypeEQ.
+func Type(v int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldType, v))
+}
+
+// BotID applies equality check predicate on the "bot_id" field. It's identical to BotIDEQ.
+func BotID(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldBotID, v))
+}
+
+// OrganizationID applies equality check predicate on the "organization_id" field. It's identical to OrganizationIDEQ.
+func OrganizationID(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// AiResponse applies equality check predicate on the "ai_response" field. It's identical to AiResponseEQ.
+func AiResponse(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldAiResponse, v))
+}
+
+// SopRun applies equality check predicate on the "sop_run" field. It's identical to SopRunEQ.
+func SopRun(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldSopRun, v))
+}
+
+// TotalFriend applies equality check predicate on the "total_friend" field. It's identical to TotalFriendEQ.
+func TotalFriend(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldTotalFriend, v))
+}
+
+// TotalGroup applies equality check predicate on the "total_group" field. It's identical to TotalGroupEQ.
+func TotalGroup(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldTotalGroup, v))
+}
+
+// AccountBalance applies equality check predicate on the "account_balance" field. It's identical to AccountBalanceEQ.
+func AccountBalance(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldAccountBalance, v))
+}
+
+// ConsumeToken applies equality check predicate on the "consume_token" field. It's identical to ConsumeTokenEQ.
+func ConsumeToken(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldConsumeToken, v))
+}
+
+// ActiveUser applies equality check predicate on the "active_user" field. It's identical to ActiveUserEQ.
+func ActiveUser(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldActiveUser, v))
+}
+
+// NewUser applies equality check predicate on the "new_user" field. It's identical to NewUserEQ.
+func NewUser(v int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldNewUser, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v uint8) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusIsNil applies the IsNil predicate on the "status" field.
+func StatusIsNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIsNull(FieldStatus))
+}
+
+// StatusNotNil applies the NotNil predicate on the "status" field.
+func StatusNotNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotNull(FieldStatus))
+}
+
+// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
+func DeletedAtEQ(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
+func DeletedAtNEQ(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtIn applies the In predicate on the "deleted_at" field.
+func DeletedAtIn(vs ...time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
+func DeletedAtNotIn(vs ...time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtGT applies the GT predicate on the "deleted_at" field.
+func DeletedAtGT(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldDeletedAt, v))
+}
+
+// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
+func DeletedAtGTE(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldDeletedAt, v))
+}
+
+// DeletedAtLT applies the LT predicate on the "deleted_at" field.
+func DeletedAtLT(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldDeletedAt, v))
+}
+
+// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
+func DeletedAtLTE(v time.Time) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldDeletedAt, v))
+}
+
+// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
+func DeletedAtIsNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIsNull(FieldDeletedAt))
+}
+
+// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
+func DeletedAtNotNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotNull(FieldDeletedAt))
+}
+
+// AddtimeEQ applies the EQ predicate on the "addtime" field.
+func AddtimeEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldAddtime, v))
+}
+
+// AddtimeNEQ applies the NEQ predicate on the "addtime" field.
+func AddtimeNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldAddtime, v))
+}
+
+// AddtimeIn applies the In predicate on the "addtime" field.
+func AddtimeIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldAddtime, vs...))
+}
+
+// AddtimeNotIn applies the NotIn predicate on the "addtime" field.
+func AddtimeNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldAddtime, vs...))
+}
+
+// AddtimeGT applies the GT predicate on the "addtime" field.
+func AddtimeGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldAddtime, v))
+}
+
+// AddtimeGTE applies the GTE predicate on the "addtime" field.
+func AddtimeGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldAddtime, v))
+}
+
+// AddtimeLT applies the LT predicate on the "addtime" field.
+func AddtimeLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldAddtime, v))
+}
+
+// AddtimeLTE applies the LTE predicate on the "addtime" field.
+func AddtimeLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldAddtime, v))
+}
+
+// TypeEQ applies the EQ predicate on the "type" field.
+func TypeEQ(v int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldType, v))
+}
+
+// TypeNEQ applies the NEQ predicate on the "type" field.
+func TypeNEQ(v int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldType, v))
+}
+
+// TypeIn applies the In predicate on the "type" field.
+func TypeIn(vs ...int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldType, vs...))
+}
+
+// TypeNotIn applies the NotIn predicate on the "type" field.
+func TypeNotIn(vs ...int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldType, vs...))
+}
+
+// TypeGT applies the GT predicate on the "type" field.
+func TypeGT(v int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldType, v))
+}
+
+// TypeGTE applies the GTE predicate on the "type" field.
+func TypeGTE(v int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldType, v))
+}
+
+// TypeLT applies the LT predicate on the "type" field.
+func TypeLT(v int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldType, v))
+}
+
+// TypeLTE applies the LTE predicate on the "type" field.
+func TypeLTE(v int) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldType, v))
+}
+
+// BotIDEQ applies the EQ predicate on the "bot_id" field.
+func BotIDEQ(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldBotID, v))
+}
+
+// BotIDNEQ applies the NEQ predicate on the "bot_id" field.
+func BotIDNEQ(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldBotID, v))
+}
+
+// BotIDIn applies the In predicate on the "bot_id" field.
+func BotIDIn(vs ...string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldBotID, vs...))
+}
+
+// BotIDNotIn applies the NotIn predicate on the "bot_id" field.
+func BotIDNotIn(vs ...string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldBotID, vs...))
+}
+
+// BotIDGT applies the GT predicate on the "bot_id" field.
+func BotIDGT(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldBotID, v))
+}
+
+// BotIDGTE applies the GTE predicate on the "bot_id" field.
+func BotIDGTE(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldBotID, v))
+}
+
+// BotIDLT applies the LT predicate on the "bot_id" field.
+func BotIDLT(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldBotID, v))
+}
+
+// BotIDLTE applies the LTE predicate on the "bot_id" field.
+func BotIDLTE(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldBotID, v))
+}
+
+// BotIDContains applies the Contains predicate on the "bot_id" field.
+func BotIDContains(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldContains(FieldBotID, v))
+}
+
+// BotIDHasPrefix applies the HasPrefix predicate on the "bot_id" field.
+func BotIDHasPrefix(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldHasPrefix(FieldBotID, v))
+}
+
+// BotIDHasSuffix applies the HasSuffix predicate on the "bot_id" field.
+func BotIDHasSuffix(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldHasSuffix(FieldBotID, v))
+}
+
+// BotIDIsNil applies the IsNil predicate on the "bot_id" field.
+func BotIDIsNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIsNull(FieldBotID))
+}
+
+// BotIDNotNil applies the NotNil predicate on the "bot_id" field.
+func BotIDNotNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotNull(FieldBotID))
+}
+
+// BotIDEqualFold applies the EqualFold predicate on the "bot_id" field.
+func BotIDEqualFold(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEqualFold(FieldBotID, v))
+}
+
+// BotIDContainsFold applies the ContainsFold predicate on the "bot_id" field.
+func BotIDContainsFold(v string) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldContainsFold(FieldBotID, v))
+}
+
+// OrganizationIDEQ applies the EQ predicate on the "organization_id" field.
+func OrganizationIDEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDNEQ applies the NEQ predicate on the "organization_id" field.
+func OrganizationIDNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDIn applies the In predicate on the "organization_id" field.
+func OrganizationIDIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDNotIn applies the NotIn predicate on the "organization_id" field.
+func OrganizationIDNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDGT applies the GT predicate on the "organization_id" field.
+func OrganizationIDGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldOrganizationID, v))
+}
+
+// OrganizationIDGTE applies the GTE predicate on the "organization_id" field.
+func OrganizationIDGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldOrganizationID, v))
+}
+
+// OrganizationIDLT applies the LT predicate on the "organization_id" field.
+func OrganizationIDLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldOrganizationID, v))
+}
+
+// OrganizationIDLTE applies the LTE predicate on the "organization_id" field.
+func OrganizationIDLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldOrganizationID, v))
+}
+
+// OrganizationIDIsNil applies the IsNil predicate on the "organization_id" field.
+func OrganizationIDIsNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIsNull(FieldOrganizationID))
+}
+
+// OrganizationIDNotNil applies the NotNil predicate on the "organization_id" field.
+func OrganizationIDNotNil() predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotNull(FieldOrganizationID))
+}
+
+// AiResponseEQ applies the EQ predicate on the "ai_response" field.
+func AiResponseEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldAiResponse, v))
+}
+
+// AiResponseNEQ applies the NEQ predicate on the "ai_response" field.
+func AiResponseNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldAiResponse, v))
+}
+
+// AiResponseIn applies the In predicate on the "ai_response" field.
+func AiResponseIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldAiResponse, vs...))
+}
+
+// AiResponseNotIn applies the NotIn predicate on the "ai_response" field.
+func AiResponseNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldAiResponse, vs...))
+}
+
+// AiResponseGT applies the GT predicate on the "ai_response" field.
+func AiResponseGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldAiResponse, v))
+}
+
+// AiResponseGTE applies the GTE predicate on the "ai_response" field.
+func AiResponseGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldAiResponse, v))
+}
+
+// AiResponseLT applies the LT predicate on the "ai_response" field.
+func AiResponseLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldAiResponse, v))
+}
+
+// AiResponseLTE applies the LTE predicate on the "ai_response" field.
+func AiResponseLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldAiResponse, v))
+}
+
+// SopRunEQ applies the EQ predicate on the "sop_run" field.
+func SopRunEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldSopRun, v))
+}
+
+// SopRunNEQ applies the NEQ predicate on the "sop_run" field.
+func SopRunNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldSopRun, v))
+}
+
+// SopRunIn applies the In predicate on the "sop_run" field.
+func SopRunIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldSopRun, vs...))
+}
+
+// SopRunNotIn applies the NotIn predicate on the "sop_run" field.
+func SopRunNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldSopRun, vs...))
+}
+
+// SopRunGT applies the GT predicate on the "sop_run" field.
+func SopRunGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldSopRun, v))
+}
+
+// SopRunGTE applies the GTE predicate on the "sop_run" field.
+func SopRunGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldSopRun, v))
+}
+
+// SopRunLT applies the LT predicate on the "sop_run" field.
+func SopRunLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldSopRun, v))
+}
+
+// SopRunLTE applies the LTE predicate on the "sop_run" field.
+func SopRunLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldSopRun, v))
+}
+
+// TotalFriendEQ applies the EQ predicate on the "total_friend" field.
+func TotalFriendEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldTotalFriend, v))
+}
+
+// TotalFriendNEQ applies the NEQ predicate on the "total_friend" field.
+func TotalFriendNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldTotalFriend, v))
+}
+
+// TotalFriendIn applies the In predicate on the "total_friend" field.
+func TotalFriendIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldTotalFriend, vs...))
+}
+
+// TotalFriendNotIn applies the NotIn predicate on the "total_friend" field.
+func TotalFriendNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldTotalFriend, vs...))
+}
+
+// TotalFriendGT applies the GT predicate on the "total_friend" field.
+func TotalFriendGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldTotalFriend, v))
+}
+
+// TotalFriendGTE applies the GTE predicate on the "total_friend" field.
+func TotalFriendGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldTotalFriend, v))
+}
+
+// TotalFriendLT applies the LT predicate on the "total_friend" field.
+func TotalFriendLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldTotalFriend, v))
+}
+
+// TotalFriendLTE applies the LTE predicate on the "total_friend" field.
+func TotalFriendLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldTotalFriend, v))
+}
+
+// TotalGroupEQ applies the EQ predicate on the "total_group" field.
+func TotalGroupEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldTotalGroup, v))
+}
+
+// TotalGroupNEQ applies the NEQ predicate on the "total_group" field.
+func TotalGroupNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldTotalGroup, v))
+}
+
+// TotalGroupIn applies the In predicate on the "total_group" field.
+func TotalGroupIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldTotalGroup, vs...))
+}
+
+// TotalGroupNotIn applies the NotIn predicate on the "total_group" field.
+func TotalGroupNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldTotalGroup, vs...))
+}
+
+// TotalGroupGT applies the GT predicate on the "total_group" field.
+func TotalGroupGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldTotalGroup, v))
+}
+
+// TotalGroupGTE applies the GTE predicate on the "total_group" field.
+func TotalGroupGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldTotalGroup, v))
+}
+
+// TotalGroupLT applies the LT predicate on the "total_group" field.
+func TotalGroupLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldTotalGroup, v))
+}
+
+// TotalGroupLTE applies the LTE predicate on the "total_group" field.
+func TotalGroupLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldTotalGroup, v))
+}
+
+// AccountBalanceEQ applies the EQ predicate on the "account_balance" field.
+func AccountBalanceEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldAccountBalance, v))
+}
+
+// AccountBalanceNEQ applies the NEQ predicate on the "account_balance" field.
+func AccountBalanceNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldAccountBalance, v))
+}
+
+// AccountBalanceIn applies the In predicate on the "account_balance" field.
+func AccountBalanceIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldAccountBalance, vs...))
+}
+
+// AccountBalanceNotIn applies the NotIn predicate on the "account_balance" field.
+func AccountBalanceNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldAccountBalance, vs...))
+}
+
+// AccountBalanceGT applies the GT predicate on the "account_balance" field.
+func AccountBalanceGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldAccountBalance, v))
+}
+
+// AccountBalanceGTE applies the GTE predicate on the "account_balance" field.
+func AccountBalanceGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldAccountBalance, v))
+}
+
+// AccountBalanceLT applies the LT predicate on the "account_balance" field.
+func AccountBalanceLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldAccountBalance, v))
+}
+
+// AccountBalanceLTE applies the LTE predicate on the "account_balance" field.
+func AccountBalanceLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldAccountBalance, v))
+}
+
+// ConsumeTokenEQ applies the EQ predicate on the "consume_token" field.
+func ConsumeTokenEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldConsumeToken, v))
+}
+
+// ConsumeTokenNEQ applies the NEQ predicate on the "consume_token" field.
+func ConsumeTokenNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldConsumeToken, v))
+}
+
+// ConsumeTokenIn applies the In predicate on the "consume_token" field.
+func ConsumeTokenIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldConsumeToken, vs...))
+}
+
+// ConsumeTokenNotIn applies the NotIn predicate on the "consume_token" field.
+func ConsumeTokenNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldConsumeToken, vs...))
+}
+
+// ConsumeTokenGT applies the GT predicate on the "consume_token" field.
+func ConsumeTokenGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldConsumeToken, v))
+}
+
+// ConsumeTokenGTE applies the GTE predicate on the "consume_token" field.
+func ConsumeTokenGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldConsumeToken, v))
+}
+
+// ConsumeTokenLT applies the LT predicate on the "consume_token" field.
+func ConsumeTokenLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldConsumeToken, v))
+}
+
+// ConsumeTokenLTE applies the LTE predicate on the "consume_token" field.
+func ConsumeTokenLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldConsumeToken, v))
+}
+
+// ActiveUserEQ applies the EQ predicate on the "active_user" field.
+func ActiveUserEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldActiveUser, v))
+}
+
+// ActiveUserNEQ applies the NEQ predicate on the "active_user" field.
+func ActiveUserNEQ(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldActiveUser, v))
+}
+
+// ActiveUserIn applies the In predicate on the "active_user" field.
+func ActiveUserIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldActiveUser, vs...))
+}
+
+// ActiveUserNotIn applies the NotIn predicate on the "active_user" field.
+func ActiveUserNotIn(vs ...uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldActiveUser, vs...))
+}
+
+// ActiveUserGT applies the GT predicate on the "active_user" field.
+func ActiveUserGT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldActiveUser, v))
+}
+
+// ActiveUserGTE applies the GTE predicate on the "active_user" field.
+func ActiveUserGTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldActiveUser, v))
+}
+
+// ActiveUserLT applies the LT predicate on the "active_user" field.
+func ActiveUserLT(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldActiveUser, v))
+}
+
+// ActiveUserLTE applies the LTE predicate on the "active_user" field.
+func ActiveUserLTE(v uint64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldActiveUser, v))
+}
+
+// NewUserEQ applies the EQ predicate on the "new_user" field.
+func NewUserEQ(v int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldEQ(FieldNewUser, v))
+}
+
+// NewUserNEQ applies the NEQ predicate on the "new_user" field.
+func NewUserNEQ(v int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNEQ(FieldNewUser, v))
+}
+
+// NewUserIn applies the In predicate on the "new_user" field.
+func NewUserIn(vs ...int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldIn(FieldNewUser, vs...))
+}
+
+// NewUserNotIn applies the NotIn predicate on the "new_user" field.
+func NewUserNotIn(vs ...int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldNotIn(FieldNewUser, vs...))
+}
+
+// NewUserGT applies the GT predicate on the "new_user" field.
+func NewUserGT(v int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGT(FieldNewUser, v))
+}
+
+// NewUserGTE applies the GTE predicate on the "new_user" field.
+func NewUserGTE(v int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldGTE(FieldNewUser, v))
+}
+
+// NewUserLT applies the LT predicate on the "new_user" field.
+func NewUserLT(v int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLT(FieldNewUser, v))
+}
+
+// NewUserLTE applies the LTE predicate on the "new_user" field.
+func NewUserLTE(v int64) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.FieldLTE(FieldNewUser, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.UsageStatisticDay) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.UsageStatisticDay) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.UsageStatisticDay) predicate.UsageStatisticDay {
+	return predicate.UsageStatisticDay(sql.NotPredicates(p))
+}

+ 1683 - 0
ent/usagestatisticday_create.go

@@ -0,0 +1,1683 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/usagestatisticday"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticDayCreate is the builder for creating a UsageStatisticDay entity.
+type UsageStatisticDayCreate struct {
+	config
+	mutation *UsageStatisticDayMutation
+	hooks    []Hook
+	conflict []sql.ConflictOption
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (usdc *UsageStatisticDayCreate) SetCreatedAt(t time.Time) *UsageStatisticDayCreate {
+	usdc.mutation.SetCreatedAt(t)
+	return usdc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (usdc *UsageStatisticDayCreate) SetNillableCreatedAt(t *time.Time) *UsageStatisticDayCreate {
+	if t != nil {
+		usdc.SetCreatedAt(*t)
+	}
+	return usdc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (usdc *UsageStatisticDayCreate) SetUpdatedAt(t time.Time) *UsageStatisticDayCreate {
+	usdc.mutation.SetUpdatedAt(t)
+	return usdc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (usdc *UsageStatisticDayCreate) SetNillableUpdatedAt(t *time.Time) *UsageStatisticDayCreate {
+	if t != nil {
+		usdc.SetUpdatedAt(*t)
+	}
+	return usdc
+}
+
+// SetStatus sets the "status" field.
+func (usdc *UsageStatisticDayCreate) SetStatus(u uint8) *UsageStatisticDayCreate {
+	usdc.mutation.SetStatus(u)
+	return usdc
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (usdc *UsageStatisticDayCreate) SetNillableStatus(u *uint8) *UsageStatisticDayCreate {
+	if u != nil {
+		usdc.SetStatus(*u)
+	}
+	return usdc
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (usdc *UsageStatisticDayCreate) SetDeletedAt(t time.Time) *UsageStatisticDayCreate {
+	usdc.mutation.SetDeletedAt(t)
+	return usdc
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (usdc *UsageStatisticDayCreate) SetNillableDeletedAt(t *time.Time) *UsageStatisticDayCreate {
+	if t != nil {
+		usdc.SetDeletedAt(*t)
+	}
+	return usdc
+}
+
+// SetAddtime sets the "addtime" field.
+func (usdc *UsageStatisticDayCreate) SetAddtime(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetAddtime(u)
+	return usdc
+}
+
+// SetType sets the "type" field.
+func (usdc *UsageStatisticDayCreate) SetType(i int) *UsageStatisticDayCreate {
+	usdc.mutation.SetType(i)
+	return usdc
+}
+
+// SetBotID sets the "bot_id" field.
+func (usdc *UsageStatisticDayCreate) SetBotID(s string) *UsageStatisticDayCreate {
+	usdc.mutation.SetBotID(s)
+	return usdc
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (usdc *UsageStatisticDayCreate) SetNillableBotID(s *string) *UsageStatisticDayCreate {
+	if s != nil {
+		usdc.SetBotID(*s)
+	}
+	return usdc
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (usdc *UsageStatisticDayCreate) SetOrganizationID(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetOrganizationID(u)
+	return usdc
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (usdc *UsageStatisticDayCreate) SetNillableOrganizationID(u *uint64) *UsageStatisticDayCreate {
+	if u != nil {
+		usdc.SetOrganizationID(*u)
+	}
+	return usdc
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (usdc *UsageStatisticDayCreate) SetAiResponse(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetAiResponse(u)
+	return usdc
+}
+
+// SetSopRun sets the "sop_run" field.
+func (usdc *UsageStatisticDayCreate) SetSopRun(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetSopRun(u)
+	return usdc
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (usdc *UsageStatisticDayCreate) SetTotalFriend(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetTotalFriend(u)
+	return usdc
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (usdc *UsageStatisticDayCreate) SetTotalGroup(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetTotalGroup(u)
+	return usdc
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (usdc *UsageStatisticDayCreate) SetAccountBalance(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetAccountBalance(u)
+	return usdc
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (usdc *UsageStatisticDayCreate) SetConsumeToken(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetConsumeToken(u)
+	return usdc
+}
+
+// SetActiveUser sets the "active_user" field.
+func (usdc *UsageStatisticDayCreate) SetActiveUser(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetActiveUser(u)
+	return usdc
+}
+
+// SetNewUser sets the "new_user" field.
+func (usdc *UsageStatisticDayCreate) SetNewUser(i int64) *UsageStatisticDayCreate {
+	usdc.mutation.SetNewUser(i)
+	return usdc
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (usdc *UsageStatisticDayCreate) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticDayCreate {
+	usdc.mutation.SetLabelDist(ctd)
+	return usdc
+}
+
+// SetID sets the "id" field.
+func (usdc *UsageStatisticDayCreate) SetID(u uint64) *UsageStatisticDayCreate {
+	usdc.mutation.SetID(u)
+	return usdc
+}
+
+// Mutation returns the UsageStatisticDayMutation object of the builder.
+func (usdc *UsageStatisticDayCreate) Mutation() *UsageStatisticDayMutation {
+	return usdc.mutation
+}
+
+// Save creates the UsageStatisticDay in the database.
+func (usdc *UsageStatisticDayCreate) Save(ctx context.Context) (*UsageStatisticDay, error) {
+	if err := usdc.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, usdc.sqlSave, usdc.mutation, usdc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (usdc *UsageStatisticDayCreate) SaveX(ctx context.Context) *UsageStatisticDay {
+	v, err := usdc.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (usdc *UsageStatisticDayCreate) Exec(ctx context.Context) error {
+	_, err := usdc.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usdc *UsageStatisticDayCreate) ExecX(ctx context.Context) {
+	if err := usdc.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (usdc *UsageStatisticDayCreate) defaults() error {
+	if _, ok := usdc.mutation.CreatedAt(); !ok {
+		if usagestatisticday.DefaultCreatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticday.DefaultCreatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticday.DefaultCreatedAt()
+		usdc.mutation.SetCreatedAt(v)
+	}
+	if _, ok := usdc.mutation.UpdatedAt(); !ok {
+		if usagestatisticday.DefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticday.DefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticday.DefaultUpdatedAt()
+		usdc.mutation.SetUpdatedAt(v)
+	}
+	if _, ok := usdc.mutation.Status(); !ok {
+		v := usagestatisticday.DefaultStatus
+		usdc.mutation.SetStatus(v)
+	}
+	return nil
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (usdc *UsageStatisticDayCreate) check() error {
+	if _, ok := usdc.mutation.CreatedAt(); !ok {
+		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "UsageStatisticDay.created_at"`)}
+	}
+	if _, ok := usdc.mutation.UpdatedAt(); !ok {
+		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "UsageStatisticDay.updated_at"`)}
+	}
+	if _, ok := usdc.mutation.Addtime(); !ok {
+		return &ValidationError{Name: "addtime", err: errors.New(`ent: missing required field "UsageStatisticDay.addtime"`)}
+	}
+	if _, ok := usdc.mutation.GetType(); !ok {
+		return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "UsageStatisticDay.type"`)}
+	}
+	if _, ok := usdc.mutation.AiResponse(); !ok {
+		return &ValidationError{Name: "ai_response", err: errors.New(`ent: missing required field "UsageStatisticDay.ai_response"`)}
+	}
+	if _, ok := usdc.mutation.SopRun(); !ok {
+		return &ValidationError{Name: "sop_run", err: errors.New(`ent: missing required field "UsageStatisticDay.sop_run"`)}
+	}
+	if _, ok := usdc.mutation.TotalFriend(); !ok {
+		return &ValidationError{Name: "total_friend", err: errors.New(`ent: missing required field "UsageStatisticDay.total_friend"`)}
+	}
+	if _, ok := usdc.mutation.TotalGroup(); !ok {
+		return &ValidationError{Name: "total_group", err: errors.New(`ent: missing required field "UsageStatisticDay.total_group"`)}
+	}
+	if _, ok := usdc.mutation.AccountBalance(); !ok {
+		return &ValidationError{Name: "account_balance", err: errors.New(`ent: missing required field "UsageStatisticDay.account_balance"`)}
+	}
+	if _, ok := usdc.mutation.ConsumeToken(); !ok {
+		return &ValidationError{Name: "consume_token", err: errors.New(`ent: missing required field "UsageStatisticDay.consume_token"`)}
+	}
+	if _, ok := usdc.mutation.ActiveUser(); !ok {
+		return &ValidationError{Name: "active_user", err: errors.New(`ent: missing required field "UsageStatisticDay.active_user"`)}
+	}
+	if _, ok := usdc.mutation.NewUser(); !ok {
+		return &ValidationError{Name: "new_user", err: errors.New(`ent: missing required field "UsageStatisticDay.new_user"`)}
+	}
+	if _, ok := usdc.mutation.LabelDist(); !ok {
+		return &ValidationError{Name: "label_dist", err: errors.New(`ent: missing required field "UsageStatisticDay.label_dist"`)}
+	}
+	return nil
+}
+
+func (usdc *UsageStatisticDayCreate) sqlSave(ctx context.Context) (*UsageStatisticDay, error) {
+	if err := usdc.check(); err != nil {
+		return nil, err
+	}
+	_node, _spec := usdc.createSpec()
+	if err := sqlgraph.CreateNode(ctx, usdc.driver, _spec); err != nil {
+		if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	if _spec.ID.Value != _node.ID {
+		id := _spec.ID.Value.(int64)
+		_node.ID = uint64(id)
+	}
+	usdc.mutation.id = &_node.ID
+	usdc.mutation.done = true
+	return _node, nil
+}
+
+func (usdc *UsageStatisticDayCreate) createSpec() (*UsageStatisticDay, *sqlgraph.CreateSpec) {
+	var (
+		_node = &UsageStatisticDay{config: usdc.config}
+		_spec = sqlgraph.NewCreateSpec(usagestatisticday.Table, sqlgraph.NewFieldSpec(usagestatisticday.FieldID, field.TypeUint64))
+	)
+	_spec.OnConflict = usdc.conflict
+	if id, ok := usdc.mutation.ID(); ok {
+		_node.ID = id
+		_spec.ID.Value = id
+	}
+	if value, ok := usdc.mutation.CreatedAt(); ok {
+		_spec.SetField(usagestatisticday.FieldCreatedAt, field.TypeTime, value)
+		_node.CreatedAt = value
+	}
+	if value, ok := usdc.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatisticday.FieldUpdatedAt, field.TypeTime, value)
+		_node.UpdatedAt = value
+	}
+	if value, ok := usdc.mutation.Status(); ok {
+		_spec.SetField(usagestatisticday.FieldStatus, field.TypeUint8, value)
+		_node.Status = value
+	}
+	if value, ok := usdc.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatisticday.FieldDeletedAt, field.TypeTime, value)
+		_node.DeletedAt = value
+	}
+	if value, ok := usdc.mutation.Addtime(); ok {
+		_spec.SetField(usagestatisticday.FieldAddtime, field.TypeUint64, value)
+		_node.Addtime = value
+	}
+	if value, ok := usdc.mutation.GetType(); ok {
+		_spec.SetField(usagestatisticday.FieldType, field.TypeInt, value)
+		_node.Type = value
+	}
+	if value, ok := usdc.mutation.BotID(); ok {
+		_spec.SetField(usagestatisticday.FieldBotID, field.TypeString, value)
+		_node.BotID = value
+	}
+	if value, ok := usdc.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatisticday.FieldOrganizationID, field.TypeUint64, value)
+		_node.OrganizationID = value
+	}
+	if value, ok := usdc.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatisticday.FieldAiResponse, field.TypeUint64, value)
+		_node.AiResponse = value
+	}
+	if value, ok := usdc.mutation.SopRun(); ok {
+		_spec.SetField(usagestatisticday.FieldSopRun, field.TypeUint64, value)
+		_node.SopRun = value
+	}
+	if value, ok := usdc.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatisticday.FieldTotalFriend, field.TypeUint64, value)
+		_node.TotalFriend = value
+	}
+	if value, ok := usdc.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatisticday.FieldTotalGroup, field.TypeUint64, value)
+		_node.TotalGroup = value
+	}
+	if value, ok := usdc.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatisticday.FieldAccountBalance, field.TypeUint64, value)
+		_node.AccountBalance = value
+	}
+	if value, ok := usdc.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatisticday.FieldConsumeToken, field.TypeUint64, value)
+		_node.ConsumeToken = value
+	}
+	if value, ok := usdc.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatisticday.FieldActiveUser, field.TypeUint64, value)
+		_node.ActiveUser = value
+	}
+	if value, ok := usdc.mutation.NewUser(); ok {
+		_spec.SetField(usagestatisticday.FieldNewUser, field.TypeInt64, value)
+		_node.NewUser = value
+	}
+	if value, ok := usdc.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatisticday.FieldLabelDist, field.TypeJSON, value)
+		_node.LabelDist = value
+	}
+	return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.UsageStatisticDay.Create().
+//		SetCreatedAt(v).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.UsageStatisticDayUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (usdc *UsageStatisticDayCreate) OnConflict(opts ...sql.ConflictOption) *UsageStatisticDayUpsertOne {
+	usdc.conflict = opts
+	return &UsageStatisticDayUpsertOne{
+		create: usdc,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.UsageStatisticDay.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (usdc *UsageStatisticDayCreate) OnConflictColumns(columns ...string) *UsageStatisticDayUpsertOne {
+	usdc.conflict = append(usdc.conflict, sql.ConflictColumns(columns...))
+	return &UsageStatisticDayUpsertOne{
+		create: usdc,
+	}
+}
+
+type (
+	// UsageStatisticDayUpsertOne is the builder for "upsert"-ing
+	//  one UsageStatisticDay node.
+	UsageStatisticDayUpsertOne struct {
+		create *UsageStatisticDayCreate
+	}
+
+	// UsageStatisticDayUpsert is the "OnConflict" setter.
+	UsageStatisticDayUpsert struct {
+		*sql.UpdateSet
+	}
+)
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticDayUpsert) SetUpdatedAt(v time.Time) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldUpdatedAt, v)
+	return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateUpdatedAt() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldUpdatedAt)
+	return u
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticDayUpsert) SetStatus(v uint8) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldStatus, v)
+	return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateStatus() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldStatus)
+	return u
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticDayUpsert) AddStatus(v uint8) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldStatus, v)
+	return u
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticDayUpsert) ClearStatus() *UsageStatisticDayUpsert {
+	u.SetNull(usagestatisticday.FieldStatus)
+	return u
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticDayUpsert) SetDeletedAt(v time.Time) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldDeletedAt, v)
+	return u
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateDeletedAt() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldDeletedAt)
+	return u
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticDayUpsert) ClearDeletedAt() *UsageStatisticDayUpsert {
+	u.SetNull(usagestatisticday.FieldDeletedAt)
+	return u
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticDayUpsert) SetAddtime(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldAddtime, v)
+	return u
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateAddtime() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldAddtime)
+	return u
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticDayUpsert) AddAddtime(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldAddtime, v)
+	return u
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticDayUpsert) SetType(v int) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldType, v)
+	return u
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateType() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldType)
+	return u
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticDayUpsert) AddType(v int) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldType, v)
+	return u
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticDayUpsert) SetBotID(v string) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldBotID, v)
+	return u
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateBotID() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldBotID)
+	return u
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticDayUpsert) ClearBotID() *UsageStatisticDayUpsert {
+	u.SetNull(usagestatisticday.FieldBotID)
+	return u
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticDayUpsert) SetOrganizationID(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldOrganizationID, v)
+	return u
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateOrganizationID() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldOrganizationID)
+	return u
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticDayUpsert) AddOrganizationID(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldOrganizationID, v)
+	return u
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticDayUpsert) ClearOrganizationID() *UsageStatisticDayUpsert {
+	u.SetNull(usagestatisticday.FieldOrganizationID)
+	return u
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticDayUpsert) SetAiResponse(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldAiResponse, v)
+	return u
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateAiResponse() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldAiResponse)
+	return u
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticDayUpsert) AddAiResponse(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldAiResponse, v)
+	return u
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticDayUpsert) SetSopRun(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldSopRun, v)
+	return u
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateSopRun() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldSopRun)
+	return u
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticDayUpsert) AddSopRun(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldSopRun, v)
+	return u
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticDayUpsert) SetTotalFriend(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldTotalFriend, v)
+	return u
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateTotalFriend() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldTotalFriend)
+	return u
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticDayUpsert) AddTotalFriend(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldTotalFriend, v)
+	return u
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticDayUpsert) SetTotalGroup(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldTotalGroup, v)
+	return u
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateTotalGroup() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldTotalGroup)
+	return u
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticDayUpsert) AddTotalGroup(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldTotalGroup, v)
+	return u
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticDayUpsert) SetAccountBalance(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldAccountBalance, v)
+	return u
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateAccountBalance() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldAccountBalance)
+	return u
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticDayUpsert) AddAccountBalance(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldAccountBalance, v)
+	return u
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticDayUpsert) SetConsumeToken(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldConsumeToken, v)
+	return u
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateConsumeToken() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldConsumeToken)
+	return u
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticDayUpsert) AddConsumeToken(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldConsumeToken, v)
+	return u
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticDayUpsert) SetActiveUser(v uint64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldActiveUser, v)
+	return u
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateActiveUser() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldActiveUser)
+	return u
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticDayUpsert) AddActiveUser(v uint64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldActiveUser, v)
+	return u
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticDayUpsert) SetNewUser(v int64) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldNewUser, v)
+	return u
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateNewUser() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldNewUser)
+	return u
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticDayUpsert) AddNewUser(v int64) *UsageStatisticDayUpsert {
+	u.Add(usagestatisticday.FieldNewUser, v)
+	return u
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticDayUpsert) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticDayUpsert {
+	u.Set(usagestatisticday.FieldLabelDist, v)
+	return u
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsert) UpdateLabelDist() *UsageStatisticDayUpsert {
+	u.SetExcluded(usagestatisticday.FieldLabelDist)
+	return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticDay.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(usagestatisticday.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *UsageStatisticDayUpsertOne) UpdateNewValues() *UsageStatisticDayUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		if _, exists := u.create.mutation.ID(); exists {
+			s.SetIgnore(usagestatisticday.FieldID)
+		}
+		if _, exists := u.create.mutation.CreatedAt(); exists {
+			s.SetIgnore(usagestatisticday.FieldCreatedAt)
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticDay.Create().
+//	    OnConflict(sql.ResolveWithIgnore()).
+//	    Exec(ctx)
+func (u *UsageStatisticDayUpsertOne) Ignore() *UsageStatisticDayUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *UsageStatisticDayUpsertOne) DoNothing() *UsageStatisticDayUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the UsageStatisticDayCreate.OnConflict
+// documentation for more info.
+func (u *UsageStatisticDayUpsertOne) Update(set func(*UsageStatisticDayUpsert)) *UsageStatisticDayUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&UsageStatisticDayUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticDayUpsertOne) SetUpdatedAt(v time.Time) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateUpdatedAt() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticDayUpsertOne) SetStatus(v uint8) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticDayUpsertOne) AddStatus(v uint8) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateStatus() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticDayUpsertOne) ClearStatus() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticDayUpsertOne) SetDeletedAt(v time.Time) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateDeletedAt() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticDayUpsertOne) ClearDeletedAt() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticDayUpsertOne) SetAddtime(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetAddtime(v)
+	})
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticDayUpsertOne) AddAddtime(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddAddtime(v)
+	})
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateAddtime() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateAddtime()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticDayUpsertOne) SetType(v int) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticDayUpsertOne) AddType(v int) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateType() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticDayUpsertOne) SetBotID(v string) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetBotID(v)
+	})
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateBotID() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateBotID()
+	})
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticDayUpsertOne) ClearBotID() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearBotID()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticDayUpsertOne) SetOrganizationID(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticDayUpsertOne) AddOrganizationID(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateOrganizationID() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticDayUpsertOne) ClearOrganizationID() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticDayUpsertOne) SetAiResponse(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetAiResponse(v)
+	})
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticDayUpsertOne) AddAiResponse(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddAiResponse(v)
+	})
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateAiResponse() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateAiResponse()
+	})
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticDayUpsertOne) SetSopRun(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetSopRun(v)
+	})
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticDayUpsertOne) AddSopRun(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddSopRun(v)
+	})
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateSopRun() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateSopRun()
+	})
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticDayUpsertOne) SetTotalFriend(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetTotalFriend(v)
+	})
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticDayUpsertOne) AddTotalFriend(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddTotalFriend(v)
+	})
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateTotalFriend() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateTotalFriend()
+	})
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticDayUpsertOne) SetTotalGroup(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetTotalGroup(v)
+	})
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticDayUpsertOne) AddTotalGroup(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddTotalGroup(v)
+	})
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateTotalGroup() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateTotalGroup()
+	})
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticDayUpsertOne) SetAccountBalance(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetAccountBalance(v)
+	})
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticDayUpsertOne) AddAccountBalance(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddAccountBalance(v)
+	})
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateAccountBalance() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateAccountBalance()
+	})
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticDayUpsertOne) SetConsumeToken(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetConsumeToken(v)
+	})
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticDayUpsertOne) AddConsumeToken(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddConsumeToken(v)
+	})
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateConsumeToken() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateConsumeToken()
+	})
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticDayUpsertOne) SetActiveUser(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetActiveUser(v)
+	})
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticDayUpsertOne) AddActiveUser(v uint64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddActiveUser(v)
+	})
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateActiveUser() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateActiveUser()
+	})
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticDayUpsertOne) SetNewUser(v int64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetNewUser(v)
+	})
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticDayUpsertOne) AddNewUser(v int64) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddNewUser(v)
+	})
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateNewUser() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateNewUser()
+	})
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticDayUpsertOne) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetLabelDist(v)
+	})
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertOne) UpdateLabelDist() *UsageStatisticDayUpsertOne {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateLabelDist()
+	})
+}
+
+// Exec executes the query.
+func (u *UsageStatisticDayUpsertOne) Exec(ctx context.Context) error {
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for UsageStatisticDayCreate.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *UsageStatisticDayUpsertOne) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *UsageStatisticDayUpsertOne) ID(ctx context.Context) (id uint64, err error) {
+	node, err := u.create.Save(ctx)
+	if err != nil {
+		return id, err
+	}
+	return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *UsageStatisticDayUpsertOne) IDX(ctx context.Context) uint64 {
+	id, err := u.ID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// UsageStatisticDayCreateBulk is the builder for creating many UsageStatisticDay entities in bulk.
+type UsageStatisticDayCreateBulk struct {
+	config
+	err      error
+	builders []*UsageStatisticDayCreate
+	conflict []sql.ConflictOption
+}
+
+// Save creates the UsageStatisticDay entities in the database.
+func (usdcb *UsageStatisticDayCreateBulk) Save(ctx context.Context) ([]*UsageStatisticDay, error) {
+	if usdcb.err != nil {
+		return nil, usdcb.err
+	}
+	specs := make([]*sqlgraph.CreateSpec, len(usdcb.builders))
+	nodes := make([]*UsageStatisticDay, len(usdcb.builders))
+	mutators := make([]Mutator, len(usdcb.builders))
+	for i := range usdcb.builders {
+		func(i int, root context.Context) {
+			builder := usdcb.builders[i]
+			builder.defaults()
+			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+				mutation, ok := m.(*UsageStatisticDayMutation)
+				if !ok {
+					return nil, fmt.Errorf("unexpected mutation type %T", m)
+				}
+				if err := builder.check(); err != nil {
+					return nil, err
+				}
+				builder.mutation = mutation
+				var err error
+				nodes[i], specs[i] = builder.createSpec()
+				if i < len(mutators)-1 {
+					_, err = mutators[i+1].Mutate(root, usdcb.builders[i+1].mutation)
+				} else {
+					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+					spec.OnConflict = usdcb.conflict
+					// Invoke the actual operation on the latest mutation in the chain.
+					if err = sqlgraph.BatchCreate(ctx, usdcb.driver, spec); err != nil {
+						if sqlgraph.IsConstraintError(err) {
+							err = &ConstraintError{msg: err.Error(), wrap: err}
+						}
+					}
+				}
+				if err != nil {
+					return nil, err
+				}
+				mutation.id = &nodes[i].ID
+				if specs[i].ID.Value != nil && nodes[i].ID == 0 {
+					id := specs[i].ID.Value.(int64)
+					nodes[i].ID = uint64(id)
+				}
+				mutation.done = true
+				return nodes[i], nil
+			})
+			for i := len(builder.hooks) - 1; i >= 0; i-- {
+				mut = builder.hooks[i](mut)
+			}
+			mutators[i] = mut
+		}(i, ctx)
+	}
+	if len(mutators) > 0 {
+		if _, err := mutators[0].Mutate(ctx, usdcb.builders[0].mutation); err != nil {
+			return nil, err
+		}
+	}
+	return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (usdcb *UsageStatisticDayCreateBulk) SaveX(ctx context.Context) []*UsageStatisticDay {
+	v, err := usdcb.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (usdcb *UsageStatisticDayCreateBulk) Exec(ctx context.Context) error {
+	_, err := usdcb.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usdcb *UsageStatisticDayCreateBulk) ExecX(ctx context.Context) {
+	if err := usdcb.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.UsageStatisticDay.CreateBulk(builders...).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.UsageStatisticDayUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (usdcb *UsageStatisticDayCreateBulk) OnConflict(opts ...sql.ConflictOption) *UsageStatisticDayUpsertBulk {
+	usdcb.conflict = opts
+	return &UsageStatisticDayUpsertBulk{
+		create: usdcb,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.UsageStatisticDay.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (usdcb *UsageStatisticDayCreateBulk) OnConflictColumns(columns ...string) *UsageStatisticDayUpsertBulk {
+	usdcb.conflict = append(usdcb.conflict, sql.ConflictColumns(columns...))
+	return &UsageStatisticDayUpsertBulk{
+		create: usdcb,
+	}
+}
+
+// UsageStatisticDayUpsertBulk is the builder for "upsert"-ing
+// a bulk of UsageStatisticDay nodes.
+type UsageStatisticDayUpsertBulk struct {
+	create *UsageStatisticDayCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+//	client.UsageStatisticDay.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(usagestatisticday.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *UsageStatisticDayUpsertBulk) UpdateNewValues() *UsageStatisticDayUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		for _, b := range u.create.builders {
+			if _, exists := b.mutation.ID(); exists {
+				s.SetIgnore(usagestatisticday.FieldID)
+			}
+			if _, exists := b.mutation.CreatedAt(); exists {
+				s.SetIgnore(usagestatisticday.FieldCreatedAt)
+			}
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticDay.Create().
+//		OnConflict(sql.ResolveWithIgnore()).
+//		Exec(ctx)
+func (u *UsageStatisticDayUpsertBulk) Ignore() *UsageStatisticDayUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *UsageStatisticDayUpsertBulk) DoNothing() *UsageStatisticDayUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the UsageStatisticDayCreateBulk.OnConflict
+// documentation for more info.
+func (u *UsageStatisticDayUpsertBulk) Update(set func(*UsageStatisticDayUpsert)) *UsageStatisticDayUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&UsageStatisticDayUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticDayUpsertBulk) SetUpdatedAt(v time.Time) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateUpdatedAt() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticDayUpsertBulk) SetStatus(v uint8) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticDayUpsertBulk) AddStatus(v uint8) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateStatus() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticDayUpsertBulk) ClearStatus() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticDayUpsertBulk) SetDeletedAt(v time.Time) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateDeletedAt() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticDayUpsertBulk) ClearDeletedAt() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticDayUpsertBulk) SetAddtime(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetAddtime(v)
+	})
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticDayUpsertBulk) AddAddtime(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddAddtime(v)
+	})
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateAddtime() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateAddtime()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticDayUpsertBulk) SetType(v int) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticDayUpsertBulk) AddType(v int) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateType() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticDayUpsertBulk) SetBotID(v string) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetBotID(v)
+	})
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateBotID() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateBotID()
+	})
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticDayUpsertBulk) ClearBotID() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearBotID()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticDayUpsertBulk) SetOrganizationID(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticDayUpsertBulk) AddOrganizationID(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateOrganizationID() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticDayUpsertBulk) ClearOrganizationID() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticDayUpsertBulk) SetAiResponse(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetAiResponse(v)
+	})
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticDayUpsertBulk) AddAiResponse(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddAiResponse(v)
+	})
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateAiResponse() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateAiResponse()
+	})
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticDayUpsertBulk) SetSopRun(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetSopRun(v)
+	})
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticDayUpsertBulk) AddSopRun(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddSopRun(v)
+	})
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateSopRun() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateSopRun()
+	})
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticDayUpsertBulk) SetTotalFriend(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetTotalFriend(v)
+	})
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticDayUpsertBulk) AddTotalFriend(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddTotalFriend(v)
+	})
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateTotalFriend() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateTotalFriend()
+	})
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticDayUpsertBulk) SetTotalGroup(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetTotalGroup(v)
+	})
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticDayUpsertBulk) AddTotalGroup(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddTotalGroup(v)
+	})
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateTotalGroup() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateTotalGroup()
+	})
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticDayUpsertBulk) SetAccountBalance(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetAccountBalance(v)
+	})
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticDayUpsertBulk) AddAccountBalance(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddAccountBalance(v)
+	})
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateAccountBalance() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateAccountBalance()
+	})
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticDayUpsertBulk) SetConsumeToken(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetConsumeToken(v)
+	})
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticDayUpsertBulk) AddConsumeToken(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddConsumeToken(v)
+	})
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateConsumeToken() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateConsumeToken()
+	})
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticDayUpsertBulk) SetActiveUser(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetActiveUser(v)
+	})
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticDayUpsertBulk) AddActiveUser(v uint64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddActiveUser(v)
+	})
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateActiveUser() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateActiveUser()
+	})
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticDayUpsertBulk) SetNewUser(v int64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetNewUser(v)
+	})
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticDayUpsertBulk) AddNewUser(v int64) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.AddNewUser(v)
+	})
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateNewUser() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateNewUser()
+	})
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticDayUpsertBulk) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.SetLabelDist(v)
+	})
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticDayUpsertBulk) UpdateLabelDist() *UsageStatisticDayUpsertBulk {
+	return u.Update(func(s *UsageStatisticDayUpsert) {
+		s.UpdateLabelDist()
+	})
+}
+
+// Exec executes the query.
+func (u *UsageStatisticDayUpsertBulk) Exec(ctx context.Context) error {
+	if u.create.err != nil {
+		return u.create.err
+	}
+	for i, b := range u.create.builders {
+		if len(b.conflict) != 0 {
+			return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the UsageStatisticDayCreateBulk instead", i)
+		}
+	}
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for UsageStatisticDayCreateBulk.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *UsageStatisticDayUpsertBulk) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 88 - 0
ent/usagestatisticday_delete.go

@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticday"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticDayDelete is the builder for deleting a UsageStatisticDay entity.
+type UsageStatisticDayDelete struct {
+	config
+	hooks    []Hook
+	mutation *UsageStatisticDayMutation
+}
+
+// Where appends a list predicates to the UsageStatisticDayDelete builder.
+func (usdd *UsageStatisticDayDelete) Where(ps ...predicate.UsageStatisticDay) *UsageStatisticDayDelete {
+	usdd.mutation.Where(ps...)
+	return usdd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (usdd *UsageStatisticDayDelete) Exec(ctx context.Context) (int, error) {
+	return withHooks(ctx, usdd.sqlExec, usdd.mutation, usdd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usdd *UsageStatisticDayDelete) ExecX(ctx context.Context) int {
+	n, err := usdd.Exec(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return n
+}
+
+func (usdd *UsageStatisticDayDelete) sqlExec(ctx context.Context) (int, error) {
+	_spec := sqlgraph.NewDeleteSpec(usagestatisticday.Table, sqlgraph.NewFieldSpec(usagestatisticday.FieldID, field.TypeUint64))
+	if ps := usdd.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	affected, err := sqlgraph.DeleteNodes(ctx, usdd.driver, _spec)
+	if err != nil && sqlgraph.IsConstraintError(err) {
+		err = &ConstraintError{msg: err.Error(), wrap: err}
+	}
+	usdd.mutation.done = true
+	return affected, err
+}
+
+// UsageStatisticDayDeleteOne is the builder for deleting a single UsageStatisticDay entity.
+type UsageStatisticDayDeleteOne struct {
+	usdd *UsageStatisticDayDelete
+}
+
+// Where appends a list predicates to the UsageStatisticDayDelete builder.
+func (usddo *UsageStatisticDayDeleteOne) Where(ps ...predicate.UsageStatisticDay) *UsageStatisticDayDeleteOne {
+	usddo.usdd.mutation.Where(ps...)
+	return usddo
+}
+
+// Exec executes the deletion query.
+func (usddo *UsageStatisticDayDeleteOne) Exec(ctx context.Context) error {
+	n, err := usddo.usdd.Exec(ctx)
+	switch {
+	case err != nil:
+		return err
+	case n == 0:
+		return &NotFoundError{usagestatisticday.Label}
+	default:
+		return nil
+	}
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usddo *UsageStatisticDayDeleteOne) ExecX(ctx context.Context) {
+	if err := usddo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 526 - 0
ent/usagestatisticday_query.go

@@ -0,0 +1,526 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"fmt"
+	"math"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticday"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticDayQuery is the builder for querying UsageStatisticDay entities.
+type UsageStatisticDayQuery struct {
+	config
+	ctx        *QueryContext
+	order      []usagestatisticday.OrderOption
+	inters     []Interceptor
+	predicates []predicate.UsageStatisticDay
+	// intermediate query (i.e. traversal path).
+	sql  *sql.Selector
+	path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the UsageStatisticDayQuery builder.
+func (usdq *UsageStatisticDayQuery) Where(ps ...predicate.UsageStatisticDay) *UsageStatisticDayQuery {
+	usdq.predicates = append(usdq.predicates, ps...)
+	return usdq
+}
+
+// Limit the number of records to be returned by this query.
+func (usdq *UsageStatisticDayQuery) Limit(limit int) *UsageStatisticDayQuery {
+	usdq.ctx.Limit = &limit
+	return usdq
+}
+
+// Offset to start from.
+func (usdq *UsageStatisticDayQuery) Offset(offset int) *UsageStatisticDayQuery {
+	usdq.ctx.Offset = &offset
+	return usdq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (usdq *UsageStatisticDayQuery) Unique(unique bool) *UsageStatisticDayQuery {
+	usdq.ctx.Unique = &unique
+	return usdq
+}
+
+// Order specifies how the records should be ordered.
+func (usdq *UsageStatisticDayQuery) Order(o ...usagestatisticday.OrderOption) *UsageStatisticDayQuery {
+	usdq.order = append(usdq.order, o...)
+	return usdq
+}
+
+// First returns the first UsageStatisticDay entity from the query.
+// Returns a *NotFoundError when no UsageStatisticDay was found.
+func (usdq *UsageStatisticDayQuery) First(ctx context.Context) (*UsageStatisticDay, error) {
+	nodes, err := usdq.Limit(1).All(setContextOp(ctx, usdq.ctx, "First"))
+	if err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nil, &NotFoundError{usagestatisticday.Label}
+	}
+	return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) FirstX(ctx context.Context) *UsageStatisticDay {
+	node, err := usdq.First(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return node
+}
+
+// FirstID returns the first UsageStatisticDay ID from the query.
+// Returns a *NotFoundError when no UsageStatisticDay ID was found.
+func (usdq *UsageStatisticDayQuery) FirstID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = usdq.Limit(1).IDs(setContextOp(ctx, usdq.ctx, "FirstID")); err != nil {
+		return
+	}
+	if len(ids) == 0 {
+		err = &NotFoundError{usagestatisticday.Label}
+		return
+	}
+	return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) FirstIDX(ctx context.Context) uint64 {
+	id, err := usdq.FirstID(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return id
+}
+
+// Only returns a single UsageStatisticDay entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one UsageStatisticDay entity is found.
+// Returns a *NotFoundError when no UsageStatisticDay entities are found.
+func (usdq *UsageStatisticDayQuery) Only(ctx context.Context) (*UsageStatisticDay, error) {
+	nodes, err := usdq.Limit(2).All(setContextOp(ctx, usdq.ctx, "Only"))
+	if err != nil {
+		return nil, err
+	}
+	switch len(nodes) {
+	case 1:
+		return nodes[0], nil
+	case 0:
+		return nil, &NotFoundError{usagestatisticday.Label}
+	default:
+		return nil, &NotSingularError{usagestatisticday.Label}
+	}
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) OnlyX(ctx context.Context) *UsageStatisticDay {
+	node, err := usdq.Only(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// OnlyID is like Only, but returns the only UsageStatisticDay ID in the query.
+// Returns a *NotSingularError when more than one UsageStatisticDay ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (usdq *UsageStatisticDayQuery) OnlyID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = usdq.Limit(2).IDs(setContextOp(ctx, usdq.ctx, "OnlyID")); err != nil {
+		return
+	}
+	switch len(ids) {
+	case 1:
+		id = ids[0]
+	case 0:
+		err = &NotFoundError{usagestatisticday.Label}
+	default:
+		err = &NotSingularError{usagestatisticday.Label}
+	}
+	return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) OnlyIDX(ctx context.Context) uint64 {
+	id, err := usdq.OnlyID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// All executes the query and returns a list of UsageStatisticDays.
+func (usdq *UsageStatisticDayQuery) All(ctx context.Context) ([]*UsageStatisticDay, error) {
+	ctx = setContextOp(ctx, usdq.ctx, "All")
+	if err := usdq.prepareQuery(ctx); err != nil {
+		return nil, err
+	}
+	qr := querierAll[[]*UsageStatisticDay, *UsageStatisticDayQuery]()
+	return withInterceptors[[]*UsageStatisticDay](ctx, usdq, qr, usdq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) AllX(ctx context.Context) []*UsageStatisticDay {
+	nodes, err := usdq.All(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return nodes
+}
+
+// IDs executes the query and returns a list of UsageStatisticDay IDs.
+func (usdq *UsageStatisticDayQuery) IDs(ctx context.Context) (ids []uint64, err error) {
+	if usdq.ctx.Unique == nil && usdq.path != nil {
+		usdq.Unique(true)
+	}
+	ctx = setContextOp(ctx, usdq.ctx, "IDs")
+	if err = usdq.Select(usagestatisticday.FieldID).Scan(ctx, &ids); err != nil {
+		return nil, err
+	}
+	return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) IDsX(ctx context.Context) []uint64 {
+	ids, err := usdq.IDs(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return ids
+}
+
+// Count returns the count of the given query.
+func (usdq *UsageStatisticDayQuery) Count(ctx context.Context) (int, error) {
+	ctx = setContextOp(ctx, usdq.ctx, "Count")
+	if err := usdq.prepareQuery(ctx); err != nil {
+		return 0, err
+	}
+	return withInterceptors[int](ctx, usdq, querierCount[*UsageStatisticDayQuery](), usdq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) CountX(ctx context.Context) int {
+	count, err := usdq.Count(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (usdq *UsageStatisticDayQuery) Exist(ctx context.Context) (bool, error) {
+	ctx = setContextOp(ctx, usdq.ctx, "Exist")
+	switch _, err := usdq.FirstID(ctx); {
+	case IsNotFound(err):
+		return false, nil
+	case err != nil:
+		return false, fmt.Errorf("ent: check existence: %w", err)
+	default:
+		return true, nil
+	}
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (usdq *UsageStatisticDayQuery) ExistX(ctx context.Context) bool {
+	exist, err := usdq.Exist(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return exist
+}
+
+// Clone returns a duplicate of the UsageStatisticDayQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (usdq *UsageStatisticDayQuery) Clone() *UsageStatisticDayQuery {
+	if usdq == nil {
+		return nil
+	}
+	return &UsageStatisticDayQuery{
+		config:     usdq.config,
+		ctx:        usdq.ctx.Clone(),
+		order:      append([]usagestatisticday.OrderOption{}, usdq.order...),
+		inters:     append([]Interceptor{}, usdq.inters...),
+		predicates: append([]predicate.UsageStatisticDay{}, usdq.predicates...),
+		// clone intermediate query.
+		sql:  usdq.sql.Clone(),
+		path: usdq.path,
+	}
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//		Count int `json:"count,omitempty"`
+//	}
+//
+//	client.UsageStatisticDay.Query().
+//		GroupBy(usagestatisticday.FieldCreatedAt).
+//		Aggregate(ent.Count()).
+//		Scan(ctx, &v)
+func (usdq *UsageStatisticDayQuery) GroupBy(field string, fields ...string) *UsageStatisticDayGroupBy {
+	usdq.ctx.Fields = append([]string{field}, fields...)
+	grbuild := &UsageStatisticDayGroupBy{build: usdq}
+	grbuild.flds = &usdq.ctx.Fields
+	grbuild.label = usagestatisticday.Label
+	grbuild.scan = grbuild.Scan
+	return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//	}
+//
+//	client.UsageStatisticDay.Query().
+//		Select(usagestatisticday.FieldCreatedAt).
+//		Scan(ctx, &v)
+func (usdq *UsageStatisticDayQuery) Select(fields ...string) *UsageStatisticDaySelect {
+	usdq.ctx.Fields = append(usdq.ctx.Fields, fields...)
+	sbuild := &UsageStatisticDaySelect{UsageStatisticDayQuery: usdq}
+	sbuild.label = usagestatisticday.Label
+	sbuild.flds, sbuild.scan = &usdq.ctx.Fields, sbuild.Scan
+	return sbuild
+}
+
+// Aggregate returns a UsageStatisticDaySelect configured with the given aggregations.
+func (usdq *UsageStatisticDayQuery) Aggregate(fns ...AggregateFunc) *UsageStatisticDaySelect {
+	return usdq.Select().Aggregate(fns...)
+}
+
+func (usdq *UsageStatisticDayQuery) prepareQuery(ctx context.Context) error {
+	for _, inter := range usdq.inters {
+		if inter == nil {
+			return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+		}
+		if trv, ok := inter.(Traverser); ok {
+			if err := trv.Traverse(ctx, usdq); err != nil {
+				return err
+			}
+		}
+	}
+	for _, f := range usdq.ctx.Fields {
+		if !usagestatisticday.ValidColumn(f) {
+			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+		}
+	}
+	if usdq.path != nil {
+		prev, err := usdq.path(ctx)
+		if err != nil {
+			return err
+		}
+		usdq.sql = prev
+	}
+	return nil
+}
+
+func (usdq *UsageStatisticDayQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*UsageStatisticDay, error) {
+	var (
+		nodes = []*UsageStatisticDay{}
+		_spec = usdq.querySpec()
+	)
+	_spec.ScanValues = func(columns []string) ([]any, error) {
+		return (*UsageStatisticDay).scanValues(nil, columns)
+	}
+	_spec.Assign = func(columns []string, values []any) error {
+		node := &UsageStatisticDay{config: usdq.config}
+		nodes = append(nodes, node)
+		return node.assignValues(columns, values)
+	}
+	for i := range hooks {
+		hooks[i](ctx, _spec)
+	}
+	if err := sqlgraph.QueryNodes(ctx, usdq.driver, _spec); err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nodes, nil
+	}
+	return nodes, nil
+}
+
+func (usdq *UsageStatisticDayQuery) sqlCount(ctx context.Context) (int, error) {
+	_spec := usdq.querySpec()
+	_spec.Node.Columns = usdq.ctx.Fields
+	if len(usdq.ctx.Fields) > 0 {
+		_spec.Unique = usdq.ctx.Unique != nil && *usdq.ctx.Unique
+	}
+	return sqlgraph.CountNodes(ctx, usdq.driver, _spec)
+}
+
+func (usdq *UsageStatisticDayQuery) querySpec() *sqlgraph.QuerySpec {
+	_spec := sqlgraph.NewQuerySpec(usagestatisticday.Table, usagestatisticday.Columns, sqlgraph.NewFieldSpec(usagestatisticday.FieldID, field.TypeUint64))
+	_spec.From = usdq.sql
+	if unique := usdq.ctx.Unique; unique != nil {
+		_spec.Unique = *unique
+	} else if usdq.path != nil {
+		_spec.Unique = true
+	}
+	if fields := usdq.ctx.Fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, usagestatisticday.FieldID)
+		for i := range fields {
+			if fields[i] != usagestatisticday.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+			}
+		}
+	}
+	if ps := usdq.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if limit := usdq.ctx.Limit; limit != nil {
+		_spec.Limit = *limit
+	}
+	if offset := usdq.ctx.Offset; offset != nil {
+		_spec.Offset = *offset
+	}
+	if ps := usdq.order; len(ps) > 0 {
+		_spec.Order = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	return _spec
+}
+
+func (usdq *UsageStatisticDayQuery) sqlQuery(ctx context.Context) *sql.Selector {
+	builder := sql.Dialect(usdq.driver.Dialect())
+	t1 := builder.Table(usagestatisticday.Table)
+	columns := usdq.ctx.Fields
+	if len(columns) == 0 {
+		columns = usagestatisticday.Columns
+	}
+	selector := builder.Select(t1.Columns(columns...)...).From(t1)
+	if usdq.sql != nil {
+		selector = usdq.sql
+		selector.Select(selector.Columns(columns...)...)
+	}
+	if usdq.ctx.Unique != nil && *usdq.ctx.Unique {
+		selector.Distinct()
+	}
+	for _, p := range usdq.predicates {
+		p(selector)
+	}
+	for _, p := range usdq.order {
+		p(selector)
+	}
+	if offset := usdq.ctx.Offset; offset != nil {
+		// limit is mandatory for offset clause. We start
+		// with default value, and override it below if needed.
+		selector.Offset(*offset).Limit(math.MaxInt32)
+	}
+	if limit := usdq.ctx.Limit; limit != nil {
+		selector.Limit(*limit)
+	}
+	return selector
+}
+
+// UsageStatisticDayGroupBy is the group-by builder for UsageStatisticDay entities.
+type UsageStatisticDayGroupBy struct {
+	selector
+	build *UsageStatisticDayQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (usdgb *UsageStatisticDayGroupBy) Aggregate(fns ...AggregateFunc) *UsageStatisticDayGroupBy {
+	usdgb.fns = append(usdgb.fns, fns...)
+	return usdgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (usdgb *UsageStatisticDayGroupBy) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, usdgb.build.ctx, "GroupBy")
+	if err := usdgb.build.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*UsageStatisticDayQuery, *UsageStatisticDayGroupBy](ctx, usdgb.build, usdgb, usdgb.build.inters, v)
+}
+
+func (usdgb *UsageStatisticDayGroupBy) sqlScan(ctx context.Context, root *UsageStatisticDayQuery, v any) error {
+	selector := root.sqlQuery(ctx).Select()
+	aggregation := make([]string, 0, len(usdgb.fns))
+	for _, fn := range usdgb.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	if len(selector.SelectedColumns()) == 0 {
+		columns := make([]string, 0, len(*usdgb.flds)+len(usdgb.fns))
+		for _, f := range *usdgb.flds {
+			columns = append(columns, selector.C(f))
+		}
+		columns = append(columns, aggregation...)
+		selector.Select(columns...)
+	}
+	selector.GroupBy(selector.Columns(*usdgb.flds...)...)
+	if err := selector.Err(); err != nil {
+		return err
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := usdgb.build.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}
+
+// UsageStatisticDaySelect is the builder for selecting fields of UsageStatisticDay entities.
+type UsageStatisticDaySelect struct {
+	*UsageStatisticDayQuery
+	selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (usds *UsageStatisticDaySelect) Aggregate(fns ...AggregateFunc) *UsageStatisticDaySelect {
+	usds.fns = append(usds.fns, fns...)
+	return usds
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (usds *UsageStatisticDaySelect) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, usds.ctx, "Select")
+	if err := usds.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*UsageStatisticDayQuery, *UsageStatisticDaySelect](ctx, usds.UsageStatisticDayQuery, usds, usds.inters, v)
+}
+
+func (usds *UsageStatisticDaySelect) sqlScan(ctx context.Context, root *UsageStatisticDayQuery, v any) error {
+	selector := root.sqlQuery(ctx)
+	aggregation := make([]string, 0, len(usds.fns))
+	for _, fn := range usds.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	switch n := len(*usds.selector.flds); {
+	case n == 0 && len(aggregation) > 0:
+		selector.Select(aggregation...)
+	case n != 0 && len(aggregation) > 0:
+		selector.AppendSelect(aggregation...)
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := usds.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}

+ 1054 - 0
ent/usagestatisticday_update.go

@@ -0,0 +1,1054 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticday"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/dialect/sql/sqljson"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticDayUpdate is the builder for updating UsageStatisticDay entities.
+type UsageStatisticDayUpdate struct {
+	config
+	hooks    []Hook
+	mutation *UsageStatisticDayMutation
+}
+
+// Where appends a list predicates to the UsageStatisticDayUpdate builder.
+func (usdu *UsageStatisticDayUpdate) Where(ps ...predicate.UsageStatisticDay) *UsageStatisticDayUpdate {
+	usdu.mutation.Where(ps...)
+	return usdu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (usdu *UsageStatisticDayUpdate) SetUpdatedAt(t time.Time) *UsageStatisticDayUpdate {
+	usdu.mutation.SetUpdatedAt(t)
+	return usdu
+}
+
+// SetStatus sets the "status" field.
+func (usdu *UsageStatisticDayUpdate) SetStatus(u uint8) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetStatus()
+	usdu.mutation.SetStatus(u)
+	return usdu
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableStatus(u *uint8) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetStatus(*u)
+	}
+	return usdu
+}
+
+// AddStatus adds u to the "status" field.
+func (usdu *UsageStatisticDayUpdate) AddStatus(u int8) *UsageStatisticDayUpdate {
+	usdu.mutation.AddStatus(u)
+	return usdu
+}
+
+// ClearStatus clears the value of the "status" field.
+func (usdu *UsageStatisticDayUpdate) ClearStatus() *UsageStatisticDayUpdate {
+	usdu.mutation.ClearStatus()
+	return usdu
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (usdu *UsageStatisticDayUpdate) SetDeletedAt(t time.Time) *UsageStatisticDayUpdate {
+	usdu.mutation.SetDeletedAt(t)
+	return usdu
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableDeletedAt(t *time.Time) *UsageStatisticDayUpdate {
+	if t != nil {
+		usdu.SetDeletedAt(*t)
+	}
+	return usdu
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (usdu *UsageStatisticDayUpdate) ClearDeletedAt() *UsageStatisticDayUpdate {
+	usdu.mutation.ClearDeletedAt()
+	return usdu
+}
+
+// SetAddtime sets the "addtime" field.
+func (usdu *UsageStatisticDayUpdate) SetAddtime(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetAddtime()
+	usdu.mutation.SetAddtime(u)
+	return usdu
+}
+
+// SetNillableAddtime sets the "addtime" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableAddtime(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetAddtime(*u)
+	}
+	return usdu
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (usdu *UsageStatisticDayUpdate) AddAddtime(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddAddtime(u)
+	return usdu
+}
+
+// SetType sets the "type" field.
+func (usdu *UsageStatisticDayUpdate) SetType(i int) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetType()
+	usdu.mutation.SetType(i)
+	return usdu
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableType(i *int) *UsageStatisticDayUpdate {
+	if i != nil {
+		usdu.SetType(*i)
+	}
+	return usdu
+}
+
+// AddType adds i to the "type" field.
+func (usdu *UsageStatisticDayUpdate) AddType(i int) *UsageStatisticDayUpdate {
+	usdu.mutation.AddType(i)
+	return usdu
+}
+
+// SetBotID sets the "bot_id" field.
+func (usdu *UsageStatisticDayUpdate) SetBotID(s string) *UsageStatisticDayUpdate {
+	usdu.mutation.SetBotID(s)
+	return usdu
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableBotID(s *string) *UsageStatisticDayUpdate {
+	if s != nil {
+		usdu.SetBotID(*s)
+	}
+	return usdu
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (usdu *UsageStatisticDayUpdate) ClearBotID() *UsageStatisticDayUpdate {
+	usdu.mutation.ClearBotID()
+	return usdu
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (usdu *UsageStatisticDayUpdate) SetOrganizationID(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetOrganizationID()
+	usdu.mutation.SetOrganizationID(u)
+	return usdu
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableOrganizationID(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetOrganizationID(*u)
+	}
+	return usdu
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (usdu *UsageStatisticDayUpdate) AddOrganizationID(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddOrganizationID(u)
+	return usdu
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (usdu *UsageStatisticDayUpdate) ClearOrganizationID() *UsageStatisticDayUpdate {
+	usdu.mutation.ClearOrganizationID()
+	return usdu
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (usdu *UsageStatisticDayUpdate) SetAiResponse(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetAiResponse()
+	usdu.mutation.SetAiResponse(u)
+	return usdu
+}
+
+// SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableAiResponse(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetAiResponse(*u)
+	}
+	return usdu
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (usdu *UsageStatisticDayUpdate) AddAiResponse(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddAiResponse(u)
+	return usdu
+}
+
+// SetSopRun sets the "sop_run" field.
+func (usdu *UsageStatisticDayUpdate) SetSopRun(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetSopRun()
+	usdu.mutation.SetSopRun(u)
+	return usdu
+}
+
+// SetNillableSopRun sets the "sop_run" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableSopRun(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetSopRun(*u)
+	}
+	return usdu
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (usdu *UsageStatisticDayUpdate) AddSopRun(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddSopRun(u)
+	return usdu
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (usdu *UsageStatisticDayUpdate) SetTotalFriend(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetTotalFriend()
+	usdu.mutation.SetTotalFriend(u)
+	return usdu
+}
+
+// SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableTotalFriend(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetTotalFriend(*u)
+	}
+	return usdu
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (usdu *UsageStatisticDayUpdate) AddTotalFriend(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddTotalFriend(u)
+	return usdu
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (usdu *UsageStatisticDayUpdate) SetTotalGroup(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetTotalGroup()
+	usdu.mutation.SetTotalGroup(u)
+	return usdu
+}
+
+// SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableTotalGroup(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetTotalGroup(*u)
+	}
+	return usdu
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (usdu *UsageStatisticDayUpdate) AddTotalGroup(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddTotalGroup(u)
+	return usdu
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (usdu *UsageStatisticDayUpdate) SetAccountBalance(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetAccountBalance()
+	usdu.mutation.SetAccountBalance(u)
+	return usdu
+}
+
+// SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableAccountBalance(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetAccountBalance(*u)
+	}
+	return usdu
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (usdu *UsageStatisticDayUpdate) AddAccountBalance(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddAccountBalance(u)
+	return usdu
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (usdu *UsageStatisticDayUpdate) SetConsumeToken(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetConsumeToken()
+	usdu.mutation.SetConsumeToken(u)
+	return usdu
+}
+
+// SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableConsumeToken(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetConsumeToken(*u)
+	}
+	return usdu
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (usdu *UsageStatisticDayUpdate) AddConsumeToken(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddConsumeToken(u)
+	return usdu
+}
+
+// SetActiveUser sets the "active_user" field.
+func (usdu *UsageStatisticDayUpdate) SetActiveUser(u uint64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetActiveUser()
+	usdu.mutation.SetActiveUser(u)
+	return usdu
+}
+
+// SetNillableActiveUser sets the "active_user" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableActiveUser(u *uint64) *UsageStatisticDayUpdate {
+	if u != nil {
+		usdu.SetActiveUser(*u)
+	}
+	return usdu
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (usdu *UsageStatisticDayUpdate) AddActiveUser(u int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddActiveUser(u)
+	return usdu
+}
+
+// SetNewUser sets the "new_user" field.
+func (usdu *UsageStatisticDayUpdate) SetNewUser(i int64) *UsageStatisticDayUpdate {
+	usdu.mutation.ResetNewUser()
+	usdu.mutation.SetNewUser(i)
+	return usdu
+}
+
+// SetNillableNewUser sets the "new_user" field if the given value is not nil.
+func (usdu *UsageStatisticDayUpdate) SetNillableNewUser(i *int64) *UsageStatisticDayUpdate {
+	if i != nil {
+		usdu.SetNewUser(*i)
+	}
+	return usdu
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (usdu *UsageStatisticDayUpdate) AddNewUser(i int64) *UsageStatisticDayUpdate {
+	usdu.mutation.AddNewUser(i)
+	return usdu
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (usdu *UsageStatisticDayUpdate) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticDayUpdate {
+	usdu.mutation.SetLabelDist(ctd)
+	return usdu
+}
+
+// AppendLabelDist appends ctd to the "label_dist" field.
+func (usdu *UsageStatisticDayUpdate) AppendLabelDist(ctd []custom_types.LabelDist) *UsageStatisticDayUpdate {
+	usdu.mutation.AppendLabelDist(ctd)
+	return usdu
+}
+
+// Mutation returns the UsageStatisticDayMutation object of the builder.
+func (usdu *UsageStatisticDayUpdate) Mutation() *UsageStatisticDayMutation {
+	return usdu.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (usdu *UsageStatisticDayUpdate) Save(ctx context.Context) (int, error) {
+	if err := usdu.defaults(); err != nil {
+		return 0, err
+	}
+	return withHooks(ctx, usdu.sqlSave, usdu.mutation, usdu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (usdu *UsageStatisticDayUpdate) SaveX(ctx context.Context) int {
+	affected, err := usdu.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return affected
+}
+
+// Exec executes the query.
+func (usdu *UsageStatisticDayUpdate) Exec(ctx context.Context) error {
+	_, err := usdu.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usdu *UsageStatisticDayUpdate) ExecX(ctx context.Context) {
+	if err := usdu.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (usdu *UsageStatisticDayUpdate) defaults() error {
+	if _, ok := usdu.mutation.UpdatedAt(); !ok {
+		if usagestatisticday.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticday.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticday.UpdateDefaultUpdatedAt()
+		usdu.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (usdu *UsageStatisticDayUpdate) sqlSave(ctx context.Context) (n int, err error) {
+	_spec := sqlgraph.NewUpdateSpec(usagestatisticday.Table, usagestatisticday.Columns, sqlgraph.NewFieldSpec(usagestatisticday.FieldID, field.TypeUint64))
+	if ps := usdu.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := usdu.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatisticday.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := usdu.mutation.Status(); ok {
+		_spec.SetField(usagestatisticday.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := usdu.mutation.AddedStatus(); ok {
+		_spec.AddField(usagestatisticday.FieldStatus, field.TypeUint8, value)
+	}
+	if usdu.mutation.StatusCleared() {
+		_spec.ClearField(usagestatisticday.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := usdu.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatisticday.FieldDeletedAt, field.TypeTime, value)
+	}
+	if usdu.mutation.DeletedAtCleared() {
+		_spec.ClearField(usagestatisticday.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := usdu.mutation.Addtime(); ok {
+		_spec.SetField(usagestatisticday.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedAddtime(); ok {
+		_spec.AddField(usagestatisticday.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.GetType(); ok {
+		_spec.SetField(usagestatisticday.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usdu.mutation.AddedType(); ok {
+		_spec.AddField(usagestatisticday.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usdu.mutation.BotID(); ok {
+		_spec.SetField(usagestatisticday.FieldBotID, field.TypeString, value)
+	}
+	if usdu.mutation.BotIDCleared() {
+		_spec.ClearField(usagestatisticday.FieldBotID, field.TypeString)
+	}
+	if value, ok := usdu.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatisticday.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(usagestatisticday.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if usdu.mutation.OrganizationIDCleared() {
+		_spec.ClearField(usagestatisticday.FieldOrganizationID, field.TypeUint64)
+	}
+	if value, ok := usdu.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatisticday.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedAiResponse(); ok {
+		_spec.AddField(usagestatisticday.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.SopRun(); ok {
+		_spec.SetField(usagestatisticday.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedSopRun(); ok {
+		_spec.AddField(usagestatisticday.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatisticday.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedTotalFriend(); ok {
+		_spec.AddField(usagestatisticday.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatisticday.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedTotalGroup(); ok {
+		_spec.AddField(usagestatisticday.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatisticday.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedAccountBalance(); ok {
+		_spec.AddField(usagestatisticday.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatisticday.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedConsumeToken(); ok {
+		_spec.AddField(usagestatisticday.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatisticday.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.AddedActiveUser(); ok {
+		_spec.AddField(usagestatisticday.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usdu.mutation.NewUser(); ok {
+		_spec.SetField(usagestatisticday.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usdu.mutation.AddedNewUser(); ok {
+		_spec.AddField(usagestatisticday.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usdu.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatisticday.FieldLabelDist, field.TypeJSON, value)
+	}
+	if value, ok := usdu.mutation.AppendedLabelDist(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, usagestatisticday.FieldLabelDist, value)
+		})
+	}
+	if n, err = sqlgraph.UpdateNodes(ctx, usdu.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{usagestatisticday.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return 0, err
+	}
+	usdu.mutation.done = true
+	return n, nil
+}
+
+// UsageStatisticDayUpdateOne is the builder for updating a single UsageStatisticDay entity.
+type UsageStatisticDayUpdateOne struct {
+	config
+	fields   []string
+	hooks    []Hook
+	mutation *UsageStatisticDayMutation
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (usduo *UsageStatisticDayUpdateOne) SetUpdatedAt(t time.Time) *UsageStatisticDayUpdateOne {
+	usduo.mutation.SetUpdatedAt(t)
+	return usduo
+}
+
+// SetStatus sets the "status" field.
+func (usduo *UsageStatisticDayUpdateOne) SetStatus(u uint8) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetStatus()
+	usduo.mutation.SetStatus(u)
+	return usduo
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableStatus(u *uint8) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetStatus(*u)
+	}
+	return usduo
+}
+
+// AddStatus adds u to the "status" field.
+func (usduo *UsageStatisticDayUpdateOne) AddStatus(u int8) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddStatus(u)
+	return usduo
+}
+
+// ClearStatus clears the value of the "status" field.
+func (usduo *UsageStatisticDayUpdateOne) ClearStatus() *UsageStatisticDayUpdateOne {
+	usduo.mutation.ClearStatus()
+	return usduo
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (usduo *UsageStatisticDayUpdateOne) SetDeletedAt(t time.Time) *UsageStatisticDayUpdateOne {
+	usduo.mutation.SetDeletedAt(t)
+	return usduo
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableDeletedAt(t *time.Time) *UsageStatisticDayUpdateOne {
+	if t != nil {
+		usduo.SetDeletedAt(*t)
+	}
+	return usduo
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (usduo *UsageStatisticDayUpdateOne) ClearDeletedAt() *UsageStatisticDayUpdateOne {
+	usduo.mutation.ClearDeletedAt()
+	return usduo
+}
+
+// SetAddtime sets the "addtime" field.
+func (usduo *UsageStatisticDayUpdateOne) SetAddtime(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetAddtime()
+	usduo.mutation.SetAddtime(u)
+	return usduo
+}
+
+// SetNillableAddtime sets the "addtime" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableAddtime(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetAddtime(*u)
+	}
+	return usduo
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (usduo *UsageStatisticDayUpdateOne) AddAddtime(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddAddtime(u)
+	return usduo
+}
+
+// SetType sets the "type" field.
+func (usduo *UsageStatisticDayUpdateOne) SetType(i int) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetType()
+	usduo.mutation.SetType(i)
+	return usduo
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableType(i *int) *UsageStatisticDayUpdateOne {
+	if i != nil {
+		usduo.SetType(*i)
+	}
+	return usduo
+}
+
+// AddType adds i to the "type" field.
+func (usduo *UsageStatisticDayUpdateOne) AddType(i int) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddType(i)
+	return usduo
+}
+
+// SetBotID sets the "bot_id" field.
+func (usduo *UsageStatisticDayUpdateOne) SetBotID(s string) *UsageStatisticDayUpdateOne {
+	usduo.mutation.SetBotID(s)
+	return usduo
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableBotID(s *string) *UsageStatisticDayUpdateOne {
+	if s != nil {
+		usduo.SetBotID(*s)
+	}
+	return usduo
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (usduo *UsageStatisticDayUpdateOne) ClearBotID() *UsageStatisticDayUpdateOne {
+	usduo.mutation.ClearBotID()
+	return usduo
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (usduo *UsageStatisticDayUpdateOne) SetOrganizationID(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetOrganizationID()
+	usduo.mutation.SetOrganizationID(u)
+	return usduo
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableOrganizationID(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetOrganizationID(*u)
+	}
+	return usduo
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (usduo *UsageStatisticDayUpdateOne) AddOrganizationID(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddOrganizationID(u)
+	return usduo
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (usduo *UsageStatisticDayUpdateOne) ClearOrganizationID() *UsageStatisticDayUpdateOne {
+	usduo.mutation.ClearOrganizationID()
+	return usduo
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (usduo *UsageStatisticDayUpdateOne) SetAiResponse(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetAiResponse()
+	usduo.mutation.SetAiResponse(u)
+	return usduo
+}
+
+// SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableAiResponse(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetAiResponse(*u)
+	}
+	return usduo
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (usduo *UsageStatisticDayUpdateOne) AddAiResponse(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddAiResponse(u)
+	return usduo
+}
+
+// SetSopRun sets the "sop_run" field.
+func (usduo *UsageStatisticDayUpdateOne) SetSopRun(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetSopRun()
+	usduo.mutation.SetSopRun(u)
+	return usduo
+}
+
+// SetNillableSopRun sets the "sop_run" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableSopRun(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetSopRun(*u)
+	}
+	return usduo
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (usduo *UsageStatisticDayUpdateOne) AddSopRun(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddSopRun(u)
+	return usduo
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (usduo *UsageStatisticDayUpdateOne) SetTotalFriend(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetTotalFriend()
+	usduo.mutation.SetTotalFriend(u)
+	return usduo
+}
+
+// SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableTotalFriend(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetTotalFriend(*u)
+	}
+	return usduo
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (usduo *UsageStatisticDayUpdateOne) AddTotalFriend(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddTotalFriend(u)
+	return usduo
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (usduo *UsageStatisticDayUpdateOne) SetTotalGroup(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetTotalGroup()
+	usduo.mutation.SetTotalGroup(u)
+	return usduo
+}
+
+// SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableTotalGroup(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetTotalGroup(*u)
+	}
+	return usduo
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (usduo *UsageStatisticDayUpdateOne) AddTotalGroup(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddTotalGroup(u)
+	return usduo
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (usduo *UsageStatisticDayUpdateOne) SetAccountBalance(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetAccountBalance()
+	usduo.mutation.SetAccountBalance(u)
+	return usduo
+}
+
+// SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableAccountBalance(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetAccountBalance(*u)
+	}
+	return usduo
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (usduo *UsageStatisticDayUpdateOne) AddAccountBalance(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddAccountBalance(u)
+	return usduo
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (usduo *UsageStatisticDayUpdateOne) SetConsumeToken(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetConsumeToken()
+	usduo.mutation.SetConsumeToken(u)
+	return usduo
+}
+
+// SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableConsumeToken(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetConsumeToken(*u)
+	}
+	return usduo
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (usduo *UsageStatisticDayUpdateOne) AddConsumeToken(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddConsumeToken(u)
+	return usduo
+}
+
+// SetActiveUser sets the "active_user" field.
+func (usduo *UsageStatisticDayUpdateOne) SetActiveUser(u uint64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetActiveUser()
+	usduo.mutation.SetActiveUser(u)
+	return usduo
+}
+
+// SetNillableActiveUser sets the "active_user" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableActiveUser(u *uint64) *UsageStatisticDayUpdateOne {
+	if u != nil {
+		usduo.SetActiveUser(*u)
+	}
+	return usduo
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (usduo *UsageStatisticDayUpdateOne) AddActiveUser(u int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddActiveUser(u)
+	return usduo
+}
+
+// SetNewUser sets the "new_user" field.
+func (usduo *UsageStatisticDayUpdateOne) SetNewUser(i int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.ResetNewUser()
+	usduo.mutation.SetNewUser(i)
+	return usduo
+}
+
+// SetNillableNewUser sets the "new_user" field if the given value is not nil.
+func (usduo *UsageStatisticDayUpdateOne) SetNillableNewUser(i *int64) *UsageStatisticDayUpdateOne {
+	if i != nil {
+		usduo.SetNewUser(*i)
+	}
+	return usduo
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (usduo *UsageStatisticDayUpdateOne) AddNewUser(i int64) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AddNewUser(i)
+	return usduo
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (usduo *UsageStatisticDayUpdateOne) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticDayUpdateOne {
+	usduo.mutation.SetLabelDist(ctd)
+	return usduo
+}
+
+// AppendLabelDist appends ctd to the "label_dist" field.
+func (usduo *UsageStatisticDayUpdateOne) AppendLabelDist(ctd []custom_types.LabelDist) *UsageStatisticDayUpdateOne {
+	usduo.mutation.AppendLabelDist(ctd)
+	return usduo
+}
+
+// Mutation returns the UsageStatisticDayMutation object of the builder.
+func (usduo *UsageStatisticDayUpdateOne) Mutation() *UsageStatisticDayMutation {
+	return usduo.mutation
+}
+
+// Where appends a list predicates to the UsageStatisticDayUpdate builder.
+func (usduo *UsageStatisticDayUpdateOne) Where(ps ...predicate.UsageStatisticDay) *UsageStatisticDayUpdateOne {
+	usduo.mutation.Where(ps...)
+	return usduo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (usduo *UsageStatisticDayUpdateOne) Select(field string, fields ...string) *UsageStatisticDayUpdateOne {
+	usduo.fields = append([]string{field}, fields...)
+	return usduo
+}
+
+// Save executes the query and returns the updated UsageStatisticDay entity.
+func (usduo *UsageStatisticDayUpdateOne) Save(ctx context.Context) (*UsageStatisticDay, error) {
+	if err := usduo.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, usduo.sqlSave, usduo.mutation, usduo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (usduo *UsageStatisticDayUpdateOne) SaveX(ctx context.Context) *UsageStatisticDay {
+	node, err := usduo.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// Exec executes the query on the entity.
+func (usduo *UsageStatisticDayUpdateOne) Exec(ctx context.Context) error {
+	_, err := usduo.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usduo *UsageStatisticDayUpdateOne) ExecX(ctx context.Context) {
+	if err := usduo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (usduo *UsageStatisticDayUpdateOne) defaults() error {
+	if _, ok := usduo.mutation.UpdatedAt(); !ok {
+		if usagestatisticday.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticday.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticday.UpdateDefaultUpdatedAt()
+		usduo.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (usduo *UsageStatisticDayUpdateOne) sqlSave(ctx context.Context) (_node *UsageStatisticDay, err error) {
+	_spec := sqlgraph.NewUpdateSpec(usagestatisticday.Table, usagestatisticday.Columns, sqlgraph.NewFieldSpec(usagestatisticday.FieldID, field.TypeUint64))
+	id, ok := usduo.mutation.ID()
+	if !ok {
+		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "UsageStatisticDay.id" for update`)}
+	}
+	_spec.Node.ID.Value = id
+	if fields := usduo.fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, usagestatisticday.FieldID)
+		for _, f := range fields {
+			if !usagestatisticday.ValidColumn(f) {
+				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+			}
+			if f != usagestatisticday.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, f)
+			}
+		}
+	}
+	if ps := usduo.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := usduo.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatisticday.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := usduo.mutation.Status(); ok {
+		_spec.SetField(usagestatisticday.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := usduo.mutation.AddedStatus(); ok {
+		_spec.AddField(usagestatisticday.FieldStatus, field.TypeUint8, value)
+	}
+	if usduo.mutation.StatusCleared() {
+		_spec.ClearField(usagestatisticday.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := usduo.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatisticday.FieldDeletedAt, field.TypeTime, value)
+	}
+	if usduo.mutation.DeletedAtCleared() {
+		_spec.ClearField(usagestatisticday.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := usduo.mutation.Addtime(); ok {
+		_spec.SetField(usagestatisticday.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedAddtime(); ok {
+		_spec.AddField(usagestatisticday.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.GetType(); ok {
+		_spec.SetField(usagestatisticday.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usduo.mutation.AddedType(); ok {
+		_spec.AddField(usagestatisticday.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usduo.mutation.BotID(); ok {
+		_spec.SetField(usagestatisticday.FieldBotID, field.TypeString, value)
+	}
+	if usduo.mutation.BotIDCleared() {
+		_spec.ClearField(usagestatisticday.FieldBotID, field.TypeString)
+	}
+	if value, ok := usduo.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatisticday.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(usagestatisticday.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if usduo.mutation.OrganizationIDCleared() {
+		_spec.ClearField(usagestatisticday.FieldOrganizationID, field.TypeUint64)
+	}
+	if value, ok := usduo.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatisticday.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedAiResponse(); ok {
+		_spec.AddField(usagestatisticday.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.SopRun(); ok {
+		_spec.SetField(usagestatisticday.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedSopRun(); ok {
+		_spec.AddField(usagestatisticday.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatisticday.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedTotalFriend(); ok {
+		_spec.AddField(usagestatisticday.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatisticday.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedTotalGroup(); ok {
+		_spec.AddField(usagestatisticday.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatisticday.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedAccountBalance(); ok {
+		_spec.AddField(usagestatisticday.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatisticday.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedConsumeToken(); ok {
+		_spec.AddField(usagestatisticday.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatisticday.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.AddedActiveUser(); ok {
+		_spec.AddField(usagestatisticday.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usduo.mutation.NewUser(); ok {
+		_spec.SetField(usagestatisticday.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usduo.mutation.AddedNewUser(); ok {
+		_spec.AddField(usagestatisticday.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usduo.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatisticday.FieldLabelDist, field.TypeJSON, value)
+	}
+	if value, ok := usduo.mutation.AppendedLabelDist(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, usagestatisticday.FieldLabelDist, value)
+		})
+	}
+	_node = &UsageStatisticDay{config: usduo.config}
+	_spec.Assign = _node.assignValues
+	_spec.ScanValues = _node.scanValues
+	if err = sqlgraph.UpdateNode(ctx, usduo.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{usagestatisticday.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	usduo.mutation.done = true
+	return _node, nil
+}

+ 288 - 0
ent/usagestatistichour.go

@@ -0,0 +1,288 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"encoding/json"
+	"fmt"
+	"strings"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/usagestatistichour"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+// UsageStatisticHour is the model entity for the UsageStatisticHour schema.
+type UsageStatisticHour struct {
+	config `json:"-"`
+	// ID of the ent.
+	ID uint64 `json:"id,omitempty"`
+	// Create Time | 创建日期
+	CreatedAt time.Time `json:"created_at,omitempty"`
+	// Update Time | 修改日期
+	UpdatedAt time.Time `json:"updated_at,omitempty"`
+	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
+	Status uint8 `json:"status,omitempty"`
+	// Delete Time | 删除日期
+	DeletedAt time.Time `json:"deleted_at,omitempty"`
+	// 写入小时
+	Addtime uint64 `json:"addtime,omitempty"`
+	// 1-微信 2-名片
+	Type int `json:"type,omitempty"`
+	// 微信或名片id
+	BotID string `json:"bot_id,omitempty"`
+	// 机构ID
+	OrganizationID uint64 `json:"organization_id,omitempty"`
+	// AI回复次数
+	AiResponse uint64 `json:"ai_response,omitempty"`
+	// SOP运行次数
+	SopRun uint64 `json:"sop_run,omitempty"`
+	// 好友总数
+	TotalFriend uint64 `json:"total_friend,omitempty"`
+	// 群总数
+	TotalGroup uint64 `json:"total_group,omitempty"`
+	// 账户余额(单位:分)
+	AccountBalance uint64 `json:"account_balance,omitempty"`
+	// 消耗token数
+	ConsumeToken uint64 `json:"consume_token,omitempty"`
+	// 活跃用户数
+	ActiveUser uint64 `json:"active_user,omitempty"`
+	// 新增用户数
+	NewUser int64 `json:"new_user,omitempty"`
+	// 标签分布
+	LabelDist    []custom_types.LabelDist `json:"label_dist,omitempty"`
+	selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*UsageStatisticHour) scanValues(columns []string) ([]any, error) {
+	values := make([]any, len(columns))
+	for i := range columns {
+		switch columns[i] {
+		case usagestatistichour.FieldLabelDist:
+			values[i] = new([]byte)
+		case usagestatistichour.FieldID, usagestatistichour.FieldStatus, usagestatistichour.FieldAddtime, usagestatistichour.FieldType, usagestatistichour.FieldOrganizationID, usagestatistichour.FieldAiResponse, usagestatistichour.FieldSopRun, usagestatistichour.FieldTotalFriend, usagestatistichour.FieldTotalGroup, usagestatistichour.FieldAccountBalance, usagestatistichour.FieldConsumeToken, usagestatistichour.FieldActiveUser, usagestatistichour.FieldNewUser:
+			values[i] = new(sql.NullInt64)
+		case usagestatistichour.FieldBotID:
+			values[i] = new(sql.NullString)
+		case usagestatistichour.FieldCreatedAt, usagestatistichour.FieldUpdatedAt, usagestatistichour.FieldDeletedAt:
+			values[i] = new(sql.NullTime)
+		default:
+			values[i] = new(sql.UnknownType)
+		}
+	}
+	return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the UsageStatisticHour fields.
+func (ush *UsageStatisticHour) assignValues(columns []string, values []any) error {
+	if m, n := len(values), len(columns); m < n {
+		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+	}
+	for i := range columns {
+		switch columns[i] {
+		case usagestatistichour.FieldID:
+			value, ok := values[i].(*sql.NullInt64)
+			if !ok {
+				return fmt.Errorf("unexpected type %T for field id", value)
+			}
+			ush.ID = uint64(value.Int64)
+		case usagestatistichour.FieldCreatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field created_at", values[i])
+			} else if value.Valid {
+				ush.CreatedAt = value.Time
+			}
+		case usagestatistichour.FieldUpdatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+			} else if value.Valid {
+				ush.UpdatedAt = value.Time
+			}
+		case usagestatistichour.FieldStatus:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field status", values[i])
+			} else if value.Valid {
+				ush.Status = uint8(value.Int64)
+			}
+		case usagestatistichour.FieldDeletedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
+			} else if value.Valid {
+				ush.DeletedAt = value.Time
+			}
+		case usagestatistichour.FieldAddtime:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field addtime", values[i])
+			} else if value.Valid {
+				ush.Addtime = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldType:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field type", values[i])
+			} else if value.Valid {
+				ush.Type = int(value.Int64)
+			}
+		case usagestatistichour.FieldBotID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field bot_id", values[i])
+			} else if value.Valid {
+				ush.BotID = value.String
+			}
+		case usagestatistichour.FieldOrganizationID:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field organization_id", values[i])
+			} else if value.Valid {
+				ush.OrganizationID = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldAiResponse:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field ai_response", values[i])
+			} else if value.Valid {
+				ush.AiResponse = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldSopRun:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field sop_run", values[i])
+			} else if value.Valid {
+				ush.SopRun = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldTotalFriend:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field total_friend", values[i])
+			} else if value.Valid {
+				ush.TotalFriend = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldTotalGroup:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field total_group", values[i])
+			} else if value.Valid {
+				ush.TotalGroup = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldAccountBalance:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field account_balance", values[i])
+			} else if value.Valid {
+				ush.AccountBalance = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldConsumeToken:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field consume_token", values[i])
+			} else if value.Valid {
+				ush.ConsumeToken = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldActiveUser:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field active_user", values[i])
+			} else if value.Valid {
+				ush.ActiveUser = uint64(value.Int64)
+			}
+		case usagestatistichour.FieldNewUser:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field new_user", values[i])
+			} else if value.Valid {
+				ush.NewUser = value.Int64
+			}
+		case usagestatistichour.FieldLabelDist:
+			if value, ok := values[i].(*[]byte); !ok {
+				return fmt.Errorf("unexpected type %T for field label_dist", values[i])
+			} else if value != nil && len(*value) > 0 {
+				if err := json.Unmarshal(*value, &ush.LabelDist); err != nil {
+					return fmt.Errorf("unmarshal field label_dist: %w", err)
+				}
+			}
+		default:
+			ush.selectValues.Set(columns[i], values[i])
+		}
+	}
+	return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the UsageStatisticHour.
+// This includes values selected through modifiers, order, etc.
+func (ush *UsageStatisticHour) Value(name string) (ent.Value, error) {
+	return ush.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this UsageStatisticHour.
+// Note that you need to call UsageStatisticHour.Unwrap() before calling this method if this UsageStatisticHour
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (ush *UsageStatisticHour) Update() *UsageStatisticHourUpdateOne {
+	return NewUsageStatisticHourClient(ush.config).UpdateOne(ush)
+}
+
+// Unwrap unwraps the UsageStatisticHour entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (ush *UsageStatisticHour) Unwrap() *UsageStatisticHour {
+	_tx, ok := ush.config.driver.(*txDriver)
+	if !ok {
+		panic("ent: UsageStatisticHour is not a transactional entity")
+	}
+	ush.config.driver = _tx.drv
+	return ush
+}
+
+// String implements the fmt.Stringer.
+func (ush *UsageStatisticHour) String() string {
+	var builder strings.Builder
+	builder.WriteString("UsageStatisticHour(")
+	builder.WriteString(fmt.Sprintf("id=%v, ", ush.ID))
+	builder.WriteString("created_at=")
+	builder.WriteString(ush.CreatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("updated_at=")
+	builder.WriteString(ush.UpdatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("status=")
+	builder.WriteString(fmt.Sprintf("%v", ush.Status))
+	builder.WriteString(", ")
+	builder.WriteString("deleted_at=")
+	builder.WriteString(ush.DeletedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("addtime=")
+	builder.WriteString(fmt.Sprintf("%v", ush.Addtime))
+	builder.WriteString(", ")
+	builder.WriteString("type=")
+	builder.WriteString(fmt.Sprintf("%v", ush.Type))
+	builder.WriteString(", ")
+	builder.WriteString("bot_id=")
+	builder.WriteString(ush.BotID)
+	builder.WriteString(", ")
+	builder.WriteString("organization_id=")
+	builder.WriteString(fmt.Sprintf("%v", ush.OrganizationID))
+	builder.WriteString(", ")
+	builder.WriteString("ai_response=")
+	builder.WriteString(fmt.Sprintf("%v", ush.AiResponse))
+	builder.WriteString(", ")
+	builder.WriteString("sop_run=")
+	builder.WriteString(fmt.Sprintf("%v", ush.SopRun))
+	builder.WriteString(", ")
+	builder.WriteString("total_friend=")
+	builder.WriteString(fmt.Sprintf("%v", ush.TotalFriend))
+	builder.WriteString(", ")
+	builder.WriteString("total_group=")
+	builder.WriteString(fmt.Sprintf("%v", ush.TotalGroup))
+	builder.WriteString(", ")
+	builder.WriteString("account_balance=")
+	builder.WriteString(fmt.Sprintf("%v", ush.AccountBalance))
+	builder.WriteString(", ")
+	builder.WriteString("consume_token=")
+	builder.WriteString(fmt.Sprintf("%v", ush.ConsumeToken))
+	builder.WriteString(", ")
+	builder.WriteString("active_user=")
+	builder.WriteString(fmt.Sprintf("%v", ush.ActiveUser))
+	builder.WriteString(", ")
+	builder.WriteString("new_user=")
+	builder.WriteString(fmt.Sprintf("%v", ush.NewUser))
+	builder.WriteString(", ")
+	builder.WriteString("label_dist=")
+	builder.WriteString(fmt.Sprintf("%v", ush.LabelDist))
+	builder.WriteByte(')')
+	return builder.String()
+}
+
+// UsageStatisticHours is a parsable slice of UsageStatisticHour.
+type UsageStatisticHours []*UsageStatisticHour

+ 191 - 0
ent/usagestatistichour/usagestatistichour.go

@@ -0,0 +1,191 @@
+// Code generated by ent, DO NOT EDIT.
+
+package usagestatistichour
+
+import (
+	"time"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+const (
+	// Label holds the string label denoting the usagestatistichour type in the database.
+	Label = "usage_statistic_hour"
+	// FieldID holds the string denoting the id field in the database.
+	FieldID = "id"
+	// FieldCreatedAt holds the string denoting the created_at field in the database.
+	FieldCreatedAt = "created_at"
+	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
+	FieldUpdatedAt = "updated_at"
+	// FieldStatus holds the string denoting the status field in the database.
+	FieldStatus = "status"
+	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
+	FieldDeletedAt = "deleted_at"
+	// FieldAddtime holds the string denoting the addtime field in the database.
+	FieldAddtime = "addtime"
+	// FieldType holds the string denoting the type field in the database.
+	FieldType = "type"
+	// FieldBotID holds the string denoting the bot_id field in the database.
+	FieldBotID = "bot_id"
+	// FieldOrganizationID holds the string denoting the organization_id field in the database.
+	FieldOrganizationID = "organization_id"
+	// FieldAiResponse holds the string denoting the ai_response field in the database.
+	FieldAiResponse = "ai_response"
+	// FieldSopRun holds the string denoting the sop_run field in the database.
+	FieldSopRun = "sop_run"
+	// FieldTotalFriend holds the string denoting the total_friend field in the database.
+	FieldTotalFriend = "total_friend"
+	// FieldTotalGroup holds the string denoting the total_group field in the database.
+	FieldTotalGroup = "total_group"
+	// FieldAccountBalance holds the string denoting the account_balance field in the database.
+	FieldAccountBalance = "account_balance"
+	// FieldConsumeToken holds the string denoting the consume_token field in the database.
+	FieldConsumeToken = "consume_token"
+	// FieldActiveUser holds the string denoting the active_user field in the database.
+	FieldActiveUser = "active_user"
+	// FieldNewUser holds the string denoting the new_user field in the database.
+	FieldNewUser = "new_user"
+	// FieldLabelDist holds the string denoting the label_dist field in the database.
+	FieldLabelDist = "label_dist"
+	// Table holds the table name of the usagestatistichour in the database.
+	Table = "usage_statistic_hour"
+)
+
+// Columns holds all SQL columns for usagestatistichour fields.
+var Columns = []string{
+	FieldID,
+	FieldCreatedAt,
+	FieldUpdatedAt,
+	FieldStatus,
+	FieldDeletedAt,
+	FieldAddtime,
+	FieldType,
+	FieldBotID,
+	FieldOrganizationID,
+	FieldAiResponse,
+	FieldSopRun,
+	FieldTotalFriend,
+	FieldTotalGroup,
+	FieldAccountBalance,
+	FieldConsumeToken,
+	FieldActiveUser,
+	FieldNewUser,
+	FieldLabelDist,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+	for i := range Columns {
+		if column == Columns[i] {
+			return true
+		}
+	}
+	return false
+}
+
+// Note that the variables below are initialized by the runtime
+// package on the initialization of the application. Therefore,
+// it should be imported in the main as follows:
+//
+//	import _ "wechat-api/ent/runtime"
+var (
+	Hooks        [1]ent.Hook
+	Interceptors [1]ent.Interceptor
+	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
+	DefaultCreatedAt func() time.Time
+	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+	DefaultUpdatedAt func() time.Time
+	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+	UpdateDefaultUpdatedAt func() time.Time
+	// DefaultStatus holds the default value on creation for the "status" field.
+	DefaultStatus uint8
+)
+
+// OrderOption defines the ordering options for the UsageStatisticHour queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByDeletedAt orders the results by the deleted_at field.
+func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
+}
+
+// ByAddtime orders the results by the addtime field.
+func ByAddtime(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAddtime, opts...).ToFunc()
+}
+
+// ByType orders the results by the type field.
+func ByType(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldType, opts...).ToFunc()
+}
+
+// ByBotID orders the results by the bot_id field.
+func ByBotID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldBotID, opts...).ToFunc()
+}
+
+// ByOrganizationID orders the results by the organization_id field.
+func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
+}
+
+// ByAiResponse orders the results by the ai_response field.
+func ByAiResponse(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAiResponse, opts...).ToFunc()
+}
+
+// BySopRun orders the results by the sop_run field.
+func BySopRun(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldSopRun, opts...).ToFunc()
+}
+
+// ByTotalFriend orders the results by the total_friend field.
+func ByTotalFriend(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldTotalFriend, opts...).ToFunc()
+}
+
+// ByTotalGroup orders the results by the total_group field.
+func ByTotalGroup(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldTotalGroup, opts...).ToFunc()
+}
+
+// ByAccountBalance orders the results by the account_balance field.
+func ByAccountBalance(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAccountBalance, opts...).ToFunc()
+}
+
+// ByConsumeToken orders the results by the consume_token field.
+func ByConsumeToken(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldConsumeToken, opts...).ToFunc()
+}
+
+// ByActiveUser orders the results by the active_user field.
+func ByActiveUser(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldActiveUser, opts...).ToFunc()
+}
+
+// ByNewUser orders the results by the new_user field.
+func ByNewUser(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldNewUser, opts...).ToFunc()
+}

+ 855 - 0
ent/usagestatistichour/where.go

@@ -0,0 +1,855 @@
+// Code generated by ent, DO NOT EDIT.
+
+package usagestatistichour
+
+import (
+	"time"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldStatus, v))
+}
+
+// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
+func DeletedAt(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// Addtime applies equality check predicate on the "addtime" field. It's identical to AddtimeEQ.
+func Addtime(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldAddtime, v))
+}
+
+// Type applies equality check predicate on the "type" field. It's identical to TypeEQ.
+func Type(v int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldType, v))
+}
+
+// BotID applies equality check predicate on the "bot_id" field. It's identical to BotIDEQ.
+func BotID(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldBotID, v))
+}
+
+// OrganizationID applies equality check predicate on the "organization_id" field. It's identical to OrganizationIDEQ.
+func OrganizationID(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// AiResponse applies equality check predicate on the "ai_response" field. It's identical to AiResponseEQ.
+func AiResponse(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldAiResponse, v))
+}
+
+// SopRun applies equality check predicate on the "sop_run" field. It's identical to SopRunEQ.
+func SopRun(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldSopRun, v))
+}
+
+// TotalFriend applies equality check predicate on the "total_friend" field. It's identical to TotalFriendEQ.
+func TotalFriend(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldTotalFriend, v))
+}
+
+// TotalGroup applies equality check predicate on the "total_group" field. It's identical to TotalGroupEQ.
+func TotalGroup(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldTotalGroup, v))
+}
+
+// AccountBalance applies equality check predicate on the "account_balance" field. It's identical to AccountBalanceEQ.
+func AccountBalance(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldAccountBalance, v))
+}
+
+// ConsumeToken applies equality check predicate on the "consume_token" field. It's identical to ConsumeTokenEQ.
+func ConsumeToken(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldConsumeToken, v))
+}
+
+// ActiveUser applies equality check predicate on the "active_user" field. It's identical to ActiveUserEQ.
+func ActiveUser(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldActiveUser, v))
+}
+
+// NewUser applies equality check predicate on the "new_user" field. It's identical to NewUserEQ.
+func NewUser(v int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldNewUser, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v uint8) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusIsNil applies the IsNil predicate on the "status" field.
+func StatusIsNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIsNull(FieldStatus))
+}
+
+// StatusNotNil applies the NotNil predicate on the "status" field.
+func StatusNotNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotNull(FieldStatus))
+}
+
+// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
+func DeletedAtEQ(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
+func DeletedAtNEQ(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtIn applies the In predicate on the "deleted_at" field.
+func DeletedAtIn(vs ...time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
+func DeletedAtNotIn(vs ...time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtGT applies the GT predicate on the "deleted_at" field.
+func DeletedAtGT(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldDeletedAt, v))
+}
+
+// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
+func DeletedAtGTE(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldDeletedAt, v))
+}
+
+// DeletedAtLT applies the LT predicate on the "deleted_at" field.
+func DeletedAtLT(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldDeletedAt, v))
+}
+
+// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
+func DeletedAtLTE(v time.Time) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldDeletedAt, v))
+}
+
+// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
+func DeletedAtIsNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIsNull(FieldDeletedAt))
+}
+
+// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
+func DeletedAtNotNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotNull(FieldDeletedAt))
+}
+
+// AddtimeEQ applies the EQ predicate on the "addtime" field.
+func AddtimeEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldAddtime, v))
+}
+
+// AddtimeNEQ applies the NEQ predicate on the "addtime" field.
+func AddtimeNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldAddtime, v))
+}
+
+// AddtimeIn applies the In predicate on the "addtime" field.
+func AddtimeIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldAddtime, vs...))
+}
+
+// AddtimeNotIn applies the NotIn predicate on the "addtime" field.
+func AddtimeNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldAddtime, vs...))
+}
+
+// AddtimeGT applies the GT predicate on the "addtime" field.
+func AddtimeGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldAddtime, v))
+}
+
+// AddtimeGTE applies the GTE predicate on the "addtime" field.
+func AddtimeGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldAddtime, v))
+}
+
+// AddtimeLT applies the LT predicate on the "addtime" field.
+func AddtimeLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldAddtime, v))
+}
+
+// AddtimeLTE applies the LTE predicate on the "addtime" field.
+func AddtimeLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldAddtime, v))
+}
+
+// TypeEQ applies the EQ predicate on the "type" field.
+func TypeEQ(v int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldType, v))
+}
+
+// TypeNEQ applies the NEQ predicate on the "type" field.
+func TypeNEQ(v int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldType, v))
+}
+
+// TypeIn applies the In predicate on the "type" field.
+func TypeIn(vs ...int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldType, vs...))
+}
+
+// TypeNotIn applies the NotIn predicate on the "type" field.
+func TypeNotIn(vs ...int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldType, vs...))
+}
+
+// TypeGT applies the GT predicate on the "type" field.
+func TypeGT(v int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldType, v))
+}
+
+// TypeGTE applies the GTE predicate on the "type" field.
+func TypeGTE(v int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldType, v))
+}
+
+// TypeLT applies the LT predicate on the "type" field.
+func TypeLT(v int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldType, v))
+}
+
+// TypeLTE applies the LTE predicate on the "type" field.
+func TypeLTE(v int) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldType, v))
+}
+
+// BotIDEQ applies the EQ predicate on the "bot_id" field.
+func BotIDEQ(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldBotID, v))
+}
+
+// BotIDNEQ applies the NEQ predicate on the "bot_id" field.
+func BotIDNEQ(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldBotID, v))
+}
+
+// BotIDIn applies the In predicate on the "bot_id" field.
+func BotIDIn(vs ...string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldBotID, vs...))
+}
+
+// BotIDNotIn applies the NotIn predicate on the "bot_id" field.
+func BotIDNotIn(vs ...string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldBotID, vs...))
+}
+
+// BotIDGT applies the GT predicate on the "bot_id" field.
+func BotIDGT(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldBotID, v))
+}
+
+// BotIDGTE applies the GTE predicate on the "bot_id" field.
+func BotIDGTE(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldBotID, v))
+}
+
+// BotIDLT applies the LT predicate on the "bot_id" field.
+func BotIDLT(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldBotID, v))
+}
+
+// BotIDLTE applies the LTE predicate on the "bot_id" field.
+func BotIDLTE(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldBotID, v))
+}
+
+// BotIDContains applies the Contains predicate on the "bot_id" field.
+func BotIDContains(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldContains(FieldBotID, v))
+}
+
+// BotIDHasPrefix applies the HasPrefix predicate on the "bot_id" field.
+func BotIDHasPrefix(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldHasPrefix(FieldBotID, v))
+}
+
+// BotIDHasSuffix applies the HasSuffix predicate on the "bot_id" field.
+func BotIDHasSuffix(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldHasSuffix(FieldBotID, v))
+}
+
+// BotIDIsNil applies the IsNil predicate on the "bot_id" field.
+func BotIDIsNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIsNull(FieldBotID))
+}
+
+// BotIDNotNil applies the NotNil predicate on the "bot_id" field.
+func BotIDNotNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotNull(FieldBotID))
+}
+
+// BotIDEqualFold applies the EqualFold predicate on the "bot_id" field.
+func BotIDEqualFold(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEqualFold(FieldBotID, v))
+}
+
+// BotIDContainsFold applies the ContainsFold predicate on the "bot_id" field.
+func BotIDContainsFold(v string) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldContainsFold(FieldBotID, v))
+}
+
+// OrganizationIDEQ applies the EQ predicate on the "organization_id" field.
+func OrganizationIDEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDNEQ applies the NEQ predicate on the "organization_id" field.
+func OrganizationIDNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDIn applies the In predicate on the "organization_id" field.
+func OrganizationIDIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDNotIn applies the NotIn predicate on the "organization_id" field.
+func OrganizationIDNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDGT applies the GT predicate on the "organization_id" field.
+func OrganizationIDGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldOrganizationID, v))
+}
+
+// OrganizationIDGTE applies the GTE predicate on the "organization_id" field.
+func OrganizationIDGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldOrganizationID, v))
+}
+
+// OrganizationIDLT applies the LT predicate on the "organization_id" field.
+func OrganizationIDLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldOrganizationID, v))
+}
+
+// OrganizationIDLTE applies the LTE predicate on the "organization_id" field.
+func OrganizationIDLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldOrganizationID, v))
+}
+
+// OrganizationIDIsNil applies the IsNil predicate on the "organization_id" field.
+func OrganizationIDIsNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIsNull(FieldOrganizationID))
+}
+
+// OrganizationIDNotNil applies the NotNil predicate on the "organization_id" field.
+func OrganizationIDNotNil() predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotNull(FieldOrganizationID))
+}
+
+// AiResponseEQ applies the EQ predicate on the "ai_response" field.
+func AiResponseEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldAiResponse, v))
+}
+
+// AiResponseNEQ applies the NEQ predicate on the "ai_response" field.
+func AiResponseNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldAiResponse, v))
+}
+
+// AiResponseIn applies the In predicate on the "ai_response" field.
+func AiResponseIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldAiResponse, vs...))
+}
+
+// AiResponseNotIn applies the NotIn predicate on the "ai_response" field.
+func AiResponseNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldAiResponse, vs...))
+}
+
+// AiResponseGT applies the GT predicate on the "ai_response" field.
+func AiResponseGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldAiResponse, v))
+}
+
+// AiResponseGTE applies the GTE predicate on the "ai_response" field.
+func AiResponseGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldAiResponse, v))
+}
+
+// AiResponseLT applies the LT predicate on the "ai_response" field.
+func AiResponseLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldAiResponse, v))
+}
+
+// AiResponseLTE applies the LTE predicate on the "ai_response" field.
+func AiResponseLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldAiResponse, v))
+}
+
+// SopRunEQ applies the EQ predicate on the "sop_run" field.
+func SopRunEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldSopRun, v))
+}
+
+// SopRunNEQ applies the NEQ predicate on the "sop_run" field.
+func SopRunNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldSopRun, v))
+}
+
+// SopRunIn applies the In predicate on the "sop_run" field.
+func SopRunIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldSopRun, vs...))
+}
+
+// SopRunNotIn applies the NotIn predicate on the "sop_run" field.
+func SopRunNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldSopRun, vs...))
+}
+
+// SopRunGT applies the GT predicate on the "sop_run" field.
+func SopRunGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldSopRun, v))
+}
+
+// SopRunGTE applies the GTE predicate on the "sop_run" field.
+func SopRunGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldSopRun, v))
+}
+
+// SopRunLT applies the LT predicate on the "sop_run" field.
+func SopRunLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldSopRun, v))
+}
+
+// SopRunLTE applies the LTE predicate on the "sop_run" field.
+func SopRunLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldSopRun, v))
+}
+
+// TotalFriendEQ applies the EQ predicate on the "total_friend" field.
+func TotalFriendEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldTotalFriend, v))
+}
+
+// TotalFriendNEQ applies the NEQ predicate on the "total_friend" field.
+func TotalFriendNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldTotalFriend, v))
+}
+
+// TotalFriendIn applies the In predicate on the "total_friend" field.
+func TotalFriendIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldTotalFriend, vs...))
+}
+
+// TotalFriendNotIn applies the NotIn predicate on the "total_friend" field.
+func TotalFriendNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldTotalFriend, vs...))
+}
+
+// TotalFriendGT applies the GT predicate on the "total_friend" field.
+func TotalFriendGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldTotalFriend, v))
+}
+
+// TotalFriendGTE applies the GTE predicate on the "total_friend" field.
+func TotalFriendGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldTotalFriend, v))
+}
+
+// TotalFriendLT applies the LT predicate on the "total_friend" field.
+func TotalFriendLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldTotalFriend, v))
+}
+
+// TotalFriendLTE applies the LTE predicate on the "total_friend" field.
+func TotalFriendLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldTotalFriend, v))
+}
+
+// TotalGroupEQ applies the EQ predicate on the "total_group" field.
+func TotalGroupEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldTotalGroup, v))
+}
+
+// TotalGroupNEQ applies the NEQ predicate on the "total_group" field.
+func TotalGroupNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldTotalGroup, v))
+}
+
+// TotalGroupIn applies the In predicate on the "total_group" field.
+func TotalGroupIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldTotalGroup, vs...))
+}
+
+// TotalGroupNotIn applies the NotIn predicate on the "total_group" field.
+func TotalGroupNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldTotalGroup, vs...))
+}
+
+// TotalGroupGT applies the GT predicate on the "total_group" field.
+func TotalGroupGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldTotalGroup, v))
+}
+
+// TotalGroupGTE applies the GTE predicate on the "total_group" field.
+func TotalGroupGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldTotalGroup, v))
+}
+
+// TotalGroupLT applies the LT predicate on the "total_group" field.
+func TotalGroupLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldTotalGroup, v))
+}
+
+// TotalGroupLTE applies the LTE predicate on the "total_group" field.
+func TotalGroupLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldTotalGroup, v))
+}
+
+// AccountBalanceEQ applies the EQ predicate on the "account_balance" field.
+func AccountBalanceEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldAccountBalance, v))
+}
+
+// AccountBalanceNEQ applies the NEQ predicate on the "account_balance" field.
+func AccountBalanceNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldAccountBalance, v))
+}
+
+// AccountBalanceIn applies the In predicate on the "account_balance" field.
+func AccountBalanceIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldAccountBalance, vs...))
+}
+
+// AccountBalanceNotIn applies the NotIn predicate on the "account_balance" field.
+func AccountBalanceNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldAccountBalance, vs...))
+}
+
+// AccountBalanceGT applies the GT predicate on the "account_balance" field.
+func AccountBalanceGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldAccountBalance, v))
+}
+
+// AccountBalanceGTE applies the GTE predicate on the "account_balance" field.
+func AccountBalanceGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldAccountBalance, v))
+}
+
+// AccountBalanceLT applies the LT predicate on the "account_balance" field.
+func AccountBalanceLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldAccountBalance, v))
+}
+
+// AccountBalanceLTE applies the LTE predicate on the "account_balance" field.
+func AccountBalanceLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldAccountBalance, v))
+}
+
+// ConsumeTokenEQ applies the EQ predicate on the "consume_token" field.
+func ConsumeTokenEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldConsumeToken, v))
+}
+
+// ConsumeTokenNEQ applies the NEQ predicate on the "consume_token" field.
+func ConsumeTokenNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldConsumeToken, v))
+}
+
+// ConsumeTokenIn applies the In predicate on the "consume_token" field.
+func ConsumeTokenIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldConsumeToken, vs...))
+}
+
+// ConsumeTokenNotIn applies the NotIn predicate on the "consume_token" field.
+func ConsumeTokenNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldConsumeToken, vs...))
+}
+
+// ConsumeTokenGT applies the GT predicate on the "consume_token" field.
+func ConsumeTokenGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldConsumeToken, v))
+}
+
+// ConsumeTokenGTE applies the GTE predicate on the "consume_token" field.
+func ConsumeTokenGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldConsumeToken, v))
+}
+
+// ConsumeTokenLT applies the LT predicate on the "consume_token" field.
+func ConsumeTokenLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldConsumeToken, v))
+}
+
+// ConsumeTokenLTE applies the LTE predicate on the "consume_token" field.
+func ConsumeTokenLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldConsumeToken, v))
+}
+
+// ActiveUserEQ applies the EQ predicate on the "active_user" field.
+func ActiveUserEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldActiveUser, v))
+}
+
+// ActiveUserNEQ applies the NEQ predicate on the "active_user" field.
+func ActiveUserNEQ(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldActiveUser, v))
+}
+
+// ActiveUserIn applies the In predicate on the "active_user" field.
+func ActiveUserIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldActiveUser, vs...))
+}
+
+// ActiveUserNotIn applies the NotIn predicate on the "active_user" field.
+func ActiveUserNotIn(vs ...uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldActiveUser, vs...))
+}
+
+// ActiveUserGT applies the GT predicate on the "active_user" field.
+func ActiveUserGT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldActiveUser, v))
+}
+
+// ActiveUserGTE applies the GTE predicate on the "active_user" field.
+func ActiveUserGTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldActiveUser, v))
+}
+
+// ActiveUserLT applies the LT predicate on the "active_user" field.
+func ActiveUserLT(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldActiveUser, v))
+}
+
+// ActiveUserLTE applies the LTE predicate on the "active_user" field.
+func ActiveUserLTE(v uint64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldActiveUser, v))
+}
+
+// NewUserEQ applies the EQ predicate on the "new_user" field.
+func NewUserEQ(v int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldEQ(FieldNewUser, v))
+}
+
+// NewUserNEQ applies the NEQ predicate on the "new_user" field.
+func NewUserNEQ(v int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNEQ(FieldNewUser, v))
+}
+
+// NewUserIn applies the In predicate on the "new_user" field.
+func NewUserIn(vs ...int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldIn(FieldNewUser, vs...))
+}
+
+// NewUserNotIn applies the NotIn predicate on the "new_user" field.
+func NewUserNotIn(vs ...int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldNotIn(FieldNewUser, vs...))
+}
+
+// NewUserGT applies the GT predicate on the "new_user" field.
+func NewUserGT(v int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGT(FieldNewUser, v))
+}
+
+// NewUserGTE applies the GTE predicate on the "new_user" field.
+func NewUserGTE(v int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldGTE(FieldNewUser, v))
+}
+
+// NewUserLT applies the LT predicate on the "new_user" field.
+func NewUserLT(v int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLT(FieldNewUser, v))
+}
+
+// NewUserLTE applies the LTE predicate on the "new_user" field.
+func NewUserLTE(v int64) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.FieldLTE(FieldNewUser, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.UsageStatisticHour) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.UsageStatisticHour) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.UsageStatisticHour) predicate.UsageStatisticHour {
+	return predicate.UsageStatisticHour(sql.NotPredicates(p))
+}

+ 1683 - 0
ent/usagestatistichour_create.go

@@ -0,0 +1,1683 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/usagestatistichour"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticHourCreate is the builder for creating a UsageStatisticHour entity.
+type UsageStatisticHourCreate struct {
+	config
+	mutation *UsageStatisticHourMutation
+	hooks    []Hook
+	conflict []sql.ConflictOption
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (ushc *UsageStatisticHourCreate) SetCreatedAt(t time.Time) *UsageStatisticHourCreate {
+	ushc.mutation.SetCreatedAt(t)
+	return ushc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (ushc *UsageStatisticHourCreate) SetNillableCreatedAt(t *time.Time) *UsageStatisticHourCreate {
+	if t != nil {
+		ushc.SetCreatedAt(*t)
+	}
+	return ushc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (ushc *UsageStatisticHourCreate) SetUpdatedAt(t time.Time) *UsageStatisticHourCreate {
+	ushc.mutation.SetUpdatedAt(t)
+	return ushc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (ushc *UsageStatisticHourCreate) SetNillableUpdatedAt(t *time.Time) *UsageStatisticHourCreate {
+	if t != nil {
+		ushc.SetUpdatedAt(*t)
+	}
+	return ushc
+}
+
+// SetStatus sets the "status" field.
+func (ushc *UsageStatisticHourCreate) SetStatus(u uint8) *UsageStatisticHourCreate {
+	ushc.mutation.SetStatus(u)
+	return ushc
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (ushc *UsageStatisticHourCreate) SetNillableStatus(u *uint8) *UsageStatisticHourCreate {
+	if u != nil {
+		ushc.SetStatus(*u)
+	}
+	return ushc
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (ushc *UsageStatisticHourCreate) SetDeletedAt(t time.Time) *UsageStatisticHourCreate {
+	ushc.mutation.SetDeletedAt(t)
+	return ushc
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (ushc *UsageStatisticHourCreate) SetNillableDeletedAt(t *time.Time) *UsageStatisticHourCreate {
+	if t != nil {
+		ushc.SetDeletedAt(*t)
+	}
+	return ushc
+}
+
+// SetAddtime sets the "addtime" field.
+func (ushc *UsageStatisticHourCreate) SetAddtime(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetAddtime(u)
+	return ushc
+}
+
+// SetType sets the "type" field.
+func (ushc *UsageStatisticHourCreate) SetType(i int) *UsageStatisticHourCreate {
+	ushc.mutation.SetType(i)
+	return ushc
+}
+
+// SetBotID sets the "bot_id" field.
+func (ushc *UsageStatisticHourCreate) SetBotID(s string) *UsageStatisticHourCreate {
+	ushc.mutation.SetBotID(s)
+	return ushc
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (ushc *UsageStatisticHourCreate) SetNillableBotID(s *string) *UsageStatisticHourCreate {
+	if s != nil {
+		ushc.SetBotID(*s)
+	}
+	return ushc
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (ushc *UsageStatisticHourCreate) SetOrganizationID(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetOrganizationID(u)
+	return ushc
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (ushc *UsageStatisticHourCreate) SetNillableOrganizationID(u *uint64) *UsageStatisticHourCreate {
+	if u != nil {
+		ushc.SetOrganizationID(*u)
+	}
+	return ushc
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (ushc *UsageStatisticHourCreate) SetAiResponse(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetAiResponse(u)
+	return ushc
+}
+
+// SetSopRun sets the "sop_run" field.
+func (ushc *UsageStatisticHourCreate) SetSopRun(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetSopRun(u)
+	return ushc
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (ushc *UsageStatisticHourCreate) SetTotalFriend(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetTotalFriend(u)
+	return ushc
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (ushc *UsageStatisticHourCreate) SetTotalGroup(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetTotalGroup(u)
+	return ushc
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (ushc *UsageStatisticHourCreate) SetAccountBalance(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetAccountBalance(u)
+	return ushc
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (ushc *UsageStatisticHourCreate) SetConsumeToken(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetConsumeToken(u)
+	return ushc
+}
+
+// SetActiveUser sets the "active_user" field.
+func (ushc *UsageStatisticHourCreate) SetActiveUser(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetActiveUser(u)
+	return ushc
+}
+
+// SetNewUser sets the "new_user" field.
+func (ushc *UsageStatisticHourCreate) SetNewUser(i int64) *UsageStatisticHourCreate {
+	ushc.mutation.SetNewUser(i)
+	return ushc
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (ushc *UsageStatisticHourCreate) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticHourCreate {
+	ushc.mutation.SetLabelDist(ctd)
+	return ushc
+}
+
+// SetID sets the "id" field.
+func (ushc *UsageStatisticHourCreate) SetID(u uint64) *UsageStatisticHourCreate {
+	ushc.mutation.SetID(u)
+	return ushc
+}
+
+// Mutation returns the UsageStatisticHourMutation object of the builder.
+func (ushc *UsageStatisticHourCreate) Mutation() *UsageStatisticHourMutation {
+	return ushc.mutation
+}
+
+// Save creates the UsageStatisticHour in the database.
+func (ushc *UsageStatisticHourCreate) Save(ctx context.Context) (*UsageStatisticHour, error) {
+	if err := ushc.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, ushc.sqlSave, ushc.mutation, ushc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (ushc *UsageStatisticHourCreate) SaveX(ctx context.Context) *UsageStatisticHour {
+	v, err := ushc.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (ushc *UsageStatisticHourCreate) Exec(ctx context.Context) error {
+	_, err := ushc.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ushc *UsageStatisticHourCreate) ExecX(ctx context.Context) {
+	if err := ushc.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (ushc *UsageStatisticHourCreate) defaults() error {
+	if _, ok := ushc.mutation.CreatedAt(); !ok {
+		if usagestatistichour.DefaultCreatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatistichour.DefaultCreatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatistichour.DefaultCreatedAt()
+		ushc.mutation.SetCreatedAt(v)
+	}
+	if _, ok := ushc.mutation.UpdatedAt(); !ok {
+		if usagestatistichour.DefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatistichour.DefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatistichour.DefaultUpdatedAt()
+		ushc.mutation.SetUpdatedAt(v)
+	}
+	if _, ok := ushc.mutation.Status(); !ok {
+		v := usagestatistichour.DefaultStatus
+		ushc.mutation.SetStatus(v)
+	}
+	return nil
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (ushc *UsageStatisticHourCreate) check() error {
+	if _, ok := ushc.mutation.CreatedAt(); !ok {
+		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "UsageStatisticHour.created_at"`)}
+	}
+	if _, ok := ushc.mutation.UpdatedAt(); !ok {
+		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "UsageStatisticHour.updated_at"`)}
+	}
+	if _, ok := ushc.mutation.Addtime(); !ok {
+		return &ValidationError{Name: "addtime", err: errors.New(`ent: missing required field "UsageStatisticHour.addtime"`)}
+	}
+	if _, ok := ushc.mutation.GetType(); !ok {
+		return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "UsageStatisticHour.type"`)}
+	}
+	if _, ok := ushc.mutation.AiResponse(); !ok {
+		return &ValidationError{Name: "ai_response", err: errors.New(`ent: missing required field "UsageStatisticHour.ai_response"`)}
+	}
+	if _, ok := ushc.mutation.SopRun(); !ok {
+		return &ValidationError{Name: "sop_run", err: errors.New(`ent: missing required field "UsageStatisticHour.sop_run"`)}
+	}
+	if _, ok := ushc.mutation.TotalFriend(); !ok {
+		return &ValidationError{Name: "total_friend", err: errors.New(`ent: missing required field "UsageStatisticHour.total_friend"`)}
+	}
+	if _, ok := ushc.mutation.TotalGroup(); !ok {
+		return &ValidationError{Name: "total_group", err: errors.New(`ent: missing required field "UsageStatisticHour.total_group"`)}
+	}
+	if _, ok := ushc.mutation.AccountBalance(); !ok {
+		return &ValidationError{Name: "account_balance", err: errors.New(`ent: missing required field "UsageStatisticHour.account_balance"`)}
+	}
+	if _, ok := ushc.mutation.ConsumeToken(); !ok {
+		return &ValidationError{Name: "consume_token", err: errors.New(`ent: missing required field "UsageStatisticHour.consume_token"`)}
+	}
+	if _, ok := ushc.mutation.ActiveUser(); !ok {
+		return &ValidationError{Name: "active_user", err: errors.New(`ent: missing required field "UsageStatisticHour.active_user"`)}
+	}
+	if _, ok := ushc.mutation.NewUser(); !ok {
+		return &ValidationError{Name: "new_user", err: errors.New(`ent: missing required field "UsageStatisticHour.new_user"`)}
+	}
+	if _, ok := ushc.mutation.LabelDist(); !ok {
+		return &ValidationError{Name: "label_dist", err: errors.New(`ent: missing required field "UsageStatisticHour.label_dist"`)}
+	}
+	return nil
+}
+
+func (ushc *UsageStatisticHourCreate) sqlSave(ctx context.Context) (*UsageStatisticHour, error) {
+	if err := ushc.check(); err != nil {
+		return nil, err
+	}
+	_node, _spec := ushc.createSpec()
+	if err := sqlgraph.CreateNode(ctx, ushc.driver, _spec); err != nil {
+		if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	if _spec.ID.Value != _node.ID {
+		id := _spec.ID.Value.(int64)
+		_node.ID = uint64(id)
+	}
+	ushc.mutation.id = &_node.ID
+	ushc.mutation.done = true
+	return _node, nil
+}
+
+func (ushc *UsageStatisticHourCreate) createSpec() (*UsageStatisticHour, *sqlgraph.CreateSpec) {
+	var (
+		_node = &UsageStatisticHour{config: ushc.config}
+		_spec = sqlgraph.NewCreateSpec(usagestatistichour.Table, sqlgraph.NewFieldSpec(usagestatistichour.FieldID, field.TypeUint64))
+	)
+	_spec.OnConflict = ushc.conflict
+	if id, ok := ushc.mutation.ID(); ok {
+		_node.ID = id
+		_spec.ID.Value = id
+	}
+	if value, ok := ushc.mutation.CreatedAt(); ok {
+		_spec.SetField(usagestatistichour.FieldCreatedAt, field.TypeTime, value)
+		_node.CreatedAt = value
+	}
+	if value, ok := ushc.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatistichour.FieldUpdatedAt, field.TypeTime, value)
+		_node.UpdatedAt = value
+	}
+	if value, ok := ushc.mutation.Status(); ok {
+		_spec.SetField(usagestatistichour.FieldStatus, field.TypeUint8, value)
+		_node.Status = value
+	}
+	if value, ok := ushc.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatistichour.FieldDeletedAt, field.TypeTime, value)
+		_node.DeletedAt = value
+	}
+	if value, ok := ushc.mutation.Addtime(); ok {
+		_spec.SetField(usagestatistichour.FieldAddtime, field.TypeUint64, value)
+		_node.Addtime = value
+	}
+	if value, ok := ushc.mutation.GetType(); ok {
+		_spec.SetField(usagestatistichour.FieldType, field.TypeInt, value)
+		_node.Type = value
+	}
+	if value, ok := ushc.mutation.BotID(); ok {
+		_spec.SetField(usagestatistichour.FieldBotID, field.TypeString, value)
+		_node.BotID = value
+	}
+	if value, ok := ushc.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatistichour.FieldOrganizationID, field.TypeUint64, value)
+		_node.OrganizationID = value
+	}
+	if value, ok := ushc.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatistichour.FieldAiResponse, field.TypeUint64, value)
+		_node.AiResponse = value
+	}
+	if value, ok := ushc.mutation.SopRun(); ok {
+		_spec.SetField(usagestatistichour.FieldSopRun, field.TypeUint64, value)
+		_node.SopRun = value
+	}
+	if value, ok := ushc.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatistichour.FieldTotalFriend, field.TypeUint64, value)
+		_node.TotalFriend = value
+	}
+	if value, ok := ushc.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatistichour.FieldTotalGroup, field.TypeUint64, value)
+		_node.TotalGroup = value
+	}
+	if value, ok := ushc.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatistichour.FieldAccountBalance, field.TypeUint64, value)
+		_node.AccountBalance = value
+	}
+	if value, ok := ushc.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatistichour.FieldConsumeToken, field.TypeUint64, value)
+		_node.ConsumeToken = value
+	}
+	if value, ok := ushc.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatistichour.FieldActiveUser, field.TypeUint64, value)
+		_node.ActiveUser = value
+	}
+	if value, ok := ushc.mutation.NewUser(); ok {
+		_spec.SetField(usagestatistichour.FieldNewUser, field.TypeInt64, value)
+		_node.NewUser = value
+	}
+	if value, ok := ushc.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatistichour.FieldLabelDist, field.TypeJSON, value)
+		_node.LabelDist = value
+	}
+	return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.UsageStatisticHour.Create().
+//		SetCreatedAt(v).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.UsageStatisticHourUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (ushc *UsageStatisticHourCreate) OnConflict(opts ...sql.ConflictOption) *UsageStatisticHourUpsertOne {
+	ushc.conflict = opts
+	return &UsageStatisticHourUpsertOne{
+		create: ushc,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.UsageStatisticHour.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (ushc *UsageStatisticHourCreate) OnConflictColumns(columns ...string) *UsageStatisticHourUpsertOne {
+	ushc.conflict = append(ushc.conflict, sql.ConflictColumns(columns...))
+	return &UsageStatisticHourUpsertOne{
+		create: ushc,
+	}
+}
+
+type (
+	// UsageStatisticHourUpsertOne is the builder for "upsert"-ing
+	//  one UsageStatisticHour node.
+	UsageStatisticHourUpsertOne struct {
+		create *UsageStatisticHourCreate
+	}
+
+	// UsageStatisticHourUpsert is the "OnConflict" setter.
+	UsageStatisticHourUpsert struct {
+		*sql.UpdateSet
+	}
+)
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticHourUpsert) SetUpdatedAt(v time.Time) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldUpdatedAt, v)
+	return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateUpdatedAt() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldUpdatedAt)
+	return u
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticHourUpsert) SetStatus(v uint8) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldStatus, v)
+	return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateStatus() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldStatus)
+	return u
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticHourUpsert) AddStatus(v uint8) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldStatus, v)
+	return u
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticHourUpsert) ClearStatus() *UsageStatisticHourUpsert {
+	u.SetNull(usagestatistichour.FieldStatus)
+	return u
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticHourUpsert) SetDeletedAt(v time.Time) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldDeletedAt, v)
+	return u
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateDeletedAt() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldDeletedAt)
+	return u
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticHourUpsert) ClearDeletedAt() *UsageStatisticHourUpsert {
+	u.SetNull(usagestatistichour.FieldDeletedAt)
+	return u
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticHourUpsert) SetAddtime(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldAddtime, v)
+	return u
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateAddtime() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldAddtime)
+	return u
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticHourUpsert) AddAddtime(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldAddtime, v)
+	return u
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticHourUpsert) SetType(v int) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldType, v)
+	return u
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateType() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldType)
+	return u
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticHourUpsert) AddType(v int) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldType, v)
+	return u
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticHourUpsert) SetBotID(v string) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldBotID, v)
+	return u
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateBotID() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldBotID)
+	return u
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticHourUpsert) ClearBotID() *UsageStatisticHourUpsert {
+	u.SetNull(usagestatistichour.FieldBotID)
+	return u
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticHourUpsert) SetOrganizationID(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldOrganizationID, v)
+	return u
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateOrganizationID() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldOrganizationID)
+	return u
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticHourUpsert) AddOrganizationID(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldOrganizationID, v)
+	return u
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticHourUpsert) ClearOrganizationID() *UsageStatisticHourUpsert {
+	u.SetNull(usagestatistichour.FieldOrganizationID)
+	return u
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticHourUpsert) SetAiResponse(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldAiResponse, v)
+	return u
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateAiResponse() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldAiResponse)
+	return u
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticHourUpsert) AddAiResponse(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldAiResponse, v)
+	return u
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticHourUpsert) SetSopRun(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldSopRun, v)
+	return u
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateSopRun() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldSopRun)
+	return u
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticHourUpsert) AddSopRun(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldSopRun, v)
+	return u
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticHourUpsert) SetTotalFriend(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldTotalFriend, v)
+	return u
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateTotalFriend() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldTotalFriend)
+	return u
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticHourUpsert) AddTotalFriend(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldTotalFriend, v)
+	return u
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticHourUpsert) SetTotalGroup(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldTotalGroup, v)
+	return u
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateTotalGroup() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldTotalGroup)
+	return u
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticHourUpsert) AddTotalGroup(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldTotalGroup, v)
+	return u
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticHourUpsert) SetAccountBalance(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldAccountBalance, v)
+	return u
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateAccountBalance() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldAccountBalance)
+	return u
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticHourUpsert) AddAccountBalance(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldAccountBalance, v)
+	return u
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticHourUpsert) SetConsumeToken(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldConsumeToken, v)
+	return u
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateConsumeToken() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldConsumeToken)
+	return u
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticHourUpsert) AddConsumeToken(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldConsumeToken, v)
+	return u
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticHourUpsert) SetActiveUser(v uint64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldActiveUser, v)
+	return u
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateActiveUser() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldActiveUser)
+	return u
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticHourUpsert) AddActiveUser(v uint64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldActiveUser, v)
+	return u
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticHourUpsert) SetNewUser(v int64) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldNewUser, v)
+	return u
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateNewUser() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldNewUser)
+	return u
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticHourUpsert) AddNewUser(v int64) *UsageStatisticHourUpsert {
+	u.Add(usagestatistichour.FieldNewUser, v)
+	return u
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticHourUpsert) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticHourUpsert {
+	u.Set(usagestatistichour.FieldLabelDist, v)
+	return u
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsert) UpdateLabelDist() *UsageStatisticHourUpsert {
+	u.SetExcluded(usagestatistichour.FieldLabelDist)
+	return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticHour.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(usagestatistichour.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *UsageStatisticHourUpsertOne) UpdateNewValues() *UsageStatisticHourUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		if _, exists := u.create.mutation.ID(); exists {
+			s.SetIgnore(usagestatistichour.FieldID)
+		}
+		if _, exists := u.create.mutation.CreatedAt(); exists {
+			s.SetIgnore(usagestatistichour.FieldCreatedAt)
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticHour.Create().
+//	    OnConflict(sql.ResolveWithIgnore()).
+//	    Exec(ctx)
+func (u *UsageStatisticHourUpsertOne) Ignore() *UsageStatisticHourUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *UsageStatisticHourUpsertOne) DoNothing() *UsageStatisticHourUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the UsageStatisticHourCreate.OnConflict
+// documentation for more info.
+func (u *UsageStatisticHourUpsertOne) Update(set func(*UsageStatisticHourUpsert)) *UsageStatisticHourUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&UsageStatisticHourUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticHourUpsertOne) SetUpdatedAt(v time.Time) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateUpdatedAt() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticHourUpsertOne) SetStatus(v uint8) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticHourUpsertOne) AddStatus(v uint8) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateStatus() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticHourUpsertOne) ClearStatus() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticHourUpsertOne) SetDeletedAt(v time.Time) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateDeletedAt() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticHourUpsertOne) ClearDeletedAt() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticHourUpsertOne) SetAddtime(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetAddtime(v)
+	})
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticHourUpsertOne) AddAddtime(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddAddtime(v)
+	})
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateAddtime() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateAddtime()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticHourUpsertOne) SetType(v int) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticHourUpsertOne) AddType(v int) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateType() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticHourUpsertOne) SetBotID(v string) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetBotID(v)
+	})
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateBotID() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateBotID()
+	})
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticHourUpsertOne) ClearBotID() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearBotID()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticHourUpsertOne) SetOrganizationID(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticHourUpsertOne) AddOrganizationID(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateOrganizationID() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticHourUpsertOne) ClearOrganizationID() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticHourUpsertOne) SetAiResponse(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetAiResponse(v)
+	})
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticHourUpsertOne) AddAiResponse(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddAiResponse(v)
+	})
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateAiResponse() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateAiResponse()
+	})
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticHourUpsertOne) SetSopRun(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetSopRun(v)
+	})
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticHourUpsertOne) AddSopRun(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddSopRun(v)
+	})
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateSopRun() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateSopRun()
+	})
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticHourUpsertOne) SetTotalFriend(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetTotalFriend(v)
+	})
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticHourUpsertOne) AddTotalFriend(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddTotalFriend(v)
+	})
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateTotalFriend() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateTotalFriend()
+	})
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticHourUpsertOne) SetTotalGroup(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetTotalGroup(v)
+	})
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticHourUpsertOne) AddTotalGroup(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddTotalGroup(v)
+	})
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateTotalGroup() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateTotalGroup()
+	})
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticHourUpsertOne) SetAccountBalance(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetAccountBalance(v)
+	})
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticHourUpsertOne) AddAccountBalance(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddAccountBalance(v)
+	})
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateAccountBalance() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateAccountBalance()
+	})
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticHourUpsertOne) SetConsumeToken(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetConsumeToken(v)
+	})
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticHourUpsertOne) AddConsumeToken(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddConsumeToken(v)
+	})
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateConsumeToken() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateConsumeToken()
+	})
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticHourUpsertOne) SetActiveUser(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetActiveUser(v)
+	})
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticHourUpsertOne) AddActiveUser(v uint64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddActiveUser(v)
+	})
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateActiveUser() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateActiveUser()
+	})
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticHourUpsertOne) SetNewUser(v int64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetNewUser(v)
+	})
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticHourUpsertOne) AddNewUser(v int64) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddNewUser(v)
+	})
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateNewUser() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateNewUser()
+	})
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticHourUpsertOne) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetLabelDist(v)
+	})
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertOne) UpdateLabelDist() *UsageStatisticHourUpsertOne {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateLabelDist()
+	})
+}
+
+// Exec executes the query.
+func (u *UsageStatisticHourUpsertOne) Exec(ctx context.Context) error {
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for UsageStatisticHourCreate.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *UsageStatisticHourUpsertOne) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *UsageStatisticHourUpsertOne) ID(ctx context.Context) (id uint64, err error) {
+	node, err := u.create.Save(ctx)
+	if err != nil {
+		return id, err
+	}
+	return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *UsageStatisticHourUpsertOne) IDX(ctx context.Context) uint64 {
+	id, err := u.ID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// UsageStatisticHourCreateBulk is the builder for creating many UsageStatisticHour entities in bulk.
+type UsageStatisticHourCreateBulk struct {
+	config
+	err      error
+	builders []*UsageStatisticHourCreate
+	conflict []sql.ConflictOption
+}
+
+// Save creates the UsageStatisticHour entities in the database.
+func (ushcb *UsageStatisticHourCreateBulk) Save(ctx context.Context) ([]*UsageStatisticHour, error) {
+	if ushcb.err != nil {
+		return nil, ushcb.err
+	}
+	specs := make([]*sqlgraph.CreateSpec, len(ushcb.builders))
+	nodes := make([]*UsageStatisticHour, len(ushcb.builders))
+	mutators := make([]Mutator, len(ushcb.builders))
+	for i := range ushcb.builders {
+		func(i int, root context.Context) {
+			builder := ushcb.builders[i]
+			builder.defaults()
+			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+				mutation, ok := m.(*UsageStatisticHourMutation)
+				if !ok {
+					return nil, fmt.Errorf("unexpected mutation type %T", m)
+				}
+				if err := builder.check(); err != nil {
+					return nil, err
+				}
+				builder.mutation = mutation
+				var err error
+				nodes[i], specs[i] = builder.createSpec()
+				if i < len(mutators)-1 {
+					_, err = mutators[i+1].Mutate(root, ushcb.builders[i+1].mutation)
+				} else {
+					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+					spec.OnConflict = ushcb.conflict
+					// Invoke the actual operation on the latest mutation in the chain.
+					if err = sqlgraph.BatchCreate(ctx, ushcb.driver, spec); err != nil {
+						if sqlgraph.IsConstraintError(err) {
+							err = &ConstraintError{msg: err.Error(), wrap: err}
+						}
+					}
+				}
+				if err != nil {
+					return nil, err
+				}
+				mutation.id = &nodes[i].ID
+				if specs[i].ID.Value != nil && nodes[i].ID == 0 {
+					id := specs[i].ID.Value.(int64)
+					nodes[i].ID = uint64(id)
+				}
+				mutation.done = true
+				return nodes[i], nil
+			})
+			for i := len(builder.hooks) - 1; i >= 0; i-- {
+				mut = builder.hooks[i](mut)
+			}
+			mutators[i] = mut
+		}(i, ctx)
+	}
+	if len(mutators) > 0 {
+		if _, err := mutators[0].Mutate(ctx, ushcb.builders[0].mutation); err != nil {
+			return nil, err
+		}
+	}
+	return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ushcb *UsageStatisticHourCreateBulk) SaveX(ctx context.Context) []*UsageStatisticHour {
+	v, err := ushcb.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (ushcb *UsageStatisticHourCreateBulk) Exec(ctx context.Context) error {
+	_, err := ushcb.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ushcb *UsageStatisticHourCreateBulk) ExecX(ctx context.Context) {
+	if err := ushcb.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.UsageStatisticHour.CreateBulk(builders...).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.UsageStatisticHourUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (ushcb *UsageStatisticHourCreateBulk) OnConflict(opts ...sql.ConflictOption) *UsageStatisticHourUpsertBulk {
+	ushcb.conflict = opts
+	return &UsageStatisticHourUpsertBulk{
+		create: ushcb,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.UsageStatisticHour.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (ushcb *UsageStatisticHourCreateBulk) OnConflictColumns(columns ...string) *UsageStatisticHourUpsertBulk {
+	ushcb.conflict = append(ushcb.conflict, sql.ConflictColumns(columns...))
+	return &UsageStatisticHourUpsertBulk{
+		create: ushcb,
+	}
+}
+
+// UsageStatisticHourUpsertBulk is the builder for "upsert"-ing
+// a bulk of UsageStatisticHour nodes.
+type UsageStatisticHourUpsertBulk struct {
+	create *UsageStatisticHourCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+//	client.UsageStatisticHour.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(usagestatistichour.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *UsageStatisticHourUpsertBulk) UpdateNewValues() *UsageStatisticHourUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		for _, b := range u.create.builders {
+			if _, exists := b.mutation.ID(); exists {
+				s.SetIgnore(usagestatistichour.FieldID)
+			}
+			if _, exists := b.mutation.CreatedAt(); exists {
+				s.SetIgnore(usagestatistichour.FieldCreatedAt)
+			}
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticHour.Create().
+//		OnConflict(sql.ResolveWithIgnore()).
+//		Exec(ctx)
+func (u *UsageStatisticHourUpsertBulk) Ignore() *UsageStatisticHourUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *UsageStatisticHourUpsertBulk) DoNothing() *UsageStatisticHourUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the UsageStatisticHourCreateBulk.OnConflict
+// documentation for more info.
+func (u *UsageStatisticHourUpsertBulk) Update(set func(*UsageStatisticHourUpsert)) *UsageStatisticHourUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&UsageStatisticHourUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticHourUpsertBulk) SetUpdatedAt(v time.Time) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateUpdatedAt() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticHourUpsertBulk) SetStatus(v uint8) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticHourUpsertBulk) AddStatus(v uint8) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateStatus() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticHourUpsertBulk) ClearStatus() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticHourUpsertBulk) SetDeletedAt(v time.Time) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateDeletedAt() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticHourUpsertBulk) ClearDeletedAt() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticHourUpsertBulk) SetAddtime(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetAddtime(v)
+	})
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticHourUpsertBulk) AddAddtime(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddAddtime(v)
+	})
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateAddtime() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateAddtime()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticHourUpsertBulk) SetType(v int) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticHourUpsertBulk) AddType(v int) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateType() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticHourUpsertBulk) SetBotID(v string) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetBotID(v)
+	})
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateBotID() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateBotID()
+	})
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticHourUpsertBulk) ClearBotID() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearBotID()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticHourUpsertBulk) SetOrganizationID(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticHourUpsertBulk) AddOrganizationID(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateOrganizationID() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticHourUpsertBulk) ClearOrganizationID() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticHourUpsertBulk) SetAiResponse(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetAiResponse(v)
+	})
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticHourUpsertBulk) AddAiResponse(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddAiResponse(v)
+	})
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateAiResponse() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateAiResponse()
+	})
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticHourUpsertBulk) SetSopRun(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetSopRun(v)
+	})
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticHourUpsertBulk) AddSopRun(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddSopRun(v)
+	})
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateSopRun() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateSopRun()
+	})
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticHourUpsertBulk) SetTotalFriend(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetTotalFriend(v)
+	})
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticHourUpsertBulk) AddTotalFriend(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddTotalFriend(v)
+	})
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateTotalFriend() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateTotalFriend()
+	})
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticHourUpsertBulk) SetTotalGroup(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetTotalGroup(v)
+	})
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticHourUpsertBulk) AddTotalGroup(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddTotalGroup(v)
+	})
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateTotalGroup() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateTotalGroup()
+	})
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticHourUpsertBulk) SetAccountBalance(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetAccountBalance(v)
+	})
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticHourUpsertBulk) AddAccountBalance(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddAccountBalance(v)
+	})
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateAccountBalance() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateAccountBalance()
+	})
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticHourUpsertBulk) SetConsumeToken(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetConsumeToken(v)
+	})
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticHourUpsertBulk) AddConsumeToken(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddConsumeToken(v)
+	})
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateConsumeToken() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateConsumeToken()
+	})
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticHourUpsertBulk) SetActiveUser(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetActiveUser(v)
+	})
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticHourUpsertBulk) AddActiveUser(v uint64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddActiveUser(v)
+	})
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateActiveUser() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateActiveUser()
+	})
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticHourUpsertBulk) SetNewUser(v int64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetNewUser(v)
+	})
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticHourUpsertBulk) AddNewUser(v int64) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.AddNewUser(v)
+	})
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateNewUser() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateNewUser()
+	})
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticHourUpsertBulk) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.SetLabelDist(v)
+	})
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticHourUpsertBulk) UpdateLabelDist() *UsageStatisticHourUpsertBulk {
+	return u.Update(func(s *UsageStatisticHourUpsert) {
+		s.UpdateLabelDist()
+	})
+}
+
+// Exec executes the query.
+func (u *UsageStatisticHourUpsertBulk) Exec(ctx context.Context) error {
+	if u.create.err != nil {
+		return u.create.err
+	}
+	for i, b := range u.create.builders {
+		if len(b.conflict) != 0 {
+			return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the UsageStatisticHourCreateBulk instead", i)
+		}
+	}
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for UsageStatisticHourCreateBulk.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *UsageStatisticHourUpsertBulk) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 88 - 0
ent/usagestatistichour_delete.go

@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatistichour"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticHourDelete is the builder for deleting a UsageStatisticHour entity.
+type UsageStatisticHourDelete struct {
+	config
+	hooks    []Hook
+	mutation *UsageStatisticHourMutation
+}
+
+// Where appends a list predicates to the UsageStatisticHourDelete builder.
+func (ushd *UsageStatisticHourDelete) Where(ps ...predicate.UsageStatisticHour) *UsageStatisticHourDelete {
+	ushd.mutation.Where(ps...)
+	return ushd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (ushd *UsageStatisticHourDelete) Exec(ctx context.Context) (int, error) {
+	return withHooks(ctx, ushd.sqlExec, ushd.mutation, ushd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ushd *UsageStatisticHourDelete) ExecX(ctx context.Context) int {
+	n, err := ushd.Exec(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return n
+}
+
+func (ushd *UsageStatisticHourDelete) sqlExec(ctx context.Context) (int, error) {
+	_spec := sqlgraph.NewDeleteSpec(usagestatistichour.Table, sqlgraph.NewFieldSpec(usagestatistichour.FieldID, field.TypeUint64))
+	if ps := ushd.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	affected, err := sqlgraph.DeleteNodes(ctx, ushd.driver, _spec)
+	if err != nil && sqlgraph.IsConstraintError(err) {
+		err = &ConstraintError{msg: err.Error(), wrap: err}
+	}
+	ushd.mutation.done = true
+	return affected, err
+}
+
+// UsageStatisticHourDeleteOne is the builder for deleting a single UsageStatisticHour entity.
+type UsageStatisticHourDeleteOne struct {
+	ushd *UsageStatisticHourDelete
+}
+
+// Where appends a list predicates to the UsageStatisticHourDelete builder.
+func (ushdo *UsageStatisticHourDeleteOne) Where(ps ...predicate.UsageStatisticHour) *UsageStatisticHourDeleteOne {
+	ushdo.ushd.mutation.Where(ps...)
+	return ushdo
+}
+
+// Exec executes the deletion query.
+func (ushdo *UsageStatisticHourDeleteOne) Exec(ctx context.Context) error {
+	n, err := ushdo.ushd.Exec(ctx)
+	switch {
+	case err != nil:
+		return err
+	case n == 0:
+		return &NotFoundError{usagestatistichour.Label}
+	default:
+		return nil
+	}
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ushdo *UsageStatisticHourDeleteOne) ExecX(ctx context.Context) {
+	if err := ushdo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 526 - 0
ent/usagestatistichour_query.go

@@ -0,0 +1,526 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"fmt"
+	"math"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatistichour"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticHourQuery is the builder for querying UsageStatisticHour entities.
+type UsageStatisticHourQuery struct {
+	config
+	ctx        *QueryContext
+	order      []usagestatistichour.OrderOption
+	inters     []Interceptor
+	predicates []predicate.UsageStatisticHour
+	// intermediate query (i.e. traversal path).
+	sql  *sql.Selector
+	path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the UsageStatisticHourQuery builder.
+func (ushq *UsageStatisticHourQuery) Where(ps ...predicate.UsageStatisticHour) *UsageStatisticHourQuery {
+	ushq.predicates = append(ushq.predicates, ps...)
+	return ushq
+}
+
+// Limit the number of records to be returned by this query.
+func (ushq *UsageStatisticHourQuery) Limit(limit int) *UsageStatisticHourQuery {
+	ushq.ctx.Limit = &limit
+	return ushq
+}
+
+// Offset to start from.
+func (ushq *UsageStatisticHourQuery) Offset(offset int) *UsageStatisticHourQuery {
+	ushq.ctx.Offset = &offset
+	return ushq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (ushq *UsageStatisticHourQuery) Unique(unique bool) *UsageStatisticHourQuery {
+	ushq.ctx.Unique = &unique
+	return ushq
+}
+
+// Order specifies how the records should be ordered.
+func (ushq *UsageStatisticHourQuery) Order(o ...usagestatistichour.OrderOption) *UsageStatisticHourQuery {
+	ushq.order = append(ushq.order, o...)
+	return ushq
+}
+
+// First returns the first UsageStatisticHour entity from the query.
+// Returns a *NotFoundError when no UsageStatisticHour was found.
+func (ushq *UsageStatisticHourQuery) First(ctx context.Context) (*UsageStatisticHour, error) {
+	nodes, err := ushq.Limit(1).All(setContextOp(ctx, ushq.ctx, "First"))
+	if err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nil, &NotFoundError{usagestatistichour.Label}
+	}
+	return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) FirstX(ctx context.Context) *UsageStatisticHour {
+	node, err := ushq.First(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return node
+}
+
+// FirstID returns the first UsageStatisticHour ID from the query.
+// Returns a *NotFoundError when no UsageStatisticHour ID was found.
+func (ushq *UsageStatisticHourQuery) FirstID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = ushq.Limit(1).IDs(setContextOp(ctx, ushq.ctx, "FirstID")); err != nil {
+		return
+	}
+	if len(ids) == 0 {
+		err = &NotFoundError{usagestatistichour.Label}
+		return
+	}
+	return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) FirstIDX(ctx context.Context) uint64 {
+	id, err := ushq.FirstID(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return id
+}
+
+// Only returns a single UsageStatisticHour entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one UsageStatisticHour entity is found.
+// Returns a *NotFoundError when no UsageStatisticHour entities are found.
+func (ushq *UsageStatisticHourQuery) Only(ctx context.Context) (*UsageStatisticHour, error) {
+	nodes, err := ushq.Limit(2).All(setContextOp(ctx, ushq.ctx, "Only"))
+	if err != nil {
+		return nil, err
+	}
+	switch len(nodes) {
+	case 1:
+		return nodes[0], nil
+	case 0:
+		return nil, &NotFoundError{usagestatistichour.Label}
+	default:
+		return nil, &NotSingularError{usagestatistichour.Label}
+	}
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) OnlyX(ctx context.Context) *UsageStatisticHour {
+	node, err := ushq.Only(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// OnlyID is like Only, but returns the only UsageStatisticHour ID in the query.
+// Returns a *NotSingularError when more than one UsageStatisticHour ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (ushq *UsageStatisticHourQuery) OnlyID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = ushq.Limit(2).IDs(setContextOp(ctx, ushq.ctx, "OnlyID")); err != nil {
+		return
+	}
+	switch len(ids) {
+	case 1:
+		id = ids[0]
+	case 0:
+		err = &NotFoundError{usagestatistichour.Label}
+	default:
+		err = &NotSingularError{usagestatistichour.Label}
+	}
+	return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) OnlyIDX(ctx context.Context) uint64 {
+	id, err := ushq.OnlyID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// All executes the query and returns a list of UsageStatisticHours.
+func (ushq *UsageStatisticHourQuery) All(ctx context.Context) ([]*UsageStatisticHour, error) {
+	ctx = setContextOp(ctx, ushq.ctx, "All")
+	if err := ushq.prepareQuery(ctx); err != nil {
+		return nil, err
+	}
+	qr := querierAll[[]*UsageStatisticHour, *UsageStatisticHourQuery]()
+	return withInterceptors[[]*UsageStatisticHour](ctx, ushq, qr, ushq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) AllX(ctx context.Context) []*UsageStatisticHour {
+	nodes, err := ushq.All(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return nodes
+}
+
+// IDs executes the query and returns a list of UsageStatisticHour IDs.
+func (ushq *UsageStatisticHourQuery) IDs(ctx context.Context) (ids []uint64, err error) {
+	if ushq.ctx.Unique == nil && ushq.path != nil {
+		ushq.Unique(true)
+	}
+	ctx = setContextOp(ctx, ushq.ctx, "IDs")
+	if err = ushq.Select(usagestatistichour.FieldID).Scan(ctx, &ids); err != nil {
+		return nil, err
+	}
+	return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) IDsX(ctx context.Context) []uint64 {
+	ids, err := ushq.IDs(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return ids
+}
+
+// Count returns the count of the given query.
+func (ushq *UsageStatisticHourQuery) Count(ctx context.Context) (int, error) {
+	ctx = setContextOp(ctx, ushq.ctx, "Count")
+	if err := ushq.prepareQuery(ctx); err != nil {
+		return 0, err
+	}
+	return withInterceptors[int](ctx, ushq, querierCount[*UsageStatisticHourQuery](), ushq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) CountX(ctx context.Context) int {
+	count, err := ushq.Count(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (ushq *UsageStatisticHourQuery) Exist(ctx context.Context) (bool, error) {
+	ctx = setContextOp(ctx, ushq.ctx, "Exist")
+	switch _, err := ushq.FirstID(ctx); {
+	case IsNotFound(err):
+		return false, nil
+	case err != nil:
+		return false, fmt.Errorf("ent: check existence: %w", err)
+	default:
+		return true, nil
+	}
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (ushq *UsageStatisticHourQuery) ExistX(ctx context.Context) bool {
+	exist, err := ushq.Exist(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return exist
+}
+
+// Clone returns a duplicate of the UsageStatisticHourQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (ushq *UsageStatisticHourQuery) Clone() *UsageStatisticHourQuery {
+	if ushq == nil {
+		return nil
+	}
+	return &UsageStatisticHourQuery{
+		config:     ushq.config,
+		ctx:        ushq.ctx.Clone(),
+		order:      append([]usagestatistichour.OrderOption{}, ushq.order...),
+		inters:     append([]Interceptor{}, ushq.inters...),
+		predicates: append([]predicate.UsageStatisticHour{}, ushq.predicates...),
+		// clone intermediate query.
+		sql:  ushq.sql.Clone(),
+		path: ushq.path,
+	}
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//		Count int `json:"count,omitempty"`
+//	}
+//
+//	client.UsageStatisticHour.Query().
+//		GroupBy(usagestatistichour.FieldCreatedAt).
+//		Aggregate(ent.Count()).
+//		Scan(ctx, &v)
+func (ushq *UsageStatisticHourQuery) GroupBy(field string, fields ...string) *UsageStatisticHourGroupBy {
+	ushq.ctx.Fields = append([]string{field}, fields...)
+	grbuild := &UsageStatisticHourGroupBy{build: ushq}
+	grbuild.flds = &ushq.ctx.Fields
+	grbuild.label = usagestatistichour.Label
+	grbuild.scan = grbuild.Scan
+	return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//	}
+//
+//	client.UsageStatisticHour.Query().
+//		Select(usagestatistichour.FieldCreatedAt).
+//		Scan(ctx, &v)
+func (ushq *UsageStatisticHourQuery) Select(fields ...string) *UsageStatisticHourSelect {
+	ushq.ctx.Fields = append(ushq.ctx.Fields, fields...)
+	sbuild := &UsageStatisticHourSelect{UsageStatisticHourQuery: ushq}
+	sbuild.label = usagestatistichour.Label
+	sbuild.flds, sbuild.scan = &ushq.ctx.Fields, sbuild.Scan
+	return sbuild
+}
+
+// Aggregate returns a UsageStatisticHourSelect configured with the given aggregations.
+func (ushq *UsageStatisticHourQuery) Aggregate(fns ...AggregateFunc) *UsageStatisticHourSelect {
+	return ushq.Select().Aggregate(fns...)
+}
+
+func (ushq *UsageStatisticHourQuery) prepareQuery(ctx context.Context) error {
+	for _, inter := range ushq.inters {
+		if inter == nil {
+			return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+		}
+		if trv, ok := inter.(Traverser); ok {
+			if err := trv.Traverse(ctx, ushq); err != nil {
+				return err
+			}
+		}
+	}
+	for _, f := range ushq.ctx.Fields {
+		if !usagestatistichour.ValidColumn(f) {
+			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+		}
+	}
+	if ushq.path != nil {
+		prev, err := ushq.path(ctx)
+		if err != nil {
+			return err
+		}
+		ushq.sql = prev
+	}
+	return nil
+}
+
+func (ushq *UsageStatisticHourQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*UsageStatisticHour, error) {
+	var (
+		nodes = []*UsageStatisticHour{}
+		_spec = ushq.querySpec()
+	)
+	_spec.ScanValues = func(columns []string) ([]any, error) {
+		return (*UsageStatisticHour).scanValues(nil, columns)
+	}
+	_spec.Assign = func(columns []string, values []any) error {
+		node := &UsageStatisticHour{config: ushq.config}
+		nodes = append(nodes, node)
+		return node.assignValues(columns, values)
+	}
+	for i := range hooks {
+		hooks[i](ctx, _spec)
+	}
+	if err := sqlgraph.QueryNodes(ctx, ushq.driver, _spec); err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nodes, nil
+	}
+	return nodes, nil
+}
+
+func (ushq *UsageStatisticHourQuery) sqlCount(ctx context.Context) (int, error) {
+	_spec := ushq.querySpec()
+	_spec.Node.Columns = ushq.ctx.Fields
+	if len(ushq.ctx.Fields) > 0 {
+		_spec.Unique = ushq.ctx.Unique != nil && *ushq.ctx.Unique
+	}
+	return sqlgraph.CountNodes(ctx, ushq.driver, _spec)
+}
+
+func (ushq *UsageStatisticHourQuery) querySpec() *sqlgraph.QuerySpec {
+	_spec := sqlgraph.NewQuerySpec(usagestatistichour.Table, usagestatistichour.Columns, sqlgraph.NewFieldSpec(usagestatistichour.FieldID, field.TypeUint64))
+	_spec.From = ushq.sql
+	if unique := ushq.ctx.Unique; unique != nil {
+		_spec.Unique = *unique
+	} else if ushq.path != nil {
+		_spec.Unique = true
+	}
+	if fields := ushq.ctx.Fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, usagestatistichour.FieldID)
+		for i := range fields {
+			if fields[i] != usagestatistichour.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+			}
+		}
+	}
+	if ps := ushq.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if limit := ushq.ctx.Limit; limit != nil {
+		_spec.Limit = *limit
+	}
+	if offset := ushq.ctx.Offset; offset != nil {
+		_spec.Offset = *offset
+	}
+	if ps := ushq.order; len(ps) > 0 {
+		_spec.Order = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	return _spec
+}
+
+func (ushq *UsageStatisticHourQuery) sqlQuery(ctx context.Context) *sql.Selector {
+	builder := sql.Dialect(ushq.driver.Dialect())
+	t1 := builder.Table(usagestatistichour.Table)
+	columns := ushq.ctx.Fields
+	if len(columns) == 0 {
+		columns = usagestatistichour.Columns
+	}
+	selector := builder.Select(t1.Columns(columns...)...).From(t1)
+	if ushq.sql != nil {
+		selector = ushq.sql
+		selector.Select(selector.Columns(columns...)...)
+	}
+	if ushq.ctx.Unique != nil && *ushq.ctx.Unique {
+		selector.Distinct()
+	}
+	for _, p := range ushq.predicates {
+		p(selector)
+	}
+	for _, p := range ushq.order {
+		p(selector)
+	}
+	if offset := ushq.ctx.Offset; offset != nil {
+		// limit is mandatory for offset clause. We start
+		// with default value, and override it below if needed.
+		selector.Offset(*offset).Limit(math.MaxInt32)
+	}
+	if limit := ushq.ctx.Limit; limit != nil {
+		selector.Limit(*limit)
+	}
+	return selector
+}
+
+// UsageStatisticHourGroupBy is the group-by builder for UsageStatisticHour entities.
+type UsageStatisticHourGroupBy struct {
+	selector
+	build *UsageStatisticHourQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (ushgb *UsageStatisticHourGroupBy) Aggregate(fns ...AggregateFunc) *UsageStatisticHourGroupBy {
+	ushgb.fns = append(ushgb.fns, fns...)
+	return ushgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (ushgb *UsageStatisticHourGroupBy) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, ushgb.build.ctx, "GroupBy")
+	if err := ushgb.build.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*UsageStatisticHourQuery, *UsageStatisticHourGroupBy](ctx, ushgb.build, ushgb, ushgb.build.inters, v)
+}
+
+func (ushgb *UsageStatisticHourGroupBy) sqlScan(ctx context.Context, root *UsageStatisticHourQuery, v any) error {
+	selector := root.sqlQuery(ctx).Select()
+	aggregation := make([]string, 0, len(ushgb.fns))
+	for _, fn := range ushgb.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	if len(selector.SelectedColumns()) == 0 {
+		columns := make([]string, 0, len(*ushgb.flds)+len(ushgb.fns))
+		for _, f := range *ushgb.flds {
+			columns = append(columns, selector.C(f))
+		}
+		columns = append(columns, aggregation...)
+		selector.Select(columns...)
+	}
+	selector.GroupBy(selector.Columns(*ushgb.flds...)...)
+	if err := selector.Err(); err != nil {
+		return err
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := ushgb.build.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}
+
+// UsageStatisticHourSelect is the builder for selecting fields of UsageStatisticHour entities.
+type UsageStatisticHourSelect struct {
+	*UsageStatisticHourQuery
+	selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (ushs *UsageStatisticHourSelect) Aggregate(fns ...AggregateFunc) *UsageStatisticHourSelect {
+	ushs.fns = append(ushs.fns, fns...)
+	return ushs
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (ushs *UsageStatisticHourSelect) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, ushs.ctx, "Select")
+	if err := ushs.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*UsageStatisticHourQuery, *UsageStatisticHourSelect](ctx, ushs.UsageStatisticHourQuery, ushs, ushs.inters, v)
+}
+
+func (ushs *UsageStatisticHourSelect) sqlScan(ctx context.Context, root *UsageStatisticHourQuery, v any) error {
+	selector := root.sqlQuery(ctx)
+	aggregation := make([]string, 0, len(ushs.fns))
+	for _, fn := range ushs.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	switch n := len(*ushs.selector.flds); {
+	case n == 0 && len(aggregation) > 0:
+		selector.Select(aggregation...)
+	case n != 0 && len(aggregation) > 0:
+		selector.AppendSelect(aggregation...)
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := ushs.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}

+ 1054 - 0
ent/usagestatistichour_update.go

@@ -0,0 +1,1054 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatistichour"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/dialect/sql/sqljson"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticHourUpdate is the builder for updating UsageStatisticHour entities.
+type UsageStatisticHourUpdate struct {
+	config
+	hooks    []Hook
+	mutation *UsageStatisticHourMutation
+}
+
+// Where appends a list predicates to the UsageStatisticHourUpdate builder.
+func (ushu *UsageStatisticHourUpdate) Where(ps ...predicate.UsageStatisticHour) *UsageStatisticHourUpdate {
+	ushu.mutation.Where(ps...)
+	return ushu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (ushu *UsageStatisticHourUpdate) SetUpdatedAt(t time.Time) *UsageStatisticHourUpdate {
+	ushu.mutation.SetUpdatedAt(t)
+	return ushu
+}
+
+// SetStatus sets the "status" field.
+func (ushu *UsageStatisticHourUpdate) SetStatus(u uint8) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetStatus()
+	ushu.mutation.SetStatus(u)
+	return ushu
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableStatus(u *uint8) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetStatus(*u)
+	}
+	return ushu
+}
+
+// AddStatus adds u to the "status" field.
+func (ushu *UsageStatisticHourUpdate) AddStatus(u int8) *UsageStatisticHourUpdate {
+	ushu.mutation.AddStatus(u)
+	return ushu
+}
+
+// ClearStatus clears the value of the "status" field.
+func (ushu *UsageStatisticHourUpdate) ClearStatus() *UsageStatisticHourUpdate {
+	ushu.mutation.ClearStatus()
+	return ushu
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (ushu *UsageStatisticHourUpdate) SetDeletedAt(t time.Time) *UsageStatisticHourUpdate {
+	ushu.mutation.SetDeletedAt(t)
+	return ushu
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableDeletedAt(t *time.Time) *UsageStatisticHourUpdate {
+	if t != nil {
+		ushu.SetDeletedAt(*t)
+	}
+	return ushu
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (ushu *UsageStatisticHourUpdate) ClearDeletedAt() *UsageStatisticHourUpdate {
+	ushu.mutation.ClearDeletedAt()
+	return ushu
+}
+
+// SetAddtime sets the "addtime" field.
+func (ushu *UsageStatisticHourUpdate) SetAddtime(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetAddtime()
+	ushu.mutation.SetAddtime(u)
+	return ushu
+}
+
+// SetNillableAddtime sets the "addtime" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableAddtime(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetAddtime(*u)
+	}
+	return ushu
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (ushu *UsageStatisticHourUpdate) AddAddtime(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddAddtime(u)
+	return ushu
+}
+
+// SetType sets the "type" field.
+func (ushu *UsageStatisticHourUpdate) SetType(i int) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetType()
+	ushu.mutation.SetType(i)
+	return ushu
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableType(i *int) *UsageStatisticHourUpdate {
+	if i != nil {
+		ushu.SetType(*i)
+	}
+	return ushu
+}
+
+// AddType adds i to the "type" field.
+func (ushu *UsageStatisticHourUpdate) AddType(i int) *UsageStatisticHourUpdate {
+	ushu.mutation.AddType(i)
+	return ushu
+}
+
+// SetBotID sets the "bot_id" field.
+func (ushu *UsageStatisticHourUpdate) SetBotID(s string) *UsageStatisticHourUpdate {
+	ushu.mutation.SetBotID(s)
+	return ushu
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableBotID(s *string) *UsageStatisticHourUpdate {
+	if s != nil {
+		ushu.SetBotID(*s)
+	}
+	return ushu
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (ushu *UsageStatisticHourUpdate) ClearBotID() *UsageStatisticHourUpdate {
+	ushu.mutation.ClearBotID()
+	return ushu
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (ushu *UsageStatisticHourUpdate) SetOrganizationID(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetOrganizationID()
+	ushu.mutation.SetOrganizationID(u)
+	return ushu
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableOrganizationID(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetOrganizationID(*u)
+	}
+	return ushu
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (ushu *UsageStatisticHourUpdate) AddOrganizationID(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddOrganizationID(u)
+	return ushu
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (ushu *UsageStatisticHourUpdate) ClearOrganizationID() *UsageStatisticHourUpdate {
+	ushu.mutation.ClearOrganizationID()
+	return ushu
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (ushu *UsageStatisticHourUpdate) SetAiResponse(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetAiResponse()
+	ushu.mutation.SetAiResponse(u)
+	return ushu
+}
+
+// SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableAiResponse(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetAiResponse(*u)
+	}
+	return ushu
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (ushu *UsageStatisticHourUpdate) AddAiResponse(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddAiResponse(u)
+	return ushu
+}
+
+// SetSopRun sets the "sop_run" field.
+func (ushu *UsageStatisticHourUpdate) SetSopRun(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetSopRun()
+	ushu.mutation.SetSopRun(u)
+	return ushu
+}
+
+// SetNillableSopRun sets the "sop_run" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableSopRun(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetSopRun(*u)
+	}
+	return ushu
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (ushu *UsageStatisticHourUpdate) AddSopRun(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddSopRun(u)
+	return ushu
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (ushu *UsageStatisticHourUpdate) SetTotalFriend(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetTotalFriend()
+	ushu.mutation.SetTotalFriend(u)
+	return ushu
+}
+
+// SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableTotalFriend(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetTotalFriend(*u)
+	}
+	return ushu
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (ushu *UsageStatisticHourUpdate) AddTotalFriend(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddTotalFriend(u)
+	return ushu
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (ushu *UsageStatisticHourUpdate) SetTotalGroup(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetTotalGroup()
+	ushu.mutation.SetTotalGroup(u)
+	return ushu
+}
+
+// SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableTotalGroup(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetTotalGroup(*u)
+	}
+	return ushu
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (ushu *UsageStatisticHourUpdate) AddTotalGroup(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddTotalGroup(u)
+	return ushu
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (ushu *UsageStatisticHourUpdate) SetAccountBalance(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetAccountBalance()
+	ushu.mutation.SetAccountBalance(u)
+	return ushu
+}
+
+// SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableAccountBalance(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetAccountBalance(*u)
+	}
+	return ushu
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (ushu *UsageStatisticHourUpdate) AddAccountBalance(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddAccountBalance(u)
+	return ushu
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (ushu *UsageStatisticHourUpdate) SetConsumeToken(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetConsumeToken()
+	ushu.mutation.SetConsumeToken(u)
+	return ushu
+}
+
+// SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableConsumeToken(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetConsumeToken(*u)
+	}
+	return ushu
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (ushu *UsageStatisticHourUpdate) AddConsumeToken(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddConsumeToken(u)
+	return ushu
+}
+
+// SetActiveUser sets the "active_user" field.
+func (ushu *UsageStatisticHourUpdate) SetActiveUser(u uint64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetActiveUser()
+	ushu.mutation.SetActiveUser(u)
+	return ushu
+}
+
+// SetNillableActiveUser sets the "active_user" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableActiveUser(u *uint64) *UsageStatisticHourUpdate {
+	if u != nil {
+		ushu.SetActiveUser(*u)
+	}
+	return ushu
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (ushu *UsageStatisticHourUpdate) AddActiveUser(u int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddActiveUser(u)
+	return ushu
+}
+
+// SetNewUser sets the "new_user" field.
+func (ushu *UsageStatisticHourUpdate) SetNewUser(i int64) *UsageStatisticHourUpdate {
+	ushu.mutation.ResetNewUser()
+	ushu.mutation.SetNewUser(i)
+	return ushu
+}
+
+// SetNillableNewUser sets the "new_user" field if the given value is not nil.
+func (ushu *UsageStatisticHourUpdate) SetNillableNewUser(i *int64) *UsageStatisticHourUpdate {
+	if i != nil {
+		ushu.SetNewUser(*i)
+	}
+	return ushu
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (ushu *UsageStatisticHourUpdate) AddNewUser(i int64) *UsageStatisticHourUpdate {
+	ushu.mutation.AddNewUser(i)
+	return ushu
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (ushu *UsageStatisticHourUpdate) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticHourUpdate {
+	ushu.mutation.SetLabelDist(ctd)
+	return ushu
+}
+
+// AppendLabelDist appends ctd to the "label_dist" field.
+func (ushu *UsageStatisticHourUpdate) AppendLabelDist(ctd []custom_types.LabelDist) *UsageStatisticHourUpdate {
+	ushu.mutation.AppendLabelDist(ctd)
+	return ushu
+}
+
+// Mutation returns the UsageStatisticHourMutation object of the builder.
+func (ushu *UsageStatisticHourUpdate) Mutation() *UsageStatisticHourMutation {
+	return ushu.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (ushu *UsageStatisticHourUpdate) Save(ctx context.Context) (int, error) {
+	if err := ushu.defaults(); err != nil {
+		return 0, err
+	}
+	return withHooks(ctx, ushu.sqlSave, ushu.mutation, ushu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ushu *UsageStatisticHourUpdate) SaveX(ctx context.Context) int {
+	affected, err := ushu.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return affected
+}
+
+// Exec executes the query.
+func (ushu *UsageStatisticHourUpdate) Exec(ctx context.Context) error {
+	_, err := ushu.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ushu *UsageStatisticHourUpdate) ExecX(ctx context.Context) {
+	if err := ushu.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (ushu *UsageStatisticHourUpdate) defaults() error {
+	if _, ok := ushu.mutation.UpdatedAt(); !ok {
+		if usagestatistichour.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatistichour.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatistichour.UpdateDefaultUpdatedAt()
+		ushu.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (ushu *UsageStatisticHourUpdate) sqlSave(ctx context.Context) (n int, err error) {
+	_spec := sqlgraph.NewUpdateSpec(usagestatistichour.Table, usagestatistichour.Columns, sqlgraph.NewFieldSpec(usagestatistichour.FieldID, field.TypeUint64))
+	if ps := ushu.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := ushu.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatistichour.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := ushu.mutation.Status(); ok {
+		_spec.SetField(usagestatistichour.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := ushu.mutation.AddedStatus(); ok {
+		_spec.AddField(usagestatistichour.FieldStatus, field.TypeUint8, value)
+	}
+	if ushu.mutation.StatusCleared() {
+		_spec.ClearField(usagestatistichour.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := ushu.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatistichour.FieldDeletedAt, field.TypeTime, value)
+	}
+	if ushu.mutation.DeletedAtCleared() {
+		_spec.ClearField(usagestatistichour.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := ushu.mutation.Addtime(); ok {
+		_spec.SetField(usagestatistichour.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedAddtime(); ok {
+		_spec.AddField(usagestatistichour.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.GetType(); ok {
+		_spec.SetField(usagestatistichour.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ushu.mutation.AddedType(); ok {
+		_spec.AddField(usagestatistichour.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ushu.mutation.BotID(); ok {
+		_spec.SetField(usagestatistichour.FieldBotID, field.TypeString, value)
+	}
+	if ushu.mutation.BotIDCleared() {
+		_spec.ClearField(usagestatistichour.FieldBotID, field.TypeString)
+	}
+	if value, ok := ushu.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatistichour.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(usagestatistichour.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if ushu.mutation.OrganizationIDCleared() {
+		_spec.ClearField(usagestatistichour.FieldOrganizationID, field.TypeUint64)
+	}
+	if value, ok := ushu.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatistichour.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedAiResponse(); ok {
+		_spec.AddField(usagestatistichour.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.SopRun(); ok {
+		_spec.SetField(usagestatistichour.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedSopRun(); ok {
+		_spec.AddField(usagestatistichour.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatistichour.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedTotalFriend(); ok {
+		_spec.AddField(usagestatistichour.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatistichour.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedTotalGroup(); ok {
+		_spec.AddField(usagestatistichour.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatistichour.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedAccountBalance(); ok {
+		_spec.AddField(usagestatistichour.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatistichour.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedConsumeToken(); ok {
+		_spec.AddField(usagestatistichour.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatistichour.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.AddedActiveUser(); ok {
+		_spec.AddField(usagestatistichour.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := ushu.mutation.NewUser(); ok {
+		_spec.SetField(usagestatistichour.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := ushu.mutation.AddedNewUser(); ok {
+		_spec.AddField(usagestatistichour.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := ushu.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatistichour.FieldLabelDist, field.TypeJSON, value)
+	}
+	if value, ok := ushu.mutation.AppendedLabelDist(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, usagestatistichour.FieldLabelDist, value)
+		})
+	}
+	if n, err = sqlgraph.UpdateNodes(ctx, ushu.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{usagestatistichour.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return 0, err
+	}
+	ushu.mutation.done = true
+	return n, nil
+}
+
+// UsageStatisticHourUpdateOne is the builder for updating a single UsageStatisticHour entity.
+type UsageStatisticHourUpdateOne struct {
+	config
+	fields   []string
+	hooks    []Hook
+	mutation *UsageStatisticHourMutation
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetUpdatedAt(t time.Time) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.SetUpdatedAt(t)
+	return ushuo
+}
+
+// SetStatus sets the "status" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetStatus(u uint8) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetStatus()
+	ushuo.mutation.SetStatus(u)
+	return ushuo
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableStatus(u *uint8) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetStatus(*u)
+	}
+	return ushuo
+}
+
+// AddStatus adds u to the "status" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddStatus(u int8) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddStatus(u)
+	return ushuo
+}
+
+// ClearStatus clears the value of the "status" field.
+func (ushuo *UsageStatisticHourUpdateOne) ClearStatus() *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ClearStatus()
+	return ushuo
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetDeletedAt(t time.Time) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.SetDeletedAt(t)
+	return ushuo
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableDeletedAt(t *time.Time) *UsageStatisticHourUpdateOne {
+	if t != nil {
+		ushuo.SetDeletedAt(*t)
+	}
+	return ushuo
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (ushuo *UsageStatisticHourUpdateOne) ClearDeletedAt() *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ClearDeletedAt()
+	return ushuo
+}
+
+// SetAddtime sets the "addtime" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetAddtime(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetAddtime()
+	ushuo.mutation.SetAddtime(u)
+	return ushuo
+}
+
+// SetNillableAddtime sets the "addtime" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableAddtime(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetAddtime(*u)
+	}
+	return ushuo
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddAddtime(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddAddtime(u)
+	return ushuo
+}
+
+// SetType sets the "type" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetType(i int) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetType()
+	ushuo.mutation.SetType(i)
+	return ushuo
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableType(i *int) *UsageStatisticHourUpdateOne {
+	if i != nil {
+		ushuo.SetType(*i)
+	}
+	return ushuo
+}
+
+// AddType adds i to the "type" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddType(i int) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddType(i)
+	return ushuo
+}
+
+// SetBotID sets the "bot_id" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetBotID(s string) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.SetBotID(s)
+	return ushuo
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableBotID(s *string) *UsageStatisticHourUpdateOne {
+	if s != nil {
+		ushuo.SetBotID(*s)
+	}
+	return ushuo
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (ushuo *UsageStatisticHourUpdateOne) ClearBotID() *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ClearBotID()
+	return ushuo
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetOrganizationID(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetOrganizationID()
+	ushuo.mutation.SetOrganizationID(u)
+	return ushuo
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableOrganizationID(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetOrganizationID(*u)
+	}
+	return ushuo
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddOrganizationID(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddOrganizationID(u)
+	return ushuo
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (ushuo *UsageStatisticHourUpdateOne) ClearOrganizationID() *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ClearOrganizationID()
+	return ushuo
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetAiResponse(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetAiResponse()
+	ushuo.mutation.SetAiResponse(u)
+	return ushuo
+}
+
+// SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableAiResponse(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetAiResponse(*u)
+	}
+	return ushuo
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddAiResponse(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddAiResponse(u)
+	return ushuo
+}
+
+// SetSopRun sets the "sop_run" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetSopRun(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetSopRun()
+	ushuo.mutation.SetSopRun(u)
+	return ushuo
+}
+
+// SetNillableSopRun sets the "sop_run" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableSopRun(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetSopRun(*u)
+	}
+	return ushuo
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddSopRun(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddSopRun(u)
+	return ushuo
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetTotalFriend(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetTotalFriend()
+	ushuo.mutation.SetTotalFriend(u)
+	return ushuo
+}
+
+// SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableTotalFriend(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetTotalFriend(*u)
+	}
+	return ushuo
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddTotalFriend(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddTotalFriend(u)
+	return ushuo
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetTotalGroup(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetTotalGroup()
+	ushuo.mutation.SetTotalGroup(u)
+	return ushuo
+}
+
+// SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableTotalGroup(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetTotalGroup(*u)
+	}
+	return ushuo
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddTotalGroup(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddTotalGroup(u)
+	return ushuo
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetAccountBalance(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetAccountBalance()
+	ushuo.mutation.SetAccountBalance(u)
+	return ushuo
+}
+
+// SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableAccountBalance(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetAccountBalance(*u)
+	}
+	return ushuo
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddAccountBalance(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddAccountBalance(u)
+	return ushuo
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetConsumeToken(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetConsumeToken()
+	ushuo.mutation.SetConsumeToken(u)
+	return ushuo
+}
+
+// SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableConsumeToken(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetConsumeToken(*u)
+	}
+	return ushuo
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddConsumeToken(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddConsumeToken(u)
+	return ushuo
+}
+
+// SetActiveUser sets the "active_user" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetActiveUser(u uint64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetActiveUser()
+	ushuo.mutation.SetActiveUser(u)
+	return ushuo
+}
+
+// SetNillableActiveUser sets the "active_user" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableActiveUser(u *uint64) *UsageStatisticHourUpdateOne {
+	if u != nil {
+		ushuo.SetActiveUser(*u)
+	}
+	return ushuo
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddActiveUser(u int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddActiveUser(u)
+	return ushuo
+}
+
+// SetNewUser sets the "new_user" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetNewUser(i int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.ResetNewUser()
+	ushuo.mutation.SetNewUser(i)
+	return ushuo
+}
+
+// SetNillableNewUser sets the "new_user" field if the given value is not nil.
+func (ushuo *UsageStatisticHourUpdateOne) SetNillableNewUser(i *int64) *UsageStatisticHourUpdateOne {
+	if i != nil {
+		ushuo.SetNewUser(*i)
+	}
+	return ushuo
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (ushuo *UsageStatisticHourUpdateOne) AddNewUser(i int64) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AddNewUser(i)
+	return ushuo
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (ushuo *UsageStatisticHourUpdateOne) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.SetLabelDist(ctd)
+	return ushuo
+}
+
+// AppendLabelDist appends ctd to the "label_dist" field.
+func (ushuo *UsageStatisticHourUpdateOne) AppendLabelDist(ctd []custom_types.LabelDist) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.AppendLabelDist(ctd)
+	return ushuo
+}
+
+// Mutation returns the UsageStatisticHourMutation object of the builder.
+func (ushuo *UsageStatisticHourUpdateOne) Mutation() *UsageStatisticHourMutation {
+	return ushuo.mutation
+}
+
+// Where appends a list predicates to the UsageStatisticHourUpdate builder.
+func (ushuo *UsageStatisticHourUpdateOne) Where(ps ...predicate.UsageStatisticHour) *UsageStatisticHourUpdateOne {
+	ushuo.mutation.Where(ps...)
+	return ushuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (ushuo *UsageStatisticHourUpdateOne) Select(field string, fields ...string) *UsageStatisticHourUpdateOne {
+	ushuo.fields = append([]string{field}, fields...)
+	return ushuo
+}
+
+// Save executes the query and returns the updated UsageStatisticHour entity.
+func (ushuo *UsageStatisticHourUpdateOne) Save(ctx context.Context) (*UsageStatisticHour, error) {
+	if err := ushuo.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, ushuo.sqlSave, ushuo.mutation, ushuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ushuo *UsageStatisticHourUpdateOne) SaveX(ctx context.Context) *UsageStatisticHour {
+	node, err := ushuo.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// Exec executes the query on the entity.
+func (ushuo *UsageStatisticHourUpdateOne) Exec(ctx context.Context) error {
+	_, err := ushuo.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ushuo *UsageStatisticHourUpdateOne) ExecX(ctx context.Context) {
+	if err := ushuo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (ushuo *UsageStatisticHourUpdateOne) defaults() error {
+	if _, ok := ushuo.mutation.UpdatedAt(); !ok {
+		if usagestatistichour.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatistichour.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatistichour.UpdateDefaultUpdatedAt()
+		ushuo.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (ushuo *UsageStatisticHourUpdateOne) sqlSave(ctx context.Context) (_node *UsageStatisticHour, err error) {
+	_spec := sqlgraph.NewUpdateSpec(usagestatistichour.Table, usagestatistichour.Columns, sqlgraph.NewFieldSpec(usagestatistichour.FieldID, field.TypeUint64))
+	id, ok := ushuo.mutation.ID()
+	if !ok {
+		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "UsageStatisticHour.id" for update`)}
+	}
+	_spec.Node.ID.Value = id
+	if fields := ushuo.fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, usagestatistichour.FieldID)
+		for _, f := range fields {
+			if !usagestatistichour.ValidColumn(f) {
+				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+			}
+			if f != usagestatistichour.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, f)
+			}
+		}
+	}
+	if ps := ushuo.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := ushuo.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatistichour.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := ushuo.mutation.Status(); ok {
+		_spec.SetField(usagestatistichour.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := ushuo.mutation.AddedStatus(); ok {
+		_spec.AddField(usagestatistichour.FieldStatus, field.TypeUint8, value)
+	}
+	if ushuo.mutation.StatusCleared() {
+		_spec.ClearField(usagestatistichour.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := ushuo.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatistichour.FieldDeletedAt, field.TypeTime, value)
+	}
+	if ushuo.mutation.DeletedAtCleared() {
+		_spec.ClearField(usagestatistichour.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := ushuo.mutation.Addtime(); ok {
+		_spec.SetField(usagestatistichour.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedAddtime(); ok {
+		_spec.AddField(usagestatistichour.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.GetType(); ok {
+		_spec.SetField(usagestatistichour.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ushuo.mutation.AddedType(); ok {
+		_spec.AddField(usagestatistichour.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ushuo.mutation.BotID(); ok {
+		_spec.SetField(usagestatistichour.FieldBotID, field.TypeString, value)
+	}
+	if ushuo.mutation.BotIDCleared() {
+		_spec.ClearField(usagestatistichour.FieldBotID, field.TypeString)
+	}
+	if value, ok := ushuo.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatistichour.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(usagestatistichour.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if ushuo.mutation.OrganizationIDCleared() {
+		_spec.ClearField(usagestatistichour.FieldOrganizationID, field.TypeUint64)
+	}
+	if value, ok := ushuo.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatistichour.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedAiResponse(); ok {
+		_spec.AddField(usagestatistichour.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.SopRun(); ok {
+		_spec.SetField(usagestatistichour.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedSopRun(); ok {
+		_spec.AddField(usagestatistichour.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatistichour.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedTotalFriend(); ok {
+		_spec.AddField(usagestatistichour.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatistichour.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedTotalGroup(); ok {
+		_spec.AddField(usagestatistichour.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatistichour.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedAccountBalance(); ok {
+		_spec.AddField(usagestatistichour.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatistichour.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedConsumeToken(); ok {
+		_spec.AddField(usagestatistichour.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatistichour.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.AddedActiveUser(); ok {
+		_spec.AddField(usagestatistichour.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := ushuo.mutation.NewUser(); ok {
+		_spec.SetField(usagestatistichour.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := ushuo.mutation.AddedNewUser(); ok {
+		_spec.AddField(usagestatistichour.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := ushuo.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatistichour.FieldLabelDist, field.TypeJSON, value)
+	}
+	if value, ok := ushuo.mutation.AppendedLabelDist(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, usagestatistichour.FieldLabelDist, value)
+		})
+	}
+	_node = &UsageStatisticHour{config: ushuo.config}
+	_spec.Assign = _node.assignValues
+	_spec.ScanValues = _node.scanValues
+	if err = sqlgraph.UpdateNode(ctx, ushuo.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{usagestatistichour.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	ushuo.mutation.done = true
+	return _node, nil
+}

+ 288 - 0
ent/usagestatisticmonth.go

@@ -0,0 +1,288 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"encoding/json"
+	"fmt"
+	"strings"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/usagestatisticmonth"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+// UsageStatisticMonth is the model entity for the UsageStatisticMonth schema.
+type UsageStatisticMonth struct {
+	config `json:"-"`
+	// ID of the ent.
+	ID uint64 `json:"id,omitempty"`
+	// Create Time | 创建日期
+	CreatedAt time.Time `json:"created_at,omitempty"`
+	// Update Time | 修改日期
+	UpdatedAt time.Time `json:"updated_at,omitempty"`
+	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
+	Status uint8 `json:"status,omitempty"`
+	// Delete Time | 删除日期
+	DeletedAt time.Time `json:"deleted_at,omitempty"`
+	// 写入年月
+	Addtime uint64 `json:"addtime,omitempty"`
+	// 1-微信 2-名片
+	Type int `json:"type,omitempty"`
+	// 微信或名片id
+	BotID string `json:"bot_id,omitempty"`
+	// 机构ID
+	OrganizationID uint64 `json:"organization_id,omitempty"`
+	// AI回复次数
+	AiResponse uint64 `json:"ai_response,omitempty"`
+	// SOP运行次数
+	SopRun uint64 `json:"sop_run,omitempty"`
+	// 好友总数
+	TotalFriend uint64 `json:"total_friend,omitempty"`
+	// 群总数
+	TotalGroup uint64 `json:"total_group,omitempty"`
+	// 账户余额(单位:分)
+	AccountBalance uint64 `json:"account_balance,omitempty"`
+	// 消耗token数
+	ConsumeToken uint64 `json:"consume_token,omitempty"`
+	// 活跃用户数
+	ActiveUser uint64 `json:"active_user,omitempty"`
+	// 新增用户数
+	NewUser int64 `json:"new_user,omitempty"`
+	// 标签分布
+	LabelDist    []custom_types.LabelDist `json:"label_dist,omitempty"`
+	selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*UsageStatisticMonth) scanValues(columns []string) ([]any, error) {
+	values := make([]any, len(columns))
+	for i := range columns {
+		switch columns[i] {
+		case usagestatisticmonth.FieldLabelDist:
+			values[i] = new([]byte)
+		case usagestatisticmonth.FieldID, usagestatisticmonth.FieldStatus, usagestatisticmonth.FieldAddtime, usagestatisticmonth.FieldType, usagestatisticmonth.FieldOrganizationID, usagestatisticmonth.FieldAiResponse, usagestatisticmonth.FieldSopRun, usagestatisticmonth.FieldTotalFriend, usagestatisticmonth.FieldTotalGroup, usagestatisticmonth.FieldAccountBalance, usagestatisticmonth.FieldConsumeToken, usagestatisticmonth.FieldActiveUser, usagestatisticmonth.FieldNewUser:
+			values[i] = new(sql.NullInt64)
+		case usagestatisticmonth.FieldBotID:
+			values[i] = new(sql.NullString)
+		case usagestatisticmonth.FieldCreatedAt, usagestatisticmonth.FieldUpdatedAt, usagestatisticmonth.FieldDeletedAt:
+			values[i] = new(sql.NullTime)
+		default:
+			values[i] = new(sql.UnknownType)
+		}
+	}
+	return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the UsageStatisticMonth fields.
+func (usm *UsageStatisticMonth) assignValues(columns []string, values []any) error {
+	if m, n := len(values), len(columns); m < n {
+		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+	}
+	for i := range columns {
+		switch columns[i] {
+		case usagestatisticmonth.FieldID:
+			value, ok := values[i].(*sql.NullInt64)
+			if !ok {
+				return fmt.Errorf("unexpected type %T for field id", value)
+			}
+			usm.ID = uint64(value.Int64)
+		case usagestatisticmonth.FieldCreatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field created_at", values[i])
+			} else if value.Valid {
+				usm.CreatedAt = value.Time
+			}
+		case usagestatisticmonth.FieldUpdatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+			} else if value.Valid {
+				usm.UpdatedAt = value.Time
+			}
+		case usagestatisticmonth.FieldStatus:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field status", values[i])
+			} else if value.Valid {
+				usm.Status = uint8(value.Int64)
+			}
+		case usagestatisticmonth.FieldDeletedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
+			} else if value.Valid {
+				usm.DeletedAt = value.Time
+			}
+		case usagestatisticmonth.FieldAddtime:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field addtime", values[i])
+			} else if value.Valid {
+				usm.Addtime = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldType:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field type", values[i])
+			} else if value.Valid {
+				usm.Type = int(value.Int64)
+			}
+		case usagestatisticmonth.FieldBotID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field bot_id", values[i])
+			} else if value.Valid {
+				usm.BotID = value.String
+			}
+		case usagestatisticmonth.FieldOrganizationID:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field organization_id", values[i])
+			} else if value.Valid {
+				usm.OrganizationID = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldAiResponse:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field ai_response", values[i])
+			} else if value.Valid {
+				usm.AiResponse = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldSopRun:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field sop_run", values[i])
+			} else if value.Valid {
+				usm.SopRun = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldTotalFriend:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field total_friend", values[i])
+			} else if value.Valid {
+				usm.TotalFriend = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldTotalGroup:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field total_group", values[i])
+			} else if value.Valid {
+				usm.TotalGroup = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldAccountBalance:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field account_balance", values[i])
+			} else if value.Valid {
+				usm.AccountBalance = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldConsumeToken:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field consume_token", values[i])
+			} else if value.Valid {
+				usm.ConsumeToken = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldActiveUser:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field active_user", values[i])
+			} else if value.Valid {
+				usm.ActiveUser = uint64(value.Int64)
+			}
+		case usagestatisticmonth.FieldNewUser:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field new_user", values[i])
+			} else if value.Valid {
+				usm.NewUser = value.Int64
+			}
+		case usagestatisticmonth.FieldLabelDist:
+			if value, ok := values[i].(*[]byte); !ok {
+				return fmt.Errorf("unexpected type %T for field label_dist", values[i])
+			} else if value != nil && len(*value) > 0 {
+				if err := json.Unmarshal(*value, &usm.LabelDist); err != nil {
+					return fmt.Errorf("unmarshal field label_dist: %w", err)
+				}
+			}
+		default:
+			usm.selectValues.Set(columns[i], values[i])
+		}
+	}
+	return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the UsageStatisticMonth.
+// This includes values selected through modifiers, order, etc.
+func (usm *UsageStatisticMonth) Value(name string) (ent.Value, error) {
+	return usm.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this UsageStatisticMonth.
+// Note that you need to call UsageStatisticMonth.Unwrap() before calling this method if this UsageStatisticMonth
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (usm *UsageStatisticMonth) Update() *UsageStatisticMonthUpdateOne {
+	return NewUsageStatisticMonthClient(usm.config).UpdateOne(usm)
+}
+
+// Unwrap unwraps the UsageStatisticMonth entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (usm *UsageStatisticMonth) Unwrap() *UsageStatisticMonth {
+	_tx, ok := usm.config.driver.(*txDriver)
+	if !ok {
+		panic("ent: UsageStatisticMonth is not a transactional entity")
+	}
+	usm.config.driver = _tx.drv
+	return usm
+}
+
+// String implements the fmt.Stringer.
+func (usm *UsageStatisticMonth) String() string {
+	var builder strings.Builder
+	builder.WriteString("UsageStatisticMonth(")
+	builder.WriteString(fmt.Sprintf("id=%v, ", usm.ID))
+	builder.WriteString("created_at=")
+	builder.WriteString(usm.CreatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("updated_at=")
+	builder.WriteString(usm.UpdatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("status=")
+	builder.WriteString(fmt.Sprintf("%v", usm.Status))
+	builder.WriteString(", ")
+	builder.WriteString("deleted_at=")
+	builder.WriteString(usm.DeletedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("addtime=")
+	builder.WriteString(fmt.Sprintf("%v", usm.Addtime))
+	builder.WriteString(", ")
+	builder.WriteString("type=")
+	builder.WriteString(fmt.Sprintf("%v", usm.Type))
+	builder.WriteString(", ")
+	builder.WriteString("bot_id=")
+	builder.WriteString(usm.BotID)
+	builder.WriteString(", ")
+	builder.WriteString("organization_id=")
+	builder.WriteString(fmt.Sprintf("%v", usm.OrganizationID))
+	builder.WriteString(", ")
+	builder.WriteString("ai_response=")
+	builder.WriteString(fmt.Sprintf("%v", usm.AiResponse))
+	builder.WriteString(", ")
+	builder.WriteString("sop_run=")
+	builder.WriteString(fmt.Sprintf("%v", usm.SopRun))
+	builder.WriteString(", ")
+	builder.WriteString("total_friend=")
+	builder.WriteString(fmt.Sprintf("%v", usm.TotalFriend))
+	builder.WriteString(", ")
+	builder.WriteString("total_group=")
+	builder.WriteString(fmt.Sprintf("%v", usm.TotalGroup))
+	builder.WriteString(", ")
+	builder.WriteString("account_balance=")
+	builder.WriteString(fmt.Sprintf("%v", usm.AccountBalance))
+	builder.WriteString(", ")
+	builder.WriteString("consume_token=")
+	builder.WriteString(fmt.Sprintf("%v", usm.ConsumeToken))
+	builder.WriteString(", ")
+	builder.WriteString("active_user=")
+	builder.WriteString(fmt.Sprintf("%v", usm.ActiveUser))
+	builder.WriteString(", ")
+	builder.WriteString("new_user=")
+	builder.WriteString(fmt.Sprintf("%v", usm.NewUser))
+	builder.WriteString(", ")
+	builder.WriteString("label_dist=")
+	builder.WriteString(fmt.Sprintf("%v", usm.LabelDist))
+	builder.WriteByte(')')
+	return builder.String()
+}
+
+// UsageStatisticMonths is a parsable slice of UsageStatisticMonth.
+type UsageStatisticMonths []*UsageStatisticMonth

+ 191 - 0
ent/usagestatisticmonth/usagestatisticmonth.go

@@ -0,0 +1,191 @@
+// Code generated by ent, DO NOT EDIT.
+
+package usagestatisticmonth
+
+import (
+	"time"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+const (
+	// Label holds the string label denoting the usagestatisticmonth type in the database.
+	Label = "usage_statistic_month"
+	// FieldID holds the string denoting the id field in the database.
+	FieldID = "id"
+	// FieldCreatedAt holds the string denoting the created_at field in the database.
+	FieldCreatedAt = "created_at"
+	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
+	FieldUpdatedAt = "updated_at"
+	// FieldStatus holds the string denoting the status field in the database.
+	FieldStatus = "status"
+	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
+	FieldDeletedAt = "deleted_at"
+	// FieldAddtime holds the string denoting the addtime field in the database.
+	FieldAddtime = "addtime"
+	// FieldType holds the string denoting the type field in the database.
+	FieldType = "type"
+	// FieldBotID holds the string denoting the bot_id field in the database.
+	FieldBotID = "bot_id"
+	// FieldOrganizationID holds the string denoting the organization_id field in the database.
+	FieldOrganizationID = "organization_id"
+	// FieldAiResponse holds the string denoting the ai_response field in the database.
+	FieldAiResponse = "ai_response"
+	// FieldSopRun holds the string denoting the sop_run field in the database.
+	FieldSopRun = "sop_run"
+	// FieldTotalFriend holds the string denoting the total_friend field in the database.
+	FieldTotalFriend = "total_friend"
+	// FieldTotalGroup holds the string denoting the total_group field in the database.
+	FieldTotalGroup = "total_group"
+	// FieldAccountBalance holds the string denoting the account_balance field in the database.
+	FieldAccountBalance = "account_balance"
+	// FieldConsumeToken holds the string denoting the consume_token field in the database.
+	FieldConsumeToken = "consume_token"
+	// FieldActiveUser holds the string denoting the active_user field in the database.
+	FieldActiveUser = "active_user"
+	// FieldNewUser holds the string denoting the new_user field in the database.
+	FieldNewUser = "new_user"
+	// FieldLabelDist holds the string denoting the label_dist field in the database.
+	FieldLabelDist = "label_dist"
+	// Table holds the table name of the usagestatisticmonth in the database.
+	Table = "usage_statistic_month"
+)
+
+// Columns holds all SQL columns for usagestatisticmonth fields.
+var Columns = []string{
+	FieldID,
+	FieldCreatedAt,
+	FieldUpdatedAt,
+	FieldStatus,
+	FieldDeletedAt,
+	FieldAddtime,
+	FieldType,
+	FieldBotID,
+	FieldOrganizationID,
+	FieldAiResponse,
+	FieldSopRun,
+	FieldTotalFriend,
+	FieldTotalGroup,
+	FieldAccountBalance,
+	FieldConsumeToken,
+	FieldActiveUser,
+	FieldNewUser,
+	FieldLabelDist,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+	for i := range Columns {
+		if column == Columns[i] {
+			return true
+		}
+	}
+	return false
+}
+
+// Note that the variables below are initialized by the runtime
+// package on the initialization of the application. Therefore,
+// it should be imported in the main as follows:
+//
+//	import _ "wechat-api/ent/runtime"
+var (
+	Hooks        [1]ent.Hook
+	Interceptors [1]ent.Interceptor
+	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
+	DefaultCreatedAt func() time.Time
+	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+	DefaultUpdatedAt func() time.Time
+	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+	UpdateDefaultUpdatedAt func() time.Time
+	// DefaultStatus holds the default value on creation for the "status" field.
+	DefaultStatus uint8
+)
+
+// OrderOption defines the ordering options for the UsageStatisticMonth queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByDeletedAt orders the results by the deleted_at field.
+func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
+}
+
+// ByAddtime orders the results by the addtime field.
+func ByAddtime(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAddtime, opts...).ToFunc()
+}
+
+// ByType orders the results by the type field.
+func ByType(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldType, opts...).ToFunc()
+}
+
+// ByBotID orders the results by the bot_id field.
+func ByBotID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldBotID, opts...).ToFunc()
+}
+
+// ByOrganizationID orders the results by the organization_id field.
+func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
+}
+
+// ByAiResponse orders the results by the ai_response field.
+func ByAiResponse(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAiResponse, opts...).ToFunc()
+}
+
+// BySopRun orders the results by the sop_run field.
+func BySopRun(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldSopRun, opts...).ToFunc()
+}
+
+// ByTotalFriend orders the results by the total_friend field.
+func ByTotalFriend(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldTotalFriend, opts...).ToFunc()
+}
+
+// ByTotalGroup orders the results by the total_group field.
+func ByTotalGroup(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldTotalGroup, opts...).ToFunc()
+}
+
+// ByAccountBalance orders the results by the account_balance field.
+func ByAccountBalance(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAccountBalance, opts...).ToFunc()
+}
+
+// ByConsumeToken orders the results by the consume_token field.
+func ByConsumeToken(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldConsumeToken, opts...).ToFunc()
+}
+
+// ByActiveUser orders the results by the active_user field.
+func ByActiveUser(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldActiveUser, opts...).ToFunc()
+}
+
+// ByNewUser orders the results by the new_user field.
+func ByNewUser(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldNewUser, opts...).ToFunc()
+}

+ 855 - 0
ent/usagestatisticmonth/where.go

@@ -0,0 +1,855 @@
+// Code generated by ent, DO NOT EDIT.
+
+package usagestatisticmonth
+
+import (
+	"time"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldStatus, v))
+}
+
+// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
+func DeletedAt(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// Addtime applies equality check predicate on the "addtime" field. It's identical to AddtimeEQ.
+func Addtime(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldAddtime, v))
+}
+
+// Type applies equality check predicate on the "type" field. It's identical to TypeEQ.
+func Type(v int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldType, v))
+}
+
+// BotID applies equality check predicate on the "bot_id" field. It's identical to BotIDEQ.
+func BotID(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldBotID, v))
+}
+
+// OrganizationID applies equality check predicate on the "organization_id" field. It's identical to OrganizationIDEQ.
+func OrganizationID(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// AiResponse applies equality check predicate on the "ai_response" field. It's identical to AiResponseEQ.
+func AiResponse(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldAiResponse, v))
+}
+
+// SopRun applies equality check predicate on the "sop_run" field. It's identical to SopRunEQ.
+func SopRun(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldSopRun, v))
+}
+
+// TotalFriend applies equality check predicate on the "total_friend" field. It's identical to TotalFriendEQ.
+func TotalFriend(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldTotalFriend, v))
+}
+
+// TotalGroup applies equality check predicate on the "total_group" field. It's identical to TotalGroupEQ.
+func TotalGroup(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldTotalGroup, v))
+}
+
+// AccountBalance applies equality check predicate on the "account_balance" field. It's identical to AccountBalanceEQ.
+func AccountBalance(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldAccountBalance, v))
+}
+
+// ConsumeToken applies equality check predicate on the "consume_token" field. It's identical to ConsumeTokenEQ.
+func ConsumeToken(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldConsumeToken, v))
+}
+
+// ActiveUser applies equality check predicate on the "active_user" field. It's identical to ActiveUserEQ.
+func ActiveUser(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldActiveUser, v))
+}
+
+// NewUser applies equality check predicate on the "new_user" field. It's identical to NewUserEQ.
+func NewUser(v int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldNewUser, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v uint8) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusIsNil applies the IsNil predicate on the "status" field.
+func StatusIsNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIsNull(FieldStatus))
+}
+
+// StatusNotNil applies the NotNil predicate on the "status" field.
+func StatusNotNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotNull(FieldStatus))
+}
+
+// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
+func DeletedAtEQ(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
+func DeletedAtNEQ(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtIn applies the In predicate on the "deleted_at" field.
+func DeletedAtIn(vs ...time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
+func DeletedAtNotIn(vs ...time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtGT applies the GT predicate on the "deleted_at" field.
+func DeletedAtGT(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldDeletedAt, v))
+}
+
+// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
+func DeletedAtGTE(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldDeletedAt, v))
+}
+
+// DeletedAtLT applies the LT predicate on the "deleted_at" field.
+func DeletedAtLT(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldDeletedAt, v))
+}
+
+// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
+func DeletedAtLTE(v time.Time) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldDeletedAt, v))
+}
+
+// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
+func DeletedAtIsNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIsNull(FieldDeletedAt))
+}
+
+// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
+func DeletedAtNotNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotNull(FieldDeletedAt))
+}
+
+// AddtimeEQ applies the EQ predicate on the "addtime" field.
+func AddtimeEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldAddtime, v))
+}
+
+// AddtimeNEQ applies the NEQ predicate on the "addtime" field.
+func AddtimeNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldAddtime, v))
+}
+
+// AddtimeIn applies the In predicate on the "addtime" field.
+func AddtimeIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldAddtime, vs...))
+}
+
+// AddtimeNotIn applies the NotIn predicate on the "addtime" field.
+func AddtimeNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldAddtime, vs...))
+}
+
+// AddtimeGT applies the GT predicate on the "addtime" field.
+func AddtimeGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldAddtime, v))
+}
+
+// AddtimeGTE applies the GTE predicate on the "addtime" field.
+func AddtimeGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldAddtime, v))
+}
+
+// AddtimeLT applies the LT predicate on the "addtime" field.
+func AddtimeLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldAddtime, v))
+}
+
+// AddtimeLTE applies the LTE predicate on the "addtime" field.
+func AddtimeLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldAddtime, v))
+}
+
+// TypeEQ applies the EQ predicate on the "type" field.
+func TypeEQ(v int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldType, v))
+}
+
+// TypeNEQ applies the NEQ predicate on the "type" field.
+func TypeNEQ(v int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldType, v))
+}
+
+// TypeIn applies the In predicate on the "type" field.
+func TypeIn(vs ...int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldType, vs...))
+}
+
+// TypeNotIn applies the NotIn predicate on the "type" field.
+func TypeNotIn(vs ...int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldType, vs...))
+}
+
+// TypeGT applies the GT predicate on the "type" field.
+func TypeGT(v int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldType, v))
+}
+
+// TypeGTE applies the GTE predicate on the "type" field.
+func TypeGTE(v int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldType, v))
+}
+
+// TypeLT applies the LT predicate on the "type" field.
+func TypeLT(v int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldType, v))
+}
+
+// TypeLTE applies the LTE predicate on the "type" field.
+func TypeLTE(v int) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldType, v))
+}
+
+// BotIDEQ applies the EQ predicate on the "bot_id" field.
+func BotIDEQ(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldBotID, v))
+}
+
+// BotIDNEQ applies the NEQ predicate on the "bot_id" field.
+func BotIDNEQ(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldBotID, v))
+}
+
+// BotIDIn applies the In predicate on the "bot_id" field.
+func BotIDIn(vs ...string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldBotID, vs...))
+}
+
+// BotIDNotIn applies the NotIn predicate on the "bot_id" field.
+func BotIDNotIn(vs ...string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldBotID, vs...))
+}
+
+// BotIDGT applies the GT predicate on the "bot_id" field.
+func BotIDGT(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldBotID, v))
+}
+
+// BotIDGTE applies the GTE predicate on the "bot_id" field.
+func BotIDGTE(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldBotID, v))
+}
+
+// BotIDLT applies the LT predicate on the "bot_id" field.
+func BotIDLT(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldBotID, v))
+}
+
+// BotIDLTE applies the LTE predicate on the "bot_id" field.
+func BotIDLTE(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldBotID, v))
+}
+
+// BotIDContains applies the Contains predicate on the "bot_id" field.
+func BotIDContains(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldContains(FieldBotID, v))
+}
+
+// BotIDHasPrefix applies the HasPrefix predicate on the "bot_id" field.
+func BotIDHasPrefix(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldHasPrefix(FieldBotID, v))
+}
+
+// BotIDHasSuffix applies the HasSuffix predicate on the "bot_id" field.
+func BotIDHasSuffix(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldHasSuffix(FieldBotID, v))
+}
+
+// BotIDIsNil applies the IsNil predicate on the "bot_id" field.
+func BotIDIsNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIsNull(FieldBotID))
+}
+
+// BotIDNotNil applies the NotNil predicate on the "bot_id" field.
+func BotIDNotNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotNull(FieldBotID))
+}
+
+// BotIDEqualFold applies the EqualFold predicate on the "bot_id" field.
+func BotIDEqualFold(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEqualFold(FieldBotID, v))
+}
+
+// BotIDContainsFold applies the ContainsFold predicate on the "bot_id" field.
+func BotIDContainsFold(v string) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldContainsFold(FieldBotID, v))
+}
+
+// OrganizationIDEQ applies the EQ predicate on the "organization_id" field.
+func OrganizationIDEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDNEQ applies the NEQ predicate on the "organization_id" field.
+func OrganizationIDNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDIn applies the In predicate on the "organization_id" field.
+func OrganizationIDIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDNotIn applies the NotIn predicate on the "organization_id" field.
+func OrganizationIDNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDGT applies the GT predicate on the "organization_id" field.
+func OrganizationIDGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldOrganizationID, v))
+}
+
+// OrganizationIDGTE applies the GTE predicate on the "organization_id" field.
+func OrganizationIDGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldOrganizationID, v))
+}
+
+// OrganizationIDLT applies the LT predicate on the "organization_id" field.
+func OrganizationIDLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldOrganizationID, v))
+}
+
+// OrganizationIDLTE applies the LTE predicate on the "organization_id" field.
+func OrganizationIDLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldOrganizationID, v))
+}
+
+// OrganizationIDIsNil applies the IsNil predicate on the "organization_id" field.
+func OrganizationIDIsNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIsNull(FieldOrganizationID))
+}
+
+// OrganizationIDNotNil applies the NotNil predicate on the "organization_id" field.
+func OrganizationIDNotNil() predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotNull(FieldOrganizationID))
+}
+
+// AiResponseEQ applies the EQ predicate on the "ai_response" field.
+func AiResponseEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldAiResponse, v))
+}
+
+// AiResponseNEQ applies the NEQ predicate on the "ai_response" field.
+func AiResponseNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldAiResponse, v))
+}
+
+// AiResponseIn applies the In predicate on the "ai_response" field.
+func AiResponseIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldAiResponse, vs...))
+}
+
+// AiResponseNotIn applies the NotIn predicate on the "ai_response" field.
+func AiResponseNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldAiResponse, vs...))
+}
+
+// AiResponseGT applies the GT predicate on the "ai_response" field.
+func AiResponseGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldAiResponse, v))
+}
+
+// AiResponseGTE applies the GTE predicate on the "ai_response" field.
+func AiResponseGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldAiResponse, v))
+}
+
+// AiResponseLT applies the LT predicate on the "ai_response" field.
+func AiResponseLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldAiResponse, v))
+}
+
+// AiResponseLTE applies the LTE predicate on the "ai_response" field.
+func AiResponseLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldAiResponse, v))
+}
+
+// SopRunEQ applies the EQ predicate on the "sop_run" field.
+func SopRunEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldSopRun, v))
+}
+
+// SopRunNEQ applies the NEQ predicate on the "sop_run" field.
+func SopRunNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldSopRun, v))
+}
+
+// SopRunIn applies the In predicate on the "sop_run" field.
+func SopRunIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldSopRun, vs...))
+}
+
+// SopRunNotIn applies the NotIn predicate on the "sop_run" field.
+func SopRunNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldSopRun, vs...))
+}
+
+// SopRunGT applies the GT predicate on the "sop_run" field.
+func SopRunGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldSopRun, v))
+}
+
+// SopRunGTE applies the GTE predicate on the "sop_run" field.
+func SopRunGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldSopRun, v))
+}
+
+// SopRunLT applies the LT predicate on the "sop_run" field.
+func SopRunLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldSopRun, v))
+}
+
+// SopRunLTE applies the LTE predicate on the "sop_run" field.
+func SopRunLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldSopRun, v))
+}
+
+// TotalFriendEQ applies the EQ predicate on the "total_friend" field.
+func TotalFriendEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldTotalFriend, v))
+}
+
+// TotalFriendNEQ applies the NEQ predicate on the "total_friend" field.
+func TotalFriendNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldTotalFriend, v))
+}
+
+// TotalFriendIn applies the In predicate on the "total_friend" field.
+func TotalFriendIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldTotalFriend, vs...))
+}
+
+// TotalFriendNotIn applies the NotIn predicate on the "total_friend" field.
+func TotalFriendNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldTotalFriend, vs...))
+}
+
+// TotalFriendGT applies the GT predicate on the "total_friend" field.
+func TotalFriendGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldTotalFriend, v))
+}
+
+// TotalFriendGTE applies the GTE predicate on the "total_friend" field.
+func TotalFriendGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldTotalFriend, v))
+}
+
+// TotalFriendLT applies the LT predicate on the "total_friend" field.
+func TotalFriendLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldTotalFriend, v))
+}
+
+// TotalFriendLTE applies the LTE predicate on the "total_friend" field.
+func TotalFriendLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldTotalFriend, v))
+}
+
+// TotalGroupEQ applies the EQ predicate on the "total_group" field.
+func TotalGroupEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldTotalGroup, v))
+}
+
+// TotalGroupNEQ applies the NEQ predicate on the "total_group" field.
+func TotalGroupNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldTotalGroup, v))
+}
+
+// TotalGroupIn applies the In predicate on the "total_group" field.
+func TotalGroupIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldTotalGroup, vs...))
+}
+
+// TotalGroupNotIn applies the NotIn predicate on the "total_group" field.
+func TotalGroupNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldTotalGroup, vs...))
+}
+
+// TotalGroupGT applies the GT predicate on the "total_group" field.
+func TotalGroupGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldTotalGroup, v))
+}
+
+// TotalGroupGTE applies the GTE predicate on the "total_group" field.
+func TotalGroupGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldTotalGroup, v))
+}
+
+// TotalGroupLT applies the LT predicate on the "total_group" field.
+func TotalGroupLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldTotalGroup, v))
+}
+
+// TotalGroupLTE applies the LTE predicate on the "total_group" field.
+func TotalGroupLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldTotalGroup, v))
+}
+
+// AccountBalanceEQ applies the EQ predicate on the "account_balance" field.
+func AccountBalanceEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldAccountBalance, v))
+}
+
+// AccountBalanceNEQ applies the NEQ predicate on the "account_balance" field.
+func AccountBalanceNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldAccountBalance, v))
+}
+
+// AccountBalanceIn applies the In predicate on the "account_balance" field.
+func AccountBalanceIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldAccountBalance, vs...))
+}
+
+// AccountBalanceNotIn applies the NotIn predicate on the "account_balance" field.
+func AccountBalanceNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldAccountBalance, vs...))
+}
+
+// AccountBalanceGT applies the GT predicate on the "account_balance" field.
+func AccountBalanceGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldAccountBalance, v))
+}
+
+// AccountBalanceGTE applies the GTE predicate on the "account_balance" field.
+func AccountBalanceGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldAccountBalance, v))
+}
+
+// AccountBalanceLT applies the LT predicate on the "account_balance" field.
+func AccountBalanceLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldAccountBalance, v))
+}
+
+// AccountBalanceLTE applies the LTE predicate on the "account_balance" field.
+func AccountBalanceLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldAccountBalance, v))
+}
+
+// ConsumeTokenEQ applies the EQ predicate on the "consume_token" field.
+func ConsumeTokenEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldConsumeToken, v))
+}
+
+// ConsumeTokenNEQ applies the NEQ predicate on the "consume_token" field.
+func ConsumeTokenNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldConsumeToken, v))
+}
+
+// ConsumeTokenIn applies the In predicate on the "consume_token" field.
+func ConsumeTokenIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldConsumeToken, vs...))
+}
+
+// ConsumeTokenNotIn applies the NotIn predicate on the "consume_token" field.
+func ConsumeTokenNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldConsumeToken, vs...))
+}
+
+// ConsumeTokenGT applies the GT predicate on the "consume_token" field.
+func ConsumeTokenGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldConsumeToken, v))
+}
+
+// ConsumeTokenGTE applies the GTE predicate on the "consume_token" field.
+func ConsumeTokenGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldConsumeToken, v))
+}
+
+// ConsumeTokenLT applies the LT predicate on the "consume_token" field.
+func ConsumeTokenLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldConsumeToken, v))
+}
+
+// ConsumeTokenLTE applies the LTE predicate on the "consume_token" field.
+func ConsumeTokenLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldConsumeToken, v))
+}
+
+// ActiveUserEQ applies the EQ predicate on the "active_user" field.
+func ActiveUserEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldActiveUser, v))
+}
+
+// ActiveUserNEQ applies the NEQ predicate on the "active_user" field.
+func ActiveUserNEQ(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldActiveUser, v))
+}
+
+// ActiveUserIn applies the In predicate on the "active_user" field.
+func ActiveUserIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldActiveUser, vs...))
+}
+
+// ActiveUserNotIn applies the NotIn predicate on the "active_user" field.
+func ActiveUserNotIn(vs ...uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldActiveUser, vs...))
+}
+
+// ActiveUserGT applies the GT predicate on the "active_user" field.
+func ActiveUserGT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldActiveUser, v))
+}
+
+// ActiveUserGTE applies the GTE predicate on the "active_user" field.
+func ActiveUserGTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldActiveUser, v))
+}
+
+// ActiveUserLT applies the LT predicate on the "active_user" field.
+func ActiveUserLT(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldActiveUser, v))
+}
+
+// ActiveUserLTE applies the LTE predicate on the "active_user" field.
+func ActiveUserLTE(v uint64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldActiveUser, v))
+}
+
+// NewUserEQ applies the EQ predicate on the "new_user" field.
+func NewUserEQ(v int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldEQ(FieldNewUser, v))
+}
+
+// NewUserNEQ applies the NEQ predicate on the "new_user" field.
+func NewUserNEQ(v int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNEQ(FieldNewUser, v))
+}
+
+// NewUserIn applies the In predicate on the "new_user" field.
+func NewUserIn(vs ...int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldIn(FieldNewUser, vs...))
+}
+
+// NewUserNotIn applies the NotIn predicate on the "new_user" field.
+func NewUserNotIn(vs ...int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldNotIn(FieldNewUser, vs...))
+}
+
+// NewUserGT applies the GT predicate on the "new_user" field.
+func NewUserGT(v int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGT(FieldNewUser, v))
+}
+
+// NewUserGTE applies the GTE predicate on the "new_user" field.
+func NewUserGTE(v int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldGTE(FieldNewUser, v))
+}
+
+// NewUserLT applies the LT predicate on the "new_user" field.
+func NewUserLT(v int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLT(FieldNewUser, v))
+}
+
+// NewUserLTE applies the LTE predicate on the "new_user" field.
+func NewUserLTE(v int64) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.FieldLTE(FieldNewUser, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.UsageStatisticMonth) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.UsageStatisticMonth) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.UsageStatisticMonth) predicate.UsageStatisticMonth {
+	return predicate.UsageStatisticMonth(sql.NotPredicates(p))
+}

+ 1683 - 0
ent/usagestatisticmonth_create.go

@@ -0,0 +1,1683 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/usagestatisticmonth"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticMonthCreate is the builder for creating a UsageStatisticMonth entity.
+type UsageStatisticMonthCreate struct {
+	config
+	mutation *UsageStatisticMonthMutation
+	hooks    []Hook
+	conflict []sql.ConflictOption
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (usmc *UsageStatisticMonthCreate) SetCreatedAt(t time.Time) *UsageStatisticMonthCreate {
+	usmc.mutation.SetCreatedAt(t)
+	return usmc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (usmc *UsageStatisticMonthCreate) SetNillableCreatedAt(t *time.Time) *UsageStatisticMonthCreate {
+	if t != nil {
+		usmc.SetCreatedAt(*t)
+	}
+	return usmc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (usmc *UsageStatisticMonthCreate) SetUpdatedAt(t time.Time) *UsageStatisticMonthCreate {
+	usmc.mutation.SetUpdatedAt(t)
+	return usmc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (usmc *UsageStatisticMonthCreate) SetNillableUpdatedAt(t *time.Time) *UsageStatisticMonthCreate {
+	if t != nil {
+		usmc.SetUpdatedAt(*t)
+	}
+	return usmc
+}
+
+// SetStatus sets the "status" field.
+func (usmc *UsageStatisticMonthCreate) SetStatus(u uint8) *UsageStatisticMonthCreate {
+	usmc.mutation.SetStatus(u)
+	return usmc
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (usmc *UsageStatisticMonthCreate) SetNillableStatus(u *uint8) *UsageStatisticMonthCreate {
+	if u != nil {
+		usmc.SetStatus(*u)
+	}
+	return usmc
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (usmc *UsageStatisticMonthCreate) SetDeletedAt(t time.Time) *UsageStatisticMonthCreate {
+	usmc.mutation.SetDeletedAt(t)
+	return usmc
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (usmc *UsageStatisticMonthCreate) SetNillableDeletedAt(t *time.Time) *UsageStatisticMonthCreate {
+	if t != nil {
+		usmc.SetDeletedAt(*t)
+	}
+	return usmc
+}
+
+// SetAddtime sets the "addtime" field.
+func (usmc *UsageStatisticMonthCreate) SetAddtime(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetAddtime(u)
+	return usmc
+}
+
+// SetType sets the "type" field.
+func (usmc *UsageStatisticMonthCreate) SetType(i int) *UsageStatisticMonthCreate {
+	usmc.mutation.SetType(i)
+	return usmc
+}
+
+// SetBotID sets the "bot_id" field.
+func (usmc *UsageStatisticMonthCreate) SetBotID(s string) *UsageStatisticMonthCreate {
+	usmc.mutation.SetBotID(s)
+	return usmc
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (usmc *UsageStatisticMonthCreate) SetNillableBotID(s *string) *UsageStatisticMonthCreate {
+	if s != nil {
+		usmc.SetBotID(*s)
+	}
+	return usmc
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (usmc *UsageStatisticMonthCreate) SetOrganizationID(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetOrganizationID(u)
+	return usmc
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (usmc *UsageStatisticMonthCreate) SetNillableOrganizationID(u *uint64) *UsageStatisticMonthCreate {
+	if u != nil {
+		usmc.SetOrganizationID(*u)
+	}
+	return usmc
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (usmc *UsageStatisticMonthCreate) SetAiResponse(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetAiResponse(u)
+	return usmc
+}
+
+// SetSopRun sets the "sop_run" field.
+func (usmc *UsageStatisticMonthCreate) SetSopRun(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetSopRun(u)
+	return usmc
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (usmc *UsageStatisticMonthCreate) SetTotalFriend(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetTotalFriend(u)
+	return usmc
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (usmc *UsageStatisticMonthCreate) SetTotalGroup(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetTotalGroup(u)
+	return usmc
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (usmc *UsageStatisticMonthCreate) SetAccountBalance(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetAccountBalance(u)
+	return usmc
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (usmc *UsageStatisticMonthCreate) SetConsumeToken(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetConsumeToken(u)
+	return usmc
+}
+
+// SetActiveUser sets the "active_user" field.
+func (usmc *UsageStatisticMonthCreate) SetActiveUser(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetActiveUser(u)
+	return usmc
+}
+
+// SetNewUser sets the "new_user" field.
+func (usmc *UsageStatisticMonthCreate) SetNewUser(i int64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetNewUser(i)
+	return usmc
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (usmc *UsageStatisticMonthCreate) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticMonthCreate {
+	usmc.mutation.SetLabelDist(ctd)
+	return usmc
+}
+
+// SetID sets the "id" field.
+func (usmc *UsageStatisticMonthCreate) SetID(u uint64) *UsageStatisticMonthCreate {
+	usmc.mutation.SetID(u)
+	return usmc
+}
+
+// Mutation returns the UsageStatisticMonthMutation object of the builder.
+func (usmc *UsageStatisticMonthCreate) Mutation() *UsageStatisticMonthMutation {
+	return usmc.mutation
+}
+
+// Save creates the UsageStatisticMonth in the database.
+func (usmc *UsageStatisticMonthCreate) Save(ctx context.Context) (*UsageStatisticMonth, error) {
+	if err := usmc.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, usmc.sqlSave, usmc.mutation, usmc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (usmc *UsageStatisticMonthCreate) SaveX(ctx context.Context) *UsageStatisticMonth {
+	v, err := usmc.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (usmc *UsageStatisticMonthCreate) Exec(ctx context.Context) error {
+	_, err := usmc.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usmc *UsageStatisticMonthCreate) ExecX(ctx context.Context) {
+	if err := usmc.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (usmc *UsageStatisticMonthCreate) defaults() error {
+	if _, ok := usmc.mutation.CreatedAt(); !ok {
+		if usagestatisticmonth.DefaultCreatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticmonth.DefaultCreatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticmonth.DefaultCreatedAt()
+		usmc.mutation.SetCreatedAt(v)
+	}
+	if _, ok := usmc.mutation.UpdatedAt(); !ok {
+		if usagestatisticmonth.DefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticmonth.DefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticmonth.DefaultUpdatedAt()
+		usmc.mutation.SetUpdatedAt(v)
+	}
+	if _, ok := usmc.mutation.Status(); !ok {
+		v := usagestatisticmonth.DefaultStatus
+		usmc.mutation.SetStatus(v)
+	}
+	return nil
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (usmc *UsageStatisticMonthCreate) check() error {
+	if _, ok := usmc.mutation.CreatedAt(); !ok {
+		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "UsageStatisticMonth.created_at"`)}
+	}
+	if _, ok := usmc.mutation.UpdatedAt(); !ok {
+		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "UsageStatisticMonth.updated_at"`)}
+	}
+	if _, ok := usmc.mutation.Addtime(); !ok {
+		return &ValidationError{Name: "addtime", err: errors.New(`ent: missing required field "UsageStatisticMonth.addtime"`)}
+	}
+	if _, ok := usmc.mutation.GetType(); !ok {
+		return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "UsageStatisticMonth.type"`)}
+	}
+	if _, ok := usmc.mutation.AiResponse(); !ok {
+		return &ValidationError{Name: "ai_response", err: errors.New(`ent: missing required field "UsageStatisticMonth.ai_response"`)}
+	}
+	if _, ok := usmc.mutation.SopRun(); !ok {
+		return &ValidationError{Name: "sop_run", err: errors.New(`ent: missing required field "UsageStatisticMonth.sop_run"`)}
+	}
+	if _, ok := usmc.mutation.TotalFriend(); !ok {
+		return &ValidationError{Name: "total_friend", err: errors.New(`ent: missing required field "UsageStatisticMonth.total_friend"`)}
+	}
+	if _, ok := usmc.mutation.TotalGroup(); !ok {
+		return &ValidationError{Name: "total_group", err: errors.New(`ent: missing required field "UsageStatisticMonth.total_group"`)}
+	}
+	if _, ok := usmc.mutation.AccountBalance(); !ok {
+		return &ValidationError{Name: "account_balance", err: errors.New(`ent: missing required field "UsageStatisticMonth.account_balance"`)}
+	}
+	if _, ok := usmc.mutation.ConsumeToken(); !ok {
+		return &ValidationError{Name: "consume_token", err: errors.New(`ent: missing required field "UsageStatisticMonth.consume_token"`)}
+	}
+	if _, ok := usmc.mutation.ActiveUser(); !ok {
+		return &ValidationError{Name: "active_user", err: errors.New(`ent: missing required field "UsageStatisticMonth.active_user"`)}
+	}
+	if _, ok := usmc.mutation.NewUser(); !ok {
+		return &ValidationError{Name: "new_user", err: errors.New(`ent: missing required field "UsageStatisticMonth.new_user"`)}
+	}
+	if _, ok := usmc.mutation.LabelDist(); !ok {
+		return &ValidationError{Name: "label_dist", err: errors.New(`ent: missing required field "UsageStatisticMonth.label_dist"`)}
+	}
+	return nil
+}
+
+func (usmc *UsageStatisticMonthCreate) sqlSave(ctx context.Context) (*UsageStatisticMonth, error) {
+	if err := usmc.check(); err != nil {
+		return nil, err
+	}
+	_node, _spec := usmc.createSpec()
+	if err := sqlgraph.CreateNode(ctx, usmc.driver, _spec); err != nil {
+		if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	if _spec.ID.Value != _node.ID {
+		id := _spec.ID.Value.(int64)
+		_node.ID = uint64(id)
+	}
+	usmc.mutation.id = &_node.ID
+	usmc.mutation.done = true
+	return _node, nil
+}
+
+func (usmc *UsageStatisticMonthCreate) createSpec() (*UsageStatisticMonth, *sqlgraph.CreateSpec) {
+	var (
+		_node = &UsageStatisticMonth{config: usmc.config}
+		_spec = sqlgraph.NewCreateSpec(usagestatisticmonth.Table, sqlgraph.NewFieldSpec(usagestatisticmonth.FieldID, field.TypeUint64))
+	)
+	_spec.OnConflict = usmc.conflict
+	if id, ok := usmc.mutation.ID(); ok {
+		_node.ID = id
+		_spec.ID.Value = id
+	}
+	if value, ok := usmc.mutation.CreatedAt(); ok {
+		_spec.SetField(usagestatisticmonth.FieldCreatedAt, field.TypeTime, value)
+		_node.CreatedAt = value
+	}
+	if value, ok := usmc.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatisticmonth.FieldUpdatedAt, field.TypeTime, value)
+		_node.UpdatedAt = value
+	}
+	if value, ok := usmc.mutation.Status(); ok {
+		_spec.SetField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
+		_node.Status = value
+	}
+	if value, ok := usmc.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatisticmonth.FieldDeletedAt, field.TypeTime, value)
+		_node.DeletedAt = value
+	}
+	if value, ok := usmc.mutation.Addtime(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
+		_node.Addtime = value
+	}
+	if value, ok := usmc.mutation.GetType(); ok {
+		_spec.SetField(usagestatisticmonth.FieldType, field.TypeInt, value)
+		_node.Type = value
+	}
+	if value, ok := usmc.mutation.BotID(); ok {
+		_spec.SetField(usagestatisticmonth.FieldBotID, field.TypeString, value)
+		_node.BotID = value
+	}
+	if value, ok := usmc.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
+		_node.OrganizationID = value
+	}
+	if value, ok := usmc.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
+		_node.AiResponse = value
+	}
+	if value, ok := usmc.mutation.SopRun(); ok {
+		_spec.SetField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
+		_node.SopRun = value
+	}
+	if value, ok := usmc.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
+		_node.TotalFriend = value
+	}
+	if value, ok := usmc.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
+		_node.TotalGroup = value
+	}
+	if value, ok := usmc.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
+		_node.AccountBalance = value
+	}
+	if value, ok := usmc.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
+		_node.ConsumeToken = value
+	}
+	if value, ok := usmc.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
+		_node.ActiveUser = value
+	}
+	if value, ok := usmc.mutation.NewUser(); ok {
+		_spec.SetField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
+		_node.NewUser = value
+	}
+	if value, ok := usmc.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatisticmonth.FieldLabelDist, field.TypeJSON, value)
+		_node.LabelDist = value
+	}
+	return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.UsageStatisticMonth.Create().
+//		SetCreatedAt(v).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.UsageStatisticMonthUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (usmc *UsageStatisticMonthCreate) OnConflict(opts ...sql.ConflictOption) *UsageStatisticMonthUpsertOne {
+	usmc.conflict = opts
+	return &UsageStatisticMonthUpsertOne{
+		create: usmc,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.UsageStatisticMonth.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (usmc *UsageStatisticMonthCreate) OnConflictColumns(columns ...string) *UsageStatisticMonthUpsertOne {
+	usmc.conflict = append(usmc.conflict, sql.ConflictColumns(columns...))
+	return &UsageStatisticMonthUpsertOne{
+		create: usmc,
+	}
+}
+
+type (
+	// UsageStatisticMonthUpsertOne is the builder for "upsert"-ing
+	//  one UsageStatisticMonth node.
+	UsageStatisticMonthUpsertOne struct {
+		create *UsageStatisticMonthCreate
+	}
+
+	// UsageStatisticMonthUpsert is the "OnConflict" setter.
+	UsageStatisticMonthUpsert struct {
+		*sql.UpdateSet
+	}
+)
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticMonthUpsert) SetUpdatedAt(v time.Time) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldUpdatedAt, v)
+	return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateUpdatedAt() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldUpdatedAt)
+	return u
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticMonthUpsert) SetStatus(v uint8) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldStatus, v)
+	return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateStatus() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldStatus)
+	return u
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticMonthUpsert) AddStatus(v uint8) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldStatus, v)
+	return u
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticMonthUpsert) ClearStatus() *UsageStatisticMonthUpsert {
+	u.SetNull(usagestatisticmonth.FieldStatus)
+	return u
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticMonthUpsert) SetDeletedAt(v time.Time) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldDeletedAt, v)
+	return u
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateDeletedAt() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldDeletedAt)
+	return u
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticMonthUpsert) ClearDeletedAt() *UsageStatisticMonthUpsert {
+	u.SetNull(usagestatisticmonth.FieldDeletedAt)
+	return u
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticMonthUpsert) SetAddtime(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldAddtime, v)
+	return u
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateAddtime() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldAddtime)
+	return u
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticMonthUpsert) AddAddtime(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldAddtime, v)
+	return u
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticMonthUpsert) SetType(v int) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldType, v)
+	return u
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateType() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldType)
+	return u
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticMonthUpsert) AddType(v int) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldType, v)
+	return u
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticMonthUpsert) SetBotID(v string) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldBotID, v)
+	return u
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateBotID() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldBotID)
+	return u
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticMonthUpsert) ClearBotID() *UsageStatisticMonthUpsert {
+	u.SetNull(usagestatisticmonth.FieldBotID)
+	return u
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticMonthUpsert) SetOrganizationID(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldOrganizationID, v)
+	return u
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateOrganizationID() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldOrganizationID)
+	return u
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticMonthUpsert) AddOrganizationID(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldOrganizationID, v)
+	return u
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticMonthUpsert) ClearOrganizationID() *UsageStatisticMonthUpsert {
+	u.SetNull(usagestatisticmonth.FieldOrganizationID)
+	return u
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticMonthUpsert) SetAiResponse(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldAiResponse, v)
+	return u
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateAiResponse() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldAiResponse)
+	return u
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticMonthUpsert) AddAiResponse(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldAiResponse, v)
+	return u
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticMonthUpsert) SetSopRun(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldSopRun, v)
+	return u
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateSopRun() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldSopRun)
+	return u
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticMonthUpsert) AddSopRun(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldSopRun, v)
+	return u
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticMonthUpsert) SetTotalFriend(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldTotalFriend, v)
+	return u
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateTotalFriend() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldTotalFriend)
+	return u
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticMonthUpsert) AddTotalFriend(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldTotalFriend, v)
+	return u
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticMonthUpsert) SetTotalGroup(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldTotalGroup, v)
+	return u
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateTotalGroup() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldTotalGroup)
+	return u
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticMonthUpsert) AddTotalGroup(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldTotalGroup, v)
+	return u
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticMonthUpsert) SetAccountBalance(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldAccountBalance, v)
+	return u
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateAccountBalance() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldAccountBalance)
+	return u
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticMonthUpsert) AddAccountBalance(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldAccountBalance, v)
+	return u
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticMonthUpsert) SetConsumeToken(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldConsumeToken, v)
+	return u
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateConsumeToken() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldConsumeToken)
+	return u
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticMonthUpsert) AddConsumeToken(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldConsumeToken, v)
+	return u
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticMonthUpsert) SetActiveUser(v uint64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldActiveUser, v)
+	return u
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateActiveUser() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldActiveUser)
+	return u
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticMonthUpsert) AddActiveUser(v uint64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldActiveUser, v)
+	return u
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticMonthUpsert) SetNewUser(v int64) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldNewUser, v)
+	return u
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateNewUser() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldNewUser)
+	return u
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticMonthUpsert) AddNewUser(v int64) *UsageStatisticMonthUpsert {
+	u.Add(usagestatisticmonth.FieldNewUser, v)
+	return u
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticMonthUpsert) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticMonthUpsert {
+	u.Set(usagestatisticmonth.FieldLabelDist, v)
+	return u
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsert) UpdateLabelDist() *UsageStatisticMonthUpsert {
+	u.SetExcluded(usagestatisticmonth.FieldLabelDist)
+	return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticMonth.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(usagestatisticmonth.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *UsageStatisticMonthUpsertOne) UpdateNewValues() *UsageStatisticMonthUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		if _, exists := u.create.mutation.ID(); exists {
+			s.SetIgnore(usagestatisticmonth.FieldID)
+		}
+		if _, exists := u.create.mutation.CreatedAt(); exists {
+			s.SetIgnore(usagestatisticmonth.FieldCreatedAt)
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticMonth.Create().
+//	    OnConflict(sql.ResolveWithIgnore()).
+//	    Exec(ctx)
+func (u *UsageStatisticMonthUpsertOne) Ignore() *UsageStatisticMonthUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *UsageStatisticMonthUpsertOne) DoNothing() *UsageStatisticMonthUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the UsageStatisticMonthCreate.OnConflict
+// documentation for more info.
+func (u *UsageStatisticMonthUpsertOne) Update(set func(*UsageStatisticMonthUpsert)) *UsageStatisticMonthUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&UsageStatisticMonthUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticMonthUpsertOne) SetUpdatedAt(v time.Time) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateUpdatedAt() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticMonthUpsertOne) SetStatus(v uint8) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticMonthUpsertOne) AddStatus(v uint8) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateStatus() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticMonthUpsertOne) ClearStatus() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticMonthUpsertOne) SetDeletedAt(v time.Time) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateDeletedAt() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticMonthUpsertOne) ClearDeletedAt() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticMonthUpsertOne) SetAddtime(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetAddtime(v)
+	})
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticMonthUpsertOne) AddAddtime(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddAddtime(v)
+	})
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateAddtime() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateAddtime()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticMonthUpsertOne) SetType(v int) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticMonthUpsertOne) AddType(v int) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateType() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticMonthUpsertOne) SetBotID(v string) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetBotID(v)
+	})
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateBotID() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateBotID()
+	})
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticMonthUpsertOne) ClearBotID() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearBotID()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticMonthUpsertOne) SetOrganizationID(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticMonthUpsertOne) AddOrganizationID(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateOrganizationID() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticMonthUpsertOne) ClearOrganizationID() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticMonthUpsertOne) SetAiResponse(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetAiResponse(v)
+	})
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticMonthUpsertOne) AddAiResponse(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddAiResponse(v)
+	})
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateAiResponse() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateAiResponse()
+	})
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticMonthUpsertOne) SetSopRun(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetSopRun(v)
+	})
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticMonthUpsertOne) AddSopRun(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddSopRun(v)
+	})
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateSopRun() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateSopRun()
+	})
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticMonthUpsertOne) SetTotalFriend(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetTotalFriend(v)
+	})
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticMonthUpsertOne) AddTotalFriend(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddTotalFriend(v)
+	})
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateTotalFriend() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateTotalFriend()
+	})
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticMonthUpsertOne) SetTotalGroup(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetTotalGroup(v)
+	})
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticMonthUpsertOne) AddTotalGroup(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddTotalGroup(v)
+	})
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateTotalGroup() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateTotalGroup()
+	})
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticMonthUpsertOne) SetAccountBalance(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetAccountBalance(v)
+	})
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticMonthUpsertOne) AddAccountBalance(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddAccountBalance(v)
+	})
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateAccountBalance() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateAccountBalance()
+	})
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticMonthUpsertOne) SetConsumeToken(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetConsumeToken(v)
+	})
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticMonthUpsertOne) AddConsumeToken(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddConsumeToken(v)
+	})
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateConsumeToken() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateConsumeToken()
+	})
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticMonthUpsertOne) SetActiveUser(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetActiveUser(v)
+	})
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticMonthUpsertOne) AddActiveUser(v uint64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddActiveUser(v)
+	})
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateActiveUser() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateActiveUser()
+	})
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticMonthUpsertOne) SetNewUser(v int64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetNewUser(v)
+	})
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticMonthUpsertOne) AddNewUser(v int64) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddNewUser(v)
+	})
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateNewUser() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateNewUser()
+	})
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticMonthUpsertOne) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetLabelDist(v)
+	})
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertOne) UpdateLabelDist() *UsageStatisticMonthUpsertOne {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateLabelDist()
+	})
+}
+
+// Exec executes the query.
+func (u *UsageStatisticMonthUpsertOne) Exec(ctx context.Context) error {
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for UsageStatisticMonthCreate.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *UsageStatisticMonthUpsertOne) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *UsageStatisticMonthUpsertOne) ID(ctx context.Context) (id uint64, err error) {
+	node, err := u.create.Save(ctx)
+	if err != nil {
+		return id, err
+	}
+	return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *UsageStatisticMonthUpsertOne) IDX(ctx context.Context) uint64 {
+	id, err := u.ID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// UsageStatisticMonthCreateBulk is the builder for creating many UsageStatisticMonth entities in bulk.
+type UsageStatisticMonthCreateBulk struct {
+	config
+	err      error
+	builders []*UsageStatisticMonthCreate
+	conflict []sql.ConflictOption
+}
+
+// Save creates the UsageStatisticMonth entities in the database.
+func (usmcb *UsageStatisticMonthCreateBulk) Save(ctx context.Context) ([]*UsageStatisticMonth, error) {
+	if usmcb.err != nil {
+		return nil, usmcb.err
+	}
+	specs := make([]*sqlgraph.CreateSpec, len(usmcb.builders))
+	nodes := make([]*UsageStatisticMonth, len(usmcb.builders))
+	mutators := make([]Mutator, len(usmcb.builders))
+	for i := range usmcb.builders {
+		func(i int, root context.Context) {
+			builder := usmcb.builders[i]
+			builder.defaults()
+			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+				mutation, ok := m.(*UsageStatisticMonthMutation)
+				if !ok {
+					return nil, fmt.Errorf("unexpected mutation type %T", m)
+				}
+				if err := builder.check(); err != nil {
+					return nil, err
+				}
+				builder.mutation = mutation
+				var err error
+				nodes[i], specs[i] = builder.createSpec()
+				if i < len(mutators)-1 {
+					_, err = mutators[i+1].Mutate(root, usmcb.builders[i+1].mutation)
+				} else {
+					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+					spec.OnConflict = usmcb.conflict
+					// Invoke the actual operation on the latest mutation in the chain.
+					if err = sqlgraph.BatchCreate(ctx, usmcb.driver, spec); err != nil {
+						if sqlgraph.IsConstraintError(err) {
+							err = &ConstraintError{msg: err.Error(), wrap: err}
+						}
+					}
+				}
+				if err != nil {
+					return nil, err
+				}
+				mutation.id = &nodes[i].ID
+				if specs[i].ID.Value != nil && nodes[i].ID == 0 {
+					id := specs[i].ID.Value.(int64)
+					nodes[i].ID = uint64(id)
+				}
+				mutation.done = true
+				return nodes[i], nil
+			})
+			for i := len(builder.hooks) - 1; i >= 0; i-- {
+				mut = builder.hooks[i](mut)
+			}
+			mutators[i] = mut
+		}(i, ctx)
+	}
+	if len(mutators) > 0 {
+		if _, err := mutators[0].Mutate(ctx, usmcb.builders[0].mutation); err != nil {
+			return nil, err
+		}
+	}
+	return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (usmcb *UsageStatisticMonthCreateBulk) SaveX(ctx context.Context) []*UsageStatisticMonth {
+	v, err := usmcb.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (usmcb *UsageStatisticMonthCreateBulk) Exec(ctx context.Context) error {
+	_, err := usmcb.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usmcb *UsageStatisticMonthCreateBulk) ExecX(ctx context.Context) {
+	if err := usmcb.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.UsageStatisticMonth.CreateBulk(builders...).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.UsageStatisticMonthUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (usmcb *UsageStatisticMonthCreateBulk) OnConflict(opts ...sql.ConflictOption) *UsageStatisticMonthUpsertBulk {
+	usmcb.conflict = opts
+	return &UsageStatisticMonthUpsertBulk{
+		create: usmcb,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.UsageStatisticMonth.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (usmcb *UsageStatisticMonthCreateBulk) OnConflictColumns(columns ...string) *UsageStatisticMonthUpsertBulk {
+	usmcb.conflict = append(usmcb.conflict, sql.ConflictColumns(columns...))
+	return &UsageStatisticMonthUpsertBulk{
+		create: usmcb,
+	}
+}
+
+// UsageStatisticMonthUpsertBulk is the builder for "upsert"-ing
+// a bulk of UsageStatisticMonth nodes.
+type UsageStatisticMonthUpsertBulk struct {
+	create *UsageStatisticMonthCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+//	client.UsageStatisticMonth.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(usagestatisticmonth.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *UsageStatisticMonthUpsertBulk) UpdateNewValues() *UsageStatisticMonthUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		for _, b := range u.create.builders {
+			if _, exists := b.mutation.ID(); exists {
+				s.SetIgnore(usagestatisticmonth.FieldID)
+			}
+			if _, exists := b.mutation.CreatedAt(); exists {
+				s.SetIgnore(usagestatisticmonth.FieldCreatedAt)
+			}
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.UsageStatisticMonth.Create().
+//		OnConflict(sql.ResolveWithIgnore()).
+//		Exec(ctx)
+func (u *UsageStatisticMonthUpsertBulk) Ignore() *UsageStatisticMonthUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *UsageStatisticMonthUpsertBulk) DoNothing() *UsageStatisticMonthUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the UsageStatisticMonthCreateBulk.OnConflict
+// documentation for more info.
+func (u *UsageStatisticMonthUpsertBulk) Update(set func(*UsageStatisticMonthUpsert)) *UsageStatisticMonthUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&UsageStatisticMonthUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *UsageStatisticMonthUpsertBulk) SetUpdatedAt(v time.Time) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateUpdatedAt() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *UsageStatisticMonthUpsertBulk) SetStatus(v uint8) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *UsageStatisticMonthUpsertBulk) AddStatus(v uint8) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateStatus() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *UsageStatisticMonthUpsertBulk) ClearStatus() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *UsageStatisticMonthUpsertBulk) SetDeletedAt(v time.Time) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateDeletedAt() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *UsageStatisticMonthUpsertBulk) ClearDeletedAt() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetAddtime sets the "addtime" field.
+func (u *UsageStatisticMonthUpsertBulk) SetAddtime(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetAddtime(v)
+	})
+}
+
+// AddAddtime adds v to the "addtime" field.
+func (u *UsageStatisticMonthUpsertBulk) AddAddtime(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddAddtime(v)
+	})
+}
+
+// UpdateAddtime sets the "addtime" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateAddtime() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateAddtime()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *UsageStatisticMonthUpsertBulk) SetType(v int) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *UsageStatisticMonthUpsertBulk) AddType(v int) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateType() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetBotID sets the "bot_id" field.
+func (u *UsageStatisticMonthUpsertBulk) SetBotID(v string) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetBotID(v)
+	})
+}
+
+// UpdateBotID sets the "bot_id" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateBotID() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateBotID()
+	})
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (u *UsageStatisticMonthUpsertBulk) ClearBotID() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearBotID()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *UsageStatisticMonthUpsertBulk) SetOrganizationID(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *UsageStatisticMonthUpsertBulk) AddOrganizationID(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateOrganizationID() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *UsageStatisticMonthUpsertBulk) ClearOrganizationID() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (u *UsageStatisticMonthUpsertBulk) SetAiResponse(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetAiResponse(v)
+	})
+}
+
+// AddAiResponse adds v to the "ai_response" field.
+func (u *UsageStatisticMonthUpsertBulk) AddAiResponse(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddAiResponse(v)
+	})
+}
+
+// UpdateAiResponse sets the "ai_response" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateAiResponse() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateAiResponse()
+	})
+}
+
+// SetSopRun sets the "sop_run" field.
+func (u *UsageStatisticMonthUpsertBulk) SetSopRun(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetSopRun(v)
+	})
+}
+
+// AddSopRun adds v to the "sop_run" field.
+func (u *UsageStatisticMonthUpsertBulk) AddSopRun(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddSopRun(v)
+	})
+}
+
+// UpdateSopRun sets the "sop_run" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateSopRun() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateSopRun()
+	})
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (u *UsageStatisticMonthUpsertBulk) SetTotalFriend(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetTotalFriend(v)
+	})
+}
+
+// AddTotalFriend adds v to the "total_friend" field.
+func (u *UsageStatisticMonthUpsertBulk) AddTotalFriend(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddTotalFriend(v)
+	})
+}
+
+// UpdateTotalFriend sets the "total_friend" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateTotalFriend() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateTotalFriend()
+	})
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (u *UsageStatisticMonthUpsertBulk) SetTotalGroup(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetTotalGroup(v)
+	})
+}
+
+// AddTotalGroup adds v to the "total_group" field.
+func (u *UsageStatisticMonthUpsertBulk) AddTotalGroup(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddTotalGroup(v)
+	})
+}
+
+// UpdateTotalGroup sets the "total_group" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateTotalGroup() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateTotalGroup()
+	})
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (u *UsageStatisticMonthUpsertBulk) SetAccountBalance(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetAccountBalance(v)
+	})
+}
+
+// AddAccountBalance adds v to the "account_balance" field.
+func (u *UsageStatisticMonthUpsertBulk) AddAccountBalance(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddAccountBalance(v)
+	})
+}
+
+// UpdateAccountBalance sets the "account_balance" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateAccountBalance() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateAccountBalance()
+	})
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (u *UsageStatisticMonthUpsertBulk) SetConsumeToken(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetConsumeToken(v)
+	})
+}
+
+// AddConsumeToken adds v to the "consume_token" field.
+func (u *UsageStatisticMonthUpsertBulk) AddConsumeToken(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddConsumeToken(v)
+	})
+}
+
+// UpdateConsumeToken sets the "consume_token" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateConsumeToken() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateConsumeToken()
+	})
+}
+
+// SetActiveUser sets the "active_user" field.
+func (u *UsageStatisticMonthUpsertBulk) SetActiveUser(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetActiveUser(v)
+	})
+}
+
+// AddActiveUser adds v to the "active_user" field.
+func (u *UsageStatisticMonthUpsertBulk) AddActiveUser(v uint64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddActiveUser(v)
+	})
+}
+
+// UpdateActiveUser sets the "active_user" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateActiveUser() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateActiveUser()
+	})
+}
+
+// SetNewUser sets the "new_user" field.
+func (u *UsageStatisticMonthUpsertBulk) SetNewUser(v int64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetNewUser(v)
+	})
+}
+
+// AddNewUser adds v to the "new_user" field.
+func (u *UsageStatisticMonthUpsertBulk) AddNewUser(v int64) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.AddNewUser(v)
+	})
+}
+
+// UpdateNewUser sets the "new_user" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateNewUser() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateNewUser()
+	})
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (u *UsageStatisticMonthUpsertBulk) SetLabelDist(v []custom_types.LabelDist) *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.SetLabelDist(v)
+	})
+}
+
+// UpdateLabelDist sets the "label_dist" field to the value that was provided on create.
+func (u *UsageStatisticMonthUpsertBulk) UpdateLabelDist() *UsageStatisticMonthUpsertBulk {
+	return u.Update(func(s *UsageStatisticMonthUpsert) {
+		s.UpdateLabelDist()
+	})
+}
+
+// Exec executes the query.
+func (u *UsageStatisticMonthUpsertBulk) Exec(ctx context.Context) error {
+	if u.create.err != nil {
+		return u.create.err
+	}
+	for i, b := range u.create.builders {
+		if len(b.conflict) != 0 {
+			return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the UsageStatisticMonthCreateBulk instead", i)
+		}
+	}
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for UsageStatisticMonthCreateBulk.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *UsageStatisticMonthUpsertBulk) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 88 - 0
ent/usagestatisticmonth_delete.go

@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticmonth"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticMonthDelete is the builder for deleting a UsageStatisticMonth entity.
+type UsageStatisticMonthDelete struct {
+	config
+	hooks    []Hook
+	mutation *UsageStatisticMonthMutation
+}
+
+// Where appends a list predicates to the UsageStatisticMonthDelete builder.
+func (usmd *UsageStatisticMonthDelete) Where(ps ...predicate.UsageStatisticMonth) *UsageStatisticMonthDelete {
+	usmd.mutation.Where(ps...)
+	return usmd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (usmd *UsageStatisticMonthDelete) Exec(ctx context.Context) (int, error) {
+	return withHooks(ctx, usmd.sqlExec, usmd.mutation, usmd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usmd *UsageStatisticMonthDelete) ExecX(ctx context.Context) int {
+	n, err := usmd.Exec(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return n
+}
+
+func (usmd *UsageStatisticMonthDelete) sqlExec(ctx context.Context) (int, error) {
+	_spec := sqlgraph.NewDeleteSpec(usagestatisticmonth.Table, sqlgraph.NewFieldSpec(usagestatisticmonth.FieldID, field.TypeUint64))
+	if ps := usmd.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	affected, err := sqlgraph.DeleteNodes(ctx, usmd.driver, _spec)
+	if err != nil && sqlgraph.IsConstraintError(err) {
+		err = &ConstraintError{msg: err.Error(), wrap: err}
+	}
+	usmd.mutation.done = true
+	return affected, err
+}
+
+// UsageStatisticMonthDeleteOne is the builder for deleting a single UsageStatisticMonth entity.
+type UsageStatisticMonthDeleteOne struct {
+	usmd *UsageStatisticMonthDelete
+}
+
+// Where appends a list predicates to the UsageStatisticMonthDelete builder.
+func (usmdo *UsageStatisticMonthDeleteOne) Where(ps ...predicate.UsageStatisticMonth) *UsageStatisticMonthDeleteOne {
+	usmdo.usmd.mutation.Where(ps...)
+	return usmdo
+}
+
+// Exec executes the deletion query.
+func (usmdo *UsageStatisticMonthDeleteOne) Exec(ctx context.Context) error {
+	n, err := usmdo.usmd.Exec(ctx)
+	switch {
+	case err != nil:
+		return err
+	case n == 0:
+		return &NotFoundError{usagestatisticmonth.Label}
+	default:
+		return nil
+	}
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usmdo *UsageStatisticMonthDeleteOne) ExecX(ctx context.Context) {
+	if err := usmdo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 526 - 0
ent/usagestatisticmonth_query.go

@@ -0,0 +1,526 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"fmt"
+	"math"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticmonth"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticMonthQuery is the builder for querying UsageStatisticMonth entities.
+type UsageStatisticMonthQuery struct {
+	config
+	ctx        *QueryContext
+	order      []usagestatisticmonth.OrderOption
+	inters     []Interceptor
+	predicates []predicate.UsageStatisticMonth
+	// intermediate query (i.e. traversal path).
+	sql  *sql.Selector
+	path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the UsageStatisticMonthQuery builder.
+func (usmq *UsageStatisticMonthQuery) Where(ps ...predicate.UsageStatisticMonth) *UsageStatisticMonthQuery {
+	usmq.predicates = append(usmq.predicates, ps...)
+	return usmq
+}
+
+// Limit the number of records to be returned by this query.
+func (usmq *UsageStatisticMonthQuery) Limit(limit int) *UsageStatisticMonthQuery {
+	usmq.ctx.Limit = &limit
+	return usmq
+}
+
+// Offset to start from.
+func (usmq *UsageStatisticMonthQuery) Offset(offset int) *UsageStatisticMonthQuery {
+	usmq.ctx.Offset = &offset
+	return usmq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (usmq *UsageStatisticMonthQuery) Unique(unique bool) *UsageStatisticMonthQuery {
+	usmq.ctx.Unique = &unique
+	return usmq
+}
+
+// Order specifies how the records should be ordered.
+func (usmq *UsageStatisticMonthQuery) Order(o ...usagestatisticmonth.OrderOption) *UsageStatisticMonthQuery {
+	usmq.order = append(usmq.order, o...)
+	return usmq
+}
+
+// First returns the first UsageStatisticMonth entity from the query.
+// Returns a *NotFoundError when no UsageStatisticMonth was found.
+func (usmq *UsageStatisticMonthQuery) First(ctx context.Context) (*UsageStatisticMonth, error) {
+	nodes, err := usmq.Limit(1).All(setContextOp(ctx, usmq.ctx, "First"))
+	if err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nil, &NotFoundError{usagestatisticmonth.Label}
+	}
+	return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) FirstX(ctx context.Context) *UsageStatisticMonth {
+	node, err := usmq.First(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return node
+}
+
+// FirstID returns the first UsageStatisticMonth ID from the query.
+// Returns a *NotFoundError when no UsageStatisticMonth ID was found.
+func (usmq *UsageStatisticMonthQuery) FirstID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = usmq.Limit(1).IDs(setContextOp(ctx, usmq.ctx, "FirstID")); err != nil {
+		return
+	}
+	if len(ids) == 0 {
+		err = &NotFoundError{usagestatisticmonth.Label}
+		return
+	}
+	return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) FirstIDX(ctx context.Context) uint64 {
+	id, err := usmq.FirstID(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return id
+}
+
+// Only returns a single UsageStatisticMonth entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one UsageStatisticMonth entity is found.
+// Returns a *NotFoundError when no UsageStatisticMonth entities are found.
+func (usmq *UsageStatisticMonthQuery) Only(ctx context.Context) (*UsageStatisticMonth, error) {
+	nodes, err := usmq.Limit(2).All(setContextOp(ctx, usmq.ctx, "Only"))
+	if err != nil {
+		return nil, err
+	}
+	switch len(nodes) {
+	case 1:
+		return nodes[0], nil
+	case 0:
+		return nil, &NotFoundError{usagestatisticmonth.Label}
+	default:
+		return nil, &NotSingularError{usagestatisticmonth.Label}
+	}
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) OnlyX(ctx context.Context) *UsageStatisticMonth {
+	node, err := usmq.Only(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// OnlyID is like Only, but returns the only UsageStatisticMonth ID in the query.
+// Returns a *NotSingularError when more than one UsageStatisticMonth ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (usmq *UsageStatisticMonthQuery) OnlyID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = usmq.Limit(2).IDs(setContextOp(ctx, usmq.ctx, "OnlyID")); err != nil {
+		return
+	}
+	switch len(ids) {
+	case 1:
+		id = ids[0]
+	case 0:
+		err = &NotFoundError{usagestatisticmonth.Label}
+	default:
+		err = &NotSingularError{usagestatisticmonth.Label}
+	}
+	return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) OnlyIDX(ctx context.Context) uint64 {
+	id, err := usmq.OnlyID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// All executes the query and returns a list of UsageStatisticMonths.
+func (usmq *UsageStatisticMonthQuery) All(ctx context.Context) ([]*UsageStatisticMonth, error) {
+	ctx = setContextOp(ctx, usmq.ctx, "All")
+	if err := usmq.prepareQuery(ctx); err != nil {
+		return nil, err
+	}
+	qr := querierAll[[]*UsageStatisticMonth, *UsageStatisticMonthQuery]()
+	return withInterceptors[[]*UsageStatisticMonth](ctx, usmq, qr, usmq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) AllX(ctx context.Context) []*UsageStatisticMonth {
+	nodes, err := usmq.All(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return nodes
+}
+
+// IDs executes the query and returns a list of UsageStatisticMonth IDs.
+func (usmq *UsageStatisticMonthQuery) IDs(ctx context.Context) (ids []uint64, err error) {
+	if usmq.ctx.Unique == nil && usmq.path != nil {
+		usmq.Unique(true)
+	}
+	ctx = setContextOp(ctx, usmq.ctx, "IDs")
+	if err = usmq.Select(usagestatisticmonth.FieldID).Scan(ctx, &ids); err != nil {
+		return nil, err
+	}
+	return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) IDsX(ctx context.Context) []uint64 {
+	ids, err := usmq.IDs(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return ids
+}
+
+// Count returns the count of the given query.
+func (usmq *UsageStatisticMonthQuery) Count(ctx context.Context) (int, error) {
+	ctx = setContextOp(ctx, usmq.ctx, "Count")
+	if err := usmq.prepareQuery(ctx); err != nil {
+		return 0, err
+	}
+	return withInterceptors[int](ctx, usmq, querierCount[*UsageStatisticMonthQuery](), usmq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) CountX(ctx context.Context) int {
+	count, err := usmq.Count(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (usmq *UsageStatisticMonthQuery) Exist(ctx context.Context) (bool, error) {
+	ctx = setContextOp(ctx, usmq.ctx, "Exist")
+	switch _, err := usmq.FirstID(ctx); {
+	case IsNotFound(err):
+		return false, nil
+	case err != nil:
+		return false, fmt.Errorf("ent: check existence: %w", err)
+	default:
+		return true, nil
+	}
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (usmq *UsageStatisticMonthQuery) ExistX(ctx context.Context) bool {
+	exist, err := usmq.Exist(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return exist
+}
+
+// Clone returns a duplicate of the UsageStatisticMonthQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (usmq *UsageStatisticMonthQuery) Clone() *UsageStatisticMonthQuery {
+	if usmq == nil {
+		return nil
+	}
+	return &UsageStatisticMonthQuery{
+		config:     usmq.config,
+		ctx:        usmq.ctx.Clone(),
+		order:      append([]usagestatisticmonth.OrderOption{}, usmq.order...),
+		inters:     append([]Interceptor{}, usmq.inters...),
+		predicates: append([]predicate.UsageStatisticMonth{}, usmq.predicates...),
+		// clone intermediate query.
+		sql:  usmq.sql.Clone(),
+		path: usmq.path,
+	}
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//		Count int `json:"count,omitempty"`
+//	}
+//
+//	client.UsageStatisticMonth.Query().
+//		GroupBy(usagestatisticmonth.FieldCreatedAt).
+//		Aggregate(ent.Count()).
+//		Scan(ctx, &v)
+func (usmq *UsageStatisticMonthQuery) GroupBy(field string, fields ...string) *UsageStatisticMonthGroupBy {
+	usmq.ctx.Fields = append([]string{field}, fields...)
+	grbuild := &UsageStatisticMonthGroupBy{build: usmq}
+	grbuild.flds = &usmq.ctx.Fields
+	grbuild.label = usagestatisticmonth.Label
+	grbuild.scan = grbuild.Scan
+	return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//	}
+//
+//	client.UsageStatisticMonth.Query().
+//		Select(usagestatisticmonth.FieldCreatedAt).
+//		Scan(ctx, &v)
+func (usmq *UsageStatisticMonthQuery) Select(fields ...string) *UsageStatisticMonthSelect {
+	usmq.ctx.Fields = append(usmq.ctx.Fields, fields...)
+	sbuild := &UsageStatisticMonthSelect{UsageStatisticMonthQuery: usmq}
+	sbuild.label = usagestatisticmonth.Label
+	sbuild.flds, sbuild.scan = &usmq.ctx.Fields, sbuild.Scan
+	return sbuild
+}
+
+// Aggregate returns a UsageStatisticMonthSelect configured with the given aggregations.
+func (usmq *UsageStatisticMonthQuery) Aggregate(fns ...AggregateFunc) *UsageStatisticMonthSelect {
+	return usmq.Select().Aggregate(fns...)
+}
+
+func (usmq *UsageStatisticMonthQuery) prepareQuery(ctx context.Context) error {
+	for _, inter := range usmq.inters {
+		if inter == nil {
+			return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+		}
+		if trv, ok := inter.(Traverser); ok {
+			if err := trv.Traverse(ctx, usmq); err != nil {
+				return err
+			}
+		}
+	}
+	for _, f := range usmq.ctx.Fields {
+		if !usagestatisticmonth.ValidColumn(f) {
+			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+		}
+	}
+	if usmq.path != nil {
+		prev, err := usmq.path(ctx)
+		if err != nil {
+			return err
+		}
+		usmq.sql = prev
+	}
+	return nil
+}
+
+func (usmq *UsageStatisticMonthQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*UsageStatisticMonth, error) {
+	var (
+		nodes = []*UsageStatisticMonth{}
+		_spec = usmq.querySpec()
+	)
+	_spec.ScanValues = func(columns []string) ([]any, error) {
+		return (*UsageStatisticMonth).scanValues(nil, columns)
+	}
+	_spec.Assign = func(columns []string, values []any) error {
+		node := &UsageStatisticMonth{config: usmq.config}
+		nodes = append(nodes, node)
+		return node.assignValues(columns, values)
+	}
+	for i := range hooks {
+		hooks[i](ctx, _spec)
+	}
+	if err := sqlgraph.QueryNodes(ctx, usmq.driver, _spec); err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nodes, nil
+	}
+	return nodes, nil
+}
+
+func (usmq *UsageStatisticMonthQuery) sqlCount(ctx context.Context) (int, error) {
+	_spec := usmq.querySpec()
+	_spec.Node.Columns = usmq.ctx.Fields
+	if len(usmq.ctx.Fields) > 0 {
+		_spec.Unique = usmq.ctx.Unique != nil && *usmq.ctx.Unique
+	}
+	return sqlgraph.CountNodes(ctx, usmq.driver, _spec)
+}
+
+func (usmq *UsageStatisticMonthQuery) querySpec() *sqlgraph.QuerySpec {
+	_spec := sqlgraph.NewQuerySpec(usagestatisticmonth.Table, usagestatisticmonth.Columns, sqlgraph.NewFieldSpec(usagestatisticmonth.FieldID, field.TypeUint64))
+	_spec.From = usmq.sql
+	if unique := usmq.ctx.Unique; unique != nil {
+		_spec.Unique = *unique
+	} else if usmq.path != nil {
+		_spec.Unique = true
+	}
+	if fields := usmq.ctx.Fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, usagestatisticmonth.FieldID)
+		for i := range fields {
+			if fields[i] != usagestatisticmonth.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+			}
+		}
+	}
+	if ps := usmq.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if limit := usmq.ctx.Limit; limit != nil {
+		_spec.Limit = *limit
+	}
+	if offset := usmq.ctx.Offset; offset != nil {
+		_spec.Offset = *offset
+	}
+	if ps := usmq.order; len(ps) > 0 {
+		_spec.Order = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	return _spec
+}
+
+func (usmq *UsageStatisticMonthQuery) sqlQuery(ctx context.Context) *sql.Selector {
+	builder := sql.Dialect(usmq.driver.Dialect())
+	t1 := builder.Table(usagestatisticmonth.Table)
+	columns := usmq.ctx.Fields
+	if len(columns) == 0 {
+		columns = usagestatisticmonth.Columns
+	}
+	selector := builder.Select(t1.Columns(columns...)...).From(t1)
+	if usmq.sql != nil {
+		selector = usmq.sql
+		selector.Select(selector.Columns(columns...)...)
+	}
+	if usmq.ctx.Unique != nil && *usmq.ctx.Unique {
+		selector.Distinct()
+	}
+	for _, p := range usmq.predicates {
+		p(selector)
+	}
+	for _, p := range usmq.order {
+		p(selector)
+	}
+	if offset := usmq.ctx.Offset; offset != nil {
+		// limit is mandatory for offset clause. We start
+		// with default value, and override it below if needed.
+		selector.Offset(*offset).Limit(math.MaxInt32)
+	}
+	if limit := usmq.ctx.Limit; limit != nil {
+		selector.Limit(*limit)
+	}
+	return selector
+}
+
+// UsageStatisticMonthGroupBy is the group-by builder for UsageStatisticMonth entities.
+type UsageStatisticMonthGroupBy struct {
+	selector
+	build *UsageStatisticMonthQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (usmgb *UsageStatisticMonthGroupBy) Aggregate(fns ...AggregateFunc) *UsageStatisticMonthGroupBy {
+	usmgb.fns = append(usmgb.fns, fns...)
+	return usmgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (usmgb *UsageStatisticMonthGroupBy) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, usmgb.build.ctx, "GroupBy")
+	if err := usmgb.build.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*UsageStatisticMonthQuery, *UsageStatisticMonthGroupBy](ctx, usmgb.build, usmgb, usmgb.build.inters, v)
+}
+
+func (usmgb *UsageStatisticMonthGroupBy) sqlScan(ctx context.Context, root *UsageStatisticMonthQuery, v any) error {
+	selector := root.sqlQuery(ctx).Select()
+	aggregation := make([]string, 0, len(usmgb.fns))
+	for _, fn := range usmgb.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	if len(selector.SelectedColumns()) == 0 {
+		columns := make([]string, 0, len(*usmgb.flds)+len(usmgb.fns))
+		for _, f := range *usmgb.flds {
+			columns = append(columns, selector.C(f))
+		}
+		columns = append(columns, aggregation...)
+		selector.Select(columns...)
+	}
+	selector.GroupBy(selector.Columns(*usmgb.flds...)...)
+	if err := selector.Err(); err != nil {
+		return err
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := usmgb.build.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}
+
+// UsageStatisticMonthSelect is the builder for selecting fields of UsageStatisticMonth entities.
+type UsageStatisticMonthSelect struct {
+	*UsageStatisticMonthQuery
+	selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (usms *UsageStatisticMonthSelect) Aggregate(fns ...AggregateFunc) *UsageStatisticMonthSelect {
+	usms.fns = append(usms.fns, fns...)
+	return usms
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (usms *UsageStatisticMonthSelect) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, usms.ctx, "Select")
+	if err := usms.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*UsageStatisticMonthQuery, *UsageStatisticMonthSelect](ctx, usms.UsageStatisticMonthQuery, usms, usms.inters, v)
+}
+
+func (usms *UsageStatisticMonthSelect) sqlScan(ctx context.Context, root *UsageStatisticMonthQuery, v any) error {
+	selector := root.sqlQuery(ctx)
+	aggregation := make([]string, 0, len(usms.fns))
+	for _, fn := range usms.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	switch n := len(*usms.selector.flds); {
+	case n == 0 && len(aggregation) > 0:
+		selector.Select(aggregation...)
+	case n != 0 && len(aggregation) > 0:
+		selector.AppendSelect(aggregation...)
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := usms.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}

+ 1054 - 0
ent/usagestatisticmonth_update.go

@@ -0,0 +1,1054 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticmonth"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/dialect/sql/sqljson"
+	"entgo.io/ent/schema/field"
+)
+
+// UsageStatisticMonthUpdate is the builder for updating UsageStatisticMonth entities.
+type UsageStatisticMonthUpdate struct {
+	config
+	hooks    []Hook
+	mutation *UsageStatisticMonthMutation
+}
+
+// Where appends a list predicates to the UsageStatisticMonthUpdate builder.
+func (usmu *UsageStatisticMonthUpdate) Where(ps ...predicate.UsageStatisticMonth) *UsageStatisticMonthUpdate {
+	usmu.mutation.Where(ps...)
+	return usmu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (usmu *UsageStatisticMonthUpdate) SetUpdatedAt(t time.Time) *UsageStatisticMonthUpdate {
+	usmu.mutation.SetUpdatedAt(t)
+	return usmu
+}
+
+// SetStatus sets the "status" field.
+func (usmu *UsageStatisticMonthUpdate) SetStatus(u uint8) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetStatus()
+	usmu.mutation.SetStatus(u)
+	return usmu
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableStatus(u *uint8) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetStatus(*u)
+	}
+	return usmu
+}
+
+// AddStatus adds u to the "status" field.
+func (usmu *UsageStatisticMonthUpdate) AddStatus(u int8) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddStatus(u)
+	return usmu
+}
+
+// ClearStatus clears the value of the "status" field.
+func (usmu *UsageStatisticMonthUpdate) ClearStatus() *UsageStatisticMonthUpdate {
+	usmu.mutation.ClearStatus()
+	return usmu
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (usmu *UsageStatisticMonthUpdate) SetDeletedAt(t time.Time) *UsageStatisticMonthUpdate {
+	usmu.mutation.SetDeletedAt(t)
+	return usmu
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableDeletedAt(t *time.Time) *UsageStatisticMonthUpdate {
+	if t != nil {
+		usmu.SetDeletedAt(*t)
+	}
+	return usmu
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (usmu *UsageStatisticMonthUpdate) ClearDeletedAt() *UsageStatisticMonthUpdate {
+	usmu.mutation.ClearDeletedAt()
+	return usmu
+}
+
+// SetAddtime sets the "addtime" field.
+func (usmu *UsageStatisticMonthUpdate) SetAddtime(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetAddtime()
+	usmu.mutation.SetAddtime(u)
+	return usmu
+}
+
+// SetNillableAddtime sets the "addtime" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableAddtime(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetAddtime(*u)
+	}
+	return usmu
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (usmu *UsageStatisticMonthUpdate) AddAddtime(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddAddtime(u)
+	return usmu
+}
+
+// SetType sets the "type" field.
+func (usmu *UsageStatisticMonthUpdate) SetType(i int) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetType()
+	usmu.mutation.SetType(i)
+	return usmu
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableType(i *int) *UsageStatisticMonthUpdate {
+	if i != nil {
+		usmu.SetType(*i)
+	}
+	return usmu
+}
+
+// AddType adds i to the "type" field.
+func (usmu *UsageStatisticMonthUpdate) AddType(i int) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddType(i)
+	return usmu
+}
+
+// SetBotID sets the "bot_id" field.
+func (usmu *UsageStatisticMonthUpdate) SetBotID(s string) *UsageStatisticMonthUpdate {
+	usmu.mutation.SetBotID(s)
+	return usmu
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableBotID(s *string) *UsageStatisticMonthUpdate {
+	if s != nil {
+		usmu.SetBotID(*s)
+	}
+	return usmu
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (usmu *UsageStatisticMonthUpdate) ClearBotID() *UsageStatisticMonthUpdate {
+	usmu.mutation.ClearBotID()
+	return usmu
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (usmu *UsageStatisticMonthUpdate) SetOrganizationID(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetOrganizationID()
+	usmu.mutation.SetOrganizationID(u)
+	return usmu
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableOrganizationID(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetOrganizationID(*u)
+	}
+	return usmu
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (usmu *UsageStatisticMonthUpdate) AddOrganizationID(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddOrganizationID(u)
+	return usmu
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (usmu *UsageStatisticMonthUpdate) ClearOrganizationID() *UsageStatisticMonthUpdate {
+	usmu.mutation.ClearOrganizationID()
+	return usmu
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (usmu *UsageStatisticMonthUpdate) SetAiResponse(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetAiResponse()
+	usmu.mutation.SetAiResponse(u)
+	return usmu
+}
+
+// SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableAiResponse(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetAiResponse(*u)
+	}
+	return usmu
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (usmu *UsageStatisticMonthUpdate) AddAiResponse(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddAiResponse(u)
+	return usmu
+}
+
+// SetSopRun sets the "sop_run" field.
+func (usmu *UsageStatisticMonthUpdate) SetSopRun(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetSopRun()
+	usmu.mutation.SetSopRun(u)
+	return usmu
+}
+
+// SetNillableSopRun sets the "sop_run" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableSopRun(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetSopRun(*u)
+	}
+	return usmu
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (usmu *UsageStatisticMonthUpdate) AddSopRun(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddSopRun(u)
+	return usmu
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (usmu *UsageStatisticMonthUpdate) SetTotalFriend(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetTotalFriend()
+	usmu.mutation.SetTotalFriend(u)
+	return usmu
+}
+
+// SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableTotalFriend(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetTotalFriend(*u)
+	}
+	return usmu
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (usmu *UsageStatisticMonthUpdate) AddTotalFriend(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddTotalFriend(u)
+	return usmu
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (usmu *UsageStatisticMonthUpdate) SetTotalGroup(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetTotalGroup()
+	usmu.mutation.SetTotalGroup(u)
+	return usmu
+}
+
+// SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableTotalGroup(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetTotalGroup(*u)
+	}
+	return usmu
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (usmu *UsageStatisticMonthUpdate) AddTotalGroup(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddTotalGroup(u)
+	return usmu
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (usmu *UsageStatisticMonthUpdate) SetAccountBalance(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetAccountBalance()
+	usmu.mutation.SetAccountBalance(u)
+	return usmu
+}
+
+// SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableAccountBalance(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetAccountBalance(*u)
+	}
+	return usmu
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (usmu *UsageStatisticMonthUpdate) AddAccountBalance(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddAccountBalance(u)
+	return usmu
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (usmu *UsageStatisticMonthUpdate) SetConsumeToken(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetConsumeToken()
+	usmu.mutation.SetConsumeToken(u)
+	return usmu
+}
+
+// SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableConsumeToken(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetConsumeToken(*u)
+	}
+	return usmu
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (usmu *UsageStatisticMonthUpdate) AddConsumeToken(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddConsumeToken(u)
+	return usmu
+}
+
+// SetActiveUser sets the "active_user" field.
+func (usmu *UsageStatisticMonthUpdate) SetActiveUser(u uint64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetActiveUser()
+	usmu.mutation.SetActiveUser(u)
+	return usmu
+}
+
+// SetNillableActiveUser sets the "active_user" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableActiveUser(u *uint64) *UsageStatisticMonthUpdate {
+	if u != nil {
+		usmu.SetActiveUser(*u)
+	}
+	return usmu
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (usmu *UsageStatisticMonthUpdate) AddActiveUser(u int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddActiveUser(u)
+	return usmu
+}
+
+// SetNewUser sets the "new_user" field.
+func (usmu *UsageStatisticMonthUpdate) SetNewUser(i int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.ResetNewUser()
+	usmu.mutation.SetNewUser(i)
+	return usmu
+}
+
+// SetNillableNewUser sets the "new_user" field if the given value is not nil.
+func (usmu *UsageStatisticMonthUpdate) SetNillableNewUser(i *int64) *UsageStatisticMonthUpdate {
+	if i != nil {
+		usmu.SetNewUser(*i)
+	}
+	return usmu
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (usmu *UsageStatisticMonthUpdate) AddNewUser(i int64) *UsageStatisticMonthUpdate {
+	usmu.mutation.AddNewUser(i)
+	return usmu
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (usmu *UsageStatisticMonthUpdate) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticMonthUpdate {
+	usmu.mutation.SetLabelDist(ctd)
+	return usmu
+}
+
+// AppendLabelDist appends ctd to the "label_dist" field.
+func (usmu *UsageStatisticMonthUpdate) AppendLabelDist(ctd []custom_types.LabelDist) *UsageStatisticMonthUpdate {
+	usmu.mutation.AppendLabelDist(ctd)
+	return usmu
+}
+
+// Mutation returns the UsageStatisticMonthMutation object of the builder.
+func (usmu *UsageStatisticMonthUpdate) Mutation() *UsageStatisticMonthMutation {
+	return usmu.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (usmu *UsageStatisticMonthUpdate) Save(ctx context.Context) (int, error) {
+	if err := usmu.defaults(); err != nil {
+		return 0, err
+	}
+	return withHooks(ctx, usmu.sqlSave, usmu.mutation, usmu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (usmu *UsageStatisticMonthUpdate) SaveX(ctx context.Context) int {
+	affected, err := usmu.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return affected
+}
+
+// Exec executes the query.
+func (usmu *UsageStatisticMonthUpdate) Exec(ctx context.Context) error {
+	_, err := usmu.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usmu *UsageStatisticMonthUpdate) ExecX(ctx context.Context) {
+	if err := usmu.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (usmu *UsageStatisticMonthUpdate) defaults() error {
+	if _, ok := usmu.mutation.UpdatedAt(); !ok {
+		if usagestatisticmonth.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticmonth.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticmonth.UpdateDefaultUpdatedAt()
+		usmu.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (usmu *UsageStatisticMonthUpdate) sqlSave(ctx context.Context) (n int, err error) {
+	_spec := sqlgraph.NewUpdateSpec(usagestatisticmonth.Table, usagestatisticmonth.Columns, sqlgraph.NewFieldSpec(usagestatisticmonth.FieldID, field.TypeUint64))
+	if ps := usmu.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := usmu.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatisticmonth.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := usmu.mutation.Status(); ok {
+		_spec.SetField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := usmu.mutation.AddedStatus(); ok {
+		_spec.AddField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
+	}
+	if usmu.mutation.StatusCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := usmu.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatisticmonth.FieldDeletedAt, field.TypeTime, value)
+	}
+	if usmu.mutation.DeletedAtCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := usmu.mutation.Addtime(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedAddtime(); ok {
+		_spec.AddField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.GetType(); ok {
+		_spec.SetField(usagestatisticmonth.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usmu.mutation.AddedType(); ok {
+		_spec.AddField(usagestatisticmonth.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usmu.mutation.BotID(); ok {
+		_spec.SetField(usagestatisticmonth.FieldBotID, field.TypeString, value)
+	}
+	if usmu.mutation.BotIDCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldBotID, field.TypeString)
+	}
+	if value, ok := usmu.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if usmu.mutation.OrganizationIDCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64)
+	}
+	if value, ok := usmu.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedAiResponse(); ok {
+		_spec.AddField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.SopRun(); ok {
+		_spec.SetField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedSopRun(); ok {
+		_spec.AddField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedTotalFriend(); ok {
+		_spec.AddField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedTotalGroup(); ok {
+		_spec.AddField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedAccountBalance(); ok {
+		_spec.AddField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedConsumeToken(); ok {
+		_spec.AddField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.AddedActiveUser(); ok {
+		_spec.AddField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usmu.mutation.NewUser(); ok {
+		_spec.SetField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usmu.mutation.AddedNewUser(); ok {
+		_spec.AddField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usmu.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatisticmonth.FieldLabelDist, field.TypeJSON, value)
+	}
+	if value, ok := usmu.mutation.AppendedLabelDist(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, usagestatisticmonth.FieldLabelDist, value)
+		})
+	}
+	if n, err = sqlgraph.UpdateNodes(ctx, usmu.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{usagestatisticmonth.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return 0, err
+	}
+	usmu.mutation.done = true
+	return n, nil
+}
+
+// UsageStatisticMonthUpdateOne is the builder for updating a single UsageStatisticMonth entity.
+type UsageStatisticMonthUpdateOne struct {
+	config
+	fields   []string
+	hooks    []Hook
+	mutation *UsageStatisticMonthMutation
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetUpdatedAt(t time.Time) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.SetUpdatedAt(t)
+	return usmuo
+}
+
+// SetStatus sets the "status" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetStatus(u uint8) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetStatus()
+	usmuo.mutation.SetStatus(u)
+	return usmuo
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableStatus(u *uint8) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetStatus(*u)
+	}
+	return usmuo
+}
+
+// AddStatus adds u to the "status" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddStatus(u int8) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddStatus(u)
+	return usmuo
+}
+
+// ClearStatus clears the value of the "status" field.
+func (usmuo *UsageStatisticMonthUpdateOne) ClearStatus() *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ClearStatus()
+	return usmuo
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetDeletedAt(t time.Time) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.SetDeletedAt(t)
+	return usmuo
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableDeletedAt(t *time.Time) *UsageStatisticMonthUpdateOne {
+	if t != nil {
+		usmuo.SetDeletedAt(*t)
+	}
+	return usmuo
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (usmuo *UsageStatisticMonthUpdateOne) ClearDeletedAt() *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ClearDeletedAt()
+	return usmuo
+}
+
+// SetAddtime sets the "addtime" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetAddtime(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetAddtime()
+	usmuo.mutation.SetAddtime(u)
+	return usmuo
+}
+
+// SetNillableAddtime sets the "addtime" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableAddtime(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetAddtime(*u)
+	}
+	return usmuo
+}
+
+// AddAddtime adds u to the "addtime" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddAddtime(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddAddtime(u)
+	return usmuo
+}
+
+// SetType sets the "type" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetType(i int) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetType()
+	usmuo.mutation.SetType(i)
+	return usmuo
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableType(i *int) *UsageStatisticMonthUpdateOne {
+	if i != nil {
+		usmuo.SetType(*i)
+	}
+	return usmuo
+}
+
+// AddType adds i to the "type" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddType(i int) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddType(i)
+	return usmuo
+}
+
+// SetBotID sets the "bot_id" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetBotID(s string) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.SetBotID(s)
+	return usmuo
+}
+
+// SetNillableBotID sets the "bot_id" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableBotID(s *string) *UsageStatisticMonthUpdateOne {
+	if s != nil {
+		usmuo.SetBotID(*s)
+	}
+	return usmuo
+}
+
+// ClearBotID clears the value of the "bot_id" field.
+func (usmuo *UsageStatisticMonthUpdateOne) ClearBotID() *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ClearBotID()
+	return usmuo
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetOrganizationID(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetOrganizationID()
+	usmuo.mutation.SetOrganizationID(u)
+	return usmuo
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableOrganizationID(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetOrganizationID(*u)
+	}
+	return usmuo
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddOrganizationID(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddOrganizationID(u)
+	return usmuo
+}
+
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (usmuo *UsageStatisticMonthUpdateOne) ClearOrganizationID() *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ClearOrganizationID()
+	return usmuo
+}
+
+// SetAiResponse sets the "ai_response" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetAiResponse(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetAiResponse()
+	usmuo.mutation.SetAiResponse(u)
+	return usmuo
+}
+
+// SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableAiResponse(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetAiResponse(*u)
+	}
+	return usmuo
+}
+
+// AddAiResponse adds u to the "ai_response" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddAiResponse(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddAiResponse(u)
+	return usmuo
+}
+
+// SetSopRun sets the "sop_run" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetSopRun(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetSopRun()
+	usmuo.mutation.SetSopRun(u)
+	return usmuo
+}
+
+// SetNillableSopRun sets the "sop_run" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableSopRun(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetSopRun(*u)
+	}
+	return usmuo
+}
+
+// AddSopRun adds u to the "sop_run" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddSopRun(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddSopRun(u)
+	return usmuo
+}
+
+// SetTotalFriend sets the "total_friend" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetTotalFriend(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetTotalFriend()
+	usmuo.mutation.SetTotalFriend(u)
+	return usmuo
+}
+
+// SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableTotalFriend(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetTotalFriend(*u)
+	}
+	return usmuo
+}
+
+// AddTotalFriend adds u to the "total_friend" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddTotalFriend(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddTotalFriend(u)
+	return usmuo
+}
+
+// SetTotalGroup sets the "total_group" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetTotalGroup(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetTotalGroup()
+	usmuo.mutation.SetTotalGroup(u)
+	return usmuo
+}
+
+// SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableTotalGroup(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetTotalGroup(*u)
+	}
+	return usmuo
+}
+
+// AddTotalGroup adds u to the "total_group" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddTotalGroup(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddTotalGroup(u)
+	return usmuo
+}
+
+// SetAccountBalance sets the "account_balance" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetAccountBalance(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetAccountBalance()
+	usmuo.mutation.SetAccountBalance(u)
+	return usmuo
+}
+
+// SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableAccountBalance(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetAccountBalance(*u)
+	}
+	return usmuo
+}
+
+// AddAccountBalance adds u to the "account_balance" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddAccountBalance(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddAccountBalance(u)
+	return usmuo
+}
+
+// SetConsumeToken sets the "consume_token" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetConsumeToken(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetConsumeToken()
+	usmuo.mutation.SetConsumeToken(u)
+	return usmuo
+}
+
+// SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableConsumeToken(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetConsumeToken(*u)
+	}
+	return usmuo
+}
+
+// AddConsumeToken adds u to the "consume_token" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddConsumeToken(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddConsumeToken(u)
+	return usmuo
+}
+
+// SetActiveUser sets the "active_user" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetActiveUser(u uint64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetActiveUser()
+	usmuo.mutation.SetActiveUser(u)
+	return usmuo
+}
+
+// SetNillableActiveUser sets the "active_user" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableActiveUser(u *uint64) *UsageStatisticMonthUpdateOne {
+	if u != nil {
+		usmuo.SetActiveUser(*u)
+	}
+	return usmuo
+}
+
+// AddActiveUser adds u to the "active_user" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddActiveUser(u int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddActiveUser(u)
+	return usmuo
+}
+
+// SetNewUser sets the "new_user" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNewUser(i int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.ResetNewUser()
+	usmuo.mutation.SetNewUser(i)
+	return usmuo
+}
+
+// SetNillableNewUser sets the "new_user" field if the given value is not nil.
+func (usmuo *UsageStatisticMonthUpdateOne) SetNillableNewUser(i *int64) *UsageStatisticMonthUpdateOne {
+	if i != nil {
+		usmuo.SetNewUser(*i)
+	}
+	return usmuo
+}
+
+// AddNewUser adds i to the "new_user" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AddNewUser(i int64) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AddNewUser(i)
+	return usmuo
+}
+
+// SetLabelDist sets the "label_dist" field.
+func (usmuo *UsageStatisticMonthUpdateOne) SetLabelDist(ctd []custom_types.LabelDist) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.SetLabelDist(ctd)
+	return usmuo
+}
+
+// AppendLabelDist appends ctd to the "label_dist" field.
+func (usmuo *UsageStatisticMonthUpdateOne) AppendLabelDist(ctd []custom_types.LabelDist) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.AppendLabelDist(ctd)
+	return usmuo
+}
+
+// Mutation returns the UsageStatisticMonthMutation object of the builder.
+func (usmuo *UsageStatisticMonthUpdateOne) Mutation() *UsageStatisticMonthMutation {
+	return usmuo.mutation
+}
+
+// Where appends a list predicates to the UsageStatisticMonthUpdate builder.
+func (usmuo *UsageStatisticMonthUpdateOne) Where(ps ...predicate.UsageStatisticMonth) *UsageStatisticMonthUpdateOne {
+	usmuo.mutation.Where(ps...)
+	return usmuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (usmuo *UsageStatisticMonthUpdateOne) Select(field string, fields ...string) *UsageStatisticMonthUpdateOne {
+	usmuo.fields = append([]string{field}, fields...)
+	return usmuo
+}
+
+// Save executes the query and returns the updated UsageStatisticMonth entity.
+func (usmuo *UsageStatisticMonthUpdateOne) Save(ctx context.Context) (*UsageStatisticMonth, error) {
+	if err := usmuo.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, usmuo.sqlSave, usmuo.mutation, usmuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (usmuo *UsageStatisticMonthUpdateOne) SaveX(ctx context.Context) *UsageStatisticMonth {
+	node, err := usmuo.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// Exec executes the query on the entity.
+func (usmuo *UsageStatisticMonthUpdateOne) Exec(ctx context.Context) error {
+	_, err := usmuo.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (usmuo *UsageStatisticMonthUpdateOne) ExecX(ctx context.Context) {
+	if err := usmuo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (usmuo *UsageStatisticMonthUpdateOne) defaults() error {
+	if _, ok := usmuo.mutation.UpdatedAt(); !ok {
+		if usagestatisticmonth.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized usagestatisticmonth.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := usagestatisticmonth.UpdateDefaultUpdatedAt()
+		usmuo.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (usmuo *UsageStatisticMonthUpdateOne) sqlSave(ctx context.Context) (_node *UsageStatisticMonth, err error) {
+	_spec := sqlgraph.NewUpdateSpec(usagestatisticmonth.Table, usagestatisticmonth.Columns, sqlgraph.NewFieldSpec(usagestatisticmonth.FieldID, field.TypeUint64))
+	id, ok := usmuo.mutation.ID()
+	if !ok {
+		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "UsageStatisticMonth.id" for update`)}
+	}
+	_spec.Node.ID.Value = id
+	if fields := usmuo.fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, usagestatisticmonth.FieldID)
+		for _, f := range fields {
+			if !usagestatisticmonth.ValidColumn(f) {
+				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+			}
+			if f != usagestatisticmonth.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, f)
+			}
+		}
+	}
+	if ps := usmuo.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := usmuo.mutation.UpdatedAt(); ok {
+		_spec.SetField(usagestatisticmonth.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := usmuo.mutation.Status(); ok {
+		_spec.SetField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := usmuo.mutation.AddedStatus(); ok {
+		_spec.AddField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
+	}
+	if usmuo.mutation.StatusCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := usmuo.mutation.DeletedAt(); ok {
+		_spec.SetField(usagestatisticmonth.FieldDeletedAt, field.TypeTime, value)
+	}
+	if usmuo.mutation.DeletedAtCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := usmuo.mutation.Addtime(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedAddtime(); ok {
+		_spec.AddField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.GetType(); ok {
+		_spec.SetField(usagestatisticmonth.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usmuo.mutation.AddedType(); ok {
+		_spec.AddField(usagestatisticmonth.FieldType, field.TypeInt, value)
+	}
+	if value, ok := usmuo.mutation.BotID(); ok {
+		_spec.SetField(usagestatisticmonth.FieldBotID, field.TypeString, value)
+	}
+	if usmuo.mutation.BotIDCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldBotID, field.TypeString)
+	}
+	if value, ok := usmuo.mutation.OrganizationID(); ok {
+		_spec.SetField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if usmuo.mutation.OrganizationIDCleared() {
+		_spec.ClearField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64)
+	}
+	if value, ok := usmuo.mutation.AiResponse(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedAiResponse(); ok {
+		_spec.AddField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.SopRun(); ok {
+		_spec.SetField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedSopRun(); ok {
+		_spec.AddField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.TotalFriend(); ok {
+		_spec.SetField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedTotalFriend(); ok {
+		_spec.AddField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.TotalGroup(); ok {
+		_spec.SetField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedTotalGroup(); ok {
+		_spec.AddField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AccountBalance(); ok {
+		_spec.SetField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedAccountBalance(); ok {
+		_spec.AddField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.ConsumeToken(); ok {
+		_spec.SetField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedConsumeToken(); ok {
+		_spec.AddField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.ActiveUser(); ok {
+		_spec.SetField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.AddedActiveUser(); ok {
+		_spec.AddField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
+	}
+	if value, ok := usmuo.mutation.NewUser(); ok {
+		_spec.SetField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usmuo.mutation.AddedNewUser(); ok {
+		_spec.AddField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
+	}
+	if value, ok := usmuo.mutation.LabelDist(); ok {
+		_spec.SetField(usagestatisticmonth.FieldLabelDist, field.TypeJSON, value)
+	}
+	if value, ok := usmuo.mutation.AppendedLabelDist(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, usagestatisticmonth.FieldLabelDist, value)
+		})
+	}
+	_node = &UsageStatisticMonth{config: usmuo.config}
+	_spec.Assign = _node.assignValues
+	_spec.ScanValues = _node.scanValues
+	if err = sqlgraph.UpdateNode(ctx, usmuo.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{usagestatisticmonth.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	usmuo.mutation.done = true
+	return _node, nil
+}

+ 0 - 83
etc/wechat-docker.yaml

@@ -1,83 +0,0 @@
-Name: Wechat.api
-Host: 0.0.0.0
-Port: 19101
-Timeout: 30000
-
-Mode: "dev"
-
-Auth:
-  AccessSecret: LnQD46hBde0AgFXBer8ZZZe3FgC
-  AccessExpire: 259200
-
-CROSConf:
-  Address: '*'
-
-Log:
-  ServiceName: WechatApiLogger
-  Mode: console
-  Encoding: plain
-  Stat: false
-  Path: /tmp
-  Level: info
-  Compress: false
-  KeepDays: 7
-  StackCoolDownMillis: 100
-
-DatabaseConf:
-  Type: mysql
-  Host: scrm-mysql
-  Port: 3306
-  DBName: wechat
-  Username: root
-  Password: simple-admin.
-  MaxOpenConn: 100
-  SSLMode: disable
-  CacheTime: 5
-
-CoreRpc:
-  # Target: k8s://default/core-rpc-svc:9101
-  Endpoints:
-    - core-rpc:9101
-  Enabled: true
-
-RedisConf:
-  Host: scrm-redis:6379
-
-CasbinDatabaseConf:
-  Type: mysql
-  Host: scrm-mysql
-  Port: 3306
-  DBName: wechat-admin
-  Username: root
-  Password: simple-admin.
-  MaxOpenConn: 100
-  SSLMode: disable
-  CacheTime: 5
-
-CasbinConf:
-  ModelText: |
-    [request_definition]
-    r = sub, obj, act
-    [policy_definition]
-    p = sub, obj, act
-    [role_definition]
-    g = _, _
-    [policy_effect]
-    e = some(where (p.eft == allow))
-    [matchers]
-    m = r.sub == p.sub && keyMatch2(r.obj,p.obj) && r.act == p.act
-
-Miniprogram:
-  Appid: wx1452f34bba8fe718
-  Secret: 171fdab212fdde0d51b59fa59c9ee070
-  redisaddr: scrm-redis:6379
-
-Aliyun:
-  ACCESS_KEY_ID: LTAI5tSJwCQyuaxXR3UxfnWw
-  ACCESS_KEY_SECRET: 0pv4xhSPJv9IPSxrkB52FspJk27W7V
-  OSS_ENDPOINT: sts.cn-beijing.aliyuncs.com
-  OSS_ROLEARN: acs:ram::1317798064750399:role/ramoss
-
-Fastgpt:
-  BASE_URL: http://new-api.gkscrm.com/v1
-  API_KEY: sk-ZQRNypQOC8ID5WbpCdF263C58dF44271842e86D408Bb3848

+ 2 - 1
go.mod

@@ -18,6 +18,7 @@ require (
 	github.com/imroc/req/v3 v3.43.1
 	github.com/redis/go-redis/v9 v9.6.1
 	github.com/robfig/cron/v3 v3.0.1
+	github.com/russross/blackfriday v1.6.0
 	github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d
 	github.com/sashabaranov/go-openai v1.31.0
 	github.com/speps/go-hashids/v2 v2.0.1
@@ -25,6 +26,7 @@ require (
 	github.com/suyuan32/simple-admin-common v1.3.11
 	github.com/suyuan32/simple-admin-core v1.3.11
 	github.com/zeromicro/go-zero v1.6.3
+	golang.org/x/crypto v0.27.0
 	golang.org/x/text v0.18.0
 	google.golang.org/protobuf v1.35.2
 )
@@ -137,7 +139,6 @@ require (
 	go.uber.org/mock v0.4.0 // indirect
 	go.uber.org/multierr v1.11.0 // indirect
 	go.uber.org/zap v1.27.0 // indirect
-	golang.org/x/crypto v0.27.0 // indirect
 	golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
 	golang.org/x/mod v0.17.0 // indirect
 	golang.org/x/net v0.29.0 // indirect

+ 2 - 0
go.sum

@@ -545,6 +545,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
 github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
 github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
 github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
+github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
+github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
 github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d h1:hrujxIzL1woJ7AwssoOcM/tq5JjjG2yYOc8odClEiXA=

+ 1 - 0
internal/config/config.go

@@ -20,4 +20,5 @@ type Config struct {
 	Fastgpt            types.Fastgpt
 	Aliyun             types.Aliyun
 	CoreRpc            zrpc.RpcClientConf
+	Xiaoice            types.Xiaoice
 }

+ 44 - 0
internal/handler/dashboard/get_charts_handler.go

@@ -0,0 +1,44 @@
+package dashboard
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/dashboard"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route post /dashboard/charts dashboard GetCharts
+//
+// get charts | 获取图表数据
+//
+// get charts | 获取图表数据
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: ChartsReq
+//
+// Responses:
+//  200: ChartsResp
+
+func GetChartsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ChartsReq
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := dashboard.NewGetChartsLogic(r.Context(), svcCtx)
+		resp, err := l.GetCharts(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 44 - 0
internal/handler/dashboard/get_wxs_handler.go

@@ -0,0 +1,44 @@
+package dashboard
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/dashboard"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route post /dashboard/wx dashboard GetWxs
+//
+// get wxs | 获取图表数据
+//
+// get wxs | 获取图表数据
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: WxReq
+//
+// Responses:
+//  200: WxResp
+
+func GetWxsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.WxReq
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := dashboard.NewGetWxsLogic(r.Context(), svcCtx)
+		resp, err := l.GetWxs(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 36 - 0
internal/handler/routes.go

@@ -25,6 +25,7 @@ import (
 	chatrecords "wechat-api/internal/handler/chatrecords"
 	chatsession "wechat-api/internal/handler/chatsession"
 	contact "wechat-api/internal/handler/contact"
+	dashboard "wechat-api/internal/handler/dashboard"
 	employee "wechat-api/internal/handler/employee"
 	employee_config "wechat-api/internal/handler/employee_config"
 	label "wechat-api/internal/handler/label"
@@ -40,6 +41,7 @@ import (
 	wxcard "wechat-api/internal/handler/wxcard"
 	wxcarduser "wechat-api/internal/handler/wxcarduser"
 	wxcardvisit "wechat-api/internal/handler/wxcardvisit"
+	xiaoice "wechat-api/internal/handler/xiaoice"
 	"wechat-api/internal/svc"
 
 	"github.com/zeromicro/go-zero/rest"
@@ -1551,4 +1553,38 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 		),
 		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
 	)
+
+	server.AddRoutes(
+		[]rest.Route{
+			{
+				Method:  http.MethodGet,
+				Path:    "/api/xiaoice/signature",
+				Handler: xiaoice.SignatureGenHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/api/xiaoice/message",
+				Handler: xiaoice.GptbotsMessageHandler(serverCtx),
+			},
+		},
+	)
+
+	server.AddRoutes(
+		rest.WithMiddlewares(
+			[]rest.Middleware{serverCtx.Authority},
+			[]rest.Route{
+				{
+					Method:  http.MethodPost,
+					Path:    "/dashboard/charts",
+					Handler: dashboard.GetChartsHandler(serverCtx),
+				},
+				{
+					Method:  http.MethodPost,
+					Path:    "/dashboard/wx",
+					Handler: dashboard.GetWxsHandler(serverCtx),
+				},
+			}...,
+		),
+		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
+	)
 }

+ 44 - 0
internal/handler/xiaoice/gptbots_message_handler.go

@@ -0,0 +1,44 @@
+package xiaoice
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/xiaoice"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route get /api/xiaoice/message xiaoice GptbotsMessage
+//
+// gen gptbots | 调用gptbots
+//
+// gen gptbots | 调用gptbots
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: MessageReq
+//
+// Responses:
+//  200: MessageResp
+
+func GptbotsMessageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.MessageReq
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := xiaoice.NewGptbotsMessageLogic(r.Context(), svcCtx)
+		resp, err := l.GptbotsMessage(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 31 - 0
internal/handler/xiaoice/signature_gen_handler.go

@@ -0,0 +1,31 @@
+package xiaoice
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/xiaoice"
+	"wechat-api/internal/svc"
+)
+
+// swagger:route post /api/xiaoice/signature xiaoice SignatureGen
+//
+// get xiaoice signature | 获取小冰签名
+//
+// get xiaoice signature | 获取小冰签名
+//
+// Responses:
+//  200: SignatureResp
+
+func SignatureGenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		l := xiaoice.NewSignatureGenLogic(r.Context(), svcCtx)
+		resp, err := l.SignatureGen()
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 6 - 0
internal/logic/Wx/create_wx_logic.go

@@ -65,6 +65,8 @@ func (l *CreateWxLogic) CreateWx(req *types.WxInfo) (*types.BaseMsgResp, error)
 		return nil, err
 	}
 
+	var stringSlice []string
+
 	if ent.IsNotFound(err) {
 		wxid := strconv.Itoa(rand.New(rand.NewSource(time.Now().UnixNano())).Intn(1000000))
 		_, err := l.svcCtx.DB.Wx.Create().
@@ -76,6 +78,10 @@ func (l *CreateWxLogic) CreateWx(req *types.WxInfo) (*types.BaseMsgResp, error)
 			SetNotNilAPIKey(req.ApiKey).
 			SetWxid(wxid).
 			SetStatus(0).
+			SetAllowList(stringSlice).
+			SetGroupAllowList(stringSlice).
+			SetBlockList(stringSlice).
+			SetGroupBlockList(stringSlice).
 			Save(l.ctx)
 		if err != nil {
 			return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)

+ 1 - 6
internal/logic/chatrecords/gpts_submit_api_chat_logic.go

@@ -51,7 +51,7 @@ func (l *GptsSubmitApiChatLogic) GptsSubmitApiChat(tokenStr string, req *types.G
 
 	userId := claims["userId"].(string) //用户的uuid
 	departmentId := claims["deptId"].(float64)
-	fmt.Println(userId, departmentId, departmentId == float64(15))
+	//fmt.Println(userId, departmentId, departmentId == float64(15))
 	if departmentId == float64(15) {
 	} else {
 		jsonData := ChatMessage{}
@@ -124,11 +124,6 @@ func (l *GptsSubmitApiChatLogic) GptsSubmitApiChat(tokenStr string, req *types.G
 				finish = true
 			}
 
-			// 将 ConversationId 与 sessionId 建立关联关系
-			if chatData.ConversationId != "" {
-
-			}
-
 			jsonData := ChatMessage{}
 			jsonData.Id = chatData.Id
 			//jsonData.SessionId = c

+ 354 - 0
internal/logic/dashboard/get_charts_logic.go

@@ -0,0 +1,354 @@
+package dashboard
+
+import (
+	"context"
+	"fmt"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"strconv"
+	"time"
+	"wechat-api/ent/custom_types"
+	"wechat-api/ent/label"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetChartsLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetChartsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChartsLogic {
+	return &GetChartsLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+type SumUint struct {
+	Addtime uint64 `json:"addtime"`
+	Value   uint64 `json:"value"`
+}
+
+type SumInt struct {
+	Addtime uint64 `json:"addtime"`
+	Value   int64  `json:"value"`
+}
+
+func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp, err error) {
+	// 获取组织id
+	var organizationId uint64 = 0
+	isAdmin := l.ctx.Value("isAdmin").(bool)
+	if isAdmin && req.OrganizationId != nil && *req.OrganizationId != 0 {
+		if req.OrganizationId != nil && *req.OrganizationId != 0 {
+			organizationId = *req.OrganizationId
+		}
+	} else {
+		organizationId = l.ctx.Value("organizationId").(uint64)
+	}
+
+	// 解析起始和截止时间
+	layouts := []string{
+		"2006-01",    // 对应 "2024-01"
+		"2006-01-02", // 对应 "2024-01-01"
+	}
+
+	var layoutsType int
+
+	var startTime time.Time
+	for i, layout := range layouts {
+		startTime, err = time.Parse(layout, *req.StartDate)
+		layoutsType = i
+		if err == nil {
+			break
+		}
+	}
+
+	if err != nil {
+		fmt.Println("解析开始时间失败:", err)
+		return
+	}
+
+	var endTime time.Time
+	for _, layout := range layouts {
+		endTime, err = time.Parse(layout, *req.EndDate)
+		if err == nil {
+			break
+		}
+	}
+	if err != nil {
+		fmt.Println("解析结束时间失败:", err)
+		return
+	}
+
+	// 判断截止日期是否包含当前日
+	var isCurrentDay bool
+	now := time.Now()
+
+	if layoutsType == 0 {
+		isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month()
+	} else {
+		isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month() && endTime.Day() == now.Day()
+	}
+
+	// 定义变量
+	aiResponse := types.ChartsUint{}
+	sopRun := types.ChartsUint{}
+	totalFriend := types.ChartsUint{}
+	totalGroup := types.ChartsUint{}
+	accountBalance := types.ChartsUint{}
+	consumeToken := types.ChartsUint{}
+	activeUser := types.ChartsUint{}
+	newUser := types.ChartsInt{}
+	var labelDists []custom_types.LabelDist
+
+	if isCurrentDay && layoutsType == 1 && req.StartDate == req.EndDate {
+		// 返回当日每小时的数据
+		startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
+		startAddTimeString := startOfDay.Format("2006010200")
+		startAddTime, err := strconv.ParseUint(startAddTimeString, 10, 64)
+		if err != nil {
+			fmt.Println("转换开始时间失败:", err)
+			return nil, err
+		}
+
+		var predicates []predicate.UsageStatisticHour
+		if organizationId != 0 {
+			predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
+		}
+		predicates = append(predicates, usagestatistichour.BotIDIsNil())
+		predicates = append(predicates, usagestatistichour.AddtimeGTE(startAddTime))
+		usageStatisticHour, err := l.svcCtx.DB.UsageStatisticHour.Query().Where(predicates...).All(l.ctx)
+		if err != nil {
+			return nil, err
+		}
+		for _, hourData := range usageStatisticHour {
+			addtimeLastTwoDigits := hourData.Addtime % 100
+
+			aiResponse.Count += hourData.AiResponse
+			aiResponse.Val = append(aiResponse.Val, hourData.AiResponse)
+
+			sopRun.Count += hourData.SopRun
+			sopRun.Val = append(sopRun.Val, hourData.SopRun)
+
+			totalFriend.Count = hourData.TotalFriend
+			totalFriend.Val = append(totalFriend.Val, hourData.TotalFriend)
+
+			totalGroup.Count = hourData.TotalGroup
+			totalGroup.Val = append(totalGroup.Val, hourData.TotalGroup)
+
+			consumeToken.Count += hourData.ConsumeToken
+			consumeToken.Val = append(consumeToken.Val, hourData.ConsumeToken)
+			consumeToken.Label = append(consumeToken.Label, fmt.Sprintf("%02d", addtimeLastTwoDigits))
+
+			activeUser.Count = hourData.ActiveUser
+			activeUser.Val = append(activeUser.Val, hourData.ActiveUser)
+
+			newUser.Count += hourData.NewUser
+			newUser.Val = append(newUser.Val, hourData.NewUser)
+			newUser.Label = append(newUser.Label, fmt.Sprintf("%02d", addtimeLastTwoDigits))
+		}
+		hourLen := len(usageStatisticHour)
+		if hourLen > 0 {
+			if usageStatisticHour[0].TotalFriend > 0 {
+				totalFriend.Rate = float32((usageStatisticHour[hourLen-1].TotalFriend - usageStatisticHour[0].TotalFriend) / usageStatisticHour[0].TotalFriend)
+			}
+			if usageStatisticHour[0].TotalGroup > 0 {
+				totalGroup.Rate = float32((usageStatisticHour[hourLen-1].TotalGroup - usageStatisticHour[0].TotalGroup) / usageStatisticHour[0].TotalGroup)
+			}
+			if usageStatisticHour[0].ActiveUser > 0 {
+				activeUser.Rate = float32((usageStatisticHour[hourLen-1].ActiveUser - usageStatisticHour[0].ActiveUser) / usageStatisticHour[0].ActiveUser)
+			}
+			if usageStatisticHour[0].NewUser > 0 {
+				newUser.Rate = float32((usageStatisticHour[hourLen-1].NewUser - usageStatisticHour[0].NewUser) / usageStatisticHour[0].NewUser)
+			}
+			labelDists = usageStatisticHour[hourLen-1].LabelDist
+		}
+	} else {
+		// 从天表统计数据
+		startAddTimeString := startTime.Format("20060102")
+		startAddTime, err := strconv.ParseUint(startAddTimeString, 10, 64)
+		if err != nil {
+			fmt.Println("转换开始时间失败:", err)
+			return nil, err
+		}
+		endAddTimeString := endTime.Format("20060102")
+		endAddTime, err := strconv.ParseUint(endAddTimeString, 10, 64)
+		if err != nil {
+			fmt.Println("转换截止时间失败:", err)
+			return nil, err
+		}
+
+		var predicatesDay []predicate.UsageStatisticDay
+		if organizationId != 0 {
+			predicatesDay = append(predicatesDay, usagestatisticday.OrganizationID(organizationId))
+		}
+		predicatesDay = append(predicatesDay, usagestatisticday.BotIDIsNil())
+		predicatesDay = append(predicatesDay, usagestatisticday.AddtimeGTE(startAddTime))
+		predicatesDay = append(predicatesDay, usagestatisticday.AddtimeLTE(endAddTime))
+		usageStatisticDay, err := l.svcCtx.DB.UsageStatisticDay.Query().Where(predicatesDay...).All(l.ctx)
+		if err != nil {
+			return nil, err
+		}
+		for _, dayData := range usageStatisticDay {
+			aiResponse.Count = aiResponse.Count + dayData.AiResponse
+			aiResponse.Val = append(aiResponse.Val, dayData.AiResponse)
+
+			sopRun.Count += dayData.SopRun
+			sopRun.Val = append(sopRun.Val, dayData.SopRun)
+
+			totalFriend.Count = dayData.TotalFriend
+			totalFriend.Val = append(totalFriend.Val, dayData.TotalFriend)
+
+			totalGroup.Count = dayData.TotalGroup
+			totalGroup.Val = append(totalGroup.Val, dayData.TotalGroup)
+
+			consumeToken.Count += dayData.ConsumeToken
+			consumeToken.Val = append(consumeToken.Val, dayData.ConsumeToken)
+			consumeToken.Label = append(consumeToken.Label, fmt.Sprintf("%d", dayData.Addtime))
+
+			activeUser.Count = dayData.ActiveUser
+			activeUser.Val = append(activeUser.Val, dayData.ActiveUser)
+
+			newUser.Count += dayData.NewUser
+			newUser.Val = append(newUser.Val, dayData.NewUser)
+			newUser.Label = append(newUser.Label, fmt.Sprintf("%d", dayData.Addtime))
+		}
+		dayLen := len(usageStatisticDay)
+		if dayLen > 0 {
+			if usageStatisticDay[0].TotalFriend > 0 {
+				totalFriend.Rate = float32((usageStatisticDay[dayLen-1].TotalFriend - usageStatisticDay[0].TotalFriend) / usageStatisticDay[0].TotalFriend)
+			}
+			if usageStatisticDay[0].TotalGroup > 0 {
+				totalGroup.Rate = float32((usageStatisticDay[dayLen-1].TotalGroup - usageStatisticDay[0].TotalGroup) / usageStatisticDay[0].TotalGroup)
+			}
+			if usageStatisticDay[0].ActiveUser > 0 {
+				activeUser.Rate = float32((usageStatisticDay[dayLen-1].ActiveUser - usageStatisticDay[0].ActiveUser) / usageStatisticDay[0].ActiveUser)
+			}
+			if usageStatisticDay[0].NewUser > 0 {
+				newUser.Rate = float32((usageStatisticDay[dayLen-1].NewUser - usageStatisticDay[0].NewUser) / usageStatisticDay[0].NewUser)
+			}
+			labelDists = usageStatisticDay[dayLen-1].LabelDist
+		}
+
+		if isCurrentDay {
+			// 从小时表统计当天数据
+			startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
+			startOfDayAddTimeString := startOfDay.Format("2006010200")
+			startOfDayAddTime, err := strconv.ParseUint(startOfDayAddTimeString, 10, 64)
+			if err != nil {
+				fmt.Println("转换开始时间失败:", err)
+				return nil, err
+			}
+
+			var predicates []predicate.UsageStatisticHour
+			if organizationId != 0 {
+				predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
+			}
+			predicates = append(predicates, usagestatistichour.BotIDIsNil())
+			predicates = append(predicates, usagestatistichour.AddtimeGTE(startOfDayAddTime))
+			usageStatisticHour, err := l.svcCtx.DB.UsageStatisticHour.Query().Where(predicates...).All(l.ctx)
+			if err != nil {
+				return nil, err
+			}
+			hourLen := len(usageStatisticHour)
+			if hourLen > 0 {
+				var aiResponseOfDay uint64
+				var sopRunOfDay uint64
+				var totalFriendOfDay uint64
+				var totalGroupOfDay uint64
+				var consumeTokenOfDay uint64
+				var activeUserOfDay uint64
+				var newUserOfDay int64
+
+				for _, hourData := range usageStatisticHour {
+					aiResponseOfDay += hourData.AiResponse
+					sopRunOfDay += hourData.SopRun
+					consumeTokenOfDay += hourData.ConsumeToken
+				}
+				totalFriendOfDay = usageStatisticHour[hourLen-1].TotalFriend
+				totalGroupOfDay = usageStatisticHour[hourLen-1].TotalGroup
+				activeUserOfDay = usageStatisticHour[hourLen-1].ActiveUser
+				newUserOfDay = usageStatisticHour[hourLen-1].NewUser
+
+				aiResponse.Count = aiResponse.Count + aiResponseOfDay
+				aiResponse.Val = append(aiResponse.Val, aiResponseOfDay)
+
+				sopRun.Count = sopRun.Count + sopRunOfDay
+				sopRun.Val = append(sopRun.Val, sopRunOfDay)
+
+				totalFriend.Count = totalFriendOfDay
+				totalFriend.Val = append(totalFriend.Val, totalFriendOfDay)
+				tfLen := len(totalFriend.Val)
+				if tfLen > 0 && totalFriend.Val[0] > 0 {
+					totalFriend.Rate = float32((totalFriend.Val[tfLen-1] - totalFriend.Val[0]) / totalFriend.Val[0])
+				}
+
+				totalGroup.Count = totalGroupOfDay
+				totalGroup.Val = append(totalGroup.Val, totalGroupOfDay)
+				tgLen := len(totalGroup.Val)
+				if tgLen > 0 && totalGroup.Val[0] > 0 {
+					totalGroup.Rate = float32((totalGroup.Val[tgLen-1] - totalGroup.Val[0]) / totalGroup.Val[0])
+				}
+
+				consumeToken.Count = consumeToken.Count + consumeTokenOfDay
+				consumeToken.Val = append(consumeToken.Val, consumeTokenOfDay)
+				consumeToken.Label = append(consumeToken.Label, "今日")
+
+				activeUser.Count = activeUserOfDay
+				activeUser.Val = append(activeUser.Val, activeUserOfDay)
+				auLen := len(activeUser.Val)
+				if auLen > 0 && activeUser.Val[0] > 0 {
+					activeUser.Rate = float32((activeUser.Val[auLen-1] - activeUser.Val[0]) / activeUser.Val[0])
+				}
+
+				newUser.Count = newUserOfDay
+				newUser.Val = append(newUser.Val, newUserOfDay)
+				newUser.Label = append(newUser.Label, "今日")
+				nuLen := len(newUser.Val)
+				if nuLen > 0 && newUser.Val[0] > 0 {
+					newUser.Rate = float32((newUser.Val[nuLen-1] - newUser.Val[0]) / newUser.Val[0])
+				}
+
+				labelDists = usageStatisticHour[hourLen-1].LabelDist
+			}
+		}
+	}
+
+	var labelIds []uint64
+	var labelsData []types.LabelsData
+	labelSet := make(map[uint64]uint64)
+	for _, labelDist := range labelDists {
+		if labelDist.Count != 0 {
+			labelIds = append(labelIds, labelDist.LabelID)
+			labelSet[labelDist.LabelID] = labelDist.Count
+		}
+	}
+
+	labelInfos, err := l.svcCtx.DB.Label.Query().Where(label.IDIn(labelIds...)).All(l.ctx)
+	for _, labelInfo := range labelInfos {
+		labelsData = append(labelsData, types.LabelsData{
+			Value: labelSet[labelInfo.ID],
+			Name:  labelInfo.Name,
+		})
+	}
+
+	chartsData := types.ChartsData{
+		AiResponse:     &aiResponse,
+		SopRun:         &sopRun,
+		TotalFriend:    &totalFriend,
+		TotalGroup:     &totalGroup,
+		AccountBalance: &accountBalance,
+		ConsumeToken:   &consumeToken,
+		ActiveUser:     &activeUser,
+		NewUser:        &newUser,
+		LabelDist:      labelsData,
+	}
+
+	return &types.ChartsResp{BaseDataInfo: types.BaseDataInfo{Msg: errormsg.UpdateSuccess}, Data: &chartsData}, nil
+}

+ 176 - 0
internal/logic/dashboard/get_wxs_logic.go

@@ -0,0 +1,176 @@
+package dashboard
+
+import (
+	"context"
+	"fmt"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"strconv"
+	"time"
+	"wechat-api/ent"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/usagestatisticday"
+	"wechat-api/ent/usagestatistichour"
+	"wechat-api/ent/wx"
+	"wechat-api/internal/utils/dberrorhandler"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetWxsLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetWxsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWxsLogic {
+	return &GetWxsLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *GetWxsLogic) GetWxs(req *types.WxReq) (resp *types.WxResp, err error) {
+	// 获取组织id
+	var organizationId uint64 = 0
+	isAdmin := l.ctx.Value("isAdmin").(bool)
+	if isAdmin {
+		if req.OrganizationId != nil && *req.OrganizationId != 0 {
+			organizationId = *req.OrganizationId
+		}
+	} else {
+		organizationId = l.ctx.Value("organizationId").(uint64)
+	}
+
+	// 解析起始和截止时间
+	layouts := []string{
+		"2006-01",    // 对应 "2024-01"
+		"2006-01-02", // 对应 "2024-01-01"
+	}
+
+	var layoutsType int
+
+	var endTime time.Time
+	for i, layout := range layouts {
+		endTime, err = time.Parse(layout, *req.EndDate)
+		layoutsType = i
+		if err == nil {
+			break
+		}
+	}
+	if err != nil {
+		fmt.Println("解析结束时间失败:", err)
+		return
+	}
+
+	// 判断截止日期是否包含当前日
+	var isCurrentDay bool
+	now := time.Now()
+
+	if layoutsType == 0 {
+		isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month()
+	} else {
+		isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month() && endTime.Day() == now.Day()
+	}
+
+	var predicates []predicate.Wx
+	if organizationId != 0 {
+		predicates = append(predicates, wx.OrganizationID(organizationId))
+	}
+	wxs, err := l.svcCtx.DB.Wx.Query().Where(predicates...).All(l.ctx)
+
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+	resp = &types.WxResp{}
+	resp.Msg = errormsg.Success
+
+	var wxIds []string
+	wxSet := make(map[string]*ent.Wx)
+	for _, w := range wxs {
+		wxIds = append(wxIds, w.Wxid)
+		wxSet[w.Wxid] = w
+	}
+
+	var wxList []types.WxData
+
+	if isCurrentDay {
+		// 返回当日每小时的数据
+		var predicatesH []predicate.UsageStatisticHour
+		if organizationId != 0 {
+			predicatesH = append(predicatesH, usagestatistichour.OrganizationID(organizationId))
+			predicatesH = append(predicatesH, usagestatistichour.BotIDIn(wxIds...))
+		}
+		lastHourData, err := l.svcCtx.DB.UsageStatisticHour.Query().
+			Where(predicatesH...).
+			Order(ent.Desc(usagestatistichour.FieldAddtime)).
+			First(l.ctx)
+		if err != nil {
+			return nil, err
+		}
+		if lastHourData == nil {
+			return nil, err
+		}
+
+		var predicatesHour []predicate.UsageStatisticHour
+		if organizationId != 0 {
+			predicatesHour = append(predicatesHour, usagestatistichour.OrganizationID(organizationId))
+			predicatesHour = append(predicatesHour, usagestatistichour.BotIDIn(wxIds...))
+		}
+		predicatesHour = append(predicatesHour, usagestatistichour.Addtime(lastHourData.Addtime))
+		usageStatisticHour, err := l.svcCtx.DB.UsageStatisticHour.Query().Where(predicatesHour...).Page(l.ctx, req.Page, req.PageSize)
+		if err != nil {
+			return nil, err
+		}
+		if usageStatisticHour != nil && usageStatisticHour.List != nil {
+			resp.Data.Total = usageStatisticHour.PageDetails.Total
+			for _, hourData := range usageStatisticHour.List {
+				wxList = append(wxList, types.WxData{
+					Nickname:        wxSet[hourData.BotID].Nickname,
+					InteractionRate: float32(hourData.ActiveUser) / float32(hourData.TotalFriend),
+					TotalFriend:     hourData.TotalFriend,
+					TotalGroup:      hourData.TotalGroup,
+				})
+			}
+		}
+	} else {
+		endAddTimeString := endTime.Format("20060102")
+		endAddTime, err := strconv.ParseUint(endAddTimeString, 10, 64)
+		if err != nil {
+			fmt.Println("转换截止时间失败:", err)
+			return nil, err
+		}
+		var predicatesDay []predicate.UsageStatisticDay
+		if organizationId != 0 {
+			predicatesDay = append(predicatesDay, usagestatisticday.OrganizationID(organizationId))
+			predicatesDay = append(predicatesDay, usagestatisticday.BotIDIn(wxIds...))
+		}
+		predicatesDay = append(predicatesDay, usagestatisticday.Addtime(endAddTime))
+		usageStatisticDay, err := l.svcCtx.DB.UsageStatisticDay.Query().
+			Where(predicatesDay...).Page(l.ctx, req.Page, req.PageSize)
+		if err != nil {
+			return nil, err
+		}
+		if usageStatisticDay != nil && usageStatisticDay.List != nil {
+			resp.Data.Total = usageStatisticDay.PageDetails.Total
+			for _, dayData := range usageStatisticDay.List {
+				rate := float32(0)
+				if dayData.TotalFriend != 0 {
+					rate = float32(dayData.ActiveUser) / float32(dayData.TotalFriend)
+				}
+				wxList = append(wxList, types.WxData{
+					Nickname:        wxSet[dayData.BotID].Nickname,
+					InteractionRate: rate,
+					TotalFriend:     dayData.TotalFriend,
+					TotalGroup:      dayData.TotalGroup,
+				})
+			}
+		}
+	}
+	resp.Data.Data = wxList
+
+	return resp, nil
+}

+ 195 - 0
internal/logic/xiaoice/gptbots_message_logic.go

@@ -0,0 +1,195 @@
+package xiaoice
+
+import (
+	"bytes"
+	"context"
+	"encoding/json"
+	"fmt"
+	"github.com/russross/blackfriday"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"github.com/zeromicro/go-zero/core/errorx"
+	"io"
+	"net/http"
+	"net/url"
+	"regexp"
+	"strconv"
+	"strings"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GptbotsMessageLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGptbotsMessageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GptbotsMessageLogic {
+	return &GptbotsMessageLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *GptbotsMessageLogic) GptbotsMessage(req *types.MessageReq) (resp *types.BaseDataInfo, err error) {
+	apikey := l.svcCtx.Config.Xiaoice.GptbotsAuthorization
+	conversationId, err := l.GetConversation(apikey, strconv.FormatUint(*req.UserId, 10))
+	if conversationId == nil || err != nil {
+		return nil, err
+	}
+
+	baseURL, err := url.Parse("https://api.gptbots.ai/v1/conversation/message")
+	if err != nil {
+		return nil, errorx.NewDefaultError(fmt.Sprintf("生成内容失败: %+v", err))
+	}
+
+	// 构建请求体
+	requestBody := map[string]string{
+		"text":            *req.Text,
+		"conversation_id": *conversationId,
+		"response_mode":   "blocking",
+	}
+	jsonBody, err := json.Marshal(requestBody)
+	if err != nil {
+		return nil, errorx.NewDefaultError(fmt.Sprintf("生成内容失败: %+v", err))
+	}
+
+	// 创建HTTP请求
+	httpReq, err := http.NewRequest("POST", baseURL.String(), bytes.NewBuffer(jsonBody))
+	if err != nil {
+		return nil, errorx.NewDefaultError(fmt.Sprintf("生成内容失败: %+v", err))
+	}
+
+	// 添加必要的Header信息
+	httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apikey))
+	httpReq.Header.Set("Content-Type", "application/json")
+
+	// 创建HTTP客户端并执行请求
+	client := &http.Client{}
+	response, err := client.Do(httpReq)
+	if err != nil {
+		return nil, errorx.NewDefaultError(fmt.Sprintf("生成内容失败: %+v", err))
+	}
+	defer func(Body io.ReadCloser) {
+		err := Body.Close()
+		if err != nil {
+			l.Error("生成内容失败: %v", err)
+		}
+	}(response.Body)
+
+	// 读取和输出响应
+	body, err := io.ReadAll(response.Body)
+	if err != nil {
+		return nil, errorx.NewDefaultError(fmt.Sprintf("生成内容失败: %+v", err))
+	}
+
+	// 检查响应状态
+	if response.StatusCode != http.StatusOK {
+		//log.Fatalf("请求失败,状态码:%d,响应: %s", response.StatusCode, string(body))
+		return nil, errorx.NewDefaultError(fmt.Sprintf("生成内容失败:%d,响应: %s", response.StatusCode, string(body)))
+	}
+
+	// 解析 JSON 响应
+	var responseMap types.GptbotsMessageResp
+	if err := json.Unmarshal(body, &responseMap); err != nil {
+		return nil, errorx.NewDefaultError(fmt.Sprintf("生成内容失败: %+v", err))
+	}
+
+	data := ""
+	if responseMap.FlowOutput != nil && len(responseMap.FlowOutput) > 0 {
+		data = TrimHtml(Markdown2Html(responseMap.FlowOutput[0].Content))
+	}
+
+	return &types.BaseDataInfo{Msg: errormsg.Success, Data: data}, nil
+}
+
+func (l *GptbotsMessageLogic) GetConversation(apikey string, userId string) (conversationId *string, err error) {
+	val, _ := l.svcCtx.Rds.HGet(l.ctx, "xiaoice_conversation", userId).Result()
+	if val == "" {
+		baseURL, err := url.Parse("https://api.gptbots.ai/v1/conversation")
+		if err != nil {
+			return nil, err
+		}
+
+		// 构建请求体
+		requestBody := map[string]string{
+			"user_id": userId,
+		}
+		jsonBody, err := json.Marshal(requestBody)
+		if err != nil {
+			return nil, err
+		}
+
+		// 创建HTTP请求
+		req, err := http.NewRequest("POST", baseURL.String(), bytes.NewBuffer(jsonBody))
+		if err != nil {
+			return nil, err
+		}
+
+		// 添加必要的Header信息
+		req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apikey))
+		req.Header.Set("Content-Type", "application/json")
+
+		// 创建HTTP客户端并执行请求
+		client := &http.Client{}
+		response, err := client.Do(req)
+		if err != nil {
+			return nil, err
+		}
+		defer func(Body io.ReadCloser) {
+			err := Body.Close()
+			if err != nil {
+				l.Error("创建会话失败败: %v", err)
+			}
+		}(response.Body)
+
+		// 读取和输出响应
+		body, err := io.ReadAll(response.Body)
+		if err != nil {
+			return nil, err
+		}
+
+		// 检查响应状态
+		if response.StatusCode != http.StatusOK {
+			//log.Fatalf("请求失败,状态码:%d,响应: %s", response.StatusCode, string(body))
+			return nil, errorx.NewDefaultError(fmt.Sprintf("创建会话失败:%d,响应: %s", response.StatusCode, string(body)))
+		}
+
+		// 解析 JSON 响应
+		var responseMap types.ConversationResp
+		if err := json.Unmarshal(body, &responseMap); err != nil {
+			return nil, err
+		}
+		l.svcCtx.Rds.HSet(l.ctx, "xiaoice_conversation", userId, *responseMap.ConversationId)
+		return responseMap.ConversationId, nil
+	}
+	return &val, nil
+}
+
+// TrimHtml 去除HTML标签
+func TrimHtml(html string) string {
+	//将HTML标签全转换成小写
+	re, _ := regexp.Compile("\\<[\\S\\s]+?\\>")
+	html = re.ReplaceAllStringFunc(html, strings.ToLower)
+	//去除STYLE
+	re, _ = regexp.Compile("\\<style[\\S\\s]+?\\</style\\>")
+	html = re.ReplaceAllString(html, "")
+	//去除SCRIPT
+	re, _ = regexp.Compile("\\<script[\\S\\s]+?\\</script\\>")
+	html = re.ReplaceAllString(html, "")
+	//去除所有尖括号内的HTML代码,并换成换行符
+	re, _ = regexp.Compile("\\<[\\S\\s]+?\\>")
+	html = re.ReplaceAllString(html, "\n")
+	//去除连续的换行符
+	re, _ = regexp.Compile("\\s{2,}")
+	html = re.ReplaceAllString(html, "\n")
+	return strings.TrimSpace(html)
+}
+
+// Markdown2Html Markdown format to HTML format
+func Markdown2Html(markdown string) string {
+	html := blackfriday.MarkdownCommon([]byte(markdown))
+	return string(html)
+}

+ 86 - 0
internal/logic/xiaoice/signature_gen_logic.go

@@ -0,0 +1,86 @@
+package xiaoice
+
+import (
+	"context"
+	"encoding/json"
+	"fmt"
+	"github.com/zeromicro/go-zero/core/errorx"
+	"io"
+	"net/http"
+	"net/url"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type SignatureGenLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewSignatureGenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SignatureGenLogic {
+	return &SignatureGenLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *SignatureGenLogic) SignatureGen() (resp *types.SignatureResp, err error) {
+	// 构建请求URL
+	key := l.svcCtx.Config.Xiaoice.SubscriptionKey
+	baseURL, err := url.Parse("https://interactive-virtualhuman.xiaoice.com/openapi/signature/gen")
+	if err != nil {
+		return nil, err
+	}
+
+	// 在这里设置请求参数
+	//params := url.Values{}
+	// 如果需要设置 token 有效期,请取消下面注释并设置时间(以毫秒为单位)
+	//params.Add("effectiveDurationMilliseconds", strconv.Itoa(24*60*60*1000))
+	//baseURL.RawQuery = params.Encode()
+
+	// 创建 HTTP 请求
+	req, err := http.NewRequest("GET", baseURL.String(), nil)
+	if err != nil {
+		return nil, err
+	}
+
+	// 添加必要的Header信息
+	req.Header.Add("subscription-key", key)
+
+	// 创建HTTP客户端并执行请求
+	client := &http.Client{}
+	response, err := client.Do(req)
+	if err != nil {
+		return nil, err
+	}
+	defer func(Body io.ReadCloser) {
+		err := Body.Close()
+		if err != nil {
+			l.Error("获取小冰 AuthToken 失败: %v", err)
+		}
+	}(response.Body)
+
+	// 读取和输出响应
+	body, err := io.ReadAll(response.Body)
+	if err != nil {
+		return nil, err
+	}
+
+	// 检查响应状态
+	if response.StatusCode != http.StatusOK {
+		//log.Fatalf("请求失败,状态码:%d,响应: %s", response.StatusCode, string(body))
+		return nil, errorx.NewDefaultError(fmt.Sprintf("获取小冰 AuthToken 失败:%d,响应: %s", response.StatusCode, string(body)))
+	}
+
+	// 解析 JSON 响应
+	var responseMap types.XiaoiceSignatureResp
+	if err := json.Unmarshal(body, &responseMap); err != nil {
+		return nil, err
+	}
+
+	fmt.Printf("响应: %s\n", string(body))
+	return &types.SignatureResp{Data: &responseMap.Data}, nil
+}

+ 90 - 0
internal/types/types.go

@@ -3025,3 +3025,93 @@ type AllocAgentInfoResp struct {
 	// AllocAgent information | AllocAgent数据
 	Data AllocAgentInfo `json:"data"`
 }
+
+// swagger:model SignatureResp
+type SignatureResp struct {
+	BaseDataInfo
+	// 临时签名
+	Data *string `json:"data"`
+}
+
+// swagger:model MessageReq
+type MessageReq struct {
+	// 大模型生成内容
+	UserId *uint64 `json:"user_id"`
+	Text   *string `json:"text"`
+}
+
+// swagger:model DashboardInfo
+type DashboardInfo struct {
+	BaseIDInfo
+}
+
+// swagger:model ChartsReq
+type ChartsReq struct {
+	StartDate *string `json:"start_date"`
+	EndDate   *string `json:"end_date"`
+	// 租户id
+	OrganizationId *uint64 `json:"organizationId,optional"`
+}
+
+// swagger:model ChartsResp
+type ChartsResp struct {
+	BaseDataInfo
+	Data *ChartsData `json:"data"`
+}
+
+type ChartsData struct {
+	AiResponse     *ChartsUint  `json:"ai_response"`
+	SopRun         *ChartsUint  `json:"sop_run"`
+	TotalFriend    *ChartsUint  `json:"total_friend"`
+	TotalGroup     *ChartsUint  `json:"total_group"`
+	AccountBalance *ChartsUint  `json:"account_balance"`
+	ConsumeToken   *ChartsUint  `json:"consume_token"`
+	ActiveUser     *ChartsUint  `json:"active_user"`
+	NewUser        *ChartsInt   `json:"new_user"`
+	LabelDist      []LabelsData `json:"label_dist"`
+}
+
+type ChartsUint struct {
+	Count uint64   `json:"count"`
+	Rate  float32  `json:"rate"`
+	Label []string `json:"label"`
+	Val   []uint64 `json:"val"`
+}
+
+type ChartsInt struct {
+	Count int64    `json:"count"`
+	Rate  float32  `json:"rate"`
+	Label []string `json:"label"`
+	Val   []int64  `json:"val"`
+}
+
+type LabelsData struct {
+	Value uint64 `json:"value"`
+	Name  string `json:"name"`
+}
+
+// swagger:model WxReq
+type WxReq struct {
+	PageInfo
+	EndDate *string `json:"end_date"`
+	// 租户id
+	OrganizationId *uint64 `json:"organizationId,optional"`
+}
+
+// swagger:model WxResp
+type WxResp struct {
+	BaseDataInfo
+	Data WxList `json:"data"`
+}
+
+type WxList struct {
+	BaseListInfo
+	Data []WxData `json:"data"`
+}
+
+type WxData struct {
+	Nickname        string  `json:"nickname"`
+	TotalFriend     uint64  `json:"total_friend"`
+	TotalGroup      uint64  `json:"total_group"`
+	InteractionRate float32 `json:"interaction_rate"`
+}

+ 31 - 0
internal/types/xiaoice.go

@@ -0,0 +1,31 @@
+package types
+
+type Xiaoice struct {
+	SubscriptionKey      string
+	GptbotsAuthorization string
+}
+
+type XiaoiceSignatureResp struct {
+	Code int64  `json:"code"`
+	Data string `json:"data"`
+	Msg  string `json:"msg"`
+}
+
+type ConversationResp struct {
+	ConversationId *string `json:"conversation_id"`
+}
+
+type GptbotsMessageResp struct {
+	MessageID      string       `json:"message_id"`
+	MessageType    string       `json:"message_type"`
+	Text           string       `json:"text"`
+	FlowOutput     []FlowOutput `json:"flow_output"`
+	CreateTime     int64        `json:"create_time"`
+	ConversationID *string      `json:"conversation_id"`
+}
+
+type FlowOutput struct {
+	Content           string `json:"content"`
+	Branch            string `json:"branch"`
+	FromComponentName string `json:"from_component_name"`
+}