数据保护

This commit is contained in:
lifeiyi
2019-03-11 11:01:09 +08:00
parent c22c193e70
commit f30eb8817b
2 changed files with 6 additions and 2 deletions

View File

@@ -193,13 +193,13 @@ func (slf *DBResult) mapSingle2interface(m map[string]string, v reflect.Value) e
return err
}
value.SetFloat(f)
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
integer64, err := strconv.ParseInt(meta, 10, 64)
if err != nil {
return err
}
value.SetInt(integer64)
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
integer64, err := strconv.ParseUint(meta, 10, 64)
if err != nil {
return err

View File

@@ -111,6 +111,10 @@ func (slf *RedisModule) GoTask(fc Func) error {
// GetConn ...
func (slf *RedisModule) getConn() (redis.Conn, error) {
if slf.redispool == nil {
service.GetLogger().Printf(service.LEVER_FATAL, "Not Init RedisModule")
return nil, fmt.Errorf("Not Init RedisModule")
}
conn := slf.redispool.Get()
if conn == nil {
service.GetLogger().Printf(service.LEVER_ERROR, "Cannot get connection")