|
@@ -46,8 +46,6 @@ func (l *CronTask) analyze() {
|
|
|
template_type_date := "date"
|
|
|
template_sex_id := "sex"
|
|
|
template_sex_label := "性别"
|
|
|
- template_sex_options_unknown_label := "未知"
|
|
|
- template_sex_options_unknown_value := "未知"
|
|
|
template_sex_options_man_label := "男"
|
|
|
template_sex_options_man_value := "男"
|
|
|
template_sex_options_woman_label := "女"
|
|
@@ -83,9 +81,6 @@ func (l *CronTask) analyze() {
|
|
|
Type: &template_type_radio,
|
|
|
Options: []custom_types.ContactFieldTemplateOptions{
|
|
|
{
|
|
|
- Label: &template_sex_options_unknown_label,
|
|
|
- Value: &template_sex_options_unknown_value,
|
|
|
- }, {
|
|
|
Label: &template_sex_options_man_label,
|
|
|
Value: &template_sex_options_man_value,
|
|
|
}, {
|
|
@@ -245,7 +240,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
continue
|
|
|
}
|
|
|
value := 0
|
|
|
- if field.DataIndex == "sex" {
|
|
|
+ if field.DataIndex == "sex" && c.Sex == 0 {
|
|
|
if field.Value[0] == "男" {
|
|
|
value = 1
|
|
|
} else if field.Value[0] == "女" {
|
|
@@ -258,7 +253,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "phone" {
|
|
|
+ } else if field.DataIndex == "phone" && c.Phone == "" {
|
|
|
_, err := l.svcCtx.DB.Contact.Update().
|
|
|
Where(contact.WxidEQ(receiverID)).
|
|
|
SetPhone(field.Value[0]).
|
|
@@ -266,7 +261,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "name" {
|
|
|
+ } else if field.DataIndex == "name" && c.Cname == "" {
|
|
|
_, err := l.svcCtx.DB.Contact.Update().
|
|
|
Where(contact.WxidEQ(receiverID)).
|
|
|
SetCname(field.Value[0]).
|
|
@@ -274,7 +269,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "age" {
|
|
|
+ } else if field.DataIndex == "age" && c.Cage == 0 {
|
|
|
num, err := strconv.Atoi(field.Value[0])
|
|
|
if err != nil {
|
|
|
continue
|
|
@@ -286,7 +281,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "area" {
|
|
|
+ } else if field.DataIndex == "area" && c.Carea == "" {
|
|
|
_, err := l.svcCtx.DB.Contact.Update().
|
|
|
Where(contact.WxidEQ(receiverID)).
|
|
|
SetCarea(field.Value[0]).
|
|
@@ -294,7 +289,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "birthday" {
|
|
|
+ } else if field.DataIndex == "birthday" && c.Cbirthday == "" {
|
|
|
_, err := l.svcCtx.DB.Contact.Update().
|
|
|
Where(contact.WxidEQ(receiverID)).
|
|
|
SetCbirthday(field.Value[0]).
|
|
@@ -302,7 +297,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "birtharea" {
|
|
|
+ } else if field.DataIndex == "birtharea" && c.Cbirtharea == "" {
|
|
|
_, err := l.svcCtx.DB.Contact.Update().
|
|
|
Where(contact.WxidEQ(receiverID)).
|
|
|
SetCbirtharea(field.Value[0]).
|
|
@@ -310,7 +305,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "idcard_no" {
|
|
|
+ } else if field.DataIndex == "idcard_no" && c.CidcardNo == "" {
|
|
|
_, err := l.svcCtx.DB.Contact.Update().
|
|
|
Where(contact.WxidEQ(receiverID)).
|
|
|
SetCidcardNo(field.Value[0]).
|
|
@@ -318,7 +313,7 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if field.DataIndex == "title" {
|
|
|
+ } else if field.DataIndex == "title" && c.Ctitle == "" {
|
|
|
_, err := l.svcCtx.DB.Contact.Update().
|
|
|
Where(contact.WxidEQ(receiverID)).
|
|
|
SetCtitle(field.Value[0]).
|