boweniac 4 天之前
父節點
當前提交
8b7df71808
共有 2 個文件被更改,包括 9 次插入8 次删除
  1. 6 7
      crontask/contact_form.go
  2. 3 1
      internal/utils/compapi/form.go

+ 6 - 7
crontask/contact_form.go

@@ -392,13 +392,12 @@ func (l *CronTask) UpdateContactFields(botID string, receiverID string, fields [
 			} else {
 				if field.Value != nil {
 					if len(field.Value) == 0 || field.Value[0] == "" {
-						continue
-					}
-					_, err := l.svcCtx.DB.ContactField.UpdateOneID(f.ID).
-						SetValue(field.Value).
-						Save(l.ctx)
-					if err != nil {
-						continue
+						_, err := l.svcCtx.DB.ContactField.UpdateOneID(f.ID).
+							SetValue(field.Value).
+							Save(l.ctx)
+						if err != nil {
+							continue
+						}
 					}
 				}
 			}

+ 3 - 1
internal/utils/compapi/form.go

@@ -37,6 +37,7 @@ type FormList struct {
 
 func (me *FormClient) BuildRequest(req *types.CompApiReq) error {
 	nowTime := time.Now().Format("2006-01-02 15:04:05")
+	weekday := time.Now().Weekday().String()
 	//bytes, err := json.Marshal(req.Variables["form_data"])
 	//if err != nil {
 	//	return err
@@ -49,7 +50,8 @@ func (me *FormClient) BuildRequest(req *types.CompApiReq) error {
 请帮助user从通话记录中提取表单值,并返回一个JSON格式的表单值。
 
 # 背景信息
-` + nowTime + `
+当前时间是:` + nowTime + `
+当前星期是:` + weekday + `
 
 # 返回值示例
 * 如表单类型为 input、autoComplete、textarea,返回示例:["表单值"]