|
@@ -5,6 +5,7 @@ import (
|
|
|
"errors"
|
|
|
"github.com/suyuan32/simple-admin-common/msg/errormsg"
|
|
|
"regexp"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
"wechat-api/ent"
|
|
|
"wechat-api/ent/contact"
|
|
@@ -435,9 +436,32 @@ func splitString(input string) []string {
|
|
|
|
|
|
func varReplace(s string, contactInfo *ent.Contact) string {
|
|
|
nickname := ""
|
|
|
+ var cname, carea, cbirthday, cbirtharea, cidcard_no, ctitle, csex, cage string
|
|
|
if contactInfo != nil {
|
|
|
nickname = contactInfo.Nickname
|
|
|
+ carea = contactInfo.Carea
|
|
|
+ cname = contactInfo.Cname
|
|
|
+ cbirthday = contactInfo.Cbirthday
|
|
|
+ cbirtharea = contactInfo.Cbirtharea
|
|
|
+ cidcard_no = contactInfo.CidcardNo
|
|
|
+ ctitle = contactInfo.Ctitle
|
|
|
+ if contactInfo.Sex == 1 {
|
|
|
+ csex = "男"
|
|
|
+ } else if contactInfo.Sex == 2 {
|
|
|
+ csex = "女"
|
|
|
+ }
|
|
|
+ age := contactInfo.Cage
|
|
|
+ cage = strconv.Itoa(age)
|
|
|
}
|
|
|
+
|
|
|
s = strings.Replace(s, "${nickname}", nickname, -1)
|
|
|
+ s = strings.Replace(s, "${cname}", cname, -1)
|
|
|
+ s = strings.Replace(s, "${carea}", carea, -1)
|
|
|
+ s = strings.Replace(s, "${cbirthday}", cbirthday, -1)
|
|
|
+ s = strings.Replace(s, "${cbirtharea}", cbirtharea, -1)
|
|
|
+ s = strings.Replace(s, "${cidcard_no}", cidcard_no, -1)
|
|
|
+ s = strings.Replace(s, "${ctitle}", ctitle, -1)
|
|
|
+ s = strings.Replace(s, "${csex}", csex, -1)
|
|
|
+ s = strings.Replace(s, "${cage}", cage, -1)
|
|
|
return s
|
|
|
}
|