You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
792 B
40 lines
792 B
|
1 year ago
|
package values
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"math/rand"
|
||
|
|
"server/pb"
|
||
|
|
"server/util"
|
||
|
|
)
|
||
|
|
|
||
|
|
func PackPay(r *pb.InnerRechargeReq) {
|
||
|
|
if len(r.Name) == 0 {
|
||
|
|
// r.Name = randName()
|
||
|
|
r.Name = util.GenerateRandomString(5)
|
||
|
|
}
|
||
|
|
r.Phone = util.CheckPhone(r.Phone)
|
||
|
|
if len(r.Email) == 0 {
|
||
|
|
r.Email = util.GetSimpleRandomString(5) + "@" + "gmail.com"
|
||
|
|
}
|
||
|
|
if r.IP == "" {
|
||
|
|
r.IP = fmt.Sprintf("%d.%d.%d.%d", rand.Intn(255), rand.Intn(255), rand.Intn(255), rand.Intn(255))
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func PackWithdraw(r *pb.InnerWithdrawReq) {
|
||
|
|
if len(r.Name) == 0 {
|
||
|
|
r.Name = randName()
|
||
|
|
}
|
||
|
|
r.Phone = util.CheckPhone(r.Phone)
|
||
|
|
if len(r.Email) == 0 {
|
||
|
|
r.Email = util.GetSimpleRandomString(5) + "@" + "gmail.com"
|
||
|
|
}
|
||
|
|
if len(r.Address) == 0 {
|
||
|
|
r.Address = "SaoPaulo"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func randName() string {
|
||
|
|
return util.GenerateRandomString(5)
|
||
|
|
}
|