jimmyyem 6 miesięcy temu
rodzic
commit
d17f131f18

+ 2 - 1
desc/all.api

@@ -28,4 +28,5 @@ import "./wechat/chat_session.api"
 import "./wechat/wx_card.api"
 import "./wechat/wx_card_user.api"
 import "./wechat/wx_card_visit.api"
-import "./wechat/avatar.api"
+import "./wechat/avatar.api"
+import "./wechat/aliyun_avatar.api"

+ 101 - 0
desc/wechat/aliyun_avatar.api

@@ -0,0 +1,101 @@
+import "../base.api"
+
+type (
+    // The data of aliyun avatar information | AliyunAvatar信息
+    AliyunAvatarInfo {
+        BaseIDInfo
+
+        // user_id | wx_card_user_id 
+        UserId  *uint64 `json:"userId,optional"`
+
+        // biz_id | BizId 
+        BizId  *string `json:"bizId,optional"`
+
+        // access_key_id | AccessKeyId 
+        AccessKeyId  *string `json:"accessKeyId,optional"`
+
+        // access_key_secret | AccessKeySecret 
+        AccessKeySecret  *string `json:"accessKeySecret,optional"`
+
+        // app_id | AppId 
+        AppId  *string `json:"appId,optional"`
+
+        // tenant_id | TenantId 
+        TenantD  *uint64 `json:"tenantD,optional"`
+
+        // response | 阿里云avatar响应 
+        Response  *string `json:"response,optional"`
+
+        // token | Token 
+        Token  *string `json:"token,optional"`
+
+        // session_id | SessionId 
+        SessionId  *string `json:"sessionId,optional"`
+    }
+
+    // The response data of aliyun avatar list | AliyunAvatar列表数据
+    AliyunAvatarListResp {
+        BaseDataInfo
+
+        // AliyunAvatar list data | AliyunAvatar列表数据
+        Data AliyunAvatarListInfo `json:"data"`
+    }
+
+    // AliyunAvatar list data | AliyunAvatar列表数据
+    AliyunAvatarListInfo {
+        BaseListInfo
+
+        // The API list data | AliyunAvatar列表数据
+        Data  []AliyunAvatarInfo  `json:"data"`
+    }
+
+    // Get aliyun avatar list request params | AliyunAvatar列表请求参数
+    AliyunAvatarListReq {
+        PageInfo
+
+        // biz_id | BizId 
+        BizId  *string `json:"bizId,optional"`
+
+        // access_key_id | AccessKeyId 
+        AccessKeyId  *string `json:"accessKeyId,optional"`
+
+        // access_key_secret | AccessKeySecret 
+        AccessKeySecret  *string `json:"accessKeySecret,optional"`
+    }
+
+    // AliyunAvatar information response | AliyunAvatar信息返回体
+    AliyunAvatarInfoResp {
+        BaseDataInfo
+
+        // AliyunAvatar information | AliyunAvatar数据
+        Data AliyunAvatarInfo `json:"data"`
+    }
+)
+
+@server(
+    jwt: Auth
+    group: aliyun_avatar
+    middleware: Authority
+)
+
+service Wechat {
+    // Create aliyun avatar information | 创建AliyunAvatar
+    @handler createAliyunAvatar
+    post /aliyun_avatar/create (AliyunAvatarInfo) returns (BaseMsgResp)
+
+    // Update aliyun avatar information | 更新AliyunAvatar
+    @handler updateAliyunAvatar
+    post /aliyun_avatar/update (AliyunAvatarInfo) returns (BaseMsgResp)
+
+    // Delete aliyun avatar information | 删除AliyunAvatar信息
+    @handler deleteAliyunAvatar
+    post /aliyun_avatar/delete (IDsReq) returns (BaseMsgResp)
+
+    // Get aliyun avatar list | 获取AliyunAvatar列表
+    @handler getAliyunAvatarList
+    post /aliyun_avatar/list (AliyunAvatarListReq) returns (AliyunAvatarListResp)
+
+    // Get aliyun avatar by ID | 通过ID获取AliyunAvatar
+    @handler getAliyunAvatarById
+    post /aliyun_avatar (IDReq) returns (AliyunAvatarInfoResp)
+}

+ 227 - 0
ent/aliyunavatar.go

@@ -0,0 +1,227 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"fmt"
+	"strings"
+	"time"
+	"wechat-api/ent/aliyunavatar"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+// AliyunAvatar is the model entity for the AliyunAvatar schema.
+type AliyunAvatar 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"`
+	// Delete Time | 删除日期
+	DeletedAt time.Time `json:"deleted_at,omitempty"`
+	// user_id | wx_card_user_id
+	UserID uint64 `json:"user_id,omitempty"`
+	// biz_id | BizId
+	BizID string `json:"biz_id,omitempty"`
+	// access_key_id | AccessKeyId
+	AccessKeyID string `json:"access_key_id,omitempty"`
+	// access_key_secret | AccessKeySecret
+	AccessKeySecret string `json:"access_key_secret,omitempty"`
+	// app_id | AppId
+	AppID string `json:"app_id,omitempty"`
+	// tenant_id | TenantId
+	TenantID int64 `json:"tenant_id,omitempty"`
+	// response | 阿里云avatar响应
+	Response string `json:"response,omitempty"`
+	// token | Token
+	Token string `json:"token,omitempty"`
+	// session_id | SessionId
+	SessionID    string `json:"session_id,omitempty"`
+	selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*AliyunAvatar) scanValues(columns []string) ([]any, error) {
+	values := make([]any, len(columns))
+	for i := range columns {
+		switch columns[i] {
+		case aliyunavatar.FieldID, aliyunavatar.FieldUserID, aliyunavatar.FieldTenantID:
+			values[i] = new(sql.NullInt64)
+		case aliyunavatar.FieldBizID, aliyunavatar.FieldAccessKeyID, aliyunavatar.FieldAccessKeySecret, aliyunavatar.FieldAppID, aliyunavatar.FieldResponse, aliyunavatar.FieldToken, aliyunavatar.FieldSessionID:
+			values[i] = new(sql.NullString)
+		case aliyunavatar.FieldCreatedAt, aliyunavatar.FieldUpdatedAt, aliyunavatar.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 AliyunAvatar fields.
+func (aa *AliyunAvatar) 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 aliyunavatar.FieldID:
+			value, ok := values[i].(*sql.NullInt64)
+			if !ok {
+				return fmt.Errorf("unexpected type %T for field id", value)
+			}
+			aa.ID = uint64(value.Int64)
+		case aliyunavatar.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 {
+				aa.CreatedAt = value.Time
+			}
+		case aliyunavatar.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 {
+				aa.UpdatedAt = value.Time
+			}
+		case aliyunavatar.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 {
+				aa.DeletedAt = value.Time
+			}
+		case aliyunavatar.FieldUserID:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field user_id", values[i])
+			} else if value.Valid {
+				aa.UserID = uint64(value.Int64)
+			}
+		case aliyunavatar.FieldBizID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field biz_id", values[i])
+			} else if value.Valid {
+				aa.BizID = value.String
+			}
+		case aliyunavatar.FieldAccessKeyID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field access_key_id", values[i])
+			} else if value.Valid {
+				aa.AccessKeyID = value.String
+			}
+		case aliyunavatar.FieldAccessKeySecret:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field access_key_secret", values[i])
+			} else if value.Valid {
+				aa.AccessKeySecret = value.String
+			}
+		case aliyunavatar.FieldAppID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field app_id", values[i])
+			} else if value.Valid {
+				aa.AppID = value.String
+			}
+		case aliyunavatar.FieldTenantID:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field tenant_id", values[i])
+			} else if value.Valid {
+				aa.TenantID = value.Int64
+			}
+		case aliyunavatar.FieldResponse:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field response", values[i])
+			} else if value.Valid {
+				aa.Response = value.String
+			}
+		case aliyunavatar.FieldToken:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field token", values[i])
+			} else if value.Valid {
+				aa.Token = value.String
+			}
+		case aliyunavatar.FieldSessionID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field session_id", values[i])
+			} else if value.Valid {
+				aa.SessionID = value.String
+			}
+		default:
+			aa.selectValues.Set(columns[i], values[i])
+		}
+	}
+	return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the AliyunAvatar.
+// This includes values selected through modifiers, order, etc.
+func (aa *AliyunAvatar) Value(name string) (ent.Value, error) {
+	return aa.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this AliyunAvatar.
+// Note that you need to call AliyunAvatar.Unwrap() before calling this method if this AliyunAvatar
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (aa *AliyunAvatar) Update() *AliyunAvatarUpdateOne {
+	return NewAliyunAvatarClient(aa.config).UpdateOne(aa)
+}
+
+// Unwrap unwraps the AliyunAvatar 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 (aa *AliyunAvatar) Unwrap() *AliyunAvatar {
+	_tx, ok := aa.config.driver.(*txDriver)
+	if !ok {
+		panic("ent: AliyunAvatar is not a transactional entity")
+	}
+	aa.config.driver = _tx.drv
+	return aa
+}
+
+// String implements the fmt.Stringer.
+func (aa *AliyunAvatar) String() string {
+	var builder strings.Builder
+	builder.WriteString("AliyunAvatar(")
+	builder.WriteString(fmt.Sprintf("id=%v, ", aa.ID))
+	builder.WriteString("created_at=")
+	builder.WriteString(aa.CreatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("updated_at=")
+	builder.WriteString(aa.UpdatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("deleted_at=")
+	builder.WriteString(aa.DeletedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("user_id=")
+	builder.WriteString(fmt.Sprintf("%v", aa.UserID))
+	builder.WriteString(", ")
+	builder.WriteString("biz_id=")
+	builder.WriteString(aa.BizID)
+	builder.WriteString(", ")
+	builder.WriteString("access_key_id=")
+	builder.WriteString(aa.AccessKeyID)
+	builder.WriteString(", ")
+	builder.WriteString("access_key_secret=")
+	builder.WriteString(aa.AccessKeySecret)
+	builder.WriteString(", ")
+	builder.WriteString("app_id=")
+	builder.WriteString(aa.AppID)
+	builder.WriteString(", ")
+	builder.WriteString("tenant_id=")
+	builder.WriteString(fmt.Sprintf("%v", aa.TenantID))
+	builder.WriteString(", ")
+	builder.WriteString("response=")
+	builder.WriteString(aa.Response)
+	builder.WriteString(", ")
+	builder.WriteString("token=")
+	builder.WriteString(aa.Token)
+	builder.WriteString(", ")
+	builder.WriteString("session_id=")
+	builder.WriteString(aa.SessionID)
+	builder.WriteByte(')')
+	return builder.String()
+}
+
+// AliyunAvatars is a parsable slice of AliyunAvatar.
+type AliyunAvatars []*AliyunAvatar

+ 158 - 0
ent/aliyunavatar/aliyunavatar.go

@@ -0,0 +1,158 @@
+// Code generated by ent, DO NOT EDIT.
+
+package aliyunavatar
+
+import (
+	"time"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+const (
+	// Label holds the string label denoting the aliyunavatar type in the database.
+	Label = "aliyun_avatar"
+	// 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"
+	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
+	FieldDeletedAt = "deleted_at"
+	// FieldUserID holds the string denoting the user_id field in the database.
+	FieldUserID = "user_id"
+	// FieldBizID holds the string denoting the biz_id field in the database.
+	FieldBizID = "biz_id"
+	// FieldAccessKeyID holds the string denoting the access_key_id field in the database.
+	FieldAccessKeyID = "access_key_id"
+	// FieldAccessKeySecret holds the string denoting the access_key_secret field in the database.
+	FieldAccessKeySecret = "access_key_secret"
+	// FieldAppID holds the string denoting the app_id field in the database.
+	FieldAppID = "app_id"
+	// FieldTenantID holds the string denoting the tenant_id field in the database.
+	FieldTenantID = "tenant_id"
+	// FieldResponse holds the string denoting the response field in the database.
+	FieldResponse = "response"
+	// FieldToken holds the string denoting the token field in the database.
+	FieldToken = "token"
+	// FieldSessionID holds the string denoting the session_id field in the database.
+	FieldSessionID = "session_id"
+	// Table holds the table name of the aliyunavatar in the database.
+	Table = "aliyun_avatar"
+)
+
+// Columns holds all SQL columns for aliyunavatar fields.
+var Columns = []string{
+	FieldID,
+	FieldCreatedAt,
+	FieldUpdatedAt,
+	FieldDeletedAt,
+	FieldUserID,
+	FieldBizID,
+	FieldAccessKeyID,
+	FieldAccessKeySecret,
+	FieldAppID,
+	FieldTenantID,
+	FieldResponse,
+	FieldToken,
+	FieldSessionID,
+}
+
+// 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
+	// DefaultToken holds the default value on creation for the "token" field.
+	DefaultToken string
+	// DefaultSessionID holds the default value on creation for the "session_id" field.
+	DefaultSessionID string
+)
+
+// OrderOption defines the ordering options for the AliyunAvatar 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()
+}
+
+// ByDeletedAt orders the results by the deleted_at field.
+func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
+}
+
+// ByUserID orders the results by the user_id field.
+func ByUserID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldUserID, opts...).ToFunc()
+}
+
+// ByBizID orders the results by the biz_id field.
+func ByBizID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldBizID, opts...).ToFunc()
+}
+
+// ByAccessKeyID orders the results by the access_key_id field.
+func ByAccessKeyID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAccessKeyID, opts...).ToFunc()
+}
+
+// ByAccessKeySecret orders the results by the access_key_secret field.
+func ByAccessKeySecret(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAccessKeySecret, opts...).ToFunc()
+}
+
+// ByAppID orders the results by the app_id field.
+func ByAppID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAppID, opts...).ToFunc()
+}
+
+// ByTenantID orders the results by the tenant_id field.
+func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldTenantID, opts...).ToFunc()
+}
+
+// ByResponse orders the results by the response field.
+func ByResponse(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldResponse, opts...).ToFunc()
+}
+
+// ByToken orders the results by the token field.
+func ByToken(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldToken, opts...).ToFunc()
+}
+
+// BySessionID orders the results by the session_id field.
+func BySessionID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldSessionID, opts...).ToFunc()
+}

+ 805 - 0
ent/aliyunavatar/where.go

