@@ -77,7 +77,12 @@ func (l *AcquirerStudentPageLogic) AcquirerStudentPage(r *http.Request) (*types.
break
}
-
+ phone := r["stu_phone"].(string)
+ if len(phone) >= 11 {
+ r["stu_phone"] = utils.ReplaceSub(phone, "*", 3, 4)
+ } else if len(phone) > 5 {
+ r["stu_phone"] = utils.ReplaceSub(phone, "*", 2, 2)
+ }
return &types.Response{200, "", res}, nil
@@ -0,0 +1,13 @@
+package utils
+
+func ReplaceSub(s, sub string, start, count int) string {
+ var newStr string
+ for i, v := range s {
+ var p = string(v)
+ if i >= start && i < start+count {
+ p = sub
+ newStr += p
+ return newStr
+}