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.
30 lines
482 B
30 lines
482 B
|
1 year ago
|
package base
|
||
|
|
|
||
|
|
import (
|
||
|
|
"server/common"
|
||
|
|
"strconv"
|
||
|
|
|
||
|
|
"github.com/liangdas/mqant/log"
|
||
|
|
)
|
||
|
|
|
||
|
|
func GetUIDAndCurrency(s string) (uid int, ct common.CurrencyType) {
|
||
|
|
uids := []rune{}
|
||
|
|
cts := []rune{}
|
||
|
|
for _, v := range s {
|
||
|
|
if v < 48 || v > 57 {
|
||
|
|
cts = append(cts, v)
|
||
|
|
continue
|
||
|
|
}
|
||
|
|
uids = append(uids, v)
|
||
|
|
}
|
||
|
|
tmp := string(uids)
|
||
|
|
number, err := strconv.Atoi(tmp)
|
||
|
|
if err != nil {
|
||
|
|
log.Error("err:%v", err)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
ct = common.GetCurrencyID(string(cts))
|
||
|
|
uid = number
|
||
|
|
return
|
||
|
|
}
|