@@ -0,0 +1,805 @@
+// Code generated by ent, DO NOT EDIT.
+
+package aliyunavatar
+
+import (
+	"time"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(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.AliyunAvatar {
+	return predicate.AliyunAvatar(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.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
+func DeletedAt(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
+func UserID(v uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldUserID, v))
+}
+
+// BizID applies equality check predicate on the "biz_id" field. It's identical to BizIDEQ.
+func BizID(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldBizID, v))
+}
+
+// AccessKeyID applies equality check predicate on the "access_key_id" field. It's identical to AccessKeyIDEQ.
+func AccessKeyID(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldAccessKeyID, v))
+}
+
+// AccessKeySecret applies equality check predicate on the "access_key_secret" field. It's identical to AccessKeySecretEQ.
+func AccessKeySecret(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldAccessKeySecret, v))
+}
+
+// AppID applies equality check predicate on the "app_id" field. It's identical to AppIDEQ.
+func AppID(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldAppID, v))
+}
+
+// TenantID applies equality check predicate on the "tenant_id" field. It's identical to TenantIDEQ.
+func TenantID(v int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldTenantID, v))
+}
+
+// Response applies equality check predicate on the "response" field. It's identical to ResponseEQ.
+func Response(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldResponse, v))
+}
+
+// Token applies equality check predicate on the "token" field. It's identical to TokenEQ.
+func Token(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldToken, v))
+}
+
+// SessionID applies equality check predicate on the "session_id" field. It's identical to SessionIDEQ.
+func SessionID(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldSessionID, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
+func DeletedAtEQ(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
+func DeletedAtNEQ(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtIn applies the In predicate on the "deleted_at" field.
+func DeletedAtIn(vs ...time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
+func DeletedAtNotIn(vs ...time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtGT applies the GT predicate on the "deleted_at" field.
+func DeletedAtGT(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldDeletedAt, v))
+}
+
+// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
+func DeletedAtGTE(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldDeletedAt, v))
+}
+
+// DeletedAtLT applies the LT predicate on the "deleted_at" field.
+func DeletedAtLT(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldDeletedAt, v))
+}
+
+// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
+func DeletedAtLTE(v time.Time) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldDeletedAt, v))
+}
+
+// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
+func DeletedAtIsNil() predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIsNull(FieldDeletedAt))
+}
+
+// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
+func DeletedAtNotNil() predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotNull(FieldDeletedAt))
+}
+
+// UserIDEQ applies the EQ predicate on the "user_id" field.
+func UserIDEQ(v uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldUserID, v))
+}
+
+// UserIDNEQ applies the NEQ predicate on the "user_id" field.
+func UserIDNEQ(v uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldUserID, v))
+}
+
+// UserIDIn applies the In predicate on the "user_id" field.
+func UserIDIn(vs ...uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldUserID, vs...))
+}
+
+// UserIDNotIn applies the NotIn predicate on the "user_id" field.
+func UserIDNotIn(vs ...uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldUserID, vs...))
+}
+
+// UserIDGT applies the GT predicate on the "user_id" field.
+func UserIDGT(v uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldUserID, v))
+}
+
+// UserIDGTE applies the GTE predicate on the "user_id" field.
+func UserIDGTE(v uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldUserID, v))
+}
+
+// UserIDLT applies the LT predicate on the "user_id" field.
+func UserIDLT(v uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldUserID, v))
+}
+
+// UserIDLTE applies the LTE predicate on the "user_id" field.
+func UserIDLTE(v uint64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldUserID, v))
+}
+
+// BizIDEQ applies the EQ predicate on the "biz_id" field.
+func BizIDEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldBizID, v))
+}
+
+// BizIDNEQ applies the NEQ predicate on the "biz_id" field.
+func BizIDNEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldBizID, v))
+}
+
+// BizIDIn applies the In predicate on the "biz_id" field.
+func BizIDIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldBizID, vs...))
+}
+
+// BizIDNotIn applies the NotIn predicate on the "biz_id" field.
+func BizIDNotIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldBizID, vs...))
+}
+
+// BizIDGT applies the GT predicate on the "biz_id" field.
+func BizIDGT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldBizID, v))
+}
+
+// BizIDGTE applies the GTE predicate on the "biz_id" field.
+func BizIDGTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldBizID, v))
+}
+
+// BizIDLT applies the LT predicate on the "biz_id" field.
+func BizIDLT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldBizID, v))
+}
+
+// BizIDLTE applies the LTE predicate on the "biz_id" field.
+func BizIDLTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldBizID, v))
+}
+
+// BizIDContains applies the Contains predicate on the "biz_id" field.
+func BizIDContains(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContains(FieldBizID, v))
+}
+
+// BizIDHasPrefix applies the HasPrefix predicate on the "biz_id" field.
+func BizIDHasPrefix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasPrefix(FieldBizID, v))
+}
+
+// BizIDHasSuffix applies the HasSuffix predicate on the "biz_id" field.
+func BizIDHasSuffix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasSuffix(FieldBizID, v))
+}
+
+// BizIDEqualFold applies the EqualFold predicate on the "biz_id" field.
+func BizIDEqualFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEqualFold(FieldBizID, v))
+}
+
+// BizIDContainsFold applies the ContainsFold predicate on the "biz_id" field.
+func BizIDContainsFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContainsFold(FieldBizID, v))
+}
+
+// AccessKeyIDEQ applies the EQ predicate on the "access_key_id" field.
+func AccessKeyIDEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDNEQ applies the NEQ predicate on the "access_key_id" field.
+func AccessKeyIDNEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDIn applies the In predicate on the "access_key_id" field.
+func AccessKeyIDIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldAccessKeyID, vs...))
+}
+
+// AccessKeyIDNotIn applies the NotIn predicate on the "access_key_id" field.
+func AccessKeyIDNotIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldAccessKeyID, vs...))
+}
+
+// AccessKeyIDGT applies the GT predicate on the "access_key_id" field.
+func AccessKeyIDGT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDGTE applies the GTE predicate on the "access_key_id" field.
+func AccessKeyIDGTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDLT applies the LT predicate on the "access_key_id" field.
+func AccessKeyIDLT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDLTE applies the LTE predicate on the "access_key_id" field.
+func AccessKeyIDLTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDContains applies the Contains predicate on the "access_key_id" field.
+func AccessKeyIDContains(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContains(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDHasPrefix applies the HasPrefix predicate on the "access_key_id" field.
+func AccessKeyIDHasPrefix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasPrefix(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDHasSuffix applies the HasSuffix predicate on the "access_key_id" field.
+func AccessKeyIDHasSuffix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasSuffix(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDEqualFold applies the EqualFold predicate on the "access_key_id" field.
+func AccessKeyIDEqualFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEqualFold(FieldAccessKeyID, v))
+}
+
+// AccessKeyIDContainsFold applies the ContainsFold predicate on the "access_key_id" field.
+func AccessKeyIDContainsFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContainsFold(FieldAccessKeyID, v))
+}
+
+// AccessKeySecretEQ applies the EQ predicate on the "access_key_secret" field.
+func AccessKeySecretEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretNEQ applies the NEQ predicate on the "access_key_secret" field.
+func AccessKeySecretNEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretIn applies the In predicate on the "access_key_secret" field.
+func AccessKeySecretIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldAccessKeySecret, vs...))
+}
+
+// AccessKeySecretNotIn applies the NotIn predicate on the "access_key_secret" field.
+func AccessKeySecretNotIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldAccessKeySecret, vs...))
+}
+
+// AccessKeySecretGT applies the GT predicate on the "access_key_secret" field.
+func AccessKeySecretGT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretGTE applies the GTE predicate on the "access_key_secret" field.
+func AccessKeySecretGTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretLT applies the LT predicate on the "access_key_secret" field.
+func AccessKeySecretLT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretLTE applies the LTE predicate on the "access_key_secret" field.
+func AccessKeySecretLTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretContains applies the Contains predicate on the "access_key_secret" field.
+func AccessKeySecretContains(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContains(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretHasPrefix applies the HasPrefix predicate on the "access_key_secret" field.
+func AccessKeySecretHasPrefix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasPrefix(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretHasSuffix applies the HasSuffix predicate on the "access_key_secret" field.
+func AccessKeySecretHasSuffix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasSuffix(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretEqualFold applies the EqualFold predicate on the "access_key_secret" field.
+func AccessKeySecretEqualFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEqualFold(FieldAccessKeySecret, v))
+}
+
+// AccessKeySecretContainsFold applies the ContainsFold predicate on the "access_key_secret" field.
+func AccessKeySecretContainsFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContainsFold(FieldAccessKeySecret, v))
+}
+
+// AppIDEQ applies the EQ predicate on the "app_id" field.
+func AppIDEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldAppID, v))
+}
+
+// AppIDNEQ applies the NEQ predicate on the "app_id" field.
+func AppIDNEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldAppID, v))
+}
+
+// AppIDIn applies the In predicate on the "app_id" field.
+func AppIDIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldAppID, vs...))
+}
+
+// AppIDNotIn applies the NotIn predicate on the "app_id" field.
+func AppIDNotIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldAppID, vs...))
+}
+
+// AppIDGT applies the GT predicate on the "app_id" field.
+func AppIDGT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldAppID, v))
+}
+
+// AppIDGTE applies the GTE predicate on the "app_id" field.
+func AppIDGTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldAppID, v))
+}
+
+// AppIDLT applies the LT predicate on the "app_id" field.
+func AppIDLT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldAppID, v))
+}
+
+// AppIDLTE applies the LTE predicate on the "app_id" field.
+func AppIDLTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldAppID, v))
+}
+
+// AppIDContains applies the Contains predicate on the "app_id" field.
+func AppIDContains(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContains(FieldAppID, v))
+}
+
+// AppIDHasPrefix applies the HasPrefix predicate on the "app_id" field.
+func AppIDHasPrefix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasPrefix(FieldAppID, v))
+}
+
+// AppIDHasSuffix applies the HasSuffix predicate on the "app_id" field.
+func AppIDHasSuffix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasSuffix(FieldAppID, v))
+}
+
+// AppIDIsNil applies the IsNil predicate on the "app_id" field.
+func AppIDIsNil() predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIsNull(FieldAppID))
+}
+
+// AppIDNotNil applies the NotNil predicate on the "app_id" field.
+func AppIDNotNil() predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotNull(FieldAppID))
+}
+
+// AppIDEqualFold applies the EqualFold predicate on the "app_id" field.
+func AppIDEqualFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEqualFold(FieldAppID, v))
+}
+
+// AppIDContainsFold applies the ContainsFold predicate on the "app_id" field.
+func AppIDContainsFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContainsFold(FieldAppID, v))
+}
+
+// TenantIDEQ applies the EQ predicate on the "tenant_id" field.
+func TenantIDEQ(v int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldTenantID, v))
+}
+
+// TenantIDNEQ applies the NEQ predicate on the "tenant_id" field.
+func TenantIDNEQ(v int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldTenantID, v))
+}
+
+// TenantIDIn applies the In predicate on the "tenant_id" field.
+func TenantIDIn(vs ...int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldTenantID, vs...))
+}
+
+// TenantIDNotIn applies the NotIn predicate on the "tenant_id" field.
+func TenantIDNotIn(vs ...int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldTenantID, vs...))
+}
+
+// TenantIDGT applies the GT predicate on the "tenant_id" field.
+func TenantIDGT(v int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldTenantID, v))
+}
+
+// TenantIDGTE applies the GTE predicate on the "tenant_id" field.
+func TenantIDGTE(v int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldTenantID, v))
+}
+
+// TenantIDLT applies the LT predicate on the "tenant_id" field.
+func TenantIDLT(v int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldTenantID, v))
+}
+
+// TenantIDLTE applies the LTE predicate on the "tenant_id" field.
+func TenantIDLTE(v int64) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldTenantID, v))
+}
+
+// ResponseEQ applies the EQ predicate on the "response" field.
+func ResponseEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldResponse, v))
+}
+
+// ResponseNEQ applies the NEQ predicate on the "response" field.
+func ResponseNEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldResponse, v))
+}
+
+// ResponseIn applies the In predicate on the "response" field.
+func ResponseIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldResponse, vs...))
+}
+
+// ResponseNotIn applies the NotIn predicate on the "response" field.
+func ResponseNotIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldResponse, vs...))
+}
+
+// ResponseGT applies the GT predicate on the "response" field.
+func ResponseGT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldResponse, v))
+}
+
+// ResponseGTE applies the GTE predicate on the "response" field.
+func ResponseGTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldResponse, v))
+}
+
+// ResponseLT applies the LT predicate on the "response" field.
+func ResponseLT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldResponse, v))
+}
+
+// ResponseLTE applies the LTE predicate on the "response" field.
+func ResponseLTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldResponse, v))
+}
+
+// ResponseContains applies the Contains predicate on the "response" field.
+func ResponseContains(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContains(FieldResponse, v))
+}
+
+// ResponseHasPrefix applies the HasPrefix predicate on the "response" field.
+func ResponseHasPrefix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasPrefix(FieldResponse, v))
+}
+
+// ResponseHasSuffix applies the HasSuffix predicate on the "response" field.
+func ResponseHasSuffix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasSuffix(FieldResponse, v))
+}
+
+// ResponseEqualFold applies the EqualFold predicate on the "response" field.
+func ResponseEqualFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEqualFold(FieldResponse, v))
+}
+
+// ResponseContainsFold applies the ContainsFold predicate on the "response" field.
+func ResponseContainsFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContainsFold(FieldResponse, v))
+}
+
+// TokenEQ applies the EQ predicate on the "token" field.
+func TokenEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldToken, v))
+}
+
+// TokenNEQ applies the NEQ predicate on the "token" field.
+func TokenNEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldToken, v))
+}
+
+// TokenIn applies the In predicate on the "token" field.
+func TokenIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldToken, vs...))
+}
+
+// TokenNotIn applies the NotIn predicate on the "token" field.
+func TokenNotIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldToken, vs...))
+}
+
+// TokenGT applies the GT predicate on the "token" field.
+func TokenGT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldToken, v))
+}
+
+// TokenGTE applies the GTE predicate on the "token" field.
+func TokenGTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldToken, v))
+}
+
+// TokenLT applies the LT predicate on the "token" field.
+func TokenLT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldToken, v))
+}
+
+// TokenLTE applies the LTE predicate on the "token" field.
+func TokenLTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldToken, v))
+}
+
+// TokenContains applies the Contains predicate on the "token" field.
+func TokenContains(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContains(FieldToken, v))
+}
+
+// TokenHasPrefix applies the HasPrefix predicate on the "token" field.
+func TokenHasPrefix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasPrefix(FieldToken, v))
+}
+
+// TokenHasSuffix applies the HasSuffix predicate on the "token" field.
+func TokenHasSuffix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasSuffix(FieldToken, v))
+}
+
+// TokenEqualFold applies the EqualFold predicate on the "token" field.
+func TokenEqualFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEqualFold(FieldToken, v))
+}
+
+// TokenContainsFold applies the ContainsFold predicate on the "token" field.
+func TokenContainsFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContainsFold(FieldToken, v))
+}
+
+// SessionIDEQ applies the EQ predicate on the "session_id" field.
+func SessionIDEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEQ(FieldSessionID, v))
+}
+
+// SessionIDNEQ applies the NEQ predicate on the "session_id" field.
+func SessionIDNEQ(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNEQ(FieldSessionID, v))
+}
+
+// SessionIDIn applies the In predicate on the "session_id" field.
+func SessionIDIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldIn(FieldSessionID, vs...))
+}
+
+// SessionIDNotIn applies the NotIn predicate on the "session_id" field.
+func SessionIDNotIn(vs ...string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldNotIn(FieldSessionID, vs...))
+}
+
+// SessionIDGT applies the GT predicate on the "session_id" field.
+func SessionIDGT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGT(FieldSessionID, v))
+}
+
+// SessionIDGTE applies the GTE predicate on the "session_id" field.
+func SessionIDGTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldGTE(FieldSessionID, v))
+}
+
+// SessionIDLT applies the LT predicate on the "session_id" field.
+func SessionIDLT(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLT(FieldSessionID, v))
+}
+
+// SessionIDLTE applies the LTE predicate on the "session_id" field.
+func SessionIDLTE(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldLTE(FieldSessionID, v))
+}
+
+// SessionIDContains applies the Contains predicate on the "session_id" field.
+func SessionIDContains(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContains(FieldSessionID, v))
+}
+
+// SessionIDHasPrefix applies the HasPrefix predicate on the "session_id" field.
+func SessionIDHasPrefix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasPrefix(FieldSessionID, v))
+}
+
+// SessionIDHasSuffix applies the HasSuffix predicate on the "session_id" field.
+func SessionIDHasSuffix(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldHasSuffix(FieldSessionID, v))
+}
+
+// SessionIDEqualFold applies the EqualFold predicate on the "session_id" field.
+func SessionIDEqualFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldEqualFold(FieldSessionID, v))
+}
+
+// SessionIDContainsFold applies the ContainsFold predicate on the "session_id" field.
+func SessionIDContainsFold(v string) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.FieldContainsFold(FieldSessionID, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.AliyunAvatar) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.AliyunAvatar) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.AliyunAvatar) predicate.AliyunAvatar {
+	return predicate.AliyunAvatar(sql.NotPredicates(p))
+}

+ 1187 - 0
ent/aliyunavatar_create.go

