Explorar el Código

whatsapp 增加 cc_phone 字段
修复发送验证码接口问题

boweniac hace 1 mes
padre
commit
c0951abb1f

+ 1 - 0
desc/wechat/whatsapp.api

@@ -148,6 +148,7 @@ type (
 	}
 
 	sendCodeReq {
+	    Cc  *string `json:"cc"`
 		Phone  *string `json:"phone"`
 		WaId  *string `json:"waId"`
 		Method *string `json:"method"`

+ 2 - 1
ent/migrate/schema.go

@@ -1046,6 +1046,7 @@ var (
 		{Name: "account", Type: field.TypeString, Nullable: true, Default: ""},
 		{Name: "cc", Type: field.TypeString, Default: ""},
 		{Name: "phone", Type: field.TypeString, Default: ""},
+		{Name: "cc_phone", Type: field.TypeString, Default: ""},
 		{Name: "phone_name", Type: field.TypeString, Default: ""},
 		{Name: "phone_status", Type: field.TypeInt8, Default: 0},
 		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Default: 0},
@@ -1065,7 +1066,7 @@ var (
 		ForeignKeys: []*schema.ForeignKey{
 			{
 				Symbol:     "whatsapp_agent_wa_agent",
-				Columns:    []*schema.Column{WhatsappColumns[20]},
+				Columns:    []*schema.Column{WhatsappColumns[21]},
 				RefColumns: []*schema.Column{AgentColumns[0]},
 				OnDelete:   schema.NoAction,
 			},

+ 55 - 1
ent/mutation.go

@@ -36965,6 +36965,7 @@ type WhatsappMutation struct {
 	account                *string
 	cc                     *string
 	phone                  *string
+	cc_phone               *string
 	phone_name             *string
 	phone_status           *int8
 	addphone_status        *int8
@@ -37587,6 +37588,42 @@ func (m *WhatsappMutation) ResetPhone() {
 	m.phone = nil
 }
 
+// SetCcPhone sets the "cc_phone" field.
+func (m *WhatsappMutation) SetCcPhone(s string) {
+	m.cc_phone = &s
+}
+
+// CcPhone returns the value of the "cc_phone" field in the mutation.
+func (m *WhatsappMutation) CcPhone() (r string, exists bool) {
+	v := m.cc_phone
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldCcPhone returns the old "cc_phone" field's value of the Whatsapp entity.
+// If the Whatsapp 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 *WhatsappMutation) OldCcPhone(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldCcPhone is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldCcPhone requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldCcPhone: %w", err)
+	}
+	return oldValue.CcPhone, nil
+}
+
+// ResetCcPhone resets all changes to the "cc_phone" field.
+func (m *WhatsappMutation) ResetCcPhone() {
+	m.cc_phone = nil
+}
+
 // SetPhoneName sets the "phone_name" field.
 func (m *WhatsappMutation) SetPhoneName(s string) {
 	m.phone_name = &s
@@ -38168,7 +38205,7 @@ func (m *WhatsappMutation) Type() string {
 // order to get all numeric fields that were incremented/decremented, call
 // AddedFields().
 func (m *WhatsappMutation) Fields() []string {
-	fields := make([]string, 0, 20)
+	fields := make([]string, 0, 21)
 	if m.created_at != nil {
 		fields = append(fields, whatsapp.FieldCreatedAt)
 	}
@@ -38202,6 +38239,9 @@ func (m *WhatsappMutation) Fields() []string {
 	if m.phone != nil {
 		fields = append(fields, whatsapp.FieldPhone)
 	}
+	if m.cc_phone != nil {
+		fields = append(fields, whatsapp.FieldCcPhone)
+	}
 	if m.phone_name != nil {
 		fields = append(fields, whatsapp.FieldPhoneName)
 	}
@@ -38259,6 +38299,8 @@ func (m *WhatsappMutation) Field(name string) (ent.Value, bool) {
 		return m.Cc()
 	case whatsapp.FieldPhone:
 		return m.Phone()
+	case whatsapp.FieldCcPhone:
+		return m.CcPhone()
 	case whatsapp.FieldPhoneName:
 		return m.PhoneName()
 	case whatsapp.FieldPhoneStatus:
@@ -38308,6 +38350,8 @@ func (m *WhatsappMutation) OldField(ctx context.Context, name string) (ent.Value
 		return m.OldCc(ctx)
 	case whatsapp.FieldPhone:
 		return m.OldPhone(ctx)
+	case whatsapp.FieldCcPhone:
+		return m.OldCcPhone(ctx)
 	case whatsapp.FieldPhoneName:
 		return m.OldPhoneName(ctx)
 	case whatsapp.FieldPhoneStatus:
@@ -38412,6 +38456,13 @@ func (m *WhatsappMutation) SetField(name string, value ent.Value) error {
 		}
 		m.SetPhone(v)
 		return nil
+	case whatsapp.FieldCcPhone:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetCcPhone(v)
+		return nil
 	case whatsapp.FieldPhoneName:
 		v, ok := value.(string)
 		if !ok {
@@ -38677,6 +38728,9 @@ func (m *WhatsappMutation) ResetField(name string) error {
 	case whatsapp.FieldPhone:
 		m.ResetPhone()
 		return nil
+	case whatsapp.FieldCcPhone:
+		m.ResetCcPhone()
+		return nil
 	case whatsapp.FieldPhoneName:
 		m.ResetPhoneName()
 		return nil

+ 9 - 5
ent/runtime/runtime.go

@@ -1325,24 +1325,28 @@ func init() {
 	whatsappDescPhone := whatsappFields[6].Descriptor()
 	// whatsapp.DefaultPhone holds the default value on creation for the phone field.
 	whatsapp.DefaultPhone = whatsappDescPhone.Default.(string)
+	// whatsappDescCcPhone is the schema descriptor for cc_phone field.
+	whatsappDescCcPhone := whatsappFields[7].Descriptor()
+	// whatsapp.DefaultCcPhone holds the default value on creation for the cc_phone field.
+	whatsapp.DefaultCcPhone = whatsappDescCcPhone.Default.(string)
 	// whatsappDescPhoneName is the schema descriptor for phone_name field.
-	whatsappDescPhoneName := whatsappFields[7].Descriptor()
+	whatsappDescPhoneName := whatsappFields[8].Descriptor()
 	// whatsapp.DefaultPhoneName holds the default value on creation for the phone_name field.
 	whatsapp.DefaultPhoneName = whatsappDescPhoneName.Default.(string)
 	// whatsappDescPhoneStatus is the schema descriptor for phone_status field.
-	whatsappDescPhoneStatus := whatsappFields[8].Descriptor()
+	whatsappDescPhoneStatus := whatsappFields[9].Descriptor()
 	// whatsapp.DefaultPhoneStatus holds the default value on creation for the phone_status field.
 	whatsapp.DefaultPhoneStatus = whatsappDescPhoneStatus.Default.(int8)
 	// whatsappDescOrganizationID is the schema descriptor for organization_id field.
-	whatsappDescOrganizationID := whatsappFields[9].Descriptor()
+	whatsappDescOrganizationID := whatsappFields[10].Descriptor()
 	// whatsapp.DefaultOrganizationID holds the default value on creation for the organization_id field.
 	whatsapp.DefaultOrganizationID = whatsappDescOrganizationID.Default.(uint64)
 	// whatsappDescAPIBase is the schema descriptor for api_base field.
-	whatsappDescAPIBase := whatsappFields[10].Descriptor()
+	whatsappDescAPIBase := whatsappFields[11].Descriptor()
 	// whatsapp.DefaultAPIBase holds the default value on creation for the api_base field.
 	whatsapp.DefaultAPIBase = whatsappDescAPIBase.Default.(string)
 	// whatsappDescAPIKey is the schema descriptor for api_key field.
-	whatsappDescAPIKey := whatsappFields[11].Descriptor()
+	whatsappDescAPIKey := whatsappFields[12].Descriptor()
 	// whatsapp.DefaultAPIKey holds the default value on creation for the api_key field.
 	whatsapp.DefaultAPIKey = whatsappDescAPIKey.Default.(string)
 	whatsappchannelMixin := schema.WhatsappChannel{}.Mixin()

+ 1 - 0
ent/schema/whatsapp.go

@@ -24,6 +24,7 @@ func (Whatsapp) Fields() []ent.Field {
 		field.String("account").Optional().Default("").Comment("账号"),
 		field.String("cc").Default("").Comment("国家区号"),
 		field.String("phone").Default("").Comment("手机号"),
+		field.String("cc_phone").Default("").Comment("国家区号 + 手机号"),
 		field.String("phone_name").Default("").Comment("号码名称"),
 		field.Int8("phone_status").Default(0).Comment("号码状态"),
 		field.Uint64("organization_id").Optional().Default(0).Comment("机构 ID"),

+ 24 - 0
ent/set_not_nil.go

@@ -8000,6 +8000,30 @@ func (w *WhatsappCreate) SetNotNilPhone(value *string) *WhatsappCreate {
 }
 
 // set field if value's pointer is not nil.
+func (w *WhatsappUpdate) SetNotNilCcPhone(value *string) *WhatsappUpdate {
+	if value != nil {
+		return w.SetCcPhone(*value)
+	}
+	return w
+}
+
+// set field if value's pointer is not nil.
+func (w *WhatsappUpdateOne) SetNotNilCcPhone(value *string) *WhatsappUpdateOne {
+	if value != nil {
+		return w.SetCcPhone(*value)
+	}
+	return w
+}
+
+// set field if value's pointer is not nil.
+func (w *WhatsappCreate) SetNotNilCcPhone(value *string) *WhatsappCreate {
+	if value != nil {
+		return w.SetCcPhone(*value)
+	}
+	return w
+}
+
+// set field if value's pointer is not nil.
 func (w *WhatsappUpdate) SetNotNilPhoneName(value *string) *WhatsappUpdate {
 	if value != nil {
 		return w.SetPhoneName(*value)

+ 12 - 1
ent/whatsapp.go

@@ -41,6 +41,8 @@ type Whatsapp struct {
 	Cc string `json:"cc,omitempty"`
 	// 手机号
 	Phone string `json:"phone,omitempty"`
+	// 国家区号 + 手机号
+	CcPhone string `json:"cc_phone,omitempty"`
 	// 号码名称
 	PhoneName string `json:"phone_name,omitempty"`
 	// 号码状态
@@ -94,7 +96,7 @@ func (*Whatsapp) scanValues(columns []string) ([]any, error) {
 			values[i] = new([]byte)
 		case whatsapp.FieldID, whatsapp.FieldStatus, whatsapp.FieldAgentID, whatsapp.FieldPhoneStatus, whatsapp.FieldOrganizationID:
 			values[i] = new(sql.NullInt64)
-		case whatsapp.FieldWaID, whatsapp.FieldWaName, whatsapp.FieldCallback, whatsapp.FieldAccount, whatsapp.FieldCc, whatsapp.FieldPhone, whatsapp.FieldPhoneName, whatsapp.FieldAPIBase, whatsapp.FieldAPIKey:
+		case whatsapp.FieldWaID, whatsapp.FieldWaName, whatsapp.FieldCallback, whatsapp.FieldAccount, whatsapp.FieldCc, whatsapp.FieldPhone, whatsapp.FieldCcPhone, whatsapp.FieldPhoneName, whatsapp.FieldAPIBase, whatsapp.FieldAPIKey:
 			values[i] = new(sql.NullString)
 		case whatsapp.FieldCreatedAt, whatsapp.FieldUpdatedAt, whatsapp.FieldDeletedAt:
 			values[i] = new(sql.NullTime)
@@ -185,6 +187,12 @@ func (w *Whatsapp) assignValues(columns []string, values []any) error {
 			} else if value.Valid {
 				w.Phone = value.String
 			}
+		case whatsapp.FieldCcPhone:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field cc_phone", values[i])
+			} else if value.Valid {
+				w.CcPhone = value.String
+			}
 		case whatsapp.FieldPhoneName:
 			if value, ok := values[i].(*sql.NullString); !ok {
 				return fmt.Errorf("unexpected type %T for field phone_name", values[i])
@@ -321,6 +329,9 @@ func (w *Whatsapp) String() string {
 	builder.WriteString("phone=")
 	builder.WriteString(w.Phone)
 	builder.WriteString(", ")
+	builder.WriteString("cc_phone=")
+	builder.WriteString(w.CcPhone)
+	builder.WriteString(", ")
 	builder.WriteString("phone_name=")
 	builder.WriteString(w.PhoneName)
 	builder.WriteString(", ")

+ 10 - 0
ent/whatsapp/whatsapp.go

@@ -37,6 +37,8 @@ const (
 	FieldCc = "cc"
 	// FieldPhone holds the string denoting the phone field in the database.
 	FieldPhone = "phone"
+	// FieldCcPhone holds the string denoting the cc_phone field in the database.
+	FieldCcPhone = "cc_phone"
 	// FieldPhoneName holds the string denoting the phone_name field in the database.
 	FieldPhoneName = "phone_name"
 	// FieldPhoneStatus holds the string denoting the phone_status field in the database.
@@ -82,6 +84,7 @@ var Columns = []string{
 	FieldAccount,
 	FieldCc,
 	FieldPhone,
+	FieldCcPhone,
 	FieldPhoneName,
 	FieldPhoneStatus,
 	FieldOrganizationID,
@@ -133,6 +136,8 @@ var (
 	DefaultCc string
 	// DefaultPhone holds the default value on creation for the "phone" field.
 	DefaultPhone string
+	// DefaultCcPhone holds the default value on creation for the "cc_phone" field.
+	DefaultCcPhone string
 	// DefaultPhoneName holds the default value on creation for the "phone_name" field.
 	DefaultPhoneName string
 	// DefaultPhoneStatus holds the default value on creation for the "phone_status" field.
@@ -208,6 +213,11 @@ func ByPhone(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldPhone, opts...).ToFunc()
 }
 
+// ByCcPhone orders the results by the cc_phone field.
+func ByCcPhone(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldCcPhone, opts...).ToFunc()
+}
+
 // ByPhoneName orders the results by the phone_name field.
 func ByPhoneName(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldPhoneName, opts...).ToFunc()

+ 70 - 0
ent/whatsapp/where.go

@@ -110,6 +110,11 @@ func Phone(v string) predicate.Whatsapp {
 	return predicate.Whatsapp(sql.FieldEQ(FieldPhone, v))
 }
 
+// CcPhone applies equality check predicate on the "cc_phone" field. It's identical to CcPhoneEQ.
+func CcPhone(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldEQ(FieldCcPhone, v))
+}
+
 // PhoneName applies equality check predicate on the "phone_name" field. It's identical to PhoneNameEQ.
 func PhoneName(v string) predicate.Whatsapp {
 	return predicate.Whatsapp(sql.FieldEQ(FieldPhoneName, v))
@@ -765,6 +770,71 @@ func PhoneContainsFold(v string) predicate.Whatsapp {
 	return predicate.Whatsapp(sql.FieldContainsFold(FieldPhone, v))
 }
 
+// CcPhoneEQ applies the EQ predicate on the "cc_phone" field.
+func CcPhoneEQ(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldEQ(FieldCcPhone, v))
+}
+
+// CcPhoneNEQ applies the NEQ predicate on the "cc_phone" field.
+func CcPhoneNEQ(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldNEQ(FieldCcPhone, v))
+}
+
+// CcPhoneIn applies the In predicate on the "cc_phone" field.
+func CcPhoneIn(vs ...string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldIn(FieldCcPhone, vs...))
+}
+
+// CcPhoneNotIn applies the NotIn predicate on the "cc_phone" field.
+func CcPhoneNotIn(vs ...string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldNotIn(FieldCcPhone, vs...))
+}
+
+// CcPhoneGT applies the GT predicate on the "cc_phone" field.
+func CcPhoneGT(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldGT(FieldCcPhone, v))
+}
+
+// CcPhoneGTE applies the GTE predicate on the "cc_phone" field.
+func CcPhoneGTE(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldGTE(FieldCcPhone, v))
+}
+
+// CcPhoneLT applies the LT predicate on the "cc_phone" field.
+func CcPhoneLT(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldLT(FieldCcPhone, v))
+}
+
+// CcPhoneLTE applies the LTE predicate on the "cc_phone" field.
+func CcPhoneLTE(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldLTE(FieldCcPhone, v))
+}
+
+// CcPhoneContains applies the Contains predicate on the "cc_phone" field.
+func CcPhoneContains(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldContains(FieldCcPhone, v))
+}
+
+// CcPhoneHasPrefix applies the HasPrefix predicate on the "cc_phone" field.
+func CcPhoneHasPrefix(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldHasPrefix(FieldCcPhone, v))
+}
+
+// CcPhoneHasSuffix applies the HasSuffix predicate on the "cc_phone" field.
+func CcPhoneHasSuffix(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldHasSuffix(FieldCcPhone, v))
+}
+
+// CcPhoneEqualFold applies the EqualFold predicate on the "cc_phone" field.
+func CcPhoneEqualFold(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldEqualFold(FieldCcPhone, v))
+}
+
+// CcPhoneContainsFold applies the ContainsFold predicate on the "cc_phone" field.
+func CcPhoneContainsFold(v string) predicate.Whatsapp {
+	return predicate.Whatsapp(sql.FieldContainsFold(FieldCcPhone, v))
+}
+
 // PhoneNameEQ applies the EQ predicate on the "phone_name" field.
 func PhoneNameEQ(v string) predicate.Whatsapp {
 	return predicate.Whatsapp(sql.FieldEQ(FieldPhoneName, v))

+ 65 - 0
ent/whatsapp_create.go

@@ -177,6 +177,20 @@ func (wc *WhatsappCreate) SetNillablePhone(s *string) *WhatsappCreate {
 	return wc
 }
 
+// SetCcPhone sets the "cc_phone" field.
+func (wc *WhatsappCreate) SetCcPhone(s string) *WhatsappCreate {
+	wc.mutation.SetCcPhone(s)
+	return wc
+}
+
+// SetNillableCcPhone sets the "cc_phone" field if the given value is not nil.
+func (wc *WhatsappCreate) SetNillableCcPhone(s *string) *WhatsappCreate {
+	if s != nil {
+		wc.SetCcPhone(*s)
+	}
+	return wc
+}
+
 // SetPhoneName sets the "phone_name" field.
 func (wc *WhatsappCreate) SetPhoneName(s string) *WhatsappCreate {
 	wc.mutation.SetPhoneName(s)
@@ -365,6 +379,10 @@ func (wc *WhatsappCreate) defaults() error {
 		v := whatsapp.DefaultPhone
 		wc.mutation.SetPhone(v)
 	}
+	if _, ok := wc.mutation.CcPhone(); !ok {
+		v := whatsapp.DefaultCcPhone
+		wc.mutation.SetCcPhone(v)
+	}
 	if _, ok := wc.mutation.PhoneName(); !ok {
 		v := whatsapp.DefaultPhoneName
 		wc.mutation.SetPhoneName(v)
@@ -405,6 +423,9 @@ func (wc *WhatsappCreate) check() error {
 	if _, ok := wc.mutation.Phone(); !ok {
 		return &ValidationError{Name: "phone", err: errors.New(`ent: missing required field "Whatsapp.phone"`)}
 	}
+	if _, ok := wc.mutation.CcPhone(); !ok {
+		return &ValidationError{Name: "cc_phone", err: errors.New(`ent: missing required field "Whatsapp.cc_phone"`)}
+	}
 	if _, ok := wc.mutation.PhoneName(); !ok {
 		return &ValidationError{Name: "phone_name", err: errors.New(`ent: missing required field "Whatsapp.phone_name"`)}
 	}
@@ -487,6 +508,10 @@ func (wc *WhatsappCreate) createSpec() (*Whatsapp, *sqlgraph.CreateSpec) {
 		_spec.SetField(whatsapp.FieldPhone, field.TypeString, value)
 		_node.Phone = value
 	}
+	if value, ok := wc.mutation.CcPhone(); ok {
+		_spec.SetField(whatsapp.FieldCcPhone, field.TypeString, value)
+		_node.CcPhone = value
+	}
 	if value, ok := wc.mutation.PhoneName(); ok {
 		_spec.SetField(whatsapp.FieldPhoneName, field.TypeString, value)
 		_node.PhoneName = value
@@ -754,6 +779,18 @@ func (u *WhatsappUpsert) UpdatePhone() *WhatsappUpsert {
 	return u
 }
 
+// SetCcPhone sets the "cc_phone" field.
+func (u *WhatsappUpsert) SetCcPhone(v string) *WhatsappUpsert {
+	u.Set(whatsapp.FieldCcPhone, v)
+	return u
+}
+
+// UpdateCcPhone sets the "cc_phone" field to the value that was provided on create.
+func (u *WhatsappUpsert) UpdateCcPhone() *WhatsappUpsert {
+	u.SetExcluded(whatsapp.FieldCcPhone)
+	return u
+}
+
 // SetPhoneName sets the "phone_name" field.
 func (u *WhatsappUpsert) SetPhoneName(v string) *WhatsappUpsert {
 	u.Set(whatsapp.FieldPhoneName, v)
@@ -1156,6 +1193,20 @@ func (u *WhatsappUpsertOne) UpdatePhone() *WhatsappUpsertOne {
 	})
 }
 
+// SetCcPhone sets the "cc_phone" field.
+func (u *WhatsappUpsertOne) SetCcPhone(v string) *WhatsappUpsertOne {
+	return u.Update(func(s *WhatsappUpsert) {
+		s.SetCcPhone(v)
+	})
+}
+
+// UpdateCcPhone sets the "cc_phone" field to the value that was provided on create.
+func (u *WhatsappUpsertOne) UpdateCcPhone() *WhatsappUpsertOne {
+	return u.Update(func(s *WhatsappUpsert) {
+		s.UpdateCcPhone()
+	})
+}
+
 // SetPhoneName sets the "phone_name" field.
 func (u *WhatsappUpsertOne) SetPhoneName(v string) *WhatsappUpsertOne {
 	return u.Update(func(s *WhatsappUpsert) {
@@ -1751,6 +1802,20 @@ func (u *WhatsappUpsertBulk) UpdatePhone() *WhatsappUpsertBulk {
 	})
 }
 
+// SetCcPhone sets the "cc_phone" field.
+func (u *WhatsappUpsertBulk) SetCcPhone(v string) *WhatsappUpsertBulk {
+	return u.Update(func(s *WhatsappUpsert) {
+		s.SetCcPhone(v)
+	})
+}
+
+// UpdateCcPhone sets the "cc_phone" field to the value that was provided on create.
+func (u *WhatsappUpsertBulk) UpdateCcPhone() *WhatsappUpsertBulk {
+	return u.Update(func(s *WhatsappUpsert) {
+		s.UpdateCcPhone()
+	})
+}
+
 // SetPhoneName sets the "phone_name" field.
 func (u *WhatsappUpsertBulk) SetPhoneName(v string) *WhatsappUpsertBulk {
 	return u.Update(func(s *WhatsappUpsert) {

+ 34 - 0
ent/whatsapp_update.go

@@ -205,6 +205,20 @@ func (wu *WhatsappUpdate) SetNillablePhone(s *string) *WhatsappUpdate {
 	return wu
 }
 
+// SetCcPhone sets the "cc_phone" field.
+func (wu *WhatsappUpdate) SetCcPhone(s string) *WhatsappUpdate {
+	wu.mutation.SetCcPhone(s)
+	return wu
+}
+
+// SetNillableCcPhone sets the "cc_phone" field if the given value is not nil.
+func (wu *WhatsappUpdate) SetNillableCcPhone(s *string) *WhatsappUpdate {
+	if s != nil {
+		wu.SetCcPhone(*s)
+	}
+	return wu
+}
+
 // SetPhoneName sets the "phone_name" field.
 func (wu *WhatsappUpdate) SetPhoneName(s string) *WhatsappUpdate {
 	wu.mutation.SetPhoneName(s)
@@ -505,6 +519,9 @@ func (wu *WhatsappUpdate) sqlSave(ctx context.Context) (n int, err error) {
 	if value, ok := wu.mutation.Phone(); ok {
 		_spec.SetField(whatsapp.FieldPhone, field.TypeString, value)
 	}
+	if value, ok := wu.mutation.CcPhone(); ok {
+		_spec.SetField(whatsapp.FieldCcPhone, field.TypeString, value)
+	}
 	if value, ok := wu.mutation.PhoneName(); ok {
 		_spec.SetField(whatsapp.FieldPhoneName, field.TypeString, value)
 	}
@@ -803,6 +820,20 @@ func (wuo *WhatsappUpdateOne) SetNillablePhone(s *string) *WhatsappUpdateOne {
 	return wuo
 }
 
+// SetCcPhone sets the "cc_phone" field.
+func (wuo *WhatsappUpdateOne) SetCcPhone(s string) *WhatsappUpdateOne {
+	wuo.mutation.SetCcPhone(s)
+	return wuo
+}
+
+// SetNillableCcPhone sets the "cc_phone" field if the given value is not nil.
+func (wuo *WhatsappUpdateOne) SetNillableCcPhone(s *string) *WhatsappUpdateOne {
+	if s != nil {
+		wuo.SetCcPhone(*s)
+	}
+	return wuo
+}
+
 // SetPhoneName sets the "phone_name" field.
 func (wuo *WhatsappUpdateOne) SetPhoneName(s string) *WhatsappUpdateOne {
 	wuo.mutation.SetPhoneName(s)
@@ -1133,6 +1164,9 @@ func (wuo *WhatsappUpdateOne) sqlSave(ctx context.Context) (_node *Whatsapp, err
 	if value, ok := wuo.mutation.Phone(); ok {
 		_spec.SetField(whatsapp.FieldPhone, field.TypeString, value)
 	}
+	if value, ok := wuo.mutation.CcPhone(); ok {
+		_spec.SetField(whatsapp.FieldCcPhone, field.TypeString, value)
+	}
 	if value, ok := wuo.mutation.PhoneName(); ok {
 		_spec.SetField(whatsapp.FieldPhoneName, field.TypeString, value)
 	}

+ 4 - 0
go.sum

@@ -447,6 +447,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
 github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
 github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
 github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
 github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
 github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
 github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
@@ -480,6 +481,7 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
 github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
 github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
+github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
 github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
@@ -578,6 +580,8 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU
 github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
 github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
 github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
+github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
+github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
 github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=

+ 1 - 0
internal/logic/whatsapp/create_whatsapp_logic.go

@@ -56,6 +56,7 @@ func (l *CreateWhatsappLogic) CreateWhatsapp(req *types.WhatsappInfo) (*types.Ba
 				SetNotNilAccount(req.Account).
 				SetNotNilPhone(req.Phone).
 				SetNotNilCc(req.Cc).
+				SetCcPhone(*req.Cc + *req.Phone).
 				SetNotNilPhoneName(req.PhoneName).
 				SetNotNilOrganizationID(req.OrganizationId).
 				//SetNotNilAgentID(req.AgentId).

+ 1 - 1
internal/logic/whatsapp/send_whatsapp_code_logic.go

@@ -25,7 +25,7 @@ func NewSendWhatsappCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
 
 func (l *SendWhatsappCodeLogic) SendWhatsappCode(req *types.SendCodeReq) (*types.BaseMsgResp, error) {
 	resp := types.BaseMsgResp{}
-	_, err := aliyun.SendCamsCode(*req.Phone, *req.WaId, *req.Method, *req.Locale)
+	_, err := aliyun.SendCamsCode(*req.Cc+*req.Phone, *req.WaId, *req.Method, *req.Locale)
 	l.Logger.Infof("err=%v\n", err)
 
 	if err != nil {

+ 2 - 1
internal/logic/whatsapp/set_business_info_logic.go

@@ -28,9 +28,10 @@ func (l *SetBusinessInfoLogic) SetBusinessInfo(req *types.SetBusinessReq) (*type
 
 	websites := make([]*string, 0)
 	for _, v := range req.Websites {
+		l.Info("--------------------websites-----------------", v)
 		websites = append(websites, &v)
 	}
-
+	req.About = "ll"
 	_, err := aliyun.SetCamsBusiness(*req.Phone, *req.WaId, req.Address, req.Description, req.Vertical, req.Email, req.ProfilePictureUrl, req.About, websites)
 
 	if err != nil {

+ 1 - 0
internal/types/types.go

@@ -3538,6 +3538,7 @@ type SetAutomationReq struct {
 
 // swagger:model sendCodeReq
 type SendCodeReq struct {
+	Cc     *string `json:"cc"`
 	Phone  *string `json:"phone"`
 	WaId   *string `json:"waId"`
 	Method *string `json:"method"`