func DBClearExtraToken(uid uint64, token string) error { sqlStr := "" if uid > 0 { sqlStr = fmt.Sprintf("update t_devicetoken set token = '' where token = '%s' and uid != %d ", token, uid) } else { sqlStr = fmt.Sprintf("update t_devicetoken set token = '' where token = '%s'", token) } return errors.As(common.MysqlExec(sqlStr), uid, token) }
func DBUniInsertToken(uid uint64, token string) error { sqlStr := fmt.Sprintf("insert into t_devicetoken (id, uid, token) values (0 , %d, '%s') on duplicate key update token = '%s'", uid, token, token) return errors.As(common.MysqlExec(sqlStr), uid, token) }