@@ -0,0 +1,1187 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/aliyunavatar"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// AliyunAvatarCreate is the builder for creating a AliyunAvatar entity.
+type AliyunAvatarCreate struct {
+	config
+	mutation *AliyunAvatarMutation
+	hooks    []Hook
+	conflict []sql.ConflictOption
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (aac *AliyunAvatarCreate) SetCreatedAt(t time.Time) *AliyunAvatarCreate {
+	aac.mutation.SetCreatedAt(t)
+	return aac
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (aac *AliyunAvatarCreate) SetNillableCreatedAt(t *time.Time) *AliyunAvatarCreate {
+	if t != nil {
+		aac.SetCreatedAt(*t)
+	}
+	return aac
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (aac *AliyunAvatarCreate) SetUpdatedAt(t time.Time) *AliyunAvatarCreate {
+	aac.mutation.SetUpdatedAt(t)
+	return aac
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (aac *AliyunAvatarCreate) SetNillableUpdatedAt(t *time.Time) *AliyunAvatarCreate {
+	if t != nil {
+		aac.SetUpdatedAt(*t)
+	}
+	return aac
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (aac *AliyunAvatarCreate) SetDeletedAt(t time.Time) *AliyunAvatarCreate {
+	aac.mutation.SetDeletedAt(t)
+	return aac
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (aac *AliyunAvatarCreate) SetNillableDeletedAt(t *time.Time) *AliyunAvatarCreate {
+	if t != nil {
+		aac.SetDeletedAt(*t)
+	}
+	return aac
+}
+
+// SetUserID sets the "user_id" field.
+func (aac *AliyunAvatarCreate) SetUserID(u uint64) *AliyunAvatarCreate {
+	aac.mutation.SetUserID(u)
+	return aac
+}
+
+// SetBizID sets the "biz_id" field.
+func (aac *AliyunAvatarCreate) SetBizID(s string) *AliyunAvatarCreate {
+	aac.mutation.SetBizID(s)
+	return aac
+}
+
+// SetAccessKeyID sets the "access_key_id" field.
+func (aac *AliyunAvatarCreate) SetAccessKeyID(s string) *AliyunAvatarCreate {
+	aac.mutation.SetAccessKeyID(s)
+	return aac
+}
+
+// SetAccessKeySecret sets the "access_key_secret" field.
+func (aac *AliyunAvatarCreate) SetAccessKeySecret(s string) *AliyunAvatarCreate {
+	aac.mutation.SetAccessKeySecret(s)
+	return aac
+}
+
+// SetAppID sets the "app_id" field.
+func (aac *AliyunAvatarCreate) SetAppID(s string) *AliyunAvatarCreate {
+	aac.mutation.SetAppID(s)
+	return aac
+}
+
+// SetNillableAppID sets the "app_id" field if the given value is not nil.
+func (aac *AliyunAvatarCreate) SetNillableAppID(s *string) *AliyunAvatarCreate {
+	if s != nil {
+		aac.SetAppID(*s)
+	}
+	return aac
+}
+
+// SetTenantID sets the "tenant_id" field.
+func (aac *AliyunAvatarCreate) SetTenantID(i int64) *AliyunAvatarCreate {
+	aac.mutation.SetTenantID(i)
+	return aac
+}
+
+// SetResponse sets the "response" field.
+func (aac *AliyunAvatarCreate) SetResponse(s string) *AliyunAvatarCreate {
+	aac.mutation.SetResponse(s)
+	return aac
+}
+
+// SetToken sets the "token" field.
+func (aac *AliyunAvatarCreate) SetToken(s string) *AliyunAvatarCreate {
+	aac.mutation.SetToken(s)
+	return aac
+}
+
+// SetNillableToken sets the "token" field if the given value is not nil.
+func (aac *AliyunAvatarCreate) SetNillableToken(s *string) *AliyunAvatarCreate {
+	if s != nil {
+		aac.SetToken(*s)
+	}
+	return aac
+}
+
+// SetSessionID sets the "session_id" field.
+func (aac *AliyunAvatarCreate) SetSessionID(s string) *AliyunAvatarCreate {
+	aac.mutation.SetSessionID(s)
+	return aac
+}
+
+// SetNillableSessionID sets the "session_id" field if the given value is not nil.
+func (aac *AliyunAvatarCreate) SetNillableSessionID(s *string) *AliyunAvatarCreate {
+	if s != nil {
+		aac.SetSessionID(*s)
+	}
+	return aac
+}
+
+// SetID sets the "id" field.
+func (aac *AliyunAvatarCreate) SetID(u uint64) *AliyunAvatarCreate {
+	aac.mutation.SetID(u)
+	return aac
+}
+
+// Mutation returns the AliyunAvatarMutation object of the builder.
+func (aac *AliyunAvatarCreate) Mutation() *AliyunAvatarMutation {
+	return aac.mutation
+}
+
+// Save creates the AliyunAvatar in the database.
+func (aac *AliyunAvatarCreate) Save(ctx context.Context) (*AliyunAvatar, error) {
+	if err := aac.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, aac.sqlSave, aac.mutation, aac.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (aac *AliyunAvatarCreate) SaveX(ctx context.Context) *AliyunAvatar {
+	v, err := aac.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (aac *AliyunAvatarCreate) Exec(ctx context.Context) error {
+	_, err := aac.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (aac *AliyunAvatarCreate) ExecX(ctx context.Context) {
+	if err := aac.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (aac *AliyunAvatarCreate) defaults() error {
+	if _, ok := aac.mutation.CreatedAt(); !ok {
+		if aliyunavatar.DefaultCreatedAt == nil {
+			return fmt.Errorf("ent: uninitialized aliyunavatar.DefaultCreatedAt (forgotten import ent/runtime?)")
+		}
+		v := aliyunavatar.DefaultCreatedAt()
+		aac.mutation.SetCreatedAt(v)
+	}
+	if _, ok := aac.mutation.UpdatedAt(); !ok {
+		if aliyunavatar.DefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized aliyunavatar.DefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := aliyunavatar.DefaultUpdatedAt()
+		aac.mutation.SetUpdatedAt(v)
+	}
+	if _, ok := aac.mutation.Token(); !ok {
+		v := aliyunavatar.DefaultToken
+		aac.mutation.SetToken(v)
+	}
+	if _, ok := aac.mutation.SessionID(); !ok {
+		v := aliyunavatar.DefaultSessionID
+		aac.mutation.SetSessionID(v)
+	}
+	return nil
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (aac *AliyunAvatarCreate) check() error {
+	if _, ok := aac.mutation.CreatedAt(); !ok {
+		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "AliyunAvatar.created_at"`)}
+	}
+	if _, ok := aac.mutation.UpdatedAt(); !ok {
+		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AliyunAvatar.updated_at"`)}
+	}
+	if _, ok := aac.mutation.UserID(); !ok {
+		return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "AliyunAvatar.user_id"`)}
+	}
+	if _, ok := aac.mutation.BizID(); !ok {
+		return &ValidationError{Name: "biz_id", err: errors.New(`ent: missing required field "AliyunAvatar.biz_id"`)}
+	}
+	if _, ok := aac.mutation.AccessKeyID(); !ok {
+		return &ValidationError{Name: "access_key_id", err: errors.New(`ent: missing required field "AliyunAvatar.access_key_id"`)}
+	}
+	if _, ok := aac.mutation.AccessKeySecret(); !ok {
+		return &ValidationError{Name: "access_key_secret", err: errors.New(`ent: missing required field "AliyunAvatar.access_key_secret"`)}
+	}
+	if _, ok := aac.mutation.TenantID(); !ok {
+		return &ValidationError{Name: "tenant_id", err: errors.New(`ent: missing required field "AliyunAvatar.tenant_id"`)}
+	}
+	if _, ok := aac.mutation.Response(); !ok {
+		return &ValidationError{Name: "response", err: errors.New(`ent: missing required field "AliyunAvatar.response"`)}
+	}
+	if _, ok := aac.mutation.Token(); !ok {
+		return &ValidationError{Name: "token", err: errors.New(`ent: missing required field "AliyunAvatar.token"`)}
+	}
+	if _, ok := aac.mutation.SessionID(); !ok {
+		return &ValidationError{Name: "session_id", err: errors.New(`ent: missing required field "AliyunAvatar.session_id"`)}
+	}
+	return nil
+}
+
+func (aac *AliyunAvatarCreate) sqlSave(ctx context.Context) (*AliyunAvatar, error) {
+	if err := aac.check(); err != nil {
+		return nil, err
+	}
+	_node, _spec := aac.createSpec()
+	if err := sqlgraph.CreateNode(ctx, aac.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)
+	}
+	aac.mutation.id = &_node.ID
+	aac.mutation.done = true
+	return _node, nil
+}
+
+func (aac *AliyunAvatarCreate) createSpec() (*AliyunAvatar, *sqlgraph.CreateSpec) {
+	var (
+		_node = &AliyunAvatar{config: aac.config}
+		_spec = sqlgraph.NewCreateSpec(aliyunavatar.Table, sqlgraph.NewFieldSpec(aliyunavatar.FieldID, field.TypeUint64))
+	)
+	_spec.OnConflict = aac.conflict
+	if id, ok := aac.mutation.ID(); ok {
+		_node.ID = id
+		_spec.ID.Value = id
+	}
+	if value, ok := aac.mutation.CreatedAt(); ok {
+		_spec.SetField(aliyunavatar.FieldCreatedAt, field.TypeTime, value)
+		_node.CreatedAt = value
+	}
+	if value, ok := aac.mutation.UpdatedAt(); ok {
+		_spec.SetField(aliyunavatar.FieldUpdatedAt, field.TypeTime, value)
+		_node.UpdatedAt = value
+	}
+	if value, ok := aac.mutation.DeletedAt(); ok {
+		_spec.SetField(aliyunavatar.FieldDeletedAt, field.TypeTime, value)
+		_node.DeletedAt = value
+	}
+	if value, ok := aac.mutation.UserID(); ok {
+		_spec.SetField(aliyunavatar.FieldUserID, field.TypeUint64, value)
+		_node.UserID = value
+	}
+	if value, ok := aac.mutation.BizID(); ok {
+		_spec.SetField(aliyunavatar.FieldBizID, field.TypeString, value)
+		_node.BizID = value
+	}
+	if value, ok := aac.mutation.AccessKeyID(); ok {
+		_spec.SetField(aliyunavatar.FieldAccessKeyID, field.TypeString, value)
+		_node.AccessKeyID = value
+	}
+	if value, ok := aac.mutation.AccessKeySecret(); ok {
+		_spec.SetField(aliyunavatar.FieldAccessKeySecret, field.TypeString, value)
+		_node.AccessKeySecret = value
+	}
+	if value, ok := aac.mutation.AppID(); ok {
+		_spec.SetField(aliyunavatar.FieldAppID, field.TypeString, value)
+		_node.AppID = value
+	}
+	if value, ok := aac.mutation.TenantID(); ok {
+		_spec.SetField(aliyunavatar.FieldTenantID, field.TypeInt64, value)
+		_node.TenantID = value
+	}
+	if value, ok := aac.mutation.Response(); ok {
+		_spec.SetField(aliyunavatar.FieldResponse, field.TypeString, value)
+		_node.Response = value
+	}
+	if value, ok := aac.mutation.Token(); ok {
+		_spec.SetField(aliyunavatar.FieldToken, field.TypeString, value)
+		_node.Token = value
+	}
+	if value, ok := aac.mutation.SessionID(); ok {
+		_spec.SetField(aliyunavatar.FieldSessionID, field.TypeString, value)
+		_node.SessionID = value
+	}
+	return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.AliyunAvatar.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.AliyunAvatarUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (aac *AliyunAvatarCreate) OnConflict(opts ...sql.ConflictOption) *AliyunAvatarUpsertOne {
+	aac.conflict = opts
+	return &AliyunAvatarUpsertOne{
+		create: aac,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.AliyunAvatar.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (aac *AliyunAvatarCreate) OnConflictColumns(columns ...string) *AliyunAvatarUpsertOne {
+	aac.conflict = append(aac.conflict, sql.ConflictColumns(columns...))
+	return &AliyunAvatarUpsertOne{
+		create: aac,
+	}
+}
+
+type (
+	// AliyunAvatarUpsertOne is the builder for "upsert"-ing
+	//  one AliyunAvatar node.
+	AliyunAvatarUpsertOne struct {
+		create *AliyunAvatarCreate
+	}
+
+	// AliyunAvatarUpsert is the "OnConflict" setter.
+	AliyunAvatarUpsert struct {
+		*sql.UpdateSet
+	}
+)
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *AliyunAvatarUpsert) SetUpdatedAt(v time.Time) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldUpdatedAt, v)
+	return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateUpdatedAt() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldUpdatedAt)
+	return u
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *AliyunAvatarUpsert) SetDeletedAt(v time.Time) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldDeletedAt, v)
+	return u
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateDeletedAt() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldDeletedAt)
+	return u
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *AliyunAvatarUpsert) ClearDeletedAt() *AliyunAvatarUpsert {
+	u.SetNull(aliyunavatar.FieldDeletedAt)
+	return u
+}
+
+// SetUserID sets the "user_id" field.
+func (u *AliyunAvatarUpsert) SetUserID(v uint64) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldUserID, v)
+	return u
+}
+
+// UpdateUserID sets the "user_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateUserID() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldUserID)
+	return u
+}
+
+// AddUserID adds v to the "user_id" field.
+func (u *AliyunAvatarUpsert) AddUserID(v uint64) *AliyunAvatarUpsert {
+	u.Add(aliyunavatar.FieldUserID, v)
+	return u
+}
+
+// SetBizID sets the "biz_id" field.
+func (u *AliyunAvatarUpsert) SetBizID(v string) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldBizID, v)
+	return u
+}
+
+// UpdateBizID sets the "biz_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateBizID() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldBizID)
+	return u
+}
+
+// SetAccessKeyID sets the "access_key_id" field.
+func (u *AliyunAvatarUpsert) SetAccessKeyID(v string) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldAccessKeyID, v)
+	return u
+}
+
+// UpdateAccessKeyID sets the "access_key_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateAccessKeyID() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldAccessKeyID)
+	return u
+}
+
+// SetAccessKeySecret sets the "access_key_secret" field.
+func (u *AliyunAvatarUpsert) SetAccessKeySecret(v string) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldAccessKeySecret, v)
+	return u
+}
+
+// UpdateAccessKeySecret sets the "access_key_secret" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateAccessKeySecret() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldAccessKeySecret)
+	return u
+}
+
+// SetAppID sets the "app_id" field.
+func (u *AliyunAvatarUpsert) SetAppID(v string) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldAppID, v)
+	return u
+}
+
+// UpdateAppID sets the "app_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateAppID() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldAppID)
+	return u
+}
+
+// ClearAppID clears the value of the "app_id" field.
+func (u *AliyunAvatarUpsert) ClearAppID() *AliyunAvatarUpsert {
+	u.SetNull(aliyunavatar.FieldAppID)
+	return u
+}
+
+// SetTenantID sets the "tenant_id" field.
+func (u *AliyunAvatarUpsert) SetTenantID(v int64) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldTenantID, v)
+	return u
+}
+
+// UpdateTenantID sets the "tenant_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateTenantID() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldTenantID)
+	return u
+}
+
+// AddTenantID adds v to the "tenant_id" field.
+func (u *AliyunAvatarUpsert) AddTenantID(v int64) *AliyunAvatarUpsert {
+	u.Add(aliyunavatar.FieldTenantID, v)
+	return u
+}
+
+// SetResponse sets the "response" field.
+func (u *AliyunAvatarUpsert) SetResponse(v string) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldResponse, v)
+	return u
+}
+
+// UpdateResponse sets the "response" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateResponse() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldResponse)
+	return u
+}
+
+// SetToken sets the "token" field.
+func (u *AliyunAvatarUpsert) SetToken(v string) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldToken, v)
+	return u
+}
+
+// UpdateToken sets the "token" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateToken() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldToken)
+	return u
+}
+
+// SetSessionID sets the "session_id" field.
+func (u *AliyunAvatarUpsert) SetSessionID(v string) *AliyunAvatarUpsert {
+	u.Set(aliyunavatar.FieldSessionID, v)
+	return u
+}
+
+// UpdateSessionID sets the "session_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsert) UpdateSessionID() *AliyunAvatarUpsert {
+	u.SetExcluded(aliyunavatar.FieldSessionID)
+	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.AliyunAvatar.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(aliyunavatar.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *AliyunAvatarUpsertOne) UpdateNewValues() *AliyunAvatarUpsertOne {
+	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(aliyunavatar.FieldID)
+		}
+		if _, exists := u.create.mutation.CreatedAt(); exists {
+			s.SetIgnore(aliyunavatar.FieldCreatedAt)
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.AliyunAvatar.Create().
+//	    OnConflict(sql.ResolveWithIgnore()).
+//	    Exec(ctx)
+func (u *AliyunAvatarUpsertOne) Ignore() *AliyunAvatarUpsertOne {
+	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 *AliyunAvatarUpsertOne) DoNothing() *AliyunAvatarUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the AliyunAvatarCreate.OnConflict
+// documentation for more info.
+func (u *AliyunAvatarUpsertOne) Update(set func(*AliyunAvatarUpsert)) *AliyunAvatarUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&AliyunAvatarUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *AliyunAvatarUpsertOne) SetUpdatedAt(v time.Time) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateUpdatedAt() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *AliyunAvatarUpsertOne) SetDeletedAt(v time.Time) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateDeletedAt() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *AliyunAvatarUpsertOne) ClearDeletedAt() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetUserID sets the "user_id" field.
+func (u *AliyunAvatarUpsertOne) SetUserID(v uint64) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetUserID(v)
+	})
+}
+
+// AddUserID adds v to the "user_id" field.
+func (u *AliyunAvatarUpsertOne) AddUserID(v uint64) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.AddUserID(v)
+	})
+}
+
+// UpdateUserID sets the "user_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateUserID() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateUserID()
+	})
+}
+
+// SetBizID sets the "biz_id" field.
+func (u *AliyunAvatarUpsertOne) SetBizID(v string) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetBizID(v)
+	})
+}
+
+// UpdateBizID sets the "biz_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateBizID() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateBizID()
+	})
+}
+
+// SetAccessKeyID sets the "access_key_id" field.
+func (u *AliyunAvatarUpsertOne) SetAccessKeyID(v string) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetAccessKeyID(v)
+	})
+}
+
+// UpdateAccessKeyID sets the "access_key_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateAccessKeyID() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateAccessKeyID()
+	})
+}
+
+// SetAccessKeySecret sets the "access_key_secret" field.
+func (u *AliyunAvatarUpsertOne) SetAccessKeySecret(v string) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetAccessKeySecret(v)
+	})
+}
+
+// UpdateAccessKeySecret sets the "access_key_secret" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateAccessKeySecret() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateAccessKeySecret()
+	})
+}
+
+// SetAppID sets the "app_id" field.
+func (u *AliyunAvatarUpsertOne) SetAppID(v string) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetAppID(v)
+	})
+}
+
+// UpdateAppID sets the "app_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateAppID() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateAppID()
+	})
+}
+
+// ClearAppID clears the value of the "app_id" field.
+func (u *AliyunAvatarUpsertOne) ClearAppID() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.ClearAppID()
+	})
+}
+
+// SetTenantID sets the "tenant_id" field.
+func (u *AliyunAvatarUpsertOne) SetTenantID(v int64) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetTenantID(v)
+	})
+}
+
+// AddTenantID adds v to the "tenant_id" field.
+func (u *AliyunAvatarUpsertOne) AddTenantID(v int64) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.AddTenantID(v)
+	})
+}
+
+// UpdateTenantID sets the "tenant_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateTenantID() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateTenantID()
+	})
+}
+
+// SetResponse sets the "response" field.
+func (u *AliyunAvatarUpsertOne) SetResponse(v string) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetResponse(v)
+	})
+}
+
+// UpdateResponse sets the "response" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateResponse() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateResponse()
+	})
+}
+
+// SetToken sets the "token" field.
+func (u *AliyunAvatarUpsertOne) SetToken(v string) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetToken(v)
+	})
+}
+
+// UpdateToken sets the "token" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateToken() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateToken()
+	})
+}
+
+// SetSessionID sets the "session_id" field.
+func (u *AliyunAvatarUpsertOne) SetSessionID(v string) *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetSessionID(v)
+	})
+}
+
+// UpdateSessionID sets the "session_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertOne) UpdateSessionID() *AliyunAvatarUpsertOne {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateSessionID()
+	})
+}
+
+// Exec executes the query.
+func (u *AliyunAvatarUpsertOne) Exec(ctx context.Context) error {
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for AliyunAvatarCreate.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *AliyunAvatarUpsertOne) 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 *AliyunAvatarUpsertOne) 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 *AliyunAvatarUpsertOne) IDX(ctx context.Context) uint64 {
+	id, err := u.ID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// AliyunAvatarCreateBulk is the builder for creating many AliyunAvatar entities in bulk.
+type AliyunAvatarCreateBulk struct {
+	config
+	err      error
+	builders []*AliyunAvatarCreate
+	conflict []sql.ConflictOption
+}
+
+// Save creates the AliyunAvatar entities in the database.
+func (aacb *AliyunAvatarCreateBulk) Save(ctx context.Context) ([]*AliyunAvatar, error) {
+	if aacb.err != nil {
+		return nil, aacb.err
+	}
+	specs := make([]*sqlgraph.CreateSpec, len(aacb.builders))
+	nodes := make([]*AliyunAvatar, len(aacb.builders))
+	mutators := make([]Mutator, len(aacb.builders))
+	for i := range aacb.builders {
+		func(i int, root context.Context) {
+			builder := aacb.builders[i]
+			builder.defaults()
+			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+				mutation, ok := m.(*AliyunAvatarMutation)
+				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, aacb.builders[i+1].mutation)
+				} else {
+					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+					spec.OnConflict = aacb.conflict
+					// Invoke the actual operation on the latest mutation in the chain.
+					if err = sqlgraph.BatchCreate(ctx, aacb.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, aacb.builders[0].mutation); err != nil {
+			return nil, err
+		}
+	}
+	return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (aacb *AliyunAvatarCreateBulk) SaveX(ctx context.Context) []*AliyunAvatar {
+	v, err := aacb.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (aacb *AliyunAvatarCreateBulk) Exec(ctx context.Context) error {
+	_, err := aacb.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (aacb *AliyunAvatarCreateBulk) ExecX(ctx context.Context) {
+	if err := aacb.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.AliyunAvatar.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.AliyunAvatarUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (aacb *AliyunAvatarCreateBulk) OnConflict(opts ...sql.ConflictOption) *AliyunAvatarUpsertBulk {
+	aacb.conflict = opts
+	return &AliyunAvatarUpsertBulk{
+		create: aacb,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.AliyunAvatar.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (aacb *AliyunAvatarCreateBulk) OnConflictColumns(columns ...string) *AliyunAvatarUpsertBulk {
+	aacb.conflict = append(aacb.conflict, sql.ConflictColumns(columns...))
+	return &AliyunAvatarUpsertBulk{
+		create: aacb,
+	}
+}
+
+// AliyunAvatarUpsertBulk is the builder for "upsert"-ing
+// a bulk of AliyunAvatar nodes.
+type AliyunAvatarUpsertBulk struct {
+	create *AliyunAvatarCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+//	client.AliyunAvatar.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(aliyunavatar.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *AliyunAvatarUpsertBulk) UpdateNewValues() *AliyunAvatarUpsertBulk {
+	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(aliyunavatar.FieldID)
+			}
+			if _, exists := b.mutation.CreatedAt(); exists {
+				s.SetIgnore(aliyunavatar.FieldCreatedAt)
+			}
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.AliyunAvatar.Create().
+//		OnConflict(sql.ResolveWithIgnore()).
+//		Exec(ctx)
+func (u *AliyunAvatarUpsertBulk) Ignore() *AliyunAvatarUpsertBulk {
+	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 *AliyunAvatarUpsertBulk) DoNothing() *AliyunAvatarUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the AliyunAvatarCreateBulk.OnConflict
+// documentation for more info.
+func (u *AliyunAvatarUpsertBulk) Update(set func(*AliyunAvatarUpsert)) *AliyunAvatarUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&AliyunAvatarUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *AliyunAvatarUpsertBulk) SetUpdatedAt(v time.Time) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateUpdatedAt() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *AliyunAvatarUpsertBulk) SetDeletedAt(v time.Time) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateDeletedAt() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *AliyunAvatarUpsertBulk) ClearDeletedAt() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetUserID sets the "user_id" field.
+func (u *AliyunAvatarUpsertBulk) SetUserID(v uint64) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetUserID(v)
+	})
+}
+
+// AddUserID adds v to the "user_id" field.
+func (u *AliyunAvatarUpsertBulk) AddUserID(v uint64) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.AddUserID(v)
+	})
+}
+
+// UpdateUserID sets the "user_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateUserID() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateUserID()
+	})
+}
+
+// SetBizID sets the "biz_id" field.
+func (u *AliyunAvatarUpsertBulk) SetBizID(v string) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetBizID(v)
+	})
+}
+
+// UpdateBizID sets the "biz_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateBizID() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateBizID()
+	})
+}
+
+// SetAccessKeyID sets the "access_key_id" field.
+func (u *AliyunAvatarUpsertBulk) SetAccessKeyID(v string) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetAccessKeyID(v)
+	})
+}
+
+// UpdateAccessKeyID sets the "access_key_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateAccessKeyID() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateAccessKeyID()
+	})
+}
+
+// SetAccessKeySecret sets the "access_key_secret" field.
+func (u *AliyunAvatarUpsertBulk) SetAccessKeySecret(v string) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetAccessKeySecret(v)
+	})
+}
+
+// UpdateAccessKeySecret sets the "access_key_secret" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateAccessKeySecret() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateAccessKeySecret()
+	})
+}
+
+// SetAppID sets the "app_id" field.
+func (u *AliyunAvatarUpsertBulk) SetAppID(v string) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetAppID(v)
+	})
+}
+
+// UpdateAppID sets the "app_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateAppID() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateAppID()
+	})
+}
+
+// ClearAppID clears the value of the "app_id" field.
+func (u *AliyunAvatarUpsertBulk) ClearAppID() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.ClearAppID()
+	})
+}
+
+// SetTenantID sets the "tenant_id" field.
+func (u *AliyunAvatarUpsertBulk) SetTenantID(v int64) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetTenantID(v)
+	})
+}
+
+// AddTenantID adds v to the "tenant_id" field.
+func (u *AliyunAvatarUpsertBulk) AddTenantID(v int64) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.AddTenantID(v)
+	})
+}
+
+// UpdateTenantID sets the "tenant_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateTenantID() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateTenantID()
+	})
+}
+
+// SetResponse sets the "response" field.
+func (u *AliyunAvatarUpsertBulk) SetResponse(v string) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetResponse(v)
+	})
+}
+
+// UpdateResponse sets the "response" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateResponse() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateResponse()
+	})
+}
+
+// SetToken sets the "token" field.
+func (u *AliyunAvatarUpsertBulk) SetToken(v string) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetToken(v)
+	})
+}
+
+// UpdateToken sets the "token" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateToken() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateToken()
+	})
+}
+
+// SetSessionID sets the "session_id" field.
+func (u *AliyunAvatarUpsertBulk) SetSessionID(v string) *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.SetSessionID(v)
+	})
+}
+
+// UpdateSessionID sets the "session_id" field to the value that was provided on create.
+func (u *AliyunAvatarUpsertBulk) UpdateSessionID() *AliyunAvatarUpsertBulk {
+	return u.Update(func(s *AliyunAvatarUpsert) {
+		s.UpdateSessionID()
+	})
+}
+
+// Exec executes the query.
+func (u *AliyunAvatarUpsertBulk) 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 AliyunAvatarCreateBulk instead", i)
+		}
+	}
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for AliyunAvatarCreateBulk.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *AliyunAvatarUpsertBulk) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 88 - 0
ent/aliyunavatar_delete.go

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

+ 526 - 0
ent/aliyunavatar_query.go

@@ -0,0 +1,526 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"fmt"
+	"math"
+	"wechat-api/ent/aliyunavatar"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// AliyunAvatarQuery is the builder for querying AliyunAvatar entities.
+type AliyunAvatarQuery struct {
+	config
+	ctx        *QueryContext
+	order      []aliyunavatar.OrderOption
+	inters     []Interceptor
+	predicates []predicate.AliyunAvatar
+	// intermediate query (i.e. traversal path).
+	sql  *sql.Selector
+	path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the AliyunAvatarQuery builder.
+func (aaq *AliyunAvatarQuery) Where(ps ...predicate.AliyunAvatar) *AliyunAvatarQuery {
+	aaq.predicates = append(aaq.predicates, ps...)
+	return aaq
+}
+
+// Limit the number of records to be returned by this query.
+func (aaq *AliyunAvatarQuery) Limit(limit int) *AliyunAvatarQuery {
+	aaq.ctx.Limit = &limit
+	return aaq
+}
+
+// Offset to start from.
+func (aaq *AliyunAvatarQuery) Offset(offset int) *AliyunAvatarQuery {
+	aaq.ctx.Offset = &offset
+	return aaq
+}
+
+// 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 (aaq *AliyunAvatarQuery) Unique(unique bool) *AliyunAvatarQuery {
+	aaq.ctx.Unique = &unique
+	return aaq
+}
+
+// Order specifies how the records should be ordered.
+func (aaq *AliyunAvatarQuery) Order(o ...aliyunavatar.OrderOption) *AliyunAvatarQuery {
+	aaq.order = append(aaq.order, o...)
+	return aaq
+}
+
+// First returns the first AliyunAvatar entity from the query.
+// Returns a *NotFoundError when no AliyunAvatar was found.
+func (aaq *AliyunAvatarQuery) First(ctx context.Context) (*AliyunAvatar, error) {
+	nodes, err := aaq.Limit(1).All(setContextOp(ctx, aaq.ctx, "First"))
+	if err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nil, &NotFoundError{aliyunavatar.Label}
+	}
+	return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (aaq *AliyunAvatarQuery) FirstX(ctx context.Context) *AliyunAvatar {
+	node, err := aaq.First(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return node
+}
+
+// FirstID returns the first AliyunAvatar ID from the query.
+// Returns a *NotFoundError when no AliyunAvatar ID was found.
+func (aaq *AliyunAvatarQuery) FirstID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = aaq.Limit(1).IDs(setContextOp(ctx, aaq.ctx, "FirstID")); err != nil {
+		return
+	}
+	if len(ids) == 0 {
+		err = &NotFoundError{aliyunavatar.Label}
+		return
+	}
+	return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (aaq *AliyunAvatarQuery) FirstIDX(ctx context.Context) uint64 {
+	id, err := aaq.FirstID(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return id
+}
+
+// Only returns a single AliyunAvatar entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one AliyunAvatar entity is found.
+// Returns a *NotFoundError when no AliyunAvatar entities are found.
+func (aaq *AliyunAvatarQuery) Only(ctx context.Context) (*AliyunAvatar, error) {
+	nodes, err := aaq.Limit(2).All(setContextOp(ctx, aaq.ctx, "Only"))
+	if err != nil {
+		return nil, err
+	}
+	switch len(nodes) {
+	case 1:
+		return nodes[0], nil
+	case 0:
+		return nil, &NotFoundError{aliyunavatar.Label}
+	default:
+		return nil, &NotSingularError{aliyunavatar.Label}
+	}
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (aaq *AliyunAvatarQuery) OnlyX(ctx context.Context) *AliyunAvatar {
+	node, err := aaq.Only(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// OnlyID is like Only, but returns the only AliyunAvatar ID in the query.
+// Returns a *NotSingularError when more than one AliyunAvatar ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (aaq *AliyunAvatarQuery) OnlyID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = aaq.Limit(2).IDs(setContextOp(ctx, aaq.ctx, "OnlyID")); err != nil {
+		return
+	}
+	switch len(ids) {
+	case 1:
+		id = ids[0]
+	case 0:
+		err = &NotFoundError{aliyunavatar.Label}
+	default:
+		err = &NotSingularError{aliyunavatar.Label}
+	}
+	return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (aaq *AliyunAvatarQuery) OnlyIDX(ctx context.Context) uint64 {
+	id, err := aaq.OnlyID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// All executes the query and returns a list of AliyunAvatars.
+func (aaq *AliyunAvatarQuery) All(ctx context.Context) ([]*AliyunAvatar, error) {
+	ctx = setContextOp(ctx, aaq.ctx, "All")
+	if err := aaq.prepareQuery(ctx); err != nil {
+		return nil, err
+	}
+	qr := querierAll[[]*AliyunAvatar, *AliyunAvatarQuery]()
+	return withInterceptors[[]*AliyunAvatar](ctx, aaq, qr, aaq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (aaq *AliyunAvatarQuery) AllX(ctx context.Context) []*AliyunAvatar {
+	nodes, err := aaq.All(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return nodes
+}
+
+// IDs executes the query and returns a list of AliyunAvatar IDs.
+func (aaq *AliyunAvatarQuery) IDs(ctx context.Context) (ids []uint64, err error) {
+	if aaq.ctx.Unique == nil && aaq.path != nil {
+		aaq.Unique(true)
+	}
+	ctx = setContextOp(ctx, aaq.ctx, "IDs")
+	if err = aaq.Select(aliyunavatar.FieldID).Scan(ctx, &ids); err != nil {
+		return nil, err
+	}
+	return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (aaq *AliyunAvatarQuery) IDsX(ctx context.Context) []uint64 {
+	ids, err := aaq.IDs(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return ids
+}
+
+// Count returns the count of the given query.
+func (aaq *AliyunAvatarQuery) Count(ctx context.Context) (int, error) {
+	ctx = setContextOp(ctx, aaq.ctx, "Count")
+	if err := aaq.prepareQuery(ctx); err != nil {
+		return 0, err
+	}
+	return withInterceptors[int](ctx, aaq, querierCount[*AliyunAvatarQuery](), aaq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (aaq *AliyunAvatarQuery) CountX(ctx context.Context) int {
+	count, err := aaq.Count(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (aaq *AliyunAvatarQuery) Exist(ctx context.Context) (bool, error) {
+	ctx = setContextOp(ctx, aaq.ctx, "Exist")
+	switch _, err := aaq.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 (aaq *AliyunAvatarQuery) ExistX(ctx context.Context) bool {
+	exist, err := aaq.Exist(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return exist
+}
+
+// Clone returns a duplicate of the AliyunAvatarQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (aaq *AliyunAvatarQuery) Clone() *AliyunAvatarQuery {
+	if aaq == nil {
+		return nil
+	}
+	return &AliyunAvatarQuery{
+		config:     aaq.config,
+		ctx:        aaq.ctx.Clone(),
+		order:      append([]aliyunavatar.OrderOption{}, aaq.order...),
+		inters:     append([]Interceptor{}, aaq.inters...),
+		predicates: append([]predicate.AliyunAvatar{}, aaq.predicates...),
+		// clone intermediate query.
+		sql:  aaq.sql.Clone(),
+		path: aaq.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.AliyunAvatar.Query().
+//		GroupBy(aliyunavatar.FieldCreatedAt).
+//		Aggregate(ent.Count()).
+//		Scan(ctx, &v)
+func (aaq *AliyunAvatarQuery) GroupBy(field string, fields ...string) *AliyunAvatarGroupBy {
+	aaq.ctx.Fields = append([]string{field}, fields...)
+	grbuild := &AliyunAvatarGroupBy{build: aaq}
+	grbuild.flds = &aaq.ctx.Fields
+	grbuild.label = aliyunavatar.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.AliyunAvatar.Query().
+//		Select(aliyunavatar.FieldCreatedAt).
+//		Scan(ctx, &v)
+func (aaq *AliyunAvatarQuery) Select(fields ...string) *AliyunAvatarSelect {
+	aaq.ctx.Fields = append(aaq.ctx.Fields, fields...)
+	sbuild := &AliyunAvatarSelect{AliyunAvatarQuery: aaq}
+	sbuild.label = aliyunavatar.Label
+	sbuild.flds, sbuild.scan = &aaq.ctx.Fields, sbuild.Scan
+	return sbuild
+}
+
+// Aggregate returns a AliyunAvatarSelect configured with the given aggregations.
+func (aaq *AliyunAvatarQuery) Aggregate(fns ...AggregateFunc) *AliyunAvatarSelect {
+	return aaq.Select().Aggregate(fns...)
+}
+
+func (aaq *AliyunAvatarQuery) prepareQuery(ctx context.Context) error {
+	for _, inter := range aaq.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, aaq); err != nil {
+				return err
+			}
+		}
+	}
+	for _, f := range aaq.ctx.Fields {
+		if !aliyunavatar.ValidColumn(f) {
+			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+		}
+	}
+	if aaq.path != nil {
+		prev, err := aaq.path(ctx)
+		if err != nil {
+			return err
+		}
+		aaq.sql = prev
+	}
+	return nil
+}
+
+func (aaq *AliyunAvatarQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AliyunAvatar, error) {
+	var (
+		nodes = []*AliyunAvatar{}
+		_spec = aaq.querySpec()
+	)
+	_spec.ScanValues = func(columns []string) ([]any, error) {
+		return (*AliyunAvatar).scanValues(nil, columns)
+	}
+	_spec.Assign = func(columns []string, values []any) error {
+		node := &AliyunAvatar{config: aaq.config}
+		nodes = append(nodes, node)
+		return node.assignValues(columns, values)
+	}
+	for i := range hooks {
+		hooks[i](ctx, _spec)
+	}
+	if err := sqlgraph.QueryNodes(ctx, aaq.driver, _spec); err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nodes, nil
+	}
+	return nodes, nil
+}
+
+func (aaq *AliyunAvatarQuery) sqlCount(ctx context.Context) (int, error) {
+	_spec := aaq.querySpec()
+	_spec.Node.Columns = aaq.ctx.Fields
+	if len(aaq.ctx.Fields) > 0 {
+		_spec.Unique = aaq.ctx.Unique != nil && *aaq.ctx.Unique
+	}
+	return sqlgraph.CountNodes(ctx, aaq.driver, _spec)
+}
+
+func (aaq *AliyunAvatarQuery) querySpec() *sqlgraph.QuerySpec {
+	_spec := sqlgraph.NewQuerySpec(aliyunavatar.Table, aliyunavatar.Columns, sqlgraph.NewFieldSpec(aliyunavatar.FieldID, field.TypeUint64))
+	_spec.From = aaq.sql
+	if unique := aaq.ctx.Unique; unique != nil {
+		_spec.Unique = *unique
+	} else if aaq.path != nil {
+		_spec.Unique = true
+	}
+	if fields := aaq.ctx.Fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, aliyunavatar.FieldID)
+		for i := range fields {
+			if fields[i] != aliyunavatar.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+			}
+		}
+	}
+	if ps := aaq.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if limit := aaq.ctx.Limit; limit != nil {
+		_spec.Limit = *limit
+	}
+	if offset := aaq.ctx.Offset; offset != nil {
+		_spec.Offset = *offset
+	}
+	if ps := aaq.order; len(ps) > 0 {
+		_spec.Order = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	return _spec
+}
+
+func (aaq *AliyunAvatarQuery) sqlQuery(ctx context.Context) *sql.Selector {
+	builder := sql.Dialect(aaq.driver.Dialect())
+	t1 := builder.Table(aliyunavatar.Table)
+	columns := aaq.ctx.Fields
+	if len(columns) == 0 {
+		columns = aliyunavatar.Columns
+	}
+	selector := builder.Select(t1.Columns(columns...)...).From(t1)
+	if aaq.sql != nil {
+		selector = aaq.sql
+		selector.Select(selector.Columns(columns...)...)
+	}
+	if aaq.ctx.Unique != nil && *aaq.ctx.Unique {
+		selector.Distinct()
+	}
+	for _, p := range aaq.predicates {
+		p(selector)
+	}
+	for _, p := range aaq.order {
+		p(selector)
+	}
+	if offset := aaq.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 := aaq.ctx.Limit; limit != nil {
+		selector.Limit(*limit)
+	}
+	return selector
+}
+
+// AliyunAvatarGroupBy is the group-by builder for AliyunAvatar entities.
+type AliyunAvatarGroupBy struct {
+	selector
+	build *AliyunAvatarQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (aagb *AliyunAvatarGroupBy) Aggregate(fns ...AggregateFunc) *AliyunAvatarGroupBy {
+	aagb.fns = append(aagb.fns, fns...)
+	return aagb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (aagb *AliyunAvatarGroupBy) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, aagb.build.ctx, "GroupBy")
+	if err := aagb.build.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*AliyunAvatarQuery, *AliyunAvatarGroupBy](ctx, aagb.build, aagb, aagb.build.inters, v)
+}
+
+func (aagb *AliyunAvatarGroupBy) sqlScan(ctx context.Context, root *AliyunAvatarQuery, v any) error {
+	selector := root.sqlQuery(ctx).Select()
+	aggregation := make([]string, 0, len(aagb.fns))
+	for _, fn := range aagb.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	if len(selector.SelectedColumns()) == 0 {
+		columns := make([]string, 0, len(*aagb.flds)+len(aagb.fns))
+		for _, f := range *aagb.flds {
+			columns = append(columns, selector.C(f))
+		}
+		columns = append(columns, aggregation...)
+		selector.Select(columns...)
+	}
+	selector.GroupBy(selector.Columns(*aagb.flds...)...)
+	if err := selector.Err(); err != nil {
+		return err
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := aagb.build.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}
+
+// AliyunAvatarSelect is the builder for selecting fields of AliyunAvatar entities.
+type AliyunAvatarSelect struct {
+	*AliyunAvatarQuery
+	selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (aas *AliyunAvatarSelect) Aggregate(fns ...AggregateFunc) *AliyunAvatarSelect {
+	aas.fns = append(aas.fns, fns...)
+	return aas
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (aas *AliyunAvatarSelect) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, aas.ctx, "Select")
+	if err := aas.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*AliyunAvatarQuery, *AliyunAvatarSelect](ctx, aas.AliyunAvatarQuery, aas, aas.inters, v)
+}
+
+func (aas *AliyunAvatarSelect) sqlScan(ctx context.Context, root *AliyunAvatarQuery, v any) error {
+	selector := root.sqlQuery(ctx)
+	aggregation := make([]string, 0, len(aas.fns))
+	for _, fn := range aas.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	switch n := len(*aas.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 := aas.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}

+ 640 - 0
ent/aliyunavatar_update.go

@@ -0,0 +1,640 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/aliyunavatar"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// AliyunAvatarUpdate is the builder for updating AliyunAvatar entities.
+type AliyunAvatarUpdate struct {
+	config
+	hooks    []Hook
+	mutation *AliyunAvatarMutation
+}
+
+// Where appends a list predicates to the AliyunAvatarUpdate builder.
+func (aau *AliyunAvatarUpdate) Where(ps ...predicate.AliyunAvatar) *AliyunAvatarUpdate {
+	aau.mutation.Where(ps...)
+	return aau
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (aau *AliyunAvatarUpdate) SetUpdatedAt(t time.Time) *AliyunAvatarUpdate {
+	aau.mutation.SetUpdatedAt(t)
+	return aau
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (aau *AliyunAvatarUpdate) SetDeletedAt(t time.Time) *AliyunAvatarUpdate {
+	aau.mutation.SetDeletedAt(t)
+	return aau
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableDeletedAt(t *time.Time) *AliyunAvatarUpdate {
+	if t != nil {
+		aau.SetDeletedAt(*t)
+	}
+	return aau
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (aau *AliyunAvatarUpdate) ClearDeletedAt() *AliyunAvatarUpdate {
+	aau.mutation.ClearDeletedAt()
+	return aau
+}
+
+// SetUserID sets the "user_id" field.
+func (aau *AliyunAvatarUpdate) SetUserID(u uint64) *AliyunAvatarUpdate {
+	aau.mutation.ResetUserID()
+	aau.mutation.SetUserID(u)
+	return aau
+}
+
+// SetNillableUserID sets the "user_id" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableUserID(u *uint64) *AliyunAvatarUpdate {
+	if u != nil {
+		aau.SetUserID(*u)
+	}
+	return aau
+}
+
+// AddUserID adds u to the "user_id" field.
+func (aau *AliyunAvatarUpdate) AddUserID(u int64) *AliyunAvatarUpdate {
+	aau.mutation.AddUserID(u)
+	return aau
+}
+
+// SetBizID sets the "biz_id" field.
+func (aau *AliyunAvatarUpdate) SetBizID(s string) *AliyunAvatarUpdate {
+	aau.mutation.SetBizID(s)
+	return aau
+}
+
+// SetNillableBizID sets the "biz_id" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableBizID(s *string) *AliyunAvatarUpdate {
+	if s != nil {
+		aau.SetBizID(*s)
+	}
+	return aau
+}
+
+// SetAccessKeyID sets the "access_key_id" field.
+func (aau *AliyunAvatarUpdate) SetAccessKeyID(s string) *AliyunAvatarUpdate {
+	aau.mutation.SetAccessKeyID(s)
+	return aau
+}
+
+// SetNillableAccessKeyID sets the "access_key_id" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableAccessKeyID(s *string) *AliyunAvatarUpdate {
+	if s != nil {
+		aau.SetAccessKeyID(*s)
+	}
+	return aau
+}
+
+// SetAccessKeySecret sets the "access_key_secret" field.
+func (aau *AliyunAvatarUpdate) SetAccessKeySecret(s string) *AliyunAvatarUpdate {
+	aau.mutation.SetAccessKeySecret(s)
+	return aau
+}
+
+// SetNillableAccessKeySecret sets the "access_key_secret" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableAccessKeySecret(s *string) *AliyunAvatarUpdate {
+	if s != nil {
+		aau.SetAccessKeySecret(*s)
+	}
+	return aau
+}
+
+// SetAppID sets the "app_id" field.
+func (aau *AliyunAvatarUpdate) SetAppID(s string) *AliyunAvatarUpdate {
+	aau.mutation.SetAppID(s)
+	return aau
+}
+
+// SetNillableAppID sets the "app_id" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableAppID(s *string) *AliyunAvatarUpdate {
+	if s != nil {
+		aau.SetAppID(*s)
+	}
+	return aau
+}
+
+// ClearAppID clears the value of the "app_id" field.
+func (aau *AliyunAvatarUpdate) ClearAppID() *AliyunAvatarUpdate {
+	aau.mutation.ClearAppID()
+	return aau
+}
+
+// SetTenantID sets the "tenant_id" field.
+func (aau *AliyunAvatarUpdate) SetTenantID(i int64) *AliyunAvatarUpdate {
+	aau.mutation.ResetTenantID()
+	aau.mutation.SetTenantID(i)
+	return aau
+}
+
+// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableTenantID(i *int64) *AliyunAvatarUpdate {
+	if i != nil {
+		aau.SetTenantID(*i)
+	}
+	return aau
+}
+
+// AddTenantID adds i to the "tenant_id" field.
+func (aau *AliyunAvatarUpdate) AddTenantID(i int64) *AliyunAvatarUpdate {
+	aau.mutation.AddTenantID(i)
+	return aau
+}
+
+// SetResponse sets the "response" field.
+func (aau *AliyunAvatarUpdate) SetResponse(s string) *AliyunAvatarUpdate {
+	aau.mutation.SetResponse(s)
+	return aau
+}
+
+// SetNillableResponse sets the "response" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableResponse(s *string) *AliyunAvatarUpdate {
+	if s != nil {
+		aau.SetResponse(*s)
+	}
+	return aau
+}
+
+// SetToken sets the "token" field.
+func (aau *AliyunAvatarUpdate) SetToken(s string) *AliyunAvatarUpdate {
+	aau.mutation.SetToken(s)
+	return aau
+}
+
+// SetNillableToken sets the "token" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableToken(s *string) *AliyunAvatarUpdate {
+	if s != nil {
+		aau.SetToken(*s)
+	}
+	return aau
+}
+
+// SetSessionID sets the "session_id" field.
+func (aau *AliyunAvatarUpdate) SetSessionID(s string) *AliyunAvatarUpdate {
+	aau.mutation.SetSessionID(s)
+	return aau
+}
+
+// SetNillableSessionID sets the "session_id" field if the given value is not nil.
+func (aau *AliyunAvatarUpdate) SetNillableSessionID(s *string) *AliyunAvatarUpdate {
+	if s != nil {
+		aau.SetSessionID(*s)
+	}
+	return aau
+}
+
+// Mutation returns the AliyunAvatarMutation object of the builder.
+func (aau *AliyunAvatarUpdate) Mutation() *AliyunAvatarMutation {
+	return aau.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (aau *AliyunAvatarUpdate) Save(ctx context.Context) (int, error) {
+	if err := aau.defaults(); err != nil {
+		return 0, err
+	}
+	return withHooks(ctx, aau.sqlSave, aau.mutation, aau.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (aau *AliyunAvatarUpdate) SaveX(ctx context.Context) int {
+	affected, err := aau.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return affected
+}
+
+// Exec executes the query.
+func (aau *AliyunAvatarUpdate) Exec(ctx context.Context) error {
+	_, err := aau.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (aau *AliyunAvatarUpdate) ExecX(ctx context.Context) {
+	if err := aau.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (aau *AliyunAvatarUpdate) defaults() error {
+	if _, ok := aau.mutation.UpdatedAt(); !ok {
+		if aliyunavatar.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized aliyunavatar.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := aliyunavatar.UpdateDefaultUpdatedAt()
+		aau.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (aau *AliyunAvatarUpdate) sqlSave(ctx context.Context) (n int, err error) {
+	_spec := sqlgraph.NewUpdateSpec(aliyunavatar.Table, aliyunavatar.Columns, sqlgraph.NewFieldSpec(aliyunavatar.FieldID, field.TypeUint64))
+	if ps := aau.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := aau.mutation.UpdatedAt(); ok {
+		_spec.SetField(aliyunavatar.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := aau.mutation.DeletedAt(); ok {
+		_spec.SetField(aliyunavatar.FieldDeletedAt, field.TypeTime, value)
+	}
+	if aau.mutation.DeletedAtCleared() {
+		_spec.ClearField(aliyunavatar.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := aau.mutation.UserID(); ok {
+		_spec.SetField(aliyunavatar.FieldUserID, field.TypeUint64, value)
+	}
+	if value, ok := aau.mutation.AddedUserID(); ok {
+		_spec.AddField(aliyunavatar.FieldUserID, field.TypeUint64, value)
+	}
+	if value, ok := aau.mutation.BizID(); ok {
+		_spec.SetField(aliyunavatar.FieldBizID, field.TypeString, value)
+	}
+	if value, ok := aau.mutation.AccessKeyID(); ok {
+		_spec.SetField(aliyunavatar.FieldAccessKeyID, field.TypeString, value)
+	}
+	if value, ok := aau.mutation.AccessKeySecret(); ok {
+		_spec.SetField(aliyunavatar.FieldAccessKeySecret, field.TypeString, value)
+	}
+	if value, ok := aau.mutation.AppID(); ok {
+		_spec.SetField(aliyunavatar.FieldAppID, field.TypeString, value)
+	}
+	if aau.mutation.AppIDCleared() {
+		_spec.ClearField(aliyunavatar.FieldAppID, field.TypeString)
+	}
+	if value, ok := aau.mutation.TenantID(); ok {
+		_spec.SetField(aliyunavatar.FieldTenantID, field.TypeInt64, value)
+	}
+	if value, ok := aau.mutation.AddedTenantID(); ok {
+		_spec.AddField(aliyunavatar.FieldTenantID, field.TypeInt64, value)
+	}
+	if value, ok := aau.mutation.Response(); ok {
+		_spec.SetField(aliyunavatar.FieldResponse, field.TypeString, value)
+	}
+	if value, ok := aau.mutation.Token(); ok {
+		_spec.SetField(aliyunavatar.FieldToken, field.TypeString, value)
+	}
+	if value, ok := aau.mutation.SessionID(); ok {
+		_spec.SetField(aliyunavatar.FieldSessionID, field.TypeString, value)
+	}
+	if n, err = sqlgraph.UpdateNodes(ctx, aau.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{aliyunavatar.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return 0, err
+	}
+	aau.mutation.done = true
+	return n, nil
+}
+
+// AliyunAvatarUpdateOne is the builder for updating a single AliyunAvatar entity.
+type AliyunAvatarUpdateOne struct {
+	config
+	fields   []string
+	hooks    []Hook
+	mutation *AliyunAvatarMutation
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (aauo *AliyunAvatarUpdateOne) SetUpdatedAt(t time.Time) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetUpdatedAt(t)
+	return aauo
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (aauo *AliyunAvatarUpdateOne) SetDeletedAt(t time.Time) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetDeletedAt(t)
+	return aauo
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableDeletedAt(t *time.Time) *AliyunAvatarUpdateOne {
+	if t != nil {
+		aauo.SetDeletedAt(*t)
+	}
+	return aauo
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (aauo *AliyunAvatarUpdateOne) ClearDeletedAt() *AliyunAvatarUpdateOne {
+	aauo.mutation.ClearDeletedAt()
+	return aauo
+}
+
+// SetUserID sets the "user_id" field.
+func (aauo *AliyunAvatarUpdateOne) SetUserID(u uint64) *AliyunAvatarUpdateOne {
+	aauo.mutation.ResetUserID()
+	aauo.mutation.SetUserID(u)
+	return aauo
+}
+
+// SetNillableUserID sets the "user_id" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableUserID(u *uint64) *AliyunAvatarUpdateOne {
+	if u != nil {
+		aauo.SetUserID(*u)
+	}
+	return aauo
+}
+
+// AddUserID adds u to the "user_id" field.
+func (aauo *AliyunAvatarUpdateOne) AddUserID(u int64) *AliyunAvatarUpdateOne {
+	aauo.mutation.AddUserID(u)
+	return aauo
+}
+
+// SetBizID sets the "biz_id" field.
+func (aauo *AliyunAvatarUpdateOne) SetBizID(s string) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetBizID(s)
+	return aauo
+}
+
+// SetNillableBizID sets the "biz_id" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableBizID(s *string) *AliyunAvatarUpdateOne {
+	if s != nil {
+		aauo.SetBizID(*s)
+	}
+	return aauo
+}
+
+// SetAccessKeyID sets the "access_key_id" field.
+func (aauo *AliyunAvatarUpdateOne) SetAccessKeyID(s string) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetAccessKeyID(s)
+	return aauo
+}
+
+// SetNillableAccessKeyID sets the "access_key_id" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableAccessKeyID(s *string) *AliyunAvatarUpdateOne {
+	if s != nil {
+		aauo.SetAccessKeyID(*s)
+	}
+	return aauo
+}
+
+// SetAccessKeySecret sets the "access_key_secret" field.
+func (aauo *AliyunAvatarUpdateOne) SetAccessKeySecret(s string) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetAccessKeySecret(s)
+	return aauo
+}
+
+// SetNillableAccessKeySecret sets the "access_key_secret" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableAccessKeySecret(s *string) *AliyunAvatarUpdateOne {
+	if s != nil {
+		aauo.SetAccessKeySecret(*s)
+	}
+	return aauo
+}
+
+// SetAppID sets the "app_id" field.
+func (aauo *AliyunAvatarUpdateOne) SetAppID(s string) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetAppID(s)
+	return aauo
+}
+
+// SetNillableAppID sets the "app_id" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableAppID(s *string) *AliyunAvatarUpdateOne {
+	if s != nil {
+		aauo.SetAppID(*s)
+	}
+	return aauo
+}
+
+// ClearAppID clears the value of the "app_id" field.
+func (aauo *AliyunAvatarUpdateOne) ClearAppID() *AliyunAvatarUpdateOne {
+	aauo.mutation.ClearAppID()
+	return aauo
+}
+
+// SetTenantID sets the "tenant_id" field.
+func (aauo *AliyunAvatarUpdateOne) SetTenantID(i int64) *AliyunAvatarUpdateOne {
+	aauo.mutation.ResetTenantID()
+	aauo.mutation.SetTenantID(i)
+	return aauo
+}
+
+// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableTenantID(i *int64) *AliyunAvatarUpdateOne {
+	if i != nil {
+		aauo.SetTenantID(*i)
+	}
+	return aauo
+}
+
+// AddTenantID adds i to the "tenant_id" field.
+func (aauo *AliyunAvatarUpdateOne) AddTenantID(i int64) *AliyunAvatarUpdateOne {
+	aauo.mutation.AddTenantID(i)
+	return aauo
+}
+
+// SetResponse sets the "response" field.
+func (aauo *AliyunAvatarUpdateOne) SetResponse(s string) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetResponse(s)
+	return aauo
+}
+
+// SetNillableResponse sets the "response" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableResponse(s *string) *AliyunAvatarUpdateOne {
+	if s != nil {
+		aauo.SetResponse(*s)
+	}
+	return aauo
+}
+
+// SetToken sets the "token" field.
+func (aauo *AliyunAvatarUpdateOne) SetToken(s string) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetToken(s)
+	return aauo
+}
+
+// SetNillableToken sets the "token" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableToken(s *string) *AliyunAvatarUpdateOne {
+	if s != nil {
+		aauo.SetToken(*s)
+	}
+	return aauo
+}
+
+// SetSessionID sets the "session_id" field.
+func (aauo *AliyunAvatarUpdateOne) SetSessionID(s string) *AliyunAvatarUpdateOne {
+	aauo.mutation.SetSessionID(s)
+	return aauo
+}
+
+// SetNillableSessionID sets the "session_id" field if the given value is not nil.
+func (aauo *AliyunAvatarUpdateOne) SetNillableSessionID(s *string) *AliyunAvatarUpdateOne {
+	if s != nil {
+		aauo.SetSessionID(*s)
+	}
+	return aauo
+}
+
+// Mutation returns the AliyunAvatarMutation object of the builder.
+func (aauo *AliyunAvatarUpdateOne) Mutation() *AliyunAvatarMutation {
+	return aauo.mutation
+}
+
+// Where appends a list predicates to the AliyunAvatarUpdate builder.
+func (aauo *AliyunAvatarUpdateOne) Where(ps ...predicate.AliyunAvatar) *AliyunAvatarUpdateOne {
+	aauo.mutation.Where(ps...)
+	return aauo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (aauo *AliyunAvatarUpdateOne) Select(field string, fields ...string) *AliyunAvatarUpdateOne {
+	aauo.fields = append([]string{field}, fields...)
+	return aauo
+}
+
+// Save executes the query and returns the updated AliyunAvatar entity.
+func (aauo *AliyunAvatarUpdateOne) Save(ctx context.Context) (*AliyunAvatar, error) {
+	if err := aauo.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, aauo.sqlSave, aauo.mutation, aauo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (aauo *AliyunAvatarUpdateOne) SaveX(ctx context.Context) *AliyunAvatar {
+	node, err := aauo.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// Exec executes the query on the entity.
+func (aauo *AliyunAvatarUpdateOne) Exec(ctx context.Context) error {
+	_, err := aauo.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (aauo *AliyunAvatarUpdateOne) ExecX(ctx context.Context) {
+	if err := aauo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (aauo *AliyunAvatarUpdateOne) defaults() error {
+	if _, ok := aauo.mutation.UpdatedAt(); !ok {
+		if aliyunavatar.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized aliyunavatar.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := aliyunavatar.UpdateDefaultUpdatedAt()
+		aauo.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (aauo *AliyunAvatarUpdateOne) sqlSave(ctx context.Context) (_node *AliyunAvatar, err error) {
+	_spec := sqlgraph.NewUpdateSpec(aliyunavatar.Table, aliyunavatar.Columns, sqlgraph.NewFieldSpec(aliyunavatar.FieldID, field.TypeUint64))
+	id, ok := aauo.mutation.ID()
+	if !ok {
+		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AliyunAvatar.id" for update`)}
+	}
+	_spec.Node.ID.Value = id
+	if fields := aauo.fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, aliyunavatar.FieldID)
+		for _, f := range fields {
+			if !aliyunavatar.ValidColumn(f) {
+				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+			}
+			if f != aliyunavatar.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, f)
+			}
+		}
+	}
+	if ps := aauo.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := aauo.mutation.UpdatedAt(); ok {
+		_spec.SetField(aliyunavatar.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := aauo.mutation.DeletedAt(); ok {
+		_spec.SetField(aliyunavatar.FieldDeletedAt, field.TypeTime, value)
+	}
+	if aauo.mutation.DeletedAtCleared() {
+		_spec.ClearField(aliyunavatar.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := aauo.mutation.UserID(); ok {
+		_spec.SetField(aliyunavatar.FieldUserID, field.TypeUint64, value)
+	}
+	if value, ok := aauo.mutation.AddedUserID(); ok {
+		_spec.AddField(aliyunavatar.FieldUserID, field.TypeUint64, value)
+	}
+	if value, ok := aauo.mutation.BizID(); ok {
+		_spec.SetField(aliyunavatar.FieldBizID, field.TypeString, value)
+	}
+	if value, ok := aauo.mutation.AccessKeyID(); ok {
+		_spec.SetField(aliyunavatar.FieldAccessKeyID, field.TypeString, value)
+	}
+	if value, ok := aauo.mutation.AccessKeySecret(); ok {
+		_spec.SetField(aliyunavatar.FieldAccessKeySecret, field.TypeString, value)
+	}
+	if value, ok := aauo.mutation.AppID(); ok {
+		_spec.SetField(aliyunavatar.FieldAppID, field.TypeString, value)
+	}
+	if aauo.mutation.AppIDCleared() {
+		_spec.ClearField(aliyunavatar.FieldAppID, field.TypeString)
+	}
+	if value, ok := aauo.mutation.TenantID(); ok {
+		_spec.SetField(aliyunavatar.FieldTenantID, field.TypeInt64, value)
+	}
+	if value, ok := aauo.mutation.AddedTenantID(); ok {
+		_spec.AddField(aliyunavatar.FieldTenantID, field.TypeInt64, value)
+	}
+	if value, ok := aauo.mutation.Response(); ok {
+		_spec.SetField(aliyunavatar.FieldResponse, field.TypeString, value)
+	}
+	if value, ok := aauo.mutation.Token(); ok {
+		_spec.SetField(aliyunavatar.FieldToken, field.TypeString, value)
+	}
+	if value, ok := aauo.mutation.SessionID(); ok {
+		_spec.SetField(aliyunavatar.FieldSessionID, field.TypeString, value)
+	}
+	_node = &AliyunAvatar{config: aauo.config}
+	_spec.Assign = _node.assignValues
+	_spec.ScanValues = _node.scanValues
+	if err = sqlgraph.UpdateNode(ctx, aauo.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{aliyunavatar.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	aauo.mutation.done = true
+	return _node, nil
+}

+ 161 - 18
ent/client.go

@@ -13,6 +13,7 @@ import (
 
 	"wechat-api/ent/agent"
 	"wechat-api/ent/agentbase"
+	"wechat-api/ent/aliyunavatar"
 	"wechat-api/ent/batchmsg"
 	"wechat-api/ent/category"
 	"wechat-api/ent/chatrecords"
@@ -54,6 +55,8 @@ type Client struct {
 	Agent *AgentClient
 	// AgentBase is the client for interacting with the AgentBase builders.
 	AgentBase *AgentBaseClient
+	// AliyunAvatar is the client for interacting with the AliyunAvatar builders.
+	AliyunAvatar *AliyunAvatarClient
 	// BatchMsg is the client for interacting with the BatchMsg builders.
 	BatchMsg *BatchMsgClient
 	// Category is the client for interacting with the Category builders.
@@ -113,6 +116,7 @@ func (c *Client) init() {
 	c.Schema = migrate.NewSchema(c.driver)
 	c.Agent = NewAgentClient(c.config)
 	c.AgentBase = NewAgentBaseClient(c.config)
+	c.AliyunAvatar = NewAliyunAvatarClient(c.config)
 	c.BatchMsg = NewBatchMsgClient(c.config)
 	c.Category = NewCategoryClient(c.config)
 	c.ChatRecords = NewChatRecordsClient(c.config)
@@ -230,6 +234,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
 		config:            cfg,
 		Agent:             NewAgentClient(cfg),
 		AgentBase:         NewAgentBaseClient(cfg),
+		AliyunAvatar:      NewAliyunAvatarClient(cfg),
 		BatchMsg:          NewBatchMsgClient(cfg),
 		Category:          NewCategoryClient(cfg),
 		ChatRecords:       NewChatRecordsClient(cfg),
@@ -274,6 +279,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
 		config:            cfg,
 		Agent:             NewAgentClient(cfg),
 		AgentBase:         NewAgentBaseClient(cfg),
+		AliyunAvatar:      NewAliyunAvatarClient(cfg),
 		BatchMsg:          NewBatchMsgClient(cfg),
 		Category:          NewCategoryClient(cfg),
 		ChatRecords:       NewChatRecordsClient(cfg),
@@ -326,11 +332,11 @@ func (c *Client) Close() error {
 // In order to add hooks to a specific client, call: `client.Node.Use(...)`.
 func (c *Client) Use(hooks ...Hook) {
 	for _, n := range []interface{ Use(...Hook) }{
-		c.Agent, c.AgentBase, 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.WorkExperience, c.Wx, c.WxCard, c.WxCardUser,
-		c.WxCardVisit,
+		c.Agent, c.AgentBase, c.AliyunAvatar, 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.WorkExperience, c.Wx, c.WxCard,
+		c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Use(hooks...)
 	}
@@ -340,11 +346,11 @@ func (c *Client) Use(hooks ...Hook) {
 // In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
 func (c *Client) Intercept(interceptors ...Interceptor) {
 	for _, n := range []interface{ Intercept(...Interceptor) }{
-		c.Agent, c.AgentBase, 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.WorkExperience, c.Wx, c.WxCard, c.WxCardUser,
-		c.WxCardVisit,
+		c.Agent, c.AgentBase, c.AliyunAvatar, 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.WorkExperience, c.Wx, c.WxCard,
+		c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Intercept(interceptors...)
 	}
@@ -357,6 +363,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
 		return c.Agent.mutate(ctx, m)
 	case *AgentBaseMutation:
 		return c.AgentBase.mutate(ctx, m)
+	case *AliyunAvatarMutation:
+		return c.AliyunAvatar.mutate(ctx, m)
 	case *BatchMsgMutation:
 		return c.BatchMsg.mutate(ctx, m)
 	case *CategoryMutation:
@@ -708,6 +716,141 @@ func (c *AgentBaseClient) mutate(ctx context.Context, m *AgentBaseMutation) (Val
 	}
 }
 
+// AliyunAvatarClient is a client for the AliyunAvatar schema.
+type AliyunAvatarClient struct {
+	config
+}
+
+// NewAliyunAvatarClient returns a client for the AliyunAvatar from the given config.
+func NewAliyunAvatarClient(c config) *AliyunAvatarClient {
+	return &AliyunAvatarClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `aliyunavatar.Hooks(f(g(h())))`.
+func (c *AliyunAvatarClient) Use(hooks ...Hook) {
+	c.hooks.AliyunAvatar = append(c.hooks.AliyunAvatar, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `aliyunavatar.Intercept(f(g(h())))`.
+func (c *AliyunAvatarClient) Intercept(interceptors ...Interceptor) {
+	c.inters.AliyunAvatar = append(c.inters.AliyunAvatar, interceptors...)
+}
+
+// Create returns a builder for creating a AliyunAvatar entity.
+func (c *AliyunAvatarClient) Create() *AliyunAvatarCreate {
+	mutation := newAliyunAvatarMutation(c.config, OpCreate)
+	return &AliyunAvatarCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of AliyunAvatar entities.
+func (c *AliyunAvatarClient) CreateBulk(builders ...*AliyunAvatarCreate) *AliyunAvatarCreateBulk {
+	return &AliyunAvatarCreateBulk{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 *AliyunAvatarClient) MapCreateBulk(slice any, setFunc func(*AliyunAvatarCreate, int)) *AliyunAvatarCreateBulk {
+	rv := reflect.ValueOf(slice)
+	if rv.Kind() != reflect.Slice {
+		return &AliyunAvatarCreateBulk{err: fmt.Errorf("calling to AliyunAvatarClient.MapCreateBulk with wrong type %T, need slice", slice)}
+	}
+	builders := make([]*AliyunAvatarCreate, rv.Len())
+	for i := 0; i < rv.Len(); i++ {
+		builders[i] = c.Create()
+		setFunc(builders[i], i)
+	}
+	return &AliyunAvatarCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for AliyunAvatar.
+func (c *AliyunAvatarClient) Update() *AliyunAvatarUpdate {
+	mutation := newAliyunAvatarMutation(c.config, OpUpdate)
+	return &AliyunAvatarUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *AliyunAvatarClient) UpdateOne(aa *AliyunAvatar) *AliyunAvatarUpdateOne {
+	mutation := newAliyunAvatarMutation(c.config, OpUpdateOne, withAliyunAvatar(aa))
+	return &AliyunAvatarUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *AliyunAvatarClient) UpdateOneID(id uint64) *AliyunAvatarUpdateOne {
+	mutation := newAliyunAvatarMutation(c.config, OpUpdateOne, withAliyunAvatarID(id))
+	return &AliyunAvatarUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for AliyunAvatar.
+func (c *AliyunAvatarClient) Delete() *AliyunAvatarDelete {
+	mutation := newAliyunAvatarMutation(c.config, OpDelete)
+	return &AliyunAvatarDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *AliyunAvatarClient) DeleteOne(aa *AliyunAvatar) *AliyunAvatarDeleteOne {
+	return c.DeleteOneID(aa.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *AliyunAvatarClient) DeleteOneID(id uint64) *AliyunAvatarDeleteOne {
+	builder := c.Delete().Where(aliyunavatar.ID(id))
+	builder.mutation.id = &id
+	builder.mutation.op = OpDeleteOne
+	return &AliyunAvatarDeleteOne{builder}
+}
+
+// Query returns a query builder for AliyunAvatar.
+func (c *AliyunAvatarClient) Query() *AliyunAvatarQuery {
+	return &AliyunAvatarQuery{
+		config: c.config,
+		ctx:    &QueryContext{Type: TypeAliyunAvatar},
+		inters: c.Interceptors(),
+	}
+}
+
+// Get returns a AliyunAvatar entity by its id.
+func (c *AliyunAvatarClient) Get(ctx context.Context, id uint64) (*AliyunAvatar, error) {
+	return c.Query().Where(aliyunavatar.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *AliyunAvatarClient) GetX(ctx context.Context, id uint64) *AliyunAvatar {
+	obj, err := c.Get(ctx, id)
+	if err != nil {
+		panic(err)
+	}
+	return obj
+}
+
+// Hooks returns the client hooks.
+func (c *AliyunAvatarClient) Hooks() []Hook {
+	hooks := c.hooks.AliyunAvatar
+	return append(hooks[:len(hooks):len(hooks)], aliyunavatar.Hooks[:]...)
+}
+
+// Interceptors returns the client interceptors.
+func (c *AliyunAvatarClient) Interceptors() []Interceptor {
+	inters := c.inters.AliyunAvatar
+	return append(inters[:len(inters):len(inters)], aliyunavatar.Interceptors[:]...)
+}
+
+func (c *AliyunAvatarClient) mutate(ctx context.Context, m *AliyunAvatarMutation) (Value, error) {
+	switch m.Op() {
+	case OpCreate:
+		return (&AliyunAvatarCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdate:
+		return (&AliyunAvatarUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdateOne:
+		return (&AliyunAvatarUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpDelete, OpDeleteOne:
+		return (&AliyunAvatarDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+	default:
+		return nil, fmt.Errorf("ent: unknown AliyunAvatar mutation op: %q", m.Op())
+	}
+}
+
 // BatchMsgClient is a client for the BatchMsg schema.
 type BatchMsgClient struct {
 	config
@@ -4146,16 +4289,16 @@ func (c *WxCardVisitClient) mutate(ctx context.Context, m *WxCardVisitMutation)
 // hooks and interceptors per client, for fast access.
 type (
 	hooks struct {
-		Agent, AgentBase, BatchMsg, Category, ChatRecords, ChatSession, Contact,
-		Employee, EmployeeConfig, Label, LabelRelationship, Message, MessageRecords,
-		Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial, WorkExperience, Wx,
-		WxCard, WxCardUser, WxCardVisit []ent.Hook
+		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
+		Contact, Employee, EmployeeConfig, Label, LabelRelationship, Message,
+		MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial,
+		WorkExperience, Wx, WxCard, WxCardUser, WxCardVisit []ent.Hook
 	}
 	inters struct {
-		Agent, AgentBase, BatchMsg, Category, ChatRecords, ChatSession, Contact,
-		Employee, EmployeeConfig, Label, LabelRelationship, Message, MessageRecords,
-		Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial, WorkExperience, Wx,
-		WxCard, WxCardUser, WxCardVisit []ent.Interceptor
+		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
+		Contact, Employee, EmployeeConfig, Label, LabelRelationship, Message,
+		MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial,
+		WorkExperience, Wx, WxCard, WxCardUser, WxCardVisit []ent.Interceptor
 	}
 )
 

+ 2 - 0
ent/ent.go

@@ -10,6 +10,7 @@ import (
 	"sync"
 	"wechat-api/ent/agent"
 	"wechat-api/ent/agentbase"
+	"wechat-api/ent/aliyunavatar"
 	"wechat-api/ent/batchmsg"
 	"wechat-api/ent/category"
 	"wechat-api/ent/chatrecords"
@@ -99,6 +100,7 @@ func checkColumn(table, column string) error {
 		columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
 			agent.Table:             agent.ValidColumn,
 			agentbase.Table:         agentbase.ValidColumn,
+			aliyunavatar.Table:      aliyunavatar.ValidColumn,
 			batchmsg.Table:          batchmsg.ValidColumn,
 			category.Table:          category.ValidColumn,
 			chatrecords.Table:       chatrecords.ValidColumn,

+ 12 - 0
ent/hook/hook.go

@@ -32,6 +32,18 @@ func (f AgentBaseFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, e
 	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AgentBaseMutation", m)
 }
 
+// The AliyunAvatarFunc type is an adapter to allow the use of ordinary
+// function as AliyunAvatar mutator.
+type AliyunAvatarFunc func(context.Context, *ent.AliyunAvatarMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f AliyunAvatarFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+	if mv, ok := m.(*ent.AliyunAvatarMutation); ok {
+		return f(ctx, mv)
+	}
+	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AliyunAvatarMutation", m)
+}
+
 // The BatchMsgFunc type is an adapter to allow the use of ordinary
 // function as BatchMsg mutator.
 type BatchMsgFunc func(context.Context, *ent.BatchMsgMutation) (ent.Value, error)

+ 30 - 0
ent/intercept/intercept.go

@@ -8,6 +8,7 @@ import (
 	"wechat-api/ent"
 	"wechat-api/ent/agent"
 	"wechat-api/ent/agentbase"
+	"wechat-api/ent/aliyunavatar"
 	"wechat-api/ent/batchmsg"
 	"wechat-api/ent/category"
 	"wechat-api/ent/chatrecords"
@@ -146,6 +147,33 @@ func (f TraverseAgentBase) Traverse(ctx context.Context, q ent.Query) error {
 	return fmt.Errorf("unexpected query type %T. expect *ent.AgentBaseQuery", q)
 }
 
+// The AliyunAvatarFunc type is an adapter to allow the use of ordinary function as a Querier.
+type AliyunAvatarFunc func(context.Context, *ent.AliyunAvatarQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f AliyunAvatarFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+	if q, ok := q.(*ent.AliyunAvatarQuery); ok {
+		return f(ctx, q)
+	}
+	return nil, fmt.Errorf("unexpected query type %T. expect *ent.AliyunAvatarQuery", q)
+}
+
+// The TraverseAliyunAvatar type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseAliyunAvatar func(context.Context, *ent.AliyunAvatarQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseAliyunAvatar) Intercept(next ent.Querier) ent.Querier {
+	return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseAliyunAvatar) Traverse(ctx context.Context, q ent.Query) error {
+	if q, ok := q.(*ent.AliyunAvatarQuery); ok {
+		return f(ctx, q)
+	}
+	return fmt.Errorf("unexpected query type %T. expect *ent.AliyunAvatarQuery", q)
+}
+
 // The BatchMsgFunc type is an adapter to allow the use of ordinary function as a Querier.
 type BatchMsgFunc func(context.Context, *ent.BatchMsgQuery) (ent.Value, error)
 
@@ -774,6 +802,8 @@ func NewQuery(q ent.Query) (Query, error) {
 		return &query[*ent.AgentQuery, predicate.Agent, agent.OrderOption]{typ: ent.TypeAgent, tq: q}, nil
 	case *ent.AgentBaseQuery:
 		return &query[*ent.AgentBaseQuery, predicate.AgentBase, agentbase.OrderOption]{typ: ent.TypeAgentBase, tq: q}, nil
+	case *ent.AliyunAvatarQuery:
+		return &query[*ent.AliyunAvatarQuery, predicate.AliyunAvatar, aliyunavatar.OrderOption]{typ: ent.TypeAliyunAvatar, tq: q}, nil
 	case *ent.BatchMsgQuery:
 		return &query[*ent.BatchMsgQuery, predicate.BatchMsg, batchmsg.OrderOption]{typ: ent.TypeBatchMsg, tq: q}, nil
 	case *ent.CategoryQuery:

+ 33 - 0
ent/migrate/schema.go

@@ -56,6 +56,35 @@ var (
 		Columns:    AgentBaseColumns,
 		PrimaryKey: []*schema.Column{AgentBaseColumns[0]},
 	}
+	// AliyunAvatarColumns holds the columns for the "aliyun_avatar" table.
+	AliyunAvatarColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
+		{Name: "user_id", Type: field.TypeUint64, Comment: "user_id | wx_card_user_id"},
+		{Name: "biz_id", Type: field.TypeString, Comment: "biz_id | BizId"},
+		{Name: "access_key_id", Type: field.TypeString, Comment: "access_key_id | AccessKeyId"},
+		{Name: "access_key_secret", Type: field.TypeString, Comment: "access_key_secret | AccessKeySecret"},
+		{Name: "app_id", Type: field.TypeString, Nullable: true, Comment: "app_id | AppId"},
+		{Name: "tenant_id", Type: field.TypeInt64, Comment: "tenant_id | TenantId"},
+		{Name: "response", Type: field.TypeString, Size: 2147483647, Comment: "response | 阿里云avatar响应"},
+		{Name: "token", Type: field.TypeString, Comment: "token | Token", Default: ""},
+		{Name: "session_id", Type: field.TypeString, Comment: "session_id | SessionId", Default: ""},
+	}
+	// AliyunAvatarTable holds the schema information for the "aliyun_avatar" table.
+	AliyunAvatarTable = &schema.Table{
+		Name:       "aliyun_avatar",
+		Columns:    AliyunAvatarColumns,
+		PrimaryKey: []*schema.Column{AliyunAvatarColumns[0]},
+		Indexes: []*schema.Index{
+			{
+				Name:    "aliyunavatar_user_id",
+				Unique:  false,
+				Columns: []*schema.Column{AliyunAvatarColumns[4]},
+			},
+		},
+	}
 	// BatchMsgColumns holds the columns for the "batch_msg" table.
 	BatchMsgColumns = []*schema.Column{
 		{Name: "id", Type: field.TypeUint64, Increment: true},
@@ -872,6 +901,7 @@ var (
 	Tables = []*schema.Table{
 		AgentTable,
 		AgentBaseTable,
+		AliyunAvatarTable,
 		BatchMsgTable,
 		CategoryTable,
 		ChatRecordsTable,
@@ -905,6 +935,9 @@ func init() {
 	AgentBaseTable.Annotation = &entsql.Annotation{
 		Table: "agent_base",
 	}
+	AliyunAvatarTable.Annotation = &entsql.Annotation{
+		Table: "aliyun_avatar",
+	}
 	BatchMsgTable.Annotation = &entsql.Annotation{
 		Table: "batch_msg",
 	}

+ 1038 - 0
ent/mutation.go

@@ -10,6 +10,7 @@ import (
 	"time"
 	"wechat-api/ent/agent"
 	"wechat-api/ent/agentbase"
+	"wechat-api/ent/aliyunavatar"
 	"wechat-api/ent/batchmsg"
 	"wechat-api/ent/category"
 	"wechat-api/ent/chatrecords"
@@ -51,6 +52,7 @@ const (
 	// Node types.
 	TypeAgent             = "Agent"
 	TypeAgentBase         = "AgentBase"
+	TypeAliyunAvatar      = "AliyunAvatar"
 	TypeBatchMsg          = "BatchMsg"
 	TypeCategory          = "Category"
 	TypeChatRecords       = "ChatRecords"
@@ -2289,6 +2291,1042 @@ func (m *AgentBaseMutation) ResetEdge(name string) error {
 	return fmt.Errorf("unknown AgentBase edge %s", name)
 }
 
+// AliyunAvatarMutation represents an operation that mutates the AliyunAvatar nodes in the graph.
+type AliyunAvatarMutation struct {
+	config
+	op                Op
+	typ               string
+	id                *uint64
+	created_at        *time.Time
+	updated_at        *time.Time
+	deleted_at        *time.Time
+	user_id           *uint64
+	adduser_id        *int64
+	biz_id            *string
+	access_key_id     *string
+	access_key_secret *string
+	app_id            *string
+	tenant_id         *int64
+	addtenant_id      *int64
+	response          *string
+	token             *string
+	session_id        *string
+	clearedFields     map[string]struct{}
+	done              bool
+	oldValue          func(context.Context) (*AliyunAvatar, error)
+	predicates        []predicate.AliyunAvatar
+}
+
+var _ ent.Mutation = (*AliyunAvatarMutation)(nil)
+
+// aliyunavatarOption allows management of the mutation configuration using functional options.
+type aliyunavatarOption func(*AliyunAvatarMutation)
+
+// newAliyunAvatarMutation creates new mutation for the AliyunAvatar entity.
+func newAliyunAvatarMutation(c config, op Op, opts ...aliyunavatarOption) *AliyunAvatarMutation {
+	m := &AliyunAvatarMutation{
+		config:        c,
+		op:            op,
+		typ:           TypeAliyunAvatar,
+		clearedFields: make(map[string]struct{}),
+	}
+	for _, opt := range opts {
+		opt(m)
+	}
+	return m
+}
+
+// withAliyunAvatarID sets the ID field of the mutation.
+func withAliyunAvatarID(id uint64) aliyunavatarOption {
+	return func(m *AliyunAvatarMutation) {
+		var (
+			err   error
+			once  sync.Once
+			value *AliyunAvatar
+		)
+		m.oldValue = func(ctx context.Context) (*AliyunAvatar, error) {
+			once.Do(func() {
+				if m.done {
+					err = errors.New("querying old values post mutation is not allowed")
+				} else {
+					value, err = m.Client().AliyunAvatar.Get(ctx, id)
+				}
+			})
+			return value, err
+		}
+		m.id = &id
+	}
+}
+
+// withAliyunAvatar sets the old AliyunAvatar of the mutation.
+func withAliyunAvatar(node *AliyunAvatar) aliyunavatarOption {
+	return func(m *AliyunAvatarMutation) {
+		m.oldValue = func(context.Context) (*AliyunAvatar, 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 AliyunAvatarMutation) 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 AliyunAvatarMutation) 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 AliyunAvatar entities.
+func (m *AliyunAvatarMutation) 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 *AliyunAvatarMutation) 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 *AliyunAvatarMutation) 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().AliyunAvatar.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 *AliyunAvatarMutation) SetCreatedAt(t time.Time) {
+	m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *AliyunAvatarMutation) 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 AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) 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 *AliyunAvatarMutation) ResetCreatedAt() {
+	m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *AliyunAvatarMutation) SetUpdatedAt(t time.Time) {
+	m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *AliyunAvatarMutation) 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 AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) 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 *AliyunAvatarMutation) ResetUpdatedAt() {
+	m.updated_at = nil
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (m *AliyunAvatarMutation) SetDeletedAt(t time.Time) {
+	m.deleted_at = &t
+}
+
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
+func (m *AliyunAvatarMutation) 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 AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) 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 *AliyunAvatarMutation) ClearDeletedAt() {
+	m.deleted_at = nil
+	m.clearedFields[aliyunavatar.FieldDeletedAt] = struct{}{}
+}
+
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
+func (m *AliyunAvatarMutation) DeletedAtCleared() bool {
+	_, ok := m.clearedFields[aliyunavatar.FieldDeletedAt]
+	return ok
+}
+
+// ResetDeletedAt resets all changes to the "deleted_at" field.
+func (m *AliyunAvatarMutation) ResetDeletedAt() {
+	m.deleted_at = nil
+	delete(m.clearedFields, aliyunavatar.FieldDeletedAt)
+}
+
+// SetUserID sets the "user_id" field.
+func (m *AliyunAvatarMutation) SetUserID(u uint64) {
+	m.user_id = &u
+	m.adduser_id = nil
+}
+
+// UserID returns the value of the "user_id" field in the mutation.
+func (m *AliyunAvatarMutation) UserID() (r uint64, exists bool) {
+	v := m.user_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldUserID returns the old "user_id" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldUserID(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldUserID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldUserID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldUserID: %w", err)
+	}
+	return oldValue.UserID, nil
+}
+
+// AddUserID adds u to the "user_id" field.
+func (m *AliyunAvatarMutation) AddUserID(u int64) {
+	if m.adduser_id != nil {
+		*m.adduser_id += u
+	} else {
+		m.adduser_id = &u
+	}
+}
+
+// AddedUserID returns the value that was added to the "user_id" field in this mutation.
+func (m *AliyunAvatarMutation) AddedUserID() (r int64, exists bool) {
+	v := m.adduser_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetUserID resets all changes to the "user_id" field.
+func (m *AliyunAvatarMutation) ResetUserID() {
+	m.user_id = nil
+	m.adduser_id = nil
+}
+
+// SetBizID sets the "biz_id" field.
+func (m *AliyunAvatarMutation) SetBizID(s string) {
+	m.biz_id = &s
+}
+
+// BizID returns the value of the "biz_id" field in the mutation.
+func (m *AliyunAvatarMutation) BizID() (r string, exists bool) {
+	v := m.biz_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldBizID returns the old "biz_id" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldBizID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldBizID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldBizID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldBizID: %w", err)
+	}
+	return oldValue.BizID, nil
+}
+
+// ResetBizID resets all changes to the "biz_id" field.
+func (m *AliyunAvatarMutation) ResetBizID() {
+	m.biz_id = nil
+}
+
+// SetAccessKeyID sets the "access_key_id" field.
+func (m *AliyunAvatarMutation) SetAccessKeyID(s string) {
+	m.access_key_id = &s
+}
+
+// AccessKeyID returns the value of the "access_key_id" field in the mutation.
+func (m *AliyunAvatarMutation) AccessKeyID() (r string, exists bool) {
+	v := m.access_key_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAccessKeyID returns the old "access_key_id" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldAccessKeyID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAccessKeyID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAccessKeyID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAccessKeyID: %w", err)
+	}
+	return oldValue.AccessKeyID, nil
+}
+
+// ResetAccessKeyID resets all changes to the "access_key_id" field.
+func (m *AliyunAvatarMutation) ResetAccessKeyID() {
+	m.access_key_id = nil
+}
+
+// SetAccessKeySecret sets the "access_key_secret" field.
+func (m *AliyunAvatarMutation) SetAccessKeySecret(s string) {
+	m.access_key_secret = &s
+}
+
+// AccessKeySecret returns the value of the "access_key_secret" field in the mutation.
+func (m *AliyunAvatarMutation) AccessKeySecret() (r string, exists bool) {
+	v := m.access_key_secret
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAccessKeySecret returns the old "access_key_secret" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldAccessKeySecret(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAccessKeySecret is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAccessKeySecret requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAccessKeySecret: %w", err)
+	}
+	return oldValue.AccessKeySecret, nil
+}
+
+// ResetAccessKeySecret resets all changes to the "access_key_secret" field.
+func (m *AliyunAvatarMutation) ResetAccessKeySecret() {
+	m.access_key_secret = nil
+}
+
+// SetAppID sets the "app_id" field.
+func (m *AliyunAvatarMutation) SetAppID(s string) {
+	m.app_id = &s
+}
+
+// AppID returns the value of the "app_id" field in the mutation.
+func (m *AliyunAvatarMutation) AppID() (r string, exists bool) {
+	v := m.app_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAppID returns the old "app_id" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldAppID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAppID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAppID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAppID: %w", err)
+	}
+	return oldValue.AppID, nil
+}
+
+// ClearAppID clears the value of the "app_id" field.
+func (m *AliyunAvatarMutation) ClearAppID() {
+	m.app_id = nil
+	m.clearedFields[aliyunavatar.FieldAppID] = struct{}{}
+}
+
+// AppIDCleared returns if the "app_id" field was cleared in this mutation.
+func (m *AliyunAvatarMutation) AppIDCleared() bool {
+	_, ok := m.clearedFields[aliyunavatar.FieldAppID]
+	return ok
+}
+
+// ResetAppID resets all changes to the "app_id" field.
+func (m *AliyunAvatarMutation) ResetAppID() {
+	m.app_id = nil
+	delete(m.clearedFields, aliyunavatar.FieldAppID)
+}
+
+// SetTenantID sets the "tenant_id" field.
+func (m *AliyunAvatarMutation) SetTenantID(i int64) {
+	m.tenant_id = &i
+	m.addtenant_id = nil
+}
+
+// TenantID returns the value of the "tenant_id" field in the mutation.
+func (m *AliyunAvatarMutation) TenantID() (r int64, exists bool) {
+	v := m.tenant_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldTenantID returns the old "tenant_id" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldTenantID(ctx context.Context) (v int64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldTenantID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldTenantID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldTenantID: %w", err)
+	}
+	return oldValue.TenantID, nil
+}
+
+// AddTenantID adds i to the "tenant_id" field.
+func (m *AliyunAvatarMutation) AddTenantID(i int64) {
+	if m.addtenant_id != nil {
+		*m.addtenant_id += i
+	} else {
+		m.addtenant_id = &i
+	}
+}
+
+// AddedTenantID returns the value that was added to the "tenant_id" field in this mutation.
+func (m *AliyunAvatarMutation) AddedTenantID() (r int64, exists bool) {
+	v := m.addtenant_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetTenantID resets all changes to the "tenant_id" field.
+func (m *AliyunAvatarMutation) ResetTenantID() {
+	m.tenant_id = nil
+	m.addtenant_id = nil
+}
+
+// SetResponse sets the "response" field.
+func (m *AliyunAvatarMutation) SetResponse(s string) {
+	m.response = &s
+}
+
+// Response returns the value of the "response" field in the mutation.
+func (m *AliyunAvatarMutation) Response() (r string, exists bool) {
+	v := m.response
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldResponse returns the old "response" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldResponse(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldResponse is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldResponse requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldResponse: %w", err)
+	}
+	return oldValue.Response, nil
+}
+
+// ResetResponse resets all changes to the "response" field.
+func (m *AliyunAvatarMutation) ResetResponse() {
+	m.response = nil
+}
+
+// SetToken sets the "token" field.
+func (m *AliyunAvatarMutation) SetToken(s string) {
+	m.token = &s
+}
+
+// Token returns the value of the "token" field in the mutation.
+func (m *AliyunAvatarMutation) Token() (r string, exists bool) {
+	v := m.token
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldToken returns the old "token" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldToken(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldToken is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldToken requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldToken: %w", err)
+	}
+	return oldValue.Token, nil
+}
+
+// ResetToken resets all changes to the "token" field.
+func (m *AliyunAvatarMutation) ResetToken() {
+	m.token = nil
+}
+
+// SetSessionID sets the "session_id" field.
+func (m *AliyunAvatarMutation) SetSessionID(s string) {
+	m.session_id = &s
+}
+
+// SessionID returns the value of the "session_id" field in the mutation.
+func (m *AliyunAvatarMutation) SessionID() (r string, exists bool) {
+	v := m.session_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldSessionID returns the old "session_id" field's value of the AliyunAvatar entity.
+// If the AliyunAvatar 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 *AliyunAvatarMutation) OldSessionID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldSessionID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldSessionID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldSessionID: %w", err)
+	}
+	return oldValue.SessionID, nil
+}
+
+// ResetSessionID resets all changes to the "session_id" field.
+func (m *AliyunAvatarMutation) ResetSessionID() {
+	m.session_id = nil
+}
+
+// Where appends a list predicates to the AliyunAvatarMutation builder.
+func (m *AliyunAvatarMutation) Where(ps ...predicate.AliyunAvatar) {
+	m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the AliyunAvatarMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *AliyunAvatarMutation) WhereP(ps ...func(*sql.Selector)) {
+	p := make([]predicate.AliyunAvatar, len(ps))
+	for i := range ps {
+		p[i] = ps[i]
+	}
+	m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *AliyunAvatarMutation) Op() Op {
+	return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *AliyunAvatarMutation) SetOp(op Op) {
+	m.op = op
+}
+
+// Type returns the node type of this mutation (AliyunAvatar).
+func (m *AliyunAvatarMutation) 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 *AliyunAvatarMutation) Fields() []string {
+	fields := make([]string, 0, 12)
+	if m.created_at != nil {
+		fields = append(fields, aliyunavatar.FieldCreatedAt)
+	}
+	if m.updated_at != nil {
+		fields = append(fields, aliyunavatar.FieldUpdatedAt)
+	}
+	if m.deleted_at != nil {
+		fields = append(fields, aliyunavatar.FieldDeletedAt)
+	}
+	if m.user_id != nil {
+		fields = append(fields, aliyunavatar.FieldUserID)
+	}
+	if m.biz_id != nil {
+		fields = append(fields, aliyunavatar.FieldBizID)
+	}
+	if m.access_key_id != nil {
+		fields = append(fields, aliyunavatar.FieldAccessKeyID)
+	}
+	if m.access_key_secret != nil {
+		fields = append(fields, aliyunavatar.FieldAccessKeySecret)
+	}
+	if m.app_id != nil {
+		fields = append(fields, aliyunavatar.FieldAppID)
+	}
+	if m.tenant_id != nil {
+		fields = append(fields, aliyunavatar.FieldTenantID)
+	}
+	if m.response != nil {
+		fields = append(fields, aliyunavatar.FieldResponse)
+	}
+	if m.token != nil {
+		fields = append(fields, aliyunavatar.FieldToken)
+	}
+	if m.session_id != nil {
+		fields = append(fields, aliyunavatar.FieldSessionID)
+	}
+	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 *AliyunAvatarMutation) Field(name string) (ent.Value, bool) {
+	switch name {
+	case aliyunavatar.FieldCreatedAt:
+		return m.CreatedAt()
+	case aliyunavatar.FieldUpdatedAt:
+		return m.UpdatedAt()
+	case aliyunavatar.FieldDeletedAt:
+		return m.DeletedAt()
+	case aliyunavatar.FieldUserID:
+		return m.UserID()
+	case aliyunavatar.FieldBizID:
+		return m.BizID()
+	case aliyunavatar.FieldAccessKeyID:
+		return m.AccessKeyID()
+	case aliyunavatar.FieldAccessKeySecret:
+		return m.AccessKeySecret()
+	case aliyunavatar.FieldAppID:
+		return m.AppID()
+	case aliyunavatar.FieldTenantID:
+		return m.TenantID()
+	case aliyunavatar.FieldResponse:
+		return m.Response()
+	case aliyunavatar.FieldToken:
+		return m.Token()
+	case aliyunavatar.FieldSessionID:
+		return m.SessionID()
+	}
+	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 *AliyunAvatarMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+	switch name {
+	case aliyunavatar.FieldCreatedAt:
+		return m.OldCreatedAt(ctx)
+	case aliyunavatar.FieldUpdatedAt:
+		return m.OldUpdatedAt(ctx)
+	case aliyunavatar.FieldDeletedAt:
+		return m.OldDeletedAt(ctx)
+	case aliyunavatar.FieldUserID:
+		return m.OldUserID(ctx)
+	case aliyunavatar.FieldBizID:
+		return m.OldBizID(ctx)
+	case aliyunavatar.FieldAccessKeyID:
+		return m.OldAccessKeyID(ctx)
+	case aliyunavatar.FieldAccessKeySecret:
+		return m.OldAccessKeySecret(ctx)
+	case aliyunavatar.FieldAppID:
+		return m.OldAppID(ctx)
+	case aliyunavatar.FieldTenantID:
+		return m.OldTenantID(ctx)
+	case aliyunavatar.FieldResponse:
+		return m.OldResponse(ctx)
+	case aliyunavatar.FieldToken:
+		return m.OldToken(ctx)
+	case aliyunavatar.FieldSessionID:
+		return m.OldSessionID(ctx)
+	}
+	return nil, fmt.Errorf("unknown AliyunAvatar 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 *AliyunAvatarMutation) SetField(name string, value ent.Value) error {
+	switch name {
+	case aliyunavatar.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 aliyunavatar.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 aliyunavatar.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 aliyunavatar.FieldUserID:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetUserID(v)
+		return nil
+	case aliyunavatar.FieldBizID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetBizID(v)
+		return nil
+	case aliyunavatar.FieldAccessKeyID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAccessKeyID(v)
+		return nil
+	case aliyunavatar.FieldAccessKeySecret:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAccessKeySecret(v)
+		return nil
+	case aliyunavatar.FieldAppID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAppID(v)
+		return nil
+	case aliyunavatar.FieldTenantID:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetTenantID(v)
+		return nil
+	case aliyunavatar.FieldResponse:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetResponse(v)
+		return nil
+	case aliyunavatar.FieldToken:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetToken(v)
+		return nil
+	case aliyunavatar.FieldSessionID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetSessionID(v)
+		return nil
+	}
+	return fmt.Errorf("unknown AliyunAvatar field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *AliyunAvatarMutation) AddedFields() []string {
+	var fields []string
+	if m.adduser_id != nil {
+		fields = append(fields, aliyunavatar.FieldUserID)
+	}
+	if m.addtenant_id != nil {
+		fields = append(fields, aliyunavatar.FieldTenantID)
+	}
+	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 *AliyunAvatarMutation) AddedField(name string) (ent.Value, bool) {
+	switch name {
+	case aliyunavatar.FieldUserID:
+		return m.AddedUserID()
+	case aliyunavatar.FieldTenantID:
+		return m.AddedTenantID()
+	}
+	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 *AliyunAvatarMutation) AddField(name string, value ent.Value) error {
+	switch name {
+	case aliyunavatar.FieldUserID:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddUserID(v)
+		return nil
+	case aliyunavatar.FieldTenantID:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddTenantID(v)
+		return nil
+	}
+	return fmt.Errorf("unknown AliyunAvatar numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *AliyunAvatarMutation) ClearedFields() []string {
+	var fields []string
+	if m.FieldCleared(aliyunavatar.FieldDeletedAt) {
+		fields = append(fields, aliyunavatar.FieldDeletedAt)
+	}
+	if m.FieldCleared(aliyunavatar.FieldAppID) {
+		fields = append(fields, aliyunavatar.FieldAppID)
+	}
+	return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *AliyunAvatarMutation) 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 *AliyunAvatarMutation) ClearField(name string) error {
+	switch name {
+	case aliyunavatar.FieldDeletedAt:
+		m.ClearDeletedAt()
+		return nil
+	case aliyunavatar.FieldAppID:
+		m.ClearAppID()
+		return nil
+	}
+	return fmt.Errorf("unknown AliyunAvatar 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 *AliyunAvatarMutation) ResetField(name string) error {
+	switch name {
+	case aliyunavatar.FieldCreatedAt:
+		m.ResetCreatedAt()
+		return nil
+	case aliyunavatar.FieldUpdatedAt:
+		m.ResetUpdatedAt()
+		return nil
+	case aliyunavatar.FieldDeletedAt:
+		m.ResetDeletedAt()
+		return nil
+	case aliyunavatar.FieldUserID:
+		m.ResetUserID()
+		return nil
+	case aliyunavatar.FieldBizID:
+		m.ResetBizID()
+		return nil
+	case aliyunavatar.FieldAccessKeyID:
+		m.ResetAccessKeyID()
+		return nil
+	case aliyunavatar.FieldAccessKeySecret:
+		m.ResetAccessKeySecret()
+		return nil
+	case aliyunavatar.FieldAppID:
+		m.ResetAppID()
+		return nil
+	case aliyunavatar.FieldTenantID:
+		m.ResetTenantID()
+		return nil
+	case aliyunavatar.FieldResponse:
+		m.ResetResponse()
+		return nil
+	case aliyunavatar.FieldToken:
+		m.ResetToken()
+		return nil
+	case aliyunavatar.FieldSessionID:
+		m.ResetSessionID()
+		return nil
+	}
+	return fmt.Errorf("unknown AliyunAvatar field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *AliyunAvatarMutation) 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 *AliyunAvatarMutation) AddedIDs(name string) []ent.Value {
+	return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *AliyunAvatarMutation) 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 *AliyunAvatarMutation) RemovedIDs(name string) []ent.Value {
+	return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *AliyunAvatarMutation) 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 *AliyunAvatarMutation) 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 *AliyunAvatarMutation) ClearEdge(name string) error {
+	return fmt.Errorf("unknown AliyunAvatar 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 *AliyunAvatarMutation) ResetEdge(name string) error {
+	return fmt.Errorf("unknown AliyunAvatar edge %s", name)
+}
+
 // BatchMsgMutation represents an operation that mutates the BatchMsg nodes in the graph.
 type BatchMsgMutation struct {
 	config

+ 82 - 0
ent/pagination.go

@@ -7,6 +7,7 @@ import (
 	"fmt"
 	"wechat-api/ent/agent"
 	"wechat-api/ent/agentbase"
+	"wechat-api/ent/aliyunavatar"
 	"wechat-api/ent/batchmsg"
 	"wechat-api/ent/category"
 	"wechat-api/ent/chatrecords"
@@ -240,6 +241,87 @@ func (ab *AgentBaseQuery) Page(
 	return ret, nil
 }
 
+type AliyunAvatarPager struct {
+	Order  aliyunavatar.OrderOption
+	Filter func(*AliyunAvatarQuery) (*AliyunAvatarQuery, error)
+}
+
+// AliyunAvatarPaginateOption enables pagination customization.
+type AliyunAvatarPaginateOption func(*AliyunAvatarPager)
+
+// DefaultAliyunAvatarOrder is the default ordering of AliyunAvatar.
+var DefaultAliyunAvatarOrder = Desc(aliyunavatar.FieldID)
+
+func newAliyunAvatarPager(opts []AliyunAvatarPaginateOption) (*AliyunAvatarPager, error) {
+	pager := &AliyunAvatarPager{}
+	for _, opt := range opts {
+		opt(pager)
+	}
+	if pager.Order == nil {
+		pager.Order = DefaultAliyunAvatarOrder
+	}
+	return pager, nil
+}
+
+func (p *AliyunAvatarPager) ApplyFilter(query *AliyunAvatarQuery) (*AliyunAvatarQuery, error) {
+	if p.Filter != nil {
+		return p.Filter(query)
+	}
+	return query, nil
+}
+
+// AliyunAvatarPageList is AliyunAvatar PageList result.
+type AliyunAvatarPageList struct {
+	List        []*AliyunAvatar `json:"list"`
+	PageDetails *PageDetails    `json:"pageDetails"`
+}
+
+func (aa *AliyunAvatarQuery) Page(
+	ctx context.Context, pageNum uint64, pageSize uint64, opts ...AliyunAvatarPaginateOption,
+) (*AliyunAvatarPageList, error) {
+
+	pager, err := newAliyunAvatarPager(opts)
+	if err != nil {
+		return nil, err
+	}
+
+	if aa, err = pager.ApplyFilter(aa); err != nil {
+		return nil, err
+	}
+
+	ret := &AliyunAvatarPageList{}
+
+	ret.PageDetails = &PageDetails{
+		Page: pageNum,
+		Size: pageSize,
+	}
+
+	query := aa.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 {
+		aa = aa.Order(pager.Order)
+	} else {
+		aa = aa.Order(DefaultAliyunAvatarOrder)
+	}
+
+	aa = aa.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
+	list, err := aa.All(ctx)
+	if err != nil {
+		return nil, err
+	}
+	ret.List = list
+
+	return ret, nil
+}
+
 type BatchMsgPager struct {
 	Order  batchmsg.OrderOption
 	Filter func(*BatchMsgQuery) (*BatchMsgQuery, error)

+ 3 - 0
ent/predicate/predicate.go

@@ -12,6 +12,9 @@ type Agent func(*sql.Selector)
 // AgentBase is the predicate function for agentbase builders.
 type AgentBase func(*sql.Selector)
 
+// AliyunAvatar is the predicate function for aliyunavatar builders.
+type AliyunAvatar func(*sql.Selector)
+
 // BatchMsg is the predicate function for batchmsg builders.
 type BatchMsg func(*sql.Selector)
 

+ 28 - 0
ent/runtime/runtime.go

@@ -6,6 +6,7 @@ import (
 	"time"
 	"wechat-api/ent/agent"
 	"wechat-api/ent/agentbase"
+	"wechat-api/ent/aliyunavatar"
 	"wechat-api/ent/batchmsg"
 	"wechat-api/ent/category"
 	"wechat-api/ent/chatrecords"
@@ -123,6 +124,33 @@ func init() {
 	agentbaseDescSourceName := agentbaseFields[7].Descriptor()
 	// agentbase.DefaultSourceName holds the default value on creation for the source_name field.
 	agentbase.DefaultSourceName = agentbaseDescSourceName.Default.(string)
+	aliyunavatarMixin := schema.AliyunAvatar{}.Mixin()
+	aliyunavatarMixinHooks1 := aliyunavatarMixin[1].Hooks()
+	aliyunavatar.Hooks[0] = aliyunavatarMixinHooks1[0]
+	aliyunavatarMixinInters1 := aliyunavatarMixin[1].Interceptors()
+	aliyunavatar.Interceptors[0] = aliyunavatarMixinInters1[0]
+	aliyunavatarMixinFields0 := aliyunavatarMixin[0].Fields()
+	_ = aliyunavatarMixinFields0
+	aliyunavatarFields := schema.AliyunAvatar{}.Fields()
+	_ = aliyunavatarFields
+	// aliyunavatarDescCreatedAt is the schema descriptor for created_at field.
+	aliyunavatarDescCreatedAt := aliyunavatarMixinFields0[1].Descriptor()
+	// aliyunavatar.DefaultCreatedAt holds the default value on creation for the created_at field.
+	aliyunavatar.DefaultCreatedAt = aliyunavatarDescCreatedAt.Default.(func() time.Time)
+	// aliyunavatarDescUpdatedAt is the schema descriptor for updated_at field.
+	aliyunavatarDescUpdatedAt := aliyunavatarMixinFields0[2].Descriptor()
+	// aliyunavatar.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+	aliyunavatar.DefaultUpdatedAt = aliyunavatarDescUpdatedAt.Default.(func() time.Time)
+	// aliyunavatar.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+	aliyunavatar.UpdateDefaultUpdatedAt = aliyunavatarDescUpdatedAt.UpdateDefault.(func() time.Time)
+	// aliyunavatarDescToken is the schema descriptor for token field.
+	aliyunavatarDescToken := aliyunavatarFields[7].Descriptor()
+	// aliyunavatar.DefaultToken holds the default value on creation for the token field.
+	aliyunavatar.DefaultToken = aliyunavatarDescToken.Default.(string)
+	// aliyunavatarDescSessionID is the schema descriptor for session_id field.
+	aliyunavatarDescSessionID := aliyunavatarFields[8].Descriptor()
+	// aliyunavatar.DefaultSessionID holds the default value on creation for the session_id field.
+	aliyunavatar.DefaultSessionID = aliyunavatarDescSessionID.Default.(string)
 	batchmsgMixin := schema.BatchMsg{}.Mixin()
 	batchmsgMixinHooks1 := batchmsgMixin[1].Hooks()
 	batchmsg.Hooks[0] = batchmsgMixinHooks1[0]

+ 54 - 0
ent/schema/aliyun_avatar.go

@@ -0,0 +1,54 @@
+package schema
+
+import (
+	"entgo.io/ent/schema/index"
+	"wechat-api/ent/schema/localmixin"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/entsql"
+	"entgo.io/ent/schema"
+	"entgo.io/ent/schema/field"
+	"github.com/suyuan32/simple-admin-common/orm/ent/mixins"
+)
+
+type AliyunAvatar struct {
+	ent.Schema
+}
+
+func (AliyunAvatar) Fields() []ent.Field {
+	return []ent.Field{
+		field.Uint64("user_id").Comment("user_id | wx_card_user_id"),
+		field.String("biz_id").Comment("biz_id | BizId"),
+		field.String("access_key_id").Comment("access_key_id | AccessKeyId"),
+		field.String("access_key_secret").Comment("access_key_secret | AccessKeySecret"),
+		field.String("app_id").Optional().Comment("app_id | AppId"),
+		field.Int64("tenant_id").Comment("tenant_id | TenantId"),
+		field.Text("response").Comment("response | 阿里云avatar响应"),
+		field.String("token").Default("").Comment("token | Token"),
+		field.String("session_id").Default("").Comment("session_id | SessionId"),
+	}
+}
+
+func (AliyunAvatar) Mixin() []ent.Mixin {
+	return []ent.Mixin{
+		mixins.IDMixin{},
+		localmixin.SoftDeleteMixin{},
+	}
+}
+
+func (AliyunAvatar) Edges() []ent.Edge {
+	return nil
+}
+
+func (AliyunAvatar) Indexes() []ent.Index {
+	return []ent.Index{
+		index.Fields("user_id"),
+	}
+}
+
+func (AliyunAvatar) Annotations() []schema.Annotation {
+	return []schema.Annotation{
+		entsql.WithComments(true),
+		entsql.Annotation{Table: "aliyun_avatar"},
+	}
+}

+ 264 - 0
ent/set_not_nil.go

@@ -464,6 +464,270 @@ func (ab *AgentBaseCreate) SetNotNilIsOwner(value []bool) *AgentBaseCreate {
 }
 
 // set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilUpdatedAt(value *time.Time) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetUpdatedAt(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilUpdatedAt(value *time.Time) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetUpdatedAt(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilUpdatedAt(value *time.Time) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetUpdatedAt(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilDeletedAt(value *time.Time) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetDeletedAt(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilDeletedAt(value *time.Time) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetDeletedAt(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilDeletedAt(value *time.Time) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetDeletedAt(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilUserID(value *uint64) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetUserID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilUserID(value *uint64) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetUserID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilUserID(value *uint64) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetUserID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilBizID(value *string) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetBizID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilBizID(value *string) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetBizID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilBizID(value *string) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetBizID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilAccessKeyID(value *string) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetAccessKeyID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilAccessKeyID(value *string) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetAccessKeyID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilAccessKeyID(value *string) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetAccessKeyID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilAccessKeySecret(value *string) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetAccessKeySecret(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilAccessKeySecret(value *string) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetAccessKeySecret(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilAccessKeySecret(value *string) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetAccessKeySecret(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilAppID(value *string) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetAppID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilAppID(value *string) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetAppID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilAppID(value *string) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetAppID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilTenantID(value *int64) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetTenantID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilTenantID(value *int64) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetTenantID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilTenantID(value *int64) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetTenantID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilResponse(value *string) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetResponse(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilResponse(value *string) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetResponse(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilResponse(value *string) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetResponse(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilToken(value *string) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetToken(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilToken(value *string) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetToken(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilToken(value *string) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetToken(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdate) SetNotNilSessionID(value *string) *AliyunAvatarUpdate {
+	if value != nil {
+		return aa.SetSessionID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarUpdateOne) SetNotNilSessionID(value *string) *AliyunAvatarUpdateOne {
+	if value != nil {
+		return aa.SetSessionID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
+func (aa *AliyunAvatarCreate) SetNotNilSessionID(value *string) *AliyunAvatarCreate {
+	if value != nil {
+		return aa.SetSessionID(*value)
+	}
+	return aa
+}
+
+// set field if value's pointer is not nil.
 func (bm *BatchMsgUpdate) SetNotNilUpdatedAt(value *time.Time) *BatchMsgUpdate {
 	if value != nil {
 		return bm.SetUpdatedAt(*value)

+ 3 - 0
ent/tx.go

@@ -18,6 +18,8 @@ type Tx struct {
 	Agent *AgentClient
 	// AgentBase is the client for interacting with the AgentBase builders.
 	AgentBase *AgentBaseClient
+	// AliyunAvatar is the client for interacting with the AliyunAvatar builders.
+	AliyunAvatar *AliyunAvatarClient
 	// BatchMsg is the client for interacting with the BatchMsg builders.
 	BatchMsg *BatchMsgClient
 	// Category is the client for interacting with the Category builders.
@@ -197,6 +199,7 @@ func (tx *Tx) Client() *Client {
 func (tx *Tx) init() {
 	tx.Agent = NewAgentClient(tx.config)
 	tx.AgentBase = NewAgentBaseClient(tx.config)
+	tx.AliyunAvatar = NewAliyunAvatarClient(tx.config)
 	tx.BatchMsg = NewBatchMsgClient(tx.config)
 	tx.Category = NewCategoryClient(tx.config)
 	tx.ChatRecords = NewChatRecordsClient(tx.config)

+ 4 - 0
hook/aliyun/aitypes.go

@@ -4,5 +4,9 @@ type AiTypes struct {
 	AiType          uint64 `json:"ai_type"`
 	Ak              string `json:"ak,omitempty,optional"`
 	Sk              string `json:"sk,omitempty,optional"`
+	AccessKeyId     string `json:"access_key_id"`
+	AccessKeySecret string `json:"access_key_secret"`
+	AppId           string `json:"app_id"`
+	TenantId        int64  `json:"tenant_id"`
 	SubscriptionKey string `json:"subscription_key,omitempty,optional"`
 }

+ 11 - 8
hook/aliyun/avatar.go

@@ -8,6 +8,7 @@ import (
 	openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
 	util "github.com/alibabacloud-go/tea-utils/v2/service"
 	"github.com/alibabacloud-go/tea/tea"
+	"strconv"
 	"strings"
 	"wechat-api/internal/utils/jwt"
 )
@@ -33,11 +34,13 @@ func CreateClient(accessKeyId, accessKeySecret string) (_result *avatar20220130.
 }
 
 // StartInstance 启动数字人 userId=1234 bizId=xxoo
-func StartInstance(userId, bizId string) (*avatar20220130.StartInstanceResponseBodyData, error) {
-	accessKeyId := GetAccessKeyId()
-	accessKeySecret := GetAccessKeySecret()
-	tenantId := GetTenantId()
-	appId := GetAppId()
+func StartInstance(userId uint64, jsonData AiTypes) (*avatar20220130.StartInstanceResponseBodyData, error) {
+	accessKeyId := jsonData.AccessKeyId
+	accessKeySecret := jsonData.AccessKeySecret
+	tenantId := jsonData.TenantId
+	appId := jsonData.AppId
+	bizId := GenerateBizID(userId)
+	userIdStr := strconv.Itoa(int(userId))
 
 	client, _err := CreateClient(accessKeyId, accessKeySecret)
 	if _err != nil {
@@ -50,7 +53,7 @@ func StartInstance(userId, bizId string) (*avatar20220130.StartInstanceResponseB
 			AppId: tea.String(appId),
 		},
 		User: &avatar20220130.StartInstanceRequestUser{
-			UserId: tea.String(userId),
+			UserId: tea.String(userIdStr),
 		},
 		BizId: tea.String(bizId),
 	}
@@ -118,10 +121,10 @@ func _main(args []*string) (_err error) {
 	return _err
 }
 
-// GetBizID 业务请求id,最大支持 64 位字符
+// GenerateBizID 业务请求id,最大支持 64 位字符
 // (注意 可以使用该字段做业务启动数字人的幂等,服务端确保同一个 bizId 多次调用只会开启一路实例)
 // 鉴于以上原因这里确保每个用户只启动一个实例
-func GetBizID(userId uint64) string {
+func GenerateBizID(userId uint64) string {
 	return jwt.HashidsEncode(int(userId))
 }
 

+ 47 - 0
internal/logic/aliyun_avatar/create_aliyun_avatar_logic.go

@@ -0,0 +1,47 @@
+package aliyun_avatar
+
+import (
+	"context"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+	"wechat-api/internal/utils/dberrorhandler"
+
+    "github.com/suyuan32/simple-admin-common/msg/errormsg"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateAliyunAvatarLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewCreateAliyunAvatarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateAliyunAvatarLogic {
+	return &CreateAliyunAvatarLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *CreateAliyunAvatarLogic) CreateAliyunAvatar(req *types.AliyunAvatarInfo) (*types.BaseMsgResp, error) {
+    _, err := l.svcCtx.DB.AliyunAvatar.Create().
+			SetNotNilUserID(req.UserId).
+			SetNotNilBizID(req.BizId).
+			SetNotNilAccessKeyID(req.AccessKeyId).
+			SetNotNilAccessKeySecret(req.AccessKeySecret).
+			SetNotNilAppID(req.AppId).
+			SetNotNilTenantD(req.TenantD).
+			SetNotNilResponse(req.Response).
+			SetNotNilToken(req.Token).
+			SetNotNilSessionID(req.SessionId).
+			Save(l.ctx)
+
+    if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+    return &types.BaseMsgResp{Msg: errormsg.CreateSuccess}, nil
+}

+ 37 - 0
internal/logic/aliyun_avatar/delete_aliyun_avatar_logic.go

@@ -0,0 +1,37 @@
+package aliyun_avatar
+
+import (
+	"context"
+
+    "wechat-api/ent/aliyunavatar"
+    "wechat-api/internal/svc"
+    "wechat-api/internal/types"
+    "wechat-api/internal/utils/dberrorhandler"
+
+    "github.com/suyuan32/simple-admin-common/msg/errormsg"
+    "github.com/zeromicro/go-zero/core/logx"
+)
+
+type DeleteAliyunAvatarLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDeleteAliyunAvatarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteAliyunAvatarLogic {
+	return &DeleteAliyunAvatarLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DeleteAliyunAvatarLogic) DeleteAliyunAvatar(req *types.IDsReq) (*types.BaseMsgResp, error) {
+	_, err := l.svcCtx.DB.AliyunAvatar.Delete().Where(aliyunavatar.IDIn(req.Ids...)).Exec(l.ctx)
+
+    if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+    return &types.BaseMsgResp{Msg: errormsg.DeleteSuccess}, nil
+}

+ 59 - 0
internal/logic/aliyun_avatar/get_aliyun_avatar_by_id_logic.go

@@ -0,0 +1,59 @@
+package aliyun_avatar
+
+import (
+	"context"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+	"wechat-api/internal/utils/dberrorhandler"
+
+    "github.com/suyuan32/simple-admin-common/msg/errormsg"
+
+	"github.com/suyuan32/simple-admin-common/utils/pointy"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetAliyunAvatarByIdLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetAliyunAvatarByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAliyunAvatarByIdLogic {
+	return &GetAliyunAvatarByIdLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *GetAliyunAvatarByIdLogic) GetAliyunAvatarById(req *types.IDReq) (*types.AliyunAvatarInfoResp, error) {
+	data, err := l.svcCtx.DB.AliyunAvatar.Get(l.ctx, req.Id)
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+	return &types.AliyunAvatarInfoResp{
+	    BaseDataInfo: types.BaseDataInfo{
+            Code: 0,
+            Msg:  errormsg.Success,
+        },
+        Data: types.AliyunAvatarInfo{
+            BaseIDInfo:    types.BaseIDInfo{
+				Id:          &data.ID,
+				CreatedAt:    pointy.GetPointer(data.CreatedAt.UnixMilli()),
+				UpdatedAt:    pointy.GetPointer(data.UpdatedAt.UnixMilli()),
+            },
+			UserId:	&data.UserID,
+			BizId:	&data.BizID,
+			AccessKeyId:	&data.AccessKeyID,
+			AccessKeySecret:	&data.AccessKeySecret,
+			AppId:	&data.AppID,
+			TenantD:	&data.TenantD,
+			Response:	&data.Response,
+			Token:	&data.Token,
+			SessionId:	&data.SessionID,
+        },
+	}, nil
+}
+

+ 74 - 0
internal/logic/aliyun_avatar/get_aliyun_avatar_list_logic.go

@@ -0,0 +1,74 @@
+package aliyun_avatar
+
+import (
+	"context"
+
+	"wechat-api/ent/aliyunavatar"
+	"wechat-api/ent/predicate"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+	"wechat-api/internal/utils/dberrorhandler"
+
+    "github.com/suyuan32/simple-admin-common/msg/errormsg"
+
+	"github.com/suyuan32/simple-admin-common/utils/pointy"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetAliyunAvatarListLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetAliyunAvatarListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAliyunAvatarListLogic {
+	return &GetAliyunAvatarListLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *GetAliyunAvatarListLogic) GetAliyunAvatarList(req *types.AliyunAvatarListReq) (*types.AliyunAvatarListResp, error) {
+	var predicates []predicate.AliyunAvatar
+	if req.BizId != nil {
+		predicates = append(predicates, aliyunavatar.BizIDContains(*req.BizId))
+	}
+	if req.AccessKeyId != nil {
+		predicates = append(predicates, aliyunavatar.AccessKeyIDContains(*req.AccessKeyId))
+	}
+	if req.AccessKeySecret != nil {
+		predicates = append(predicates, aliyunavatar.AccessKeySecretContains(*req.AccessKeySecret))
+	}
+	data, err := l.svcCtx.DB.AliyunAvatar.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)
+
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+	resp := &types.AliyunAvatarListResp{}
+	resp.Msg = errormsg.Success
+	resp.Data.Total = data.PageDetails.Total
+
+	for _, v := range data.List {
+		resp.Data.Data = append(resp.Data.Data,
+		types.AliyunAvatarInfo{
+			BaseIDInfo:    types.BaseIDInfo{
+				Id:          &v.ID,
+				CreatedAt:    pointy.GetPointer(v.CreatedAt.UnixMilli()),
+				UpdatedAt:    pointy.GetPointer(v.UpdatedAt.UnixMilli()),
+            },
+			UserId:	&v.UserID,
+			BizId:	&v.BizID,
+			AccessKeyId:	&v.AccessKeyID,
+			AccessKeySecret:	&v.AccessKeySecret,
+			AppId:	&v.AppID,
+			TenantD:	&v.TenantD,
+			Response:	&v.Response,
+			Token:	&v.Token,
+			SessionId:	&v.SessionID,
+		})
+	}
+
+	return resp, nil
+}

+ 47 - 0
internal/logic/aliyun_avatar/update_aliyun_avatar_logic.go

@@ -0,0 +1,47 @@
+package aliyun_avatar
+
+import (
+	"context"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+	"wechat-api/internal/utils/dberrorhandler"
+
+
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type UpdateAliyunAvatarLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewUpdateAliyunAvatarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateAliyunAvatarLogic {
+	return &UpdateAliyunAvatarLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *UpdateAliyunAvatarLogic) UpdateAliyunAvatar(req *types.AliyunAvatarInfo) (*types.BaseMsgResp, error) {
+    err := l.svcCtx.DB.AliyunAvatar.UpdateOneID(*req.Id).
+			SetNotNilUserID(req.UserId).
+			SetNotNilBizID(req.BizId).
+			SetNotNilAccessKeyID(req.AccessKeyId).
+			SetNotNilAccessKeySecret(req.AccessKeySecret).
+			SetNotNilAppID(req.AppId).
+			SetNotNilTenantD(req.TenantD).
+			SetNotNilResponse(req.Response).
+			SetNotNilToken(req.Token).
+			SetNotNilSessionID(req.SessionId).
+			Exec(l.ctx)
+
+    if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+    return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil
+}

+ 18 - 3
internal/logic/avatar/get_api_avatar_config_logic.go

@@ -7,7 +7,6 @@ import (
 	avatar20220130 "github.com/alibabacloud-go/avatar-20220130/v2/client"
 	"github.com/suyuan32/simple-admin-common/msg/errormsg"
 	"github.com/zeromicro/go-zero/core/errorx"
-	"strconv"
 	"wechat-api/ent/wxcard"
 	"wechat-api/hook/aliyun"
 	"wechat-api/internal/utils/dberrorhandler"
@@ -51,12 +50,28 @@ func (l *GetApiAvatarConfigLogic) GetApiAvatarConfig(req *types.AvatarConfigReq)
 
 	var aiData *avatar20220130.StartInstanceResponseBodyData
 	if jsonData.AiType == 1 { // 阿里云数字人
-		userIdStr := strconv.Itoa(int(userId))
-		aiData, err = aliyun.StartInstance(userIdStr, aliyun.GetBizID(userId))
+		aiData, err = aliyun.StartInstance(userId, jsonData)
 		fmt.Printf("aliData=%v error=%v \n", aiData, err)
 		if err != nil {
 			return nil, errorx.NewInternalError(err.Error())
 		}
+
+		// 开启的数字人信息入库
+		bizId := aliyun.GenerateBizID(userId)
+		_, err := l.svcCtx.DB.AliyunAvatar.Create().
+			SetNotNilUserID(&userId).
+			SetNotNilBizID(&bizId).
+			SetNotNilAccessKeyID(&jsonData.AccessKeyId).
+			SetNotNilAccessKeySecret(&jsonData.AccessKeySecret).
+			SetNotNilAppID(&jsonData.AppId).
+			SetNotNilTenantID(&jsonData.TenantId).
+			SetNotNilSessionID(aiData.SessionId).
+			SetResponse(aiData.String()).
+			SetNotNilToken(aiData.Token).
+			Save(l.ctx)
+		if err != nil {
+			return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+		}
 	} else if jsonData.AiType == 2 { //TODO 小冰
 
 	}

+ 62 - 0
internal/logic/base/init_api_data.go

@@ -6,6 +6,68 @@ import (
 )
 
 func (l *InitDatabaseLogic) insertApiData() (err error) {
+	// AliyunAvatar
+
+	_, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
+		ServiceName: pointy.GetPointer("Wechat"),
+		Path:        pointy.GetPointer("/aliyun_avatar/create"),
+		Description: pointy.GetPointer("apiDesc.createAliyunAvatar"),
+		ApiGroup:    pointy.GetPointer("aliyun_avatar"),
+		Method:      pointy.GetPointer("POST"),
+	})
+
+	if err != nil {
+		return err
+	}
+
+	_, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
+		ServiceName: pointy.GetPointer("Wechat"),
+		Path:        pointy.GetPointer("/aliyun_avatar/update"),
+		Description: pointy.GetPointer("apiDesc.updateAliyunAvatar"),
+		ApiGroup:    pointy.GetPointer("aliyun_avatar"),
+		Method:      pointy.GetPointer("POST"),
+	})
+
+	if err != nil {
+		return err
+	}
+
+	_, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
+		ServiceName: pointy.GetPointer("Wechat"),
+		Path:        pointy.GetPointer("/aliyun_avatar/delete"),
+		Description: pointy.GetPointer("apiDesc.deleteAliyunAvatar"),
+		ApiGroup:    pointy.GetPointer("aliyun_avatar"),
+		Method:      pointy.GetPointer("POST"),
+	})
+
+	if err != nil {
+		return err
+	}
+
+	_, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
+		ServiceName: pointy.GetPointer("Wechat"),
+		Path:        pointy.GetPointer("/aliyun_avatar/list"),
+		Description: pointy.GetPointer("apiDesc.getAliyunAvatarList"),
+		ApiGroup:    pointy.GetPointer("aliyun_avatar"),
+		Method:      pointy.GetPointer("POST"),
+	})
+
+	if err != nil {
+		return err
+	}
+
+	_, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
+		ServiceName: pointy.GetPointer("Wechat"),
+		Path:        pointy.GetPointer("/aliyun_avatar"),
+		Description: pointy.GetPointer("apiDesc.getAliyunAvatarById"),
+		ApiGroup:    pointy.GetPointer("aliyun_avatar"),
+		Method:      pointy.GetPointer("POST"),
+	})
+
+	if err != nil {
+		return err
+	}
+
 	// WxCardVisit
 
 	_, